diff --git a/.github/workflows/ci_workflow.yml b/.github/workflows/ci_workflow.yml index f7b046d914..b76a8917df 100644 --- a/.github/workflows/ci_workflow.yml +++ b/.github/workflows/ci_workflow.yml @@ -47,7 +47,8 @@ jobs: C++${{ matrix.cxx-standard }}, config=${{ matrix.build-type }}, shared=${{ matrix.build-shared }}, - threads=${{ matrix.threads-enabled }}>' + threads=${{ matrix.threads-enabled }}, + docs=${{ matrix.build-docs }}>' # GH-hosted VM. The build runs in CentOS 7 'container' defined below. runs-on: ubuntu-latest container: @@ -73,6 +74,7 @@ jobs: label: threads-enabled: 'ON' vfx-cy: 2022 + build-docs: 'ON' exclude-tests: # Shared, Release, Threads OFF @@ -86,6 +88,7 @@ jobs: label: threads-enabled: 'OFF' vfx-cy: 2022 + build-docs: 'OFF' exclude-tests: # Shared, Debug @@ -99,6 +102,7 @@ jobs: label: threads-enabled: 'ON' vfx-cy: 2022 + build-docs: 'OFF' exclude-tests: # Static, Release @@ -112,6 +116,7 @@ jobs: label: threads-enabled: 'ON' vfx-cy: 2022 + build-docs: 'OFF' exclude-tests: # Static, Debug @@ -125,6 +130,7 @@ jobs: label: threads-enabled: 'ON' vfx-cy: 2022 + build-docs: 'OFF' exclude-tests: # ------------------------------------------------------------------- @@ -141,6 +147,7 @@ jobs: label: threads-enabled: 'ON' vfx-cy: 2022 + build-docs: 'OFF' exclude-tests: # Debug @@ -154,6 +161,7 @@ jobs: label: threads-enabled: 'ON' vfx-cy: 2022 + build-docs: 'OFF' exclude-tests: # Static, Release @@ -167,6 +175,7 @@ jobs: label: threads-enabled: 'ON' vfx-cy: 2022 + build-docs: 'OFF' exclude-tests: # Static, Debug @@ -179,6 +188,7 @@ jobs: compiler-desc: clang10 label: threads-enabled: 'ON' + build-docs: 'OFF' vfx-cy: 2022 exclude-tests: @@ -195,6 +205,7 @@ jobs: compiler-desc: gcc9.3.1 label: threads-enabled: 'ON' + build-docs: 'OFF' vfx-cy: 2021 exclude-tests: @@ -211,6 +222,7 @@ jobs: compiler-desc: gcc6.3.1 label: threads-enabled: 'ON' + build-docs: 'OFF' vfx-cy: 2020 exclude-tests: @@ -227,6 +239,7 @@ jobs: compiler-desc: gcc6.3.1 label: threads-enabled: 'ON' + build-docs: 'OFF' vfx-cy: 2019 exclude-tests: @@ -243,6 +256,7 @@ jobs: compiler-desc: gcc6.3.1 label: 'Legacy ' threads-enabled: 'ON' + build-docs: 'OFF' vfx-cy: 2019 exclude-tests: @@ -257,6 +271,9 @@ jobs: mkdir _install mkdir _build mkdir _examples + - name: Install docs env + run: share/ci/scripts/linux/yum/install_docs_env.sh + if: matrix.build-docs == 'ON' - name: Configure run: | cmake .. \ @@ -266,6 +283,7 @@ jobs: -DCMAKE_CXX_FLAGS=${{ matrix.cxx-flags }} \ -DCMAKE_VERBOSE_MAKEFILE:BOOL='OFF' \ -DBUILD_SHARED_LIBS=${{ matrix.build-shared }} \ + -DBUILD_DOCS=${{ matrix.build-docs }} \ -DOPENEXR_BUILD_TOOLS='ON' \ -DOPENEXR_RUN_FUZZ_TESTS='OFF' \ -DOPENEXR_ENABLE_THREADING=${{ matrix.threads-enabled }} @@ -292,7 +310,7 @@ jobs: cmake --build . \ --config ${{ matrix.build-type }} # Confirm the examples program runs - ./OpenEXRExamples + ./bin/OpenEXRExamples working-directory: _examples - name: Test run: | @@ -392,7 +410,7 @@ jobs: cmake --build . \ --config ${{ matrix.build-type }} # Confirm the examples program runs - ./OpenEXRExamples + ./bin/OpenEXRExamples working-directory: _examples - name: Test run: | @@ -517,7 +535,7 @@ jobs: ## cmake --build . \ ## --config ${{ matrix.build-type }} ## # Confirm the examples program runs - ## ./OpenEXRExamples + ## ./bin/OpenEXRExamples ## shell: bash ## working-directory: _examples - name: Test diff --git a/.github/workflows/cifuzz.yml b/.github/workflows/cifuzz.yml new file mode 100644 index 0000000000..6a51b47f1c --- /dev/null +++ b/.github/workflows/cifuzz.yml @@ -0,0 +1,26 @@ +name: CIFuzz +on: [pull_request] +jobs: + Fuzzing: + runs-on: ubuntu-latest + steps: + - name: Build Fuzzers + id: build + uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master + with: + oss-fuzz-project-name: 'openexr' + dry-run: false + language: c++ + - name: Run Fuzzers + uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master + with: + oss-fuzz-project-name: 'openexr' + fuzz-seconds: 300 + dry-run: false + language: c++ + - name: Upload Crash + uses: actions/upload-artifact@v3 + if: failure() && steps.build.outcome == 'success' + with: + name: artifacts + path: ./out/artifacts diff --git a/.gitignore b/.gitignore index 65aee5e083..4535b8077a 100644 --- a/.gitignore +++ b/.gitignore @@ -49,3 +49,4 @@ build/ build-win/ build-nuget/ *~ +.vscode \ No newline at end of file diff --git a/ASWF/tsc-meetings/2019-05-02.md b/ASWF/tsc-meetings/2019-05-02.md deleted file mode 100644 index 396648810d..0000000000 --- a/ASWF/tsc-meetings/2019-05-02.md +++ /dev/null @@ -1,57 +0,0 @@ -# 5/2/2019 - -### Attending: -* John Mertic -* Cary Phillips -* Rod Bogart -* Peter Hillman -* Larry Gritz -* Daniel Heckenberg - -### Personal introductions: - -* John Mertic: Linux Foundation - Director of Program Management. Help getting project up and going, helping with issues and concerns. -* Peter Hillman: Weta, worked on OpenEXR deep stuff. -* Cary Phillips: ILM R&D Supervisor, miscellaneous contributions to IlmBase. -* Larry Gritz: Sony Pictures Imageworks, experience as a user of OpenEXR, lead for OpenImageIO (the major client of OpenEXR, sits between the library and most users). -* Rod Bogart: One of the originators with Florian Kainz and Drew Hess. Involvement has been on and off, mostly off lately. Vice chair of the Academy’s ACES project. -* Daniel Heckenberg: ASWF TAC chair. - -### Discussion: - -* John: We are the Technical Steering Committee: - - * Set direction, features, roadmap. - * Issues, questions, - * Serves the community, not necessarily an overlord. - * Has the help of the TAC - -* Need to set up a TSC subdirectory in the github repo, to hold meeting notes, etc. - -* There are three github repos: - - Openexr - - Openexr-website - - Openexr-images (big test images, nice to not pollute the main repo with them) - -* Other contributors: - - Kimball Thurston - Weta - - Nick Rasmussen - ILM - - Nick Porcino - Occulus, formerly ILM - - Jonathan Stone - Lucasfilm/MaterialX - -* ASWF member organization have obligation to contribute to projects. - -* Larry: OCIO has a separate role for TSC chair. We can be creative with how we divide the roles. Few things come to formal votes. - -* Cary elected TSC chair - -* Action items: - - Set up aswf.io mailing lists; send message asking recipients to sign up over there; this lets us know who the community is. - - Set up private TSC alias. - - Move github repo to ASWF (contents will be unchanged, address will not change) - - John: contact Steve Winslow about code scanning, make sure license compliance in order. - - Cary: Add permissions to github repos - - - - diff --git a/ASWF/tsc-meetings/2019-05-09.md b/ASWF/tsc-meetings/2019-05-09.md deleted file mode 100644 index 9951df86cf..0000000000 --- a/ASWF/tsc-meetings/2019-05-09.md +++ /dev/null @@ -1,27 +0,0 @@ - -# 5/9/2019 - -### Agenda: -* How many mailing lists? What do to with old messages? -* Jira for TSC task tracking? -* CII badge form todo’s -* TSC membership - who else? -* Website management - -### Attending: -* Cary Phillips -* Larry Gritz -* Peter Hillman -* John Mertic - -### Discusion: - -We discussed mail aliases and settled on a single alias, [openexr-dev@lists.aswf.io](mailto:openexr-dev@lists.aswf.io). Cary will send a message to the old aliases requesting that people sign up for the new one. After a grace period, we’ll import the old list history into the new list and then disable the old lists altogether. That’s better than importing this history right away, which might fail to capture discussion that happens between now and the transitions. - -We can use hashtag to limit the discussion and help filter discussions by topic. - -We briefly discussed Jira - there is an OpenEXR Jira board at [https://jira.aswf.io/secure/Dashboard.jspa](https://jira.aswf.io/secure/Dashboard.jspa). But we decided to keep things informal for now and rely on GitHub Issues to track todo items, and adopt Jira only if a need emerges. - -We agreed to look at OpenColorIO as a template for processes, and the process documentation in particular, for code formatting style guide, code review process, etc. - -Beyond administrative issues like the web site and the CII Best Practices Badge checklist, we discussed diving straight into more substantive issues like the future of IlmBase - separate repo vs. keeping it as a subproject, as well as cleaning up and modernizing the code, adding proper use of consexpr, etc. diff --git a/ASWF/tsc-meetings/2019-06-13.md b/ASWF/tsc-meetings/2019-06-13.md deleted file mode 100644 index 169cfa317a..0000000000 --- a/ASWF/tsc-meetings/2019-06-13.md +++ /dev/null @@ -1,90 +0,0 @@ - -# 6/13/2019 - -### Attending: -* Cary Phillips - ILM -* Larry Gritz - SPI -* Rod Bogart - Epic -* Peter Hillman - Weta -* Kimball Thurston - Weta -* Nick Porcino - Oculus -* Christina Tempelaar-Lietz - Epic -* John Mertic - Linux Foundation - -### Discussion: -* Welcome new TSC members: - * Nick Porcino - Oculus - * Christina Tempelaar-Lietz - Epic - * Kimball Thurston - Weta - * Piotr was invited by hasn’t responded. -* Project goals by SIGGRAPH: - * Reach “adopted” status, seems attainable. - * CII badge progress is at 68% - * Need CI setup - * Need static/dynamic analysis setup - * Need to address security issues/policies - * Put out a new release, version 2.4: - * Address outstanding CVE’s - * Document existing CVE’s - * Compiler warnings - * CMake fixes - * Acknowledge most Issues and PRs; many can be closed as is. - * Proposal/position on the future of Imath; go into the BOF prepared to discuss. -* “Guide to the OpenEXR Project” - * GOVERNANCE.md, CONTRIBUTING.md, etc. - * Clarify project roles and clarify terminology: - * Committer vs. TSC - * Nick Rasmussen is an example of a committer not on the TSC. - * Need to clarify terms of service, how long do TSC members serve. - * OCIO meeting notes designate a PR Reviewer? - * Ad-hoc for that project to ensure fast turn around due to large number of contributions - * May want some form of this to ensure that PRs are reviewed -* Legal: - * Who keeps track of CLA’s on file? - * Should just be part of the process (CLA, DCO checks) - * Old PRs, what to do about obtaining CLAs prior to merge - * Need to check w/ ILM legal just to clarify old copyright / CLA - * Does OCIO have a policy of accepting small fixes without a CLA? No, that’s OIIO. All ASWF/Linux Foundation projects require CLA’s for every PR, no matter how small. -* CII Badge requires “acknowledgment of bug reports”. What should our policy be? - * Standard use of GitHub labels, documented in CONTRIBUTING. - * Use of GitHub Milestones to indicate priority. -* Status of the CII Best Practices Badge: - * Must ensure timely response to posts on openexr-dev - * What does it take to ensure that the website now uses https? - * Security: - * security@openexr.com, info@openexr.com - * John to arrange setting up the forwards to private tsc - * Outstanding CVE’s: - * One has a PR that needs to be merged. - * Other CVE issues have been resolved but the issues were never closed. - * CVE’s should be documented in CHANGES.md. - * OpenEXR needs a designated security expert - * Cryptographic protocols are not applicable. - * Ready to set up Azure? - * Compiler Warning flags - * -Wall with GCC 7/C++17 on Ubuntu gives a handful of warnings, straightforward to fix. - * What about Windows? - * Code coverage, static analysis, dynamic analysis: SonarCloud? - * Just needs to have been done at least prior to release (as opposed to fully integrated to release schedule) - * Test policy adherence? -* Should we update source code copyright notices? - * Cary will check with Lucasfilm Business Affairs. -* What’s the status of moving the github repository? -* TODO’s and action items: - * Label issues and PR’s - * Gives perception of response - * Use milestones instead to mark issues for including in next release - * Need to be more aggressive with closing issues that had a back and forth resulting in a consensus there’s nothing to do - * Standard comment about a house-cleaning event in migration to ASWF - * Merge/act on existing PR’s - * Fix compiler warnings - * SonarCloud: Static and dynamic analysis - * Azure - * Web site/documentation - * JM: Can be moved independently, whenever ready - * CP: wants to re-do web site to make it easier to maintain - * Email addresses for info & security - * Imath white paper - * Christina - will work on SonarCloud - * Kimball - will work on PRs, cmake, compile warnings - * Nick - will review PRs as well diff --git a/ASWF/tsc-meetings/2019-06-20.md b/ASWF/tsc-meetings/2019-06-20.md deleted file mode 100644 index 4909b80e7a..0000000000 --- a/ASWF/tsc-meetings/2019-06-20.md +++ /dev/null @@ -1,43 +0,0 @@ -# 6/20/2019 - -### Agenda: -* Update on SonarCloud? -* Document CVE’s -* C++ 98? -* Strategy on standalone Imath -* Review outstanding PR’s, via Kimball’s [PR spreadsheet](https://docs.google.com/spreadsheets/d/1dwgWs5GWur-BJkYf4J3ChbjMfb5ZlVn7q1QHq9XmB2Y/edit?ts=5d0409a9#gid=0) - -### Attending: -* Cary Phillips -* Larry Gritz -* Peter Hillman -* Nick Porcino -* Rod Bogart -* Don Dempsey (public) - -### Discussion: - -* Christina has started investigating SonarCloud, nothing to report yet. - -* Documentation of CVE’s. The CII Best Practices badge says all - publicly filed CVE’s must be noted in the release notes. Rod to - investigate, including the process for updating information at - cve.mitre.org. - -* C++ compatibility: is there a need to still maintain support for - C++98? With the VFX reference platform at C++11, can any software - reasonably claim to need new releases of OpenEXR to compile with - pre-C++11? Probably not, but worth confirming with the community, - and with the TAC. - -* TSC members should act on commenting on and closings PR's as noted - in the spreadsheet. - -* Assigned #401 and #378 to Peter, to investigate. - -* Standalone Imath: Needs further discussion with the TAC, and a - concrete proposal, potentially a straw/trial repo that folks can - comment on. Needs to be unencumbered by dependencies like Iex, and - by exceptions in general, or with the current on-the-fly code - generation of eLut and toFloat. - diff --git a/ASWF/tsc-meetings/2019-06-27.md b/ASWF/tsc-meetings/2019-06-27.md deleted file mode 100644 index 800a05483e..0000000000 --- a/ASWF/tsc-meetings/2019-06-27.md +++ /dev/null @@ -1,57 +0,0 @@ -# 6/27/2019 - -### Agenda: -* Clarify the process for approving and merging PR’s -* Release plan: Code freeze Friday, July 12? -* SIGGRAPH BOF agenda -* Update on SonarCloud -* Azure rollout -* Standalone Imath -* Review outstanding PR’s, via Kimball’s [PR spreadsheet](https://docs.google.com/spreadsheets/d/1dwgWs5GWur-BJkYf4J3ChbjMfb5ZlVn7q1QHq9XmB2Y/edit?ts=5d0409a9#gid=0) - -### Attending: - -* Cary Phillips -* Larry Gritz -* Rod Bogart -* Peter Hillman -* Kimball Thurston -* John Mertic -* Nick Porcino -* Christina Tempelaar-Lietz - - -### Discussion: -* Siggraph BOF plan: should we release before? -* July 13-14 should be deadline for release, if we do that (we will shoot for that) -* Need to check tarball versus git clone/build -* Documentation needs to be updated to ensure simple “I want OpenEXR” will just work -* Windows has most of the issues from users trying -* Various README files need to be clear to build lmBase separately from OpenEXR -* Can we deprecate autoconf, and just confirm that cmake works? Needs effort on each platform to check cmake is working -* Let’s delay the split of IlmBase -* To proceed for release (release number TBD): - * Get cmake in place - * Get docs update - * Deal with outstanding CVEs - * Need to close out discussion/issue on any outstanding vulnerability - * Need to close out discussion/issue on any outstanding vulnerability - * * Kimball has been looking at CVEs: pointer math can overflow int32 -* Pull request needs process to merge. Person who submitted can do the merge if they have permission. - * Submit PR - * Somewhen says it looks OK by “Approve” - * Submitter should then perform the Merge - * Issues have been tagged “Needs Info”, we will wait a week or so, then close them out if we hear nothing - * Issues have been tagged “To Do”, those are ready to finish, and we should enlist others to help fix them -* Suggestion: Jonathan Stone might be able to help with Windows cmake issues -* Looking thru issues in spreadsheet - * Issue238 appears to be fixed already - * Issue232 is need work - * Issue351 may be fixed, but Kimball will confirm - * 344 - RGB will try to reach out to Karl Rasche (LinkInd msg sent) - * 251 - Punt for now - * 338 - will check if new release builds on FreeBSD - * 334 - Windows can still have this problem - * Christina testing (file gets generated empty somehow) -* Need change to check the log header files into the repo. Should add unit test to rebuild and compare, but not do build of file during build. -* Will remove issues that refer to old software (ie 281) diff --git a/ASWF/tsc-meetings/2019-07-11.md b/ASWF/tsc-meetings/2019-07-11.md deleted file mode 100644 index 17acbac678..0000000000 --- a/ASWF/tsc-meetings/2019-07-11.md +++ /dev/null @@ -1,59 +0,0 @@ -# 7/11/2019 - -### Agenda: - -* Azure progress -* SonarCloud progress -* CMake refactor: - * Does it addresses the open “CMake” Issues? OK to close? - * Ready to document? -* CVE/bug progress -* Google OSS-Fuzz integration? -* Release prognosis, how close are we? -* Review issues needing attention - -### Discussion: - -* Azure/Sonar Cloud - * Underway, Christine is setting up account for her own github for testing. - * Need to create accounts for openexr/awsf ultimately - * ASWF has accounts to use - -* CMake progress - * Kimball’s got a rewrite up for review - * Simpler, removed some options, consolidated into a single file - * IlmBase and OpenEXR are their own projects, using find_package as - appropriate - * Added a root “super project”, it overrides find_package using the - current cmake idiom - * Added config.cmake files for install automation - * We will give it a spin, and Cary will write instructions - -* Issue backlog - - * Cary’s polling open issues where it’s unclear if an problem still - exists. If the issue author doesn’t respond in a week or so, - closing with an invitation to re-open - * Out of memory bugs could be addressed by pre-emptively checking - too-large image open requests, and capping the maximum image size. - * Table allocations could be made on demand, rather than on object - construction. See issue 245 - -* Release gate factors - - * CMake rewrite - * Someone needs to vet the autoconf set up to make sure it’s all - still functional - * Security vulnerabilities are the top priority for the next release - * We can announce an upcoming release at Siggraph, rather than - rushing to get a release done - -* Google Autofuzz - - * Clang tidy - consensus: thumbs up - * CMake option, OFF by default - * Sonar - consensus: thumbs up - * Autofuzz - consensus: decline on the grounds that we take security - seriously and have invested in a fuzz test that we’d prefer to - keep investing in. - diff --git a/ASWF/tsc-meetings/2019-07-18.md b/ASWF/tsc-meetings/2019-07-18.md deleted file mode 100644 index 2563a1248b..0000000000 --- a/ASWF/tsc-meetings/2019-07-18.md +++ /dev/null @@ -1,83 +0,0 @@ -# 7/17/2019 - -### Attending: -* Cary Phillips -* Peter Hillman -* Kimball Thurston -* John Mertic -* Christina Tempelaar-Lietz - -### Agenda: -* Repo move -* License scan -* Cmake/autoconf progress -* Azure+Sonar rollout -* SIGGRAPH BoF prep -* Issues needing attention - -### Discussion: - -* Why is GitHub repo name so long? - * John has no idea, would prefer shorter as well - * Is alias possible? - -* Repo move - * John - issues to consider: - * Ideal to have new CLA in place before repo move, in the works - * Have all of your organization sign the CCLA - * Make sure license scan, big critical issues are taking care of first. - * Clean up any proprietary notices. - * So perhaps we will wait - -* License scan - * Cary has made progress on reviewing the full scan. - * Some licenses from Pixar, shouldn’t be an issue to get Pixar to change license or board to buy off on it - * Other things don’t have a license, can we add a license? - * John - good to know how those contributions came in. - * Most is from ILM. - * Display driver renderman, ILM - * Photoshop plugin Piotr - * New git makefiles - question for Nick - * Need more information about what these things are, whether we still need it, the history. - * Should we replace with spdx identifier. - * ONLY an ILM employee should do this, modify ILM related license text. - * Patent on compressions code from Dreamworks? - * By comparison, Apache license has a mechanism for handling issues with patent related issues . - * There may be ambiguities downstream because license language is non-standard. - * Autoconf scripts come with a GNU license, very permissive license. - * How much longer do we want to support autoconf? Until we are certain CMake setup is robust. - * Lots of CMake files with no license information in them. - * “Copyright: OpenEXR project with its contributors” <- specific language is in the CONTRIBUTING.md with the instructions for the copyright line. - -* Cmake/autoconf progress - * Kimball closed many build-related issues. - * Kimball can’t test Windows - needs confirmation that the auto package config works. (some cmake projects have custom package configs for Windows but this may have come from before the auto config existed). - * Xcode generator doesn’t work - bug in CMake - * Are we going to continue using mkdist to make the tarballs? Cary wants to poll the community. - * Cary tried to fix the PyIlmBase autoconf setup. Fails because can’t run test program, Cary has a potential fix. - * Christina to read over the INSTALL instructions. - * Should mention external dependencies and how to override them. e.g.Zlib, Boost, Python. - * Verify in INSTALL instructions that each variable is annotated with descriptive text. - * Target end of week. - -* Azure+Sonar rollout - * Christina to look into whether we should make use of ctest options for publishing test results. There is a placeholder for publishing test results, but the test step doesn’t generate the requisite ctest xml output files yet.. - * Christina will work on making Azure pipeline work with the new CMake setup. - * Windows and mac jobs not working yet, in progress. - * Christina also needs to add IlmFuzzTest as a scheduled job. - -* SIGGRAPH BoF prep - * Present what we are thinking and solicit feedback. - * Kimball can put together some slides based on recent and proposed code changes. - * Cary has a google doc in progress to use at the BoF. - * Warn people that next version will be a 3.x, change the ABI. - * Warn about potentially changing the API as well (no API changes yet). - * Imath changes. So people are aware they may have to change some code. - -* Other - * Discussing remaining CVE, issues.. - * Issue 232 - Kimball has pending PR but only a partial fix. Has a more complete fix planned for integer overflow issue. - * PR 451 - Peter Hillman fixed but would be good to have another person review. - * Issue 344 / PR 445 - Huffman encoding based on tile size - make it optional, off by default. CMake flag to enable better performance? Roll it out with OpenEXR 3 release. - * PR 414 - assigned to Kimball, replaces PR 401. - * Lots of older PRs related to CMake, Kimball has put comments to try new CMake. If no response, will close them. diff --git a/ASWF/tsc-meetings/2019-07-25.md b/ASWF/tsc-meetings/2019-07-25.md deleted file mode 100644 index 5536607649..0000000000 --- a/ASWF/tsc-meetings/2019-07-25.md +++ /dev/null @@ -1,69 +0,0 @@ -# 7/25/2019 - -### Attending: - -* Cary Phillips -* Peter Hillman -* Kimball Thurston -* Larry Gritz -* Christina Tempelaar-Lietz -* Rod Bogart -* Emily Olin - -### Agenda - -* Prep for SIGGRAPH BoF. Draft of slides is here: - https://docs.google.com/presentation/d/1mxzp6jn2zuHAyahzwhocwRTpoenNqO-LEvPUvS7gDww/edit?usp=sharing - -* Prep for 2.4 release. - -### Discussion - -* When the repo moves to the ASWF organization, we'll make it - "OpenEXR". Capitalization isn't consistent across ASWF projects, but - we prefer it this over "openexr". - -* SIGGRAPH BoF prep: - - * Preable about the ASWF and recent progress should be brief; most - time should be reserved for the discussion. And the topics should - be presented as "community issues", raised by the community for - discussion within the community, facilitated by the TSC. These are - not plans to be executed by the TSC, the TSC is merely a - gatekeeper. - - * Imath proposal: - - * Half should have #define/#ifdef so that when included with CUDA half.h, the first one wins. - - * Peter's part ordering standard/documentation should be a proposal to go into a 3.0 release. - - * The need for a "tiny" EXR implementation? Because there are - numerous divergent ones out there; rumored examples at Apple, - Intel, and a part of ffmpeg, instigated by several factors: - - 1. People building OpenEXR get to the b44 log table build stage and say, WTF?!? - - 2. There is no option to build the library without exceptions, a - deal-breaker for platforms/compilers that don't support - exceptions, and a turn-off for many others. - - 3. You need a PhD in CMake to get it to build. - - 4. For many people, the write-it-yourself threshold is quite low. - - * There are people who choose not to use the library. We should - listen to them, even if they're not in the VFX industry. OpenEXR - is widely used; we have an obligation to be stewards outside of - just the film industry. - -* Release prep: - - * Windows build is not quite working. There are still problems with boost. - - * Windows tests are failing. - -* Issues: - - * #445 should not go into 2.4. It needs a more thorough analysis, and wider testing. - diff --git a/ASWF/tsc-meetings/2019-08-08.md b/ASWF/tsc-meetings/2019-08-08.md deleted file mode 100644 index a6ae8b5167..0000000000 --- a/ASWF/tsc-meetings/2019-08-08.md +++ /dev/null @@ -1,99 +0,0 @@ -# 8/8/2019 - -### Attending: - -* Cary Phillips -* Kimball Thurston -* Nick Porcino -* Christina Tempelaar-Leitz -* Joseph Goldstone -* Arkell Rasiah -* Robert Pancoast - -### Agenda: - -* 2.3.1 release - * Windows build? - * Confirm the proper so version? - * Mitre.org’s CVE posting - * When to create a beta tag? - -* ASWF project adoption - * CII badge progress is 95% - * Security questions (-x option a solution for memory consumption?) - * Dynamic analysis - -* Status of CLA signage - -* SIGGRAPH BoF followup - * How to turn the discussion into a “roadmap” - * Proposed new features/initiatives: - * Stateless read - * Part ordering - * Published compression standards - * Streaming performance - * 32-bit compression - * Integer images - * Bfloat16 - * In-place metadata edit - -* Next up: - * Repo move - * Imath repo - * C++11 - * pybind11 - * Clang-tidy - * SonarCloud “bugs” - * Test coverage - * Website refresh - -### Discussion: - -* Looks like Arkell and Joseph have independently written a utility - for reading exr headers into a stringstream for in-memory - manipulation of metadata. They should work on resolving and submit - it to include in the library. - -* Joseph: No order is imposed on metadata; metadata is stored as - a map, it needs a lexical ordering. - -* The “image” metadata field is a MD5 checksum on the image. Kimball: - I tend to strip out checksums because it’s almost immediately - invalid. Joseph: should it be dropped entirely? Piz compression - generates different byte streams when compression tables have - multiple unique entries because the sort isn’t stable, which yields - different checksums for identical images. Arkell has a fix, he’ll - submit it. - -* SMPTE 2065-4 doesn’t standardize all of OpenEXR, it’s just a - subset. ACES only took the minimum items that were necessary; it - doesn’t include multi-part or deep. Does anyone care? The only - reason you’d care is if you want the ACES logo on your project to - certify that it handles EXR’s. But SMPTE doesn’t accept code as the - definition of a standard, it would require explicit documentation, - which would be a lot of work, and would then lock in that - specification as the standard that the code would have to abide by. - -* Joseph: Is there a potential connection to the mention of a - “tinyexr”? Should that be the ACES container file but that you’re - free to use? Kimball: the “tiny” of the notion of “tinyexr” refers - to the size and magnitude of the source code of the library, not the - supported contents of the file. Conclusion: When/if there is - consideration of a stream-lined exr library, we should at least - discuss the SMPTE standards issue. - -* Conclusion: if this is a priority for someone, or someone puts forth - a compelling argument for standardization, then someone would need - to step up and pursue SMPTE standardization. - -* The 2.3.1 release is ABI-compatible, so won’t need to update so version. - -* Christina will leave some comments on Robert’s PR related to the - Windows build in the Azure pipeline. - -* We should consider a target that runs valgrind on the unit - tests. Can add a prefix command, then run w/valgrind in front of it. - -* Robert: MSbuild has a command-line switch to run “code analysis,” it - should be built into Azure. - diff --git a/ASWF/tsc-meetings/2019-08-16.md b/ASWF/tsc-meetings/2019-08-16.md deleted file mode 100644 index f2100f84cc..0000000000 --- a/ASWF/tsc-meetings/2019-08-16.md +++ /dev/null @@ -1,52 +0,0 @@ -# 8/16/2019 - -### Attendees: - -* Joseph Goldstone -* Larry Gritz -* Nick Porcino -* Christina Tempelaar-Lietz -* Kimball Thurston - -### Agenda: - -* Release 2.4.0 -* Other items - -### Discussion - -* Release 2.4.0 - - * Waiting to branch until we have all 3 platforms (mostly) running in Azure. - - * Christina will be re-enabling the windows builds this weekend, - others to help resolve issues - - * Nick also to separately test on local test setups to evaluate - python2 and 3 under windows at the same time - -* Other items: - - * Brief discussion about whether we need to discuss any future things: - - * mostly focused on getting patch release out - - * What are the ideas? Joseph was wondering if there is already a - list (we should publicize that) - - * mentioned the pending discussion of Imath - - * also mentioned ph's metadata group thing - - * this triggered jgoldstone to ask for reviewers for the ACES - container, it is up for 5 year renewal, want to refresh - metadata list - - * larger database of metadata vs definition - - * Can we refresh the test content? (i.e. get some scenes with more - HDR than the existing set, etc.) - - * Nick wondering what about other exr viewers, and about CTL status in viewers - - diff --git a/ASWF/tsc-meetings/2019-08-22.md b/ASWF/tsc-meetings/2019-08-22.md deleted file mode 100644 index ae9a1cb4d9..0000000000 --- a/ASWF/tsc-meetings/2019-08-22.md +++ /dev/null @@ -1,64 +0,0 @@ -# 8/22/2019 - -### Attendees: - -* Rod Bogart -* Joseph Goldstone -* Larry Gritz -* Cary Phillips -* Nick Porcino -* Christina Tempelaar-Lietz -* Kimball Thurston - -### Agenda: - -* Release 2.4.0 -* Other items - -### Discussion - -* Windows builds are running, but tests are failing. - -* Windows test failure appears to be a “device timeout” in IlmImfTest, - not sure how to proceed. Might be an Azure job setting? - -* Release version should be named v2.4.0-beta.1 - -* What to do with PR #502? Alignment issue, but it’s only in the test - suite. Probably ok. - -* Need to update release notes with recent commits. Kimball suggests - the GitHub project git-chglog. - -* Still need a security expert. Kimball suggests Dan Hutchinson at - Foundry, who was a security expert in the past. - -* Florian is enthusiastic about contributing new test images. Need to - decide what we need to show off. Florian suggests carefully - calibrated images to show what a properly exposed image is. - -* Rod noted that ACES has reference images. - -* Another application for these images: calibration. Need reference - for monitor calibration. - -* Joseph: an image that can help answer the question, “Does this look - right?” image. Joseph described a past project that involved $100 at - Safeway: Pepto Bismol pink, etc. Everyone knows what those colors - are. - -* Also need images for a performance suite. - -* Also need relevant survey of metadata. - -* We need a document that says what stuff is called, conventions. - -* Outstanding issue: PR #531, the DreamWorks Lossy Compression - license. Is the change sufficience? It's a dual license: pick which - license the user wants to use. - -* Joseph: Half as a separate library? Support in GCC and Clang for - 16-bit float? Would there be a performance gain to use standard? - Yes. But Half does very specific rounding. With float16 you can do - different rounding. Could use operators to make Half and float16 - look the same. diff --git a/ASWF/tsc-meetings/2019-08-29.md b/ASWF/tsc-meetings/2019-08-29.md deleted file mode 100644 index e59e578408..0000000000 --- a/ASWF/tsc-meetings/2019-08-29.md +++ /dev/null @@ -1,52 +0,0 @@ -# 8/29/2019 - -### Attendees: - -* Cary Phillips -* Christina Tempelaar-Lietz -* John Mertic -* Kimball Thurston -* Peter Hillman - -### Agenda: - -* Release 2.4.0 - -### Discussion - -* Cary still has a problem building PyIlmBase on his mac, but it's - most likely a local problem with the installation of boost::python. - -* The documentation should reference the Azure build scripts as a - working example manifestation of the proper sequence of steps for - installing and building. - -* The CHANGES.md file lists a summary of changed, followed by a - listing of all commits, PR's, and Issues. Is this necessary? Only - the summary will appear on the Releases page. Who cares if the - CHANGES.md file is verbose; sure, you can query this information - directly via the GitHub page, but it still seems convenient to list - everything out, and at the very least, it's not hurting anyone. - -* Decision was made to turn off floating-point exception handling by - default; it doesn't work at all under FreeBSD, because signals - happen asynchronously. - -* All tests should pass on Azure now, although the Azure windows build - does not yet include PyIlmBase because of boost issues. - -* No one on the board voiced concerns about the DWA Lossy Compression - license changes. When Steve Winslow returns, he will re-run the - license scan, and then John will put a new exception request to the - board. - -* The release can proceed independently of the license issues. - -* CII Best Practices badge progress is at 95%. - -* Dan Hutchinson from Foundry responded with security/CVE guidance, - need to schedule a follow-up discussion, when he's available. - -* Kimball will look into adding an option to run the test under - valgrind. The CII badge suggests dynamic analysis; this should - suffice for that. diff --git a/ASWF/tsc-meetings/2019-09-05.md b/ASWF/tsc-meetings/2019-09-05.md deleted file mode 100644 index ea852d0157..0000000000 --- a/ASWF/tsc-meetings/2019-09-05.md +++ /dev/null @@ -1,39 +0,0 @@ -# 9/5/2019 - -### Attendees: - -* Cary Phillips -* Christina Tempelaar-Lietz -* Kimball Thurston -* Peter Hillman -* Joseph Goldstone - -### Discussion - -* Ready to tag the 2.4 beta release, as soon as the current PR’s are - approved and merged. - -* After the tag, it’s open season on merging in other changes. - -* Still waiting on Lucasfilm business affairs to set up easyCLA; can’t - move the repo to the ASWF organization until that’s done. - -* After the repo move, split Imath into a separate repo. Should we - split sooner or later? Nobody feels strongly. What’s the best way to - preserve the history? Duplicate the repo entirely, which will carry - the Imath history with it, then delete all OpenEXR from the new - repo, and Imath from the OpenEXR repo. - -* Are there any issues with binary metadata? J Schulte wants to - know. No, probably not. - -* Issue #548: will revisit this when attempting to rectify Half - w/CUDA, although the ship has probably sailed with implicit/explicit - conversion between Half and float/double, we’d rather not break - existing application code. - -* Issue #452 - Peter fixed it, it was an alignment issue. - -* Issue #453 and #454, test failures: should ping again. - -* Issue #506 - Ask Robert to help. diff --git a/ASWF/tsc-meetings/2019-09-12.md b/ASWF/tsc-meetings/2019-09-12.md deleted file mode 100644 index d8e341a315..0000000000 --- a/ASWF/tsc-meetings/2019-09-12.md +++ /dev/null @@ -1,35 +0,0 @@ -# 9/12/2019 - -### Attendees: - -* Cary Phillips -* Christina Tempelaar-Lietz -* Rod Bogart -* Kimball Thurston -* Peter Hillman -* Arkell Rasiah -* Joseph Goldstone - -### Discussion - -* Release v2.4.0-beta.1 is out - -* Arkell asks about EasyCLA - -* SonarCloud bugs: - - - Random - - - Boost::python - - + Use python buffers, will need a numpy module for backwards compatibility - - - Constructors - - - Coverage - -* CVE’s - -* Openexr-images repo - move to ASWF - -* Arkell: abx 512, CUDA diff --git a/ASWF/tsc-meetings/2019-09-17.md b/ASWF/tsc-meetings/2019-09-17.md deleted file mode 100644 index cbd5c3fb96..0000000000 --- a/ASWF/tsc-meetings/2019-09-17.md +++ /dev/null @@ -1,49 +0,0 @@ -# 9/17/2019 - -### Attendees: - -* Cary Phillips -* Christina Tempelaar-Lietz -* Rod Bogart -* Kimball Thurston -* Peter Hillman -* Joseph Goldstone - -### Discussion - -* Beta v2.4.0-beta.1 is ready for official release. - -* Next up: - - * finish off the CII best practices badge. - - * fix sonar bugs - - * request updates to mitre.org CVE entries. - - * Still waiting on Lucasfilm Business Affairs to configure EasyCLA; - repo move is blocked until that happens. - - * Start port of PyImath to pybind11, which is going to be a lot of work. - - * clang-format (not to be confused with clang-tidy, which is - different) - Larry has a setup on OIIO that runs clang-format on - PR, rejects if the formatting is off but also posts a diff, so the - submitter can get the formatting right even if they don't have - clang installed. - -* CVE's: - - * CVE-2016-4629 and CVE-2016-4629 were fixed by Apple in the OS. - - * CVE-2006-2277 - the link on the mitre.org page is broken, but the - offending .exr is available on the internet archive wayback - machine here: - https://web.archive.org/web/20060520062054/http://w148.de/~cmertes/nachbarhaus1.exr - -* Christina gives an overview of SonarCloud set-up. Read the YAML - documentation here: - https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=azure-devops&tabs=schema - -* Joseph: We should reach out to distro packagers and - request/encourage/help them to update to the new release. diff --git a/ASWF/tsc-meetings/2019-09-19.md b/ASWF/tsc-meetings/2019-09-19.md deleted file mode 100644 index 47f4f1ea69..0000000000 --- a/ASWF/tsc-meetings/2019-09-19.md +++ /dev/null @@ -1,49 +0,0 @@ -# 9/19/2019 - -### Attendees: - -* Cary Phillips -* Christina Tempelaar-Lietz -* Rod Bogart -* Kimball Thurston -* Peter Hillman -* Joseph Goldstone - -### Discussion - -* Beta v2.4.0-beta.1 is ready for official release. - -* Next up: - - * finish off the CII best practices badge. - - * fix sonar bugs - - * request updates to mitre.org CVE entries. - - * Still waiting on Lucasfilm Business Affairs to configure EasyCLA; - repo move is blocked until that happens. - - * Start port of PyImath to pybind11, which is going to be a lot of work. - - * clang-format (not to be confused with clang-tidy, which is - different) - Larry has a setup on OIIO that runs clang-format on - PR, rejects if the formatting is off but also posts a diff, so the - submitter can get the formatting right even if they don't have - clang installed. - -* CVE's: - - * CVE-2016-4629 and CVE-2016-4629 were fixed by Apple in the OS. - - * CVE-2006-2277 - the link on the mitre.org page is broken, but the - offending .exr is available on the internet archive wayback - machine here: - https://web.archive.org/web/20060520062054/http://w148.de/~cmertes/nachbarhaus1.exr - -* Christina gives an overview of SonarCloud set-up. Read the YAML - documentation here: - https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=azure-devops&tabs=schema - -* Joseph: We should reach out to distro packagers and - request/encourage/help them to update to the new release. diff --git a/ASWF/tsc-meetings/2019-09-26.md b/ASWF/tsc-meetings/2019-09-26.md deleted file mode 100644 index a2f87bddc8..0000000000 --- a/ASWF/tsc-meetings/2019-09-26.md +++ /dev/null @@ -1,97 +0,0 @@ -# 9/26/2019 - -### Agenda: - -* Dan Hutchinson (Foundry, security expert) - - What should we know? We don’t know what we don’t know. - - CVE’s on mitre.org - - Allocating huge memory: -x option? -* Tarball signing -* VFX reference platform says 2.3.x ?!? -* Distro packages -* SonarCloud has failed on last 2 PRS’s -* Mission Statement -* Reference images - -### Attending: - -* Cary Phillips -* Christina Tempelaar-Lietz -* Kimball Thurston -* Joseph Goldstone -* Peter Hillman -* Doug Walker -* Dan Hutchinson -* Carol Payne -* Daniel Heckenberg - -### Discussion: - -* Dan Hutchinson joined from Foundry to discuss security. - -* There’s a healthy security research community, likes to look at - popular libraries and does research to find vulnerabilities. They’re - quite enthusiastic. - -* Projects need a security policy, and should announce a solicitation - to the community to report vulnerabilities. Some projects post a PGP - key with which to encrypt vulnerability reports. - -* Projects should have a Responsible Disclosure Policy - given 60 days - to respond. - -* There’s a huge chasm between a bug and an exploit, a way of turning - the bug into an actionable way of gaining access to a system. It’s - legitimate for projects to ask, “Do you have an exploit available?” - -* Projects need static and dynamic analyzers. OpenEXR uses - Sonar. SonarCube is a report aggregator. It can subsume valgrind - reports. - -* How concerned should we be about security? Put yourself in the - shoes of a hacker: file formats are a common attack vector. - -* Dan: OpenEXR is being proactive already;IlmImfFuzzTest is “awesome”. - -* Dan: Fewer than 10 CVE’s in 10 years is a pretty good record for a - file format. - -* Dan: From what you’ve said, OpenEXR has ticked all the security - boxes. - -* There are issues with how the library is used: the API says pass in - a buffer of size X and application passes in buffer of size X-1, and - we overwrite. Is that our problem? Not really. - -* Some of the complaints were that the library could allocate all the - machine’s memory, then something else would crash, leading to a - DoS. DoS attacks are common, but not the worst vulnerability. - -* An image can be large but compress well, so a small file can lead to - large memory allocation. - -* Tiff has a comparable attribute structure: is there anything we can - learn from them? - -* Is there a plan to provide binary packages hosted in nexus? Not yet. - -* Should use common hardening C++ flags. - -* Is it worth providing GPG signatures? It prevents against someone - someone inserting something into the repo, and man-in-the-middle - attacks.. - -* Should enable 2-factor authentication on GitHub accounts. - -* Would hope that package maintainers would be proactive, but many of - them probably include OpenEXR only because it’s a dependency of - something else which might not have changed.. - -* Reference images: it would be helpful to have a set of images for - use with a performance test suite, and that exhibit a range of - features of the library and format, such as multiple AOV’s, - etc. https://github.com/openexr/openexr-images needs some curating. - -* TAC meeting yesterday - Michael Johnson mentioned that Apple is - sitting on some security-related issues, will work on getting them - approved. diff --git a/ASWF/tsc-meetings/2019-10-03.md b/ASWF/tsc-meetings/2019-10-03.md deleted file mode 100644 index ac6a196abb..0000000000 --- a/ASWF/tsc-meetings/2019-10-03.md +++ /dev/null @@ -1,60 +0,0 @@ -# 10/03/2019 - -### Attending: - -* Cary Phillips -* Rod Bogart -* Larry Gritz -* Peter Hillman -* Kimball Thurston -* Nick Porcino -* Joseph Goldstone -* Carol Payne - -### Discussion - -* Discussion of the project mission statement. - -* The mission statement should give some bar for how to proceed in the - future. Our philosophy: “Keep it simple.” However, the library as - it is is not simple. - -* Are we the keepers of best practices? - -* Keep format modern and relevant. An example issue: Should we - support integer data? - -* “Provide a specification and reference implementation of the motion - picture industry's preferred image file format for high dynamic - range linear scene-referred image data.” - -* Should focus on “Content Creation” - -* Openexr-images repo, reference images. Used by OIIO as test images. - -* Rather than storing a bunch of 4k images, better to provide a - program that generates the images on the fly. - -* Start with a reasonable image, then add noise to it, see how - compression works. - -* Foundry just advertised increases in OpenEXR speed, they obviously - take performance seriously. - -* Nick: whenever I export an image from photoshop, I wonder if the - gamut has changed, etc. - -* How quantify is the image of the expect quality? - -* What is the quality of my image? Tests. - -* Should the library include utilities/operators/techniques that check - the quality of an image? - -* We are now in a different eco system now from when OpenEXR was first - written. We can refer to the existence of tools and techniques that - didn’t exist. - -* Before submitting for project adoption, we need to address - outstanding SonarCloud bugs. - diff --git a/ASWF/tsc-meetings/2019-10-17.md b/ASWF/tsc-meetings/2019-10-17.md deleted file mode 100644 index 4d4e86c99f..0000000000 --- a/ASWF/tsc-meetings/2019-10-17.md +++ /dev/null @@ -1,62 +0,0 @@ -# 10/17/2019 - -### Attending: - -* Cary Phillips -* Christina Tempelaar-Lietz -* Kimball Thurston -* Joseph Goldstone -* Peter Hillman -* Larry Gritz -* John Mertic - -### Discussion: - -* The Azure build has been failing because Christina's macOS fixes - haven't yet been merged. Done now. - -* Should we fix Sonar bugs before project adoption? Other projects - haven't. SonarCloud reports "duplicate code blocks"; it's - questionable whether it's actually better to eliminate these, - especially in the test suite. And SonarCloud "smells" are REALLY - picky, and of dubious validity. It sometimes seems like the - SonarCloud C++ rules were written by someone who doesn't know C++ - very well. - -* Could we just turn off SonarCloud altogether for the test suite, - since it's not shipping code we really care about? Actually, we do - care, since it needs to function properly, and it's needed for - coverage analysis. - -* Larry: I've uncovered a problem in the deep data handling that - appears to be offset integer math overflow with large images, - i.e. 16k x 16k images. First noticed the problem in OIIO. Still - investigating, will report findings later. - -* The web site REALLY needs a refresh, but who has the time? The - content is OK, but the organization isn't great, and the visual - style is outdated. John suggests that the team at the Linux - Foundation may be able to help, as long as they have a general - outline of content to work with. Kimball also said he has some - friends who expressed interest in helping with the web site, will - refer them on. - -* Issue [#583](https://github.com/openexr/openexr/issues/583): - ask the poster to propose a fix. - -* Issue [#581](https://github.com/openexr/openexr/issues/581): Just - need to remove ImfMisc.h - -* Issue [#579](https://github.com/openexr/openexr/issues/579): the TSC - has made a decision to move to C++11 and drop support for C++98. - -* Issue [#573](https://github.com/openexr/openexr/issues/573): ask the - poster to propose a fix. - -* Issue [#571](https://github.com/openexr/openexr/issues/571): Peter - is investigating. - -* Issue [#568](https://github.com/openexr/openexr/issues/568): Kimball - wants to do a bit more investigation. - - diff --git a/ASWF/tsc-meetings/2019-10-24.md b/ASWF/tsc-meetings/2019-10-24.md deleted file mode 100644 index b465d80d10..0000000000 --- a/ASWF/tsc-meetings/2019-10-24.md +++ /dev/null @@ -1,80 +0,0 @@ -# 10/24/2019 - -### Attending: - -* Cary Phillips -* Christina Tempelaar-Lietz -* Kimball Thurston -* Joseph Goldstone -* Peter Hillman -* Nick Porcino -* Larry Gritz -* John Mertic - -### Discussion: - - -Discussion: - -* ASWF Project Adoption Proposal has been sent to the TAC. Next steps: - wait a few days for comments, then solicit a vote by the TAC, the - put the motion to the ASWF board, hopefully within a week. - -* Once adoption is complete, the next step is to move the repo to the - ASWF GitHu organization. - -* Larry created RB-2.4 branch, in preparation for 2.4 patch - releases. He uses this naming scheme for OIIO, etc, seems a - reasonable convention to follow. The branch markers are where - changes go; release tags (e.g. v2.4.1) are for actual releases, once - they're cut. - -* We'll resolve to discuss at the first TSC meeting of every month - whether enough fixes have gone into the patch branch to warrant a - patch release. Using the GitHub process, the overhead is low. - -* We need to configure Azure to run on RB-2.4, upon merge. - -* Kimball noted that his distro, Arch Linux, has updated to v2.4.0. - -* Larry reports that he's been integrating 2.4.0 into other projects - and it's been going well, build files are working as expected. - -* Adam Ferrall-Nunge at ILM had a problem with python2_7/imath.so not - getting installed by “make install” Let sit for discussion on TAC, - will pass it on the private list Should be #ifdef, not $if HAVE_FOO, - not strong opinion. - -* Nick noted inconsistencies between #if HAVE_FOO v. #ifdef - HAVE_FOO. By the current practice, we should probably prefer #ifdef - over #if. - -* Discussion of specific issues is recorded in the GitHub Issues: - - * [#597](https://github.com/openexr/openexr/pull/597) solution is to - check in the generated .h's to the repo, with make targets to - generate them. - - * [#595](https://github.com/openexr/openexr/pull/595) - [#593](https://github.com/openexr/openexr/pull/593) - [#592](https://github.com/openexr/openexr/pull/592) seems to all - be a problem with pkg-config files. Kimball to investigate. - - * [#591](https://github.com/openexr/openexr/pull/591) fix is to - strip out C++98 copatibility code, rely solely on C++11 threads. - - * [#583](https://github.com/openexr/openexr/pull/583) CMake seems to - be confused by something in the local boost installation, not sure - what to do. - - * [#581](https://github.com/openexr/openexr/pull/581) Remove - IlmMisc.h from distribution. - - - - - - - - - diff --git a/ASWF/tsc-meetings/2019-11-15.md b/ASWF/tsc-meetings/2019-11-15.md deleted file mode 100644 index 8d9159460f..0000000000 --- a/ASWF/tsc-meetings/2019-11-15.md +++ /dev/null @@ -1,45 +0,0 @@ -# 11/15/2019 - -### Attending: - -* Cary Phillips -* Christina Tempelaar-Lietz -* Kimball Thurston -* Peter Hillman -* Nick Porcino -* Larry Gritz -* Rod Bogart - -### Discussion: - -* Ready to move the repo to https://github.com/AcademySoftwareFoundation - -* We prefer “OpenEXR” over “openexr”, even though it makes for - confusing directory names, given the sub-module called OpenEXR. - -* But... should we consider doing the IlmBase/Imath repo reorg at the - same time? Postpone the port to pybind11 to eliminate - boost/boost-python? No consensus arrived at yet. - -* Cary will follow up with a written proposal to openexr-dev. - -* Discussed how the repo README.md and openexr.com refer to the - ancillary repos, openexr-images in particular. The existence of the - image repo should be made clear. - -* Rod will attempt an alternative layout of the README/website - information. - -* Threading/thread pools: Larry will follow up with SideFX over - whether the OpenEXR v2.3.0 threadpool changes adequately address - their immediate concerns. - -* Longer term, Larry will follow up on the thread pool issue across - all ASWF projects. - -* OpenEXR has simple needs, we shouldn’t complicate it. We would pefer - not to make OpenEXR depend on TBB. - -* Larry submitted clang-format build target. No one has tried it out - yet. A good time to run a massive reformatting is when the repo - reorg happens. diff --git a/ASWF/tsc-meetings/2019-11-21.md b/ASWF/tsc-meetings/2019-11-21.md deleted file mode 100644 index 9bf7bae9b8..0000000000 --- a/ASWF/tsc-meetings/2019-11-21.md +++ /dev/null @@ -1,40 +0,0 @@ -# 11/21/2019 - -### Attending: - -* Cary Phillips -* Christina Tempelaar-Lietz -* Peter Hillman -* Nick Porcino -* Larry Gritz - -### Discussion: - -* The repo has moved. All seems to have gone smoothly. - -* Looks like azure pipeline needs to be set up in the new org. PR’s - are not currently triggering builds. - -* Larry asked about GitHub merge policy. “Allow squash merging” has - now been turned on. - -* Imath repo: Let’s begin with a very simple example of pybind11, then - add to it gradually. - -* Nick: We should remove ImathRandom from Imath, and rely on C++11 - random. But this will require careful testing. - -* #484 - the “-x” option to limit memory usage: not worth the - complexity. We considered this back when we were questioning how to - deal with security vulnerabilities, but none of us feel that this is - a necessary feature, or one that adequately addresses a security - issue. - -* #591 - pthread support for mingw: PR needs serious cleanup, not - acceptable in its current form. - -* #215 - uninstall target: good enough idea, but we’d like a “dry run” - option. - -* #344 - new DwaCompressor setting. Should be a part of a performance - metric suite. diff --git a/ASWF/tsc-meetings/2020-01-09.md b/ASWF/tsc-meetings/2020-01-09.md deleted file mode 100644 index 1787d2f7d5..0000000000 --- a/ASWF/tsc-meetings/2020-01-09.md +++ /dev/null @@ -1,25 +0,0 @@ -# 01/09/2020 - -### Attending: - -* Cary Phillips -* Christina Tempelaar-Lietz -* Peter Hillman -* Larry Gritz -* Rod Bogart -* Eskil Steenburg -* John Mertic - -### Discussion: - -* Christina will investigate Azure job failures. - -* Peter will confirm is CLA is on file. - -* Discussed #625, OPENEXR_DLL issue - -* Eskil raised the issue of conformance test and the need for standard - example images; will investigate if openexr-images repo is - sufficient. - -* We proposed moving the meeting time to 1:30pm PST. diff --git a/ASWF/tsc-meetings/2020-01-16.md b/ASWF/tsc-meetings/2020-01-16.md deleted file mode 100644 index f24d590cf7..0000000000 --- a/ASWF/tsc-meetings/2020-01-16.md +++ /dev/null @@ -1,43 +0,0 @@ -# 01/16/2020 - -### Attending: - -* Cary Phillips -* Christina Tempelaar-Lietz -* Peter Hillman -* Larry Gritz -* Rod Bogart -* Nick Porcino -* Joseph Goldstone - -### Discussion: - -* The time is now 1:30pm PST. - -* Everyone's been unusually busy with other work, with limited bandwidth. - -* Christina will follow up on the Azure build failures. - -* Peter will investigate the Weta CLA. - -* Regarding Cmake expertise, Joseph expects to learn more in the - coming months, and Larry has a general understanding. Nick has a - simplified IlmBase CMake setup, 100 lines total. The complication - comes from two sources: the sub-projects, and shared settings with - the Automake config files. When Imath/Ilmbase moves to another - repo/project, this will simplify. But we should also eliminate the - sharing of settings with the am files. Parallel settings will be - less of a headache. - -* We need a list of projects to propose for the Google Summer of - Code. Larry suggested simple stuff like modernizing the C++ code. - -* Larry also suggeste a project wiki page for "ideas", a place to - maintain a "roadmap" of sorts. - -* Regarding the goal of developer engagement, we discussed how to - recruit new people. It's not especially appealing for projects that - require mostly maintenance. Possibly the ASWF Board can encourage - Premier member companies to identify available people. - - diff --git a/ASWF/tsc-meetings/2020-02-06.md b/ASWF/tsc-meetings/2020-02-06.md deleted file mode 100644 index 5f87028117..0000000000 --- a/ASWF/tsc-meetings/2020-02-06.md +++ /dev/null @@ -1,44 +0,0 @@ -# 02/06/2020 - -### Attending: - -* Cary Phillips -* Christina Tempelaar-Lietz -* Peter Hillman -* Larry Gritz -* Joseph Goldstone -* Kimball Thurston -* Eskil Steenburg - -### Discussion: - -* The 2.4.1 release should include only essential bug fixes. Defer - everything else to the next minor release. - -* Peter will merge recent fixes into the RB-2.4 branch via cherry - picking commits. Kimball will look into any cmake changes. Cary will - prepare the release notes. - -* We'll shoot for making the release Monday or Tuesday of next week. - -* Cary proposes a new label/milestone scheme. Labels will indicate - **what** an issue is (Feature Request, Enhancement, Question, Bug, - etc), as well as its **status** (Needs Discussion, Awaiting - Feedback, etc). Milestones will indicate **when** an issue is likely - to be addressed (Next Patch Release, Next Minor Release, Next Major - Release, Backlog, etc). - -* Briefly discussed #650, Arkell's fix for chromaticity - conversion. Joseph agreed to investigate. - -* Christina will follow up on the Azure build failures and why the - SonarCloud runs don't include coverage reports. - -* Christina reported from the ASWF TAC CI meeting that the ASWF - intends to migrate from Azure to GitHub Actions. - -* Our Google Summer of Code projects ideas are in. Notification of - accepted organizations is around Feb 20. - - - diff --git a/ASWF/tsc-meetings/2020-02-20.md b/ASWF/tsc-meetings/2020-02-20.md deleted file mode 100644 index fc1f0375f2..0000000000 --- a/ASWF/tsc-meetings/2020-02-20.md +++ /dev/null @@ -1,39 +0,0 @@ -# 02/20/2020 - -### Attending: - -* Cary Phillips -* Christina Tempelaar-Lietz -* Peter Hillman -* Larry Gritz -* Joseph Goldstone -* Kimball Thurston -* Nick Porcino -* Sarah Martin -* Arkell Rasiah - -### Discussion: - -* Sarah Martin is a TA at ILM interested in helping update the - openexr.com website. Starting with a investigation of pelican as a - static site generator. - -* Google Summer of Code: be prepared for students poking around the - project inquiring about things to do. - -* #591 assigned to Nick to identify the 3-5 lines worth integrating. - -* #650 IlmAcesFile.cpp: Joseph will follow up with Arkell. - -* #646 request PR to add quotes in cmake files - -* #634 Kimball needs to get his CLA straighted out, then will merge PR. - -* #621 request more information - -* #639, #648 defer until 3.0 repo split - - - - - diff --git a/ASWF/tsc-meetings/2020-02-27.md b/ASWF/tsc-meetings/2020-02-27.md deleted file mode 100644 index fbb6f3df84..0000000000 --- a/ASWF/tsc-meetings/2020-02-27.md +++ /dev/null @@ -1,61 +0,0 @@ -# 02/27/2020 - -### Attending: - -* Cary Phillips -* Peter Hillman -* Larry Gritz -* Joseph Goldstone -* Kimball Thurston -* Nick Porcino -* Arkell Rasiah - -### Discussion: - -* Google Summer of Code: we've gotten a few inquiries; be on the - lookout for more. - -* Release schedule: 2.5 sometime in the spring; 3.0 around siggraph. - -* The VES Reference Platform will list OpenEXR 3.0 for 2021. - -* #673 see #591 - -* #672 looks good, merged. - -* #666 looks good, merged. Will go into 2.5 - -* #639 looks good, merged. - -* #634 Kimball needs to unwind what he did. - -* #591 @Lord-Kamina agreed to clean up the PR. - -* #674 the solution is to remove OpenEXR_Viewers from the cmake build - process for the 2.5 release, and then remove it from the repo - entirely for the 3.0 release. - -* 652 brew recipe for openexr may need to be updated? - -* 648 won't fix. - -* 646 should be fixed by #672 - -* 625 the intention was cut down number of Windows user errors, but - there's no consensus the right thing to do. - -* 607 the answer is: don't do in-tree build.; clean up and try again. - - - - - - - - - - - - - - diff --git a/ASWF/tsc-meetings/2020-03-05.md b/ASWF/tsc-meetings/2020-03-05.md deleted file mode 100644 index a4ae43044c..0000000000 --- a/ASWF/tsc-meetings/2020-03-05.md +++ /dev/null @@ -1,36 +0,0 @@ -# 03/05/2020 - -### Attending: - -* Cary Phillips -* Peter Hillman -* Larry Gritz -* Kimball Thurston -* Christina Tempelaar-Lietz -* Gary Mandle - -### Discussion: - -* Gary Mandle discussed a research project at Baylor University that - involves reducing metameric issues with laser projectors using a - 6-color primary system, and he's wondering the best way to store - 6-color primary image data in an exr file. The EXR format supports - arbitrary channels, although better expert color advice on the - project in general can be found at OCIO: https://opencolorio.org. - -* Per the discussion at this week's ASWF CI workgroup, Christina will - start looking into converting from Azure to GitHub Actions. - -* #681 - Kimball will review. - -* #591 - Lord-Kamina says he'll follow up. - -* #215 - "make uninstall" is a feature we'd prefer not to support. - -* #679 - Larry and Peter will respond. - -* #677 - Cary will follow up. - -* #610 - Peter will follow up; can be closed out. - - diff --git a/ASWF/tsc-meetings/2020-04-02.md b/ASWF/tsc-meetings/2020-04-02.md deleted file mode 100644 index 416c5bb90e..0000000000 --- a/ASWF/tsc-meetings/2020-04-02.md +++ /dev/null @@ -1,32 +0,0 @@ -# 4/2/2020 - -### Attending: - -* Cary Phillips -* Peter Hillman -* Larry Gritz -* Kimball Thurston -* Christina Tempelaar-Lietz -* Rod Bogart -* Joseph Goldstone -* Nick Porcino -* John Mertic -* Sarah Martin - -### Discussion: - -* Various pandemic stories. - -* Discussed Google Summer of Code project proposals. - -* Sarah Martin presented mockups of a new look for openexr.com - website. We preferred the one with obviously high-dynamic range - image, a relatively small banner across the top. We expressed a - preference for a "dark" mode style. - -* Rod will look for information about the original OpenEXR logo design. - -* Cary will follow up with John Mertic about Linux Foundation graphic - design services for a new logo. - -* #668 - Cary will respond with "won't fix." diff --git a/ASWF/tsc-meetings/2020-04-16.md b/ASWF/tsc-meetings/2020-04-16.md deleted file mode 100644 index 083049ec9d..0000000000 --- a/ASWF/tsc-meetings/2020-04-16.md +++ /dev/null @@ -1,33 +0,0 @@ -# 4/16/2020 - -### Attending: - -* Cary Phillips -* Peter Hillman -* Larry Gritz -* Kimball Thurston -* Christina Tempelaar-Lietz -* Joseph Goldstone -* John Mertic - -### Discussion: - -* More pandemic stories. - -* TSC meeting cadence will change to bi-weekly, 1:30pm PST Thursdays, - since the OSL TSC meeting is 2pm biweekly. - -* John will get the LF design team to draft some logo options. We like - the idea that the logo should be simple enough to appear on a - camera, as was the original intention, even if that's not likely to - actually happen. It's still a good principle to follow. Also, the - letters "EXR" would be appropriate because that's the file suffix. - -* Discussed Google Summer of Code project proposals. We'll request 2 - slots. Cary communicated with one candidate by email. Peter will - follow up with one of the candidates to assess interest and skills. - -* Christina will look into the Azure build failures this weekend. It's - mysterious because it was working and nothing appears to have - changed. It doesn't seem to involve any of the recent PR's. - diff --git a/ASWF/tsc-meetings/2020-04-23.md b/ASWF/tsc-meetings/2020-04-23.md deleted file mode 100644 index 9b668e1de0..0000000000 --- a/ASWF/tsc-meetings/2020-04-23.md +++ /dev/null @@ -1,48 +0,0 @@ -# 4/23/2020 - -### Attending: - -* Cary Phillips -* Christina Tempelaar-Lietz -* Eskil Steenburg -* John Mertic -* Kimball Thurston -* Larry Gritz -* Peter Hillman - -### Discussion: - -* pgados has submitted a PR that patches the recent CVE fixes into the - 2.2 release, in order to patch an older SuSE enterprise distro that - uses 2.2.1. This is fine to merge, pending the CLA. - -* We will aim for a 2.5 release sometime next week. Cary will send an - announcement to openexr-dev shortly. We will make the 2.2.2 and 2.5 - releases at the same time, with 2.2.2 first quickly followed by 2.5, - so that people don't misinterpret 2.2.2 is the most recent release. - -* Reviewed logo designed. We liked the one with the overlapping - trapezoids (layered rectangles in perspective), but suggest that the - text should emphasize "EXR" and de-emphasize "Open". Also, - experiment with red, green, and blue rectangles, subject to what the - transparency might look like. - -* Discussed Google Summer of Code project proposals. We've made our case - for an OpenEXR project but will need to negotiate with the other - ASWF projects. - -* Larry says the OIIO CI script pulls from the top of OpenEXR master - branch, so that is at least one test for an external build, and that - code version also goes through the OIIO test suite. - -* Emily Olin proposes that the ASWF Open Source Day and project BoF's - go fully virtual this year regardless of whether SIGGRAPH is - in-person or virtual. We agree that we an host a Zoom-like community - gathering to provide a project update and solicit discussion - topics. We should be able to manage an effective virtual exchange. - -* Christina will shift gears on the CI failure and port the setup to - GitHub Actions first, then hopefully in the process determine why - the macOS build is failing. The build is failing to find the iex.so - module, presumably because of a pathing problem. - diff --git a/ASWF/tsc-meetings/2020-05-14.md b/ASWF/tsc-meetings/2020-05-14.md deleted file mode 100644 index 2c4abf59d3..0000000000 --- a/ASWF/tsc-meetings/2020-05-14.md +++ /dev/null @@ -1,30 +0,0 @@ -# 5/14/2020 - -### Attending: - -* Aloys Baillet -* Cary Phillips -* Christina Tempelaar-Lietz -* Joseph Goldstone -* Kimball Thurston -* Larry Gritz -* Nick Porcino -* Owen Thompson -* Peter Hillman - -### Discussion: - -* Introduce Owen Thompson, Google Summer of Code intern, from the - Motion Picture Science program at Rochester Institute of - Technology. Internship runs June-August. - -* Discussed the Imath project: - - * A new repo, https://github.com/AcademySoftwareFoundation/Imath - - * Retain the revision history, via git rewrite history, maybe? - - * Add performance metrics, and performance regression tests. - - * Modernize the C++, too: constexpr, noexcept, CUDA-compatibility for half, etc. - diff --git a/ASWF/tsc-meetings/2020-05-21.md b/ASWF/tsc-meetings/2020-05-21.md deleted file mode 100644 index 9e568be9dd..0000000000 --- a/ASWF/tsc-meetings/2020-05-21.md +++ /dev/null @@ -1,90 +0,0 @@ -# 5/21/2020 - -### Attending: - -* Arkell Rasiah -* Cary Phillips -* Christina Tempelaar-Lietz -* Eskil Steenburg -* Joseph Goldstone -* Kimball Thurston -* Larry Gritz -* Nick Porcino -* Owen Thompson -* Peter Hillman -* Rod Bogart -* Phil Ames -* Abishek Arya - -### Discussion: - -* Arkell will investigate updating open-exr images over the - summer. Will also reach out to Florian to see if he’s interested in - providing some test images. - -* Arkell raised a concern about images in the - openexr-images/Chromaticities folder. Should the Rec709.exr and - XYY.exr appear the same? Aren’t the chromaticies the same? Rv - inherently adapts with a bradford transformation. Was the XYX made - with the wrong adaptation matrix? - -* Phil Ames and Abishek Arya from the Google AutoFuzz team joined to - discuss the OSS-Fuzz service. - - * Phil is on the information security team. The team fuzzes a lot of - open source projects, especially file formats. - - * Abishek leads the OSS-Fuzz development effort. - - * The goal is to make fuzzing really simple, simplifying workflow as - much as possible. - - * Integrated with 300 projects (e.g. OpenSSL) - - * They used to manually reproduce and file bugs, but that doesn’t - scale, so the process has been automated. - - * Lots of work has been done to de-duplicate bugs by comparing - stackframes. - - * OSS-Fuzz focuses on making bugs reproducible. Otherwise they aren’t - filed. - - * Most of the integration can be done in < 100 LOC. - - * Vendors can sign up to be notified when bugs are detected. - - * Security bugs are restricted for 90 days. - - * Bugs are closed automatically when a fix is checked in. - - * It’s using the existing IlmImfFuzzTest. Will need to break it up - into smaller tests. - - * OSS-Fuzz instrument with many sanitizers, on many cores. - - * What happens if something is discovered that’s in code that doesn’t - matter (documentation generation code)? We control that, since it’s - our code that runs the fuzzers. - - * There’s a CI option: on every PR it does 5 minutes of fuzz. - - * OSS-Fuzz doesn’t file CVE’s. - - * Example integration setup PR, for the tinyexr project: - https://github.com/google/oss-fuzz/pull/3801/files - -* Larry pointed out the recent Autodesk maya file security issue: - - https://www.autodesk.com/trust/security-advisories/adsk-sa-2020-0003 - -* We also want to run the sanitizer against the regular tests, as well - as against the fuzz tests. - -* Owen shared the Imath project task spreadsheet: - https://docs.google.com/spreadsheets/d/1rC_USR4lLXVUTyAG62gOG-uJlxzRguMNTlMYYf2rUrQ/edit?usp=sharing - -* Christina reports that Azure Pipelines is completely retired, all - migrated to GitHub Actions. One remaining issue with the Windows - build, but everything seems to be working properly. - diff --git a/ASWF/tsc-meetings/2020-06-04.md b/ASWF/tsc-meetings/2020-06-04.md deleted file mode 100644 index 9803654119..0000000000 --- a/ASWF/tsc-meetings/2020-06-04.md +++ /dev/null @@ -1,56 +0,0 @@ -# 6/4/2020 - -### Attending: - -* Cary Phillips -* Christina Tempelaar-Lietz -* Eskil Steenburg -* John Mertic -* Joseph Goldstone -* Kimball Thurston -* Larry Gritz -* Nick Porcino -* Owen Thompson -* Peter Hillman -* Rod Bogart - -### Discussion: - -* John Mertic revives the discussion of the logo design: - - * Larry referenced https://landscape.aswf.io. Some look great small, some do not. - * The concept was to demostratine dynamic range in the layers. - * The original idea was that the logo could appear as an icon on a camera. - * Eskil: Think of the original photo by Debevec with same image at different stops. - * Nick: The most important feature is dynamic range; Nick proposes a - drawing that includes and image ad different exposure levels: - night, day, sun. - * Could also illustrate "multipart." - * Rod: Should not look like photoshop layers. - * Could look like an image coming apart. - * Could show channels vs. some other multi-dimensional. - * Needs to be easy to reproduce (t-shirts, etc). - * Could be an element that’s a response curve, except that exr is linear(?) - * Logos should be clear: NASA has a continuum of logos. - * Cmake has really simple logo, has nothing to do with. - * John will invite the LF graphic designer next time. - * After the meeting, watch this: https://www.youtube.com/watch?v=pnv5iKB2hl4 - -* Imath repo project: - - * Revision history can be done later - * Need to resolve the handling of exceptions ASAP. - * Consider the new C++11 exception system categories feature, although that's mroe for OpenEXR itself. - * Imath deals mostly with math-specific exceptions. - * Nick: I ported a lot of Occulus’s code but comparisons don’t work across boundaries. - * IlmThread stays behind in OpenEXR. - * PyIlmBase goes to a new repo. - * Autotools? Leave it behind; if someone objects, we can bring it in later if needed. - * OpenEXR should encorporate Imath as a Git submodule. We’re - creating proper “find” cmake files; if it finds it, it’ll use it, - if not, it’ll build it. - * Nick: I tend to write shell scripts to handle all this stuff; I can put together a Gist to illustrate. - * Or, just build the dependency first? - -* Christina: need Kimball to check her latest PR. - diff --git a/ASWF/tsc-meetings/2020-06-18.md b/ASWF/tsc-meetings/2020-06-18.md deleted file mode 100644 index 39ae9b9929..0000000000 --- a/ASWF/tsc-meetings/2020-06-18.md +++ /dev/null @@ -1,87 +0,0 @@ -# 6/18/2020 - -### Attending: - -* Cary Phillips -* Christina Tempelaar-Lietz -* Eskil Steenburg -* Joseph Goldstone -* Kimball Thurston -* Larry Gritz -* Nick Porcino -* Owen Thompson -* Peter Hillman -* Alison Rowan - -### Discussion: - -* Review OpenEXR logo concepts with Alison Rowan from the LF's Creative Services group. - - * General consensus on preferring the design that illustrates 3 exposure levels. - - * Based loosly Nick's idea sketch. - - * How well will it read when it’s small? - - * Could EXR be in red? - - * Discusion of perspective vs orthographic. Does the perspective - look a little too precious? Consensus prefers the orthographic. - -* Discussion of exception handling. - - * Kimball will submit his proposal to a branch in the Imath repo, - for further review. He had another idea that avoids any change to - the API. - -* Discussion of performance metrics - - * Peter: can we somehow link a test with two different variations of - the library and compare metrics between them? Using namespaces? - - * Need further experiments. - -* Should PyImath be a separate repo, or a submodule of Imath? - - * Owen configured PyImath as a submodule of Imath, but Cary - suggested we actually want the opposite: Imath makes no mention of - PyImath. - - * Cary: the goal is simplicity and reliability of the build process, - especially for the default build behavior. Someone wanting the - basic c++ library, and possibly not having much technical - experience, should not get tripped up because of python or boost - configuration on their machines. - - * Kimball: I've always had trouble getting git submodule's to work, - they've tended to get out of sync. - - * Larry: OpenVDB is eager for Imath but doesn't want PyImath, so - maybe there is merit in Imath w/o python bindings. - - * Peter: The current cmake configuration tries to build the - bindings, but if it can’t, it doesn't, so there shouldn't be a - problem. - - * Cary: Don't underestimate the amount of work to reimplement the - imath FixedArray bindings, it's more complex that it seems. - Nick mentioned issue #367, regarding python buffer protocols. - - * Conclusion: move PyImath to a subfolder of Imath. The same repo, - but not built by default. The cmake configuation is completely - indepedent, and disconnected. "If you want the python bindings, cd - to PyImath and run cmake." This satisfies both goals: simple and - reliable, but a single repo. - -* Discussion of issue #765, leaks on static initialization. Resolved - in 2.5, but the problem was errant c++ version #if's. It's time to - remove all that stuff. Just remove all conditionals related to old - c++ versions, and put them back in only where they're absolutely - necessary. We may need to make a distinction between c++14 and 17 - for certain constexpr constructions. - -* Update on the Disney CLA logjam, which came to a head with OSL, due - to Pixar's involvement. The governing board's legal group met to - discuss the various iterations of the proposed CLA's and may be - close to a decision but nothing is final yet. - diff --git a/ASWF/tsc-meetings/2020-07-16.md b/ASWF/tsc-meetings/2020-07-16.md deleted file mode 100644 index 3a026befe1..0000000000 --- a/ASWF/tsc-meetings/2020-07-16.md +++ /dev/null @@ -1,127 +0,0 @@ -# 7/16/2020 - -### Attending: - -* Cary Phillips -* Christina Tempelaar-Lietz -* Joseph Goldstone -* Kimball Thurston -* Larry Gritz -* Nick Porcino -* Owen Thompson -* Peter Hillman -* Rod Bogart - -### Discussion: - -* The CLA. Disney refuses to sign the current one, although Disney - employees already authorized have apparently somehow slipped - through. This came to a head with OSL. We (OpenEXR TSC) have no - concerns about moving to the new CLA that the ASWF Governing Board - legal committee settled on, which is Apache 2. We will request help - from John Mertic to navigate through changing the forms in EasyCLA, - and getting respetive companies to sign the new one, without anyone - getting locked out of push access to the repo. Also, we need to - update the documents in repo and make sure there are no references - to the outdated form. Cary will request help from John Mertic. - -* Review the logo concepts from Ali Rowan, graphic designer with the - Linux Foundation. The red version is nicely suggestive of the old - logo. The trapezoidal shapes were intended to suggest a perspective - projection, although the shape in the concept designs provided is - not a perspective, and this feature has relatively minor appeal to - the group. Therefore, we settle on the square-ish red logo. Note - that we need several variations: text on the bottom, text to the - right, no text, gray-scale, very small "favicon". Cary will request - that of Ali. - - -* Open Source Day - - * Outline: - - * Brief recap of the year - * Overview of OpenEXR 3.0 release - * Overview of Imath (given by Owen) - * Introduction of new openexr.com (hopefully given by Sarah Martin) - - * Arkell agreed to provide some updated images for the - openexr-images repo, although he reports that he's not prepared to - generate and deep exr images. - - * Cary requested 25 minutes, but given that Imath is a major topic, - we expect enough comments and feedback that we should increase - that to 55 minutes. Cary will follow up with Emily Olin. - - * Larry notes: This is the biggest release in a very long time, with - signficant implications to the user community. Everyone who builds - openexr is going to be affected. - - * We should expect lots of questions and vigorous discussion. We had - good questions last year (e.g. “Is OpenEXR appropriate for ML?”) - - * The title of session should prominently feature "Imath". - -* 3.0 Release: time to get in any changes that break compatibility. - - We should make a pass at cleaning up exceptions in the OpenEXR tree. - - Some Issues for potential inclusion: - - * getChunkOffsetTableSize https://github.com/AcademySoftwareFoundation/openexr/issues/740 - - * Include guards https://github.com/AcademySoftwareFoundation/openexr/issues/636 - - * Signed strides: https://github.com/AcademySoftwareFoundation/openexr/issues/614 - - We will need to take care with how OpenEXR references Imath. It - could potentially be an external project path in cmake that - auto-clones imath repo. Nick reports that this works well with - OpenTimelineIO. - - We should remove legacy thread support, just use std::thread We - still want to provide the semaphore class. Lock is slower than a - semaphore class. Keep the shim layer. - - We should we move some of the directories up a level, so the OpenEXR repo has subfolders: - - * src - - * test - - * tools - -* OSS-Fuzz: Going well so far, around a dozen issues, which have been - easy to reproduce and identify. It takes some thought to determine - how to resolve them. Do we want to break compatibility, or suppress - it? - - Peter points out that the most recent report, the test case is - broken, the exr is bad data. Peter will follow up with fuzz folks. - -* Owen reports on progress with Imath. - - * Initial push of constexpr changes - - * A small set of tests. There are some python binding missing. - - * Cuda: The strategy is when compiling with Cuda, put half into Imath internal namespace. - - What is different between cuda and imath half? Bit layout is the - same. Our class has HasInf, could use std::isinf override. Rod: - We tried to merge with NVIDIA. - - Owen will write a test that verifies the behavior. Should still - support C++11. - - * Create a RC3 branch. - -* clang-format: Would like to reformat before the 3.0 release. Nick - says that OpenTimelineIO used the openexr template with - success. Larry notes: Whatever we choose, there will be sections - that don't format nicely, so just turn off formatting. But, a year - later, you'll forget about what you didn't like. - - Don't like #include sorting, it can break the build; alphabetical - order is not always what you want. - diff --git a/ASWF/tsc-meetings/2020-07-30.md b/ASWF/tsc-meetings/2020-07-30.md deleted file mode 100644 index 5b6e1d0d24..0000000000 --- a/ASWF/tsc-meetings/2020-07-30.md +++ /dev/null @@ -1,142 +0,0 @@ -# 7/30/2020 - -### Attending: - -* Cary Phillips -* Christina Tempelaar-Lietz -* Joseph Goldstone -* Kimball Thurston -* Larry Gritz -* Nick Porcino -* Owen Thompson -* Peter Hillman - -### Discussion: - -* Joseph proposed discussing the pros and cons of implementing the - attributes in the ACES Container spec (SMPTE ST 2065-4) in the - reference implementation. Putting them in the reference - implementation will effectively make them more portable. OTOH any - organization using unqualified names (not ‘legal’ according to the - spec, but of course the reference implementation doesn’t stop you - from doing it) in a nonstandard way potentially could see an impact. - - * Joseph: I have a laundry list of things I’d like to include. The - ACES container has never been a subset of OpenEXR. People who - want to use the standard attributes have to implement them - themselves. - - * If you have two different companies and they’re each implementing - fstop, one does it as a string, one as a float. If it’s in the - reference implementation, it would force consistency. You can - read a raw file and find some things in exif fields, other things - from somewhere else. What happens if the two things have the same - name? What happens if the same thing is in two different places? - - * Has anyone added standard attributes recently? No one has done - that in a very long time. Gitlog says nothing has been added - since 2014. - - * Joseph: Please look at the list of standard attributes and report - which ones are used at your shop. - - * Larry: A lot of these correspond to things we see all the time. A - lot of these, because they correspond to XMP, etc, by convention, - the OIIO does say “It’s supposed to be called blah.” - - * But there's a difference between standard attributes and required - attributes. This list combines required and standard. - - * Nick: I propose to adopt the SMPTE names. Move forward with SMPTE standard. - - * Larry: we should really strongly recommend that if anybody does - anything non-canonical, they should prefix it. - - * Peter: It’s not the file format’s job to interpret the - attributes. But if we can provide guidance and helpers to - applications. - - * What’s in the standard attributes file suggests what the type of - an attribute is, but you don’t have to use it. You can insert any - attribute with any type. The library doesn’t enforce the attribute - usage. - -* Update on Imath - - * Most significant contribution: restructuring of all the source files. It’s been pushed. - - * Installation of imath: tried to do external project. Kimball: we can follow up. - - * Nick: Can you add zlib, too? - - * Would be nice if it fails to download. - - * Nick: remember that OpenTimelineIO has a system that’s working with our CI. - - * What should the version number of the Imath release be? 1.0? That - might conflict with the libImath from OpenEXR 1.0. It's probably - best to start with "3.0", odd as that sounds. Then OpenEXR and - Imath can diverge from there as necessary. - - * Nick: Radical suggestion: D&I initiative: rename it to main. Rebasing on master is gross. - Could change to "main", "dev". - - * Larry: This is being hotly debated. Let's wait for a consensus to - emerge in the community about what everyone si going. Wait to jump - on the bandwagon. - - * Owen't next step: Finish up the pull request, then get back to CUDA. - - * Larry: two more things before the release: - - * Cuda decorators: make a define if you’re being compiled by the - CUDA compiler, define host device. Then decorate all functions - with that. - - * Change the individual component storage to a union, which provides performance improvements. - - * Owen: I'm planning to do both of these right away. - - * Should also replace std::isinf for half. - - * Maybe an option to put half in a namespace? - - -* We should aggregate all the “can’t find boost” issues into one, - since they're all versions of the same problem. With the most recent - boost release, cmake errors: "Boost is incorrectly configured.” - Kitware and boost in a fist fight. - -* Still getting permission issues on sonar scan stuff. - -* Reviewed overview of slides for ASWF Open Source Day, scheduled for - Wednesday, August 19, 4:30pm PT. - -* https://github.com/AcademySoftwareFoundation/openexr/issues/636 weak - namespace and include guards. - - The modern idiom is to use #pragma once. Header guards prevent - including twice, but also allows you to know whether they’ve been - included. We should not take them out, they're still useful. You can - get to the same file in two different ways. - -* Other issues not discussed: - - * https://github.com/AcademySoftwareFoundation/openexr/issues/789 - Better stream interface for DeepScanlineInputFile - - * https://github.com/AcademySoftwareFoundation/openexr/issues/773 - PyIlmBase cmake is able to find Boost but not boost::python - - * https://github.com/AcademySoftwareFoundation/openexr/pull/750 - Zero allocated memory to guarantee always identical output in DWAA compression - - * https://github.com/AcademySoftwareFoundation/openexr/issues/740 - Remove deprecated argument to getChunkOffsetTableSize - - * https://github.com/AcademySoftwareFoundation/openexr/issues/548 - mark half(float) constructor as explicit - - * https://github.com/AcademySoftwareFoundation/openexr/issues/485 - Remove _maxScanLineSize members - diff --git a/ASWF/tsc-meetings/2020-08-13.md b/ASWF/tsc-meetings/2020-08-13.md deleted file mode 100644 index 5720769dca..0000000000 --- a/ASWF/tsc-meetings/2020-08-13.md +++ /dev/null @@ -1,51 +0,0 @@ -# 8/13/2020 - -### Attending: - -* Cary Phillips -* Christina Tempelaar-Lietz -* Joseph Goldstone -* Kimball Thurston -* Nick Porcino -* Owen Thompson -* Peter Hillman -* Rod Bogart -* Arkell Rasiah -* Eskill Steenberg - -### Discussion: - -* Review of slides for Open Source Day. Discussion of the order of - topics, slide contents. Need to confirm how Q&A works with the Zoom - Webinar. Christina will monitor the chat and read the questions. If - there are answers in chat, read them too. Will schedule a tech - check/walk-through on Monday. - -* The tree for the Imath repo should be: - - src - ├── lib - │   ├── Half - │   └── Imath - ├── python - │   ├── PyImath - │   └── PyImathNumPy - └── test - ├── HalfTest - ├── ImathTest - └── python - ├── PyImathNumpyTest - ├── PyImathSpeedTest - └── PyImathTest - -* Eskil presented his proposal for a C implementation of ACES - spec. Joseph: ACES Central would be a good place for this. ILM’s - feeling from the beginning was that the code should be the spec, so - there has never been an independent published specification. - -* Arkell: review some new imagery for the openexr-images repo. Will - submit them via a PR. - -* Owen: This is my 2nd-to-last meeting as GSoC internl. I appreciate - everyone’s help. No plans after this. Looking for a job, please - contact me with any leads. diff --git a/ASWF/tsc-meetings/2020-08-27.md b/ASWF/tsc-meetings/2020-08-27.md deleted file mode 100644 index da43b2475c..0000000000 --- a/ASWF/tsc-meetings/2020-08-27.md +++ /dev/null @@ -1,65 +0,0 @@ -# 8/27/2020 - -### Attending: - -* Cary Phillips -* Christina Tempelaar-Lietz -* Joseph Goldstone -* Kimball Thurston -* Nick Porcino -* Owen Thompson -* Peter Hillman - -### Discussion: - -* Imath release: - - * Need a beta period. Larry: I tried to use master and fell on my - face. - - * Legacy headers: Imath headers have traditionally been installed in - OpenEXR subfolder, and existing user code has: - - #include - - * Downstream packages need to work cleanly with both current - installation of v2.* and with 3.0. - - * Proposed solution: adaptive headers. For some number of upcoming - releases, we will provide stub headers in OpenEXR folder, and - issue warnings. Then in a future release, remove them. This will - aid in user transition. - - * Should be no more FindOpenEXR.cmake. - - * Should Python on by default? The majority the complexity is in - handling both 2 and 3. Kimball: could specify a path to the - python binary. Larry: propose off by default, so it builds - better. Everyone agrees. - - * Is Half in a namespace? Only in CUDA. It in the namespace, with an - optional using. CUDA forces the option to true. - -* Versioning policy: we will bump version number immediately *after* a - release, so that building from the dev branch produces library names - with the not-yet-released version, not with the current version that - it doesn't, in fact, match. - -* Fuzz: damaged OpenEXR files can cause Undefined-shift operators in - B44 uncompress (#821). - -* Apple hardware: - - * Wave was talking at a TAC meeting. - - * Apple has some optimizations, but waiting until silicon is available. - - * Larry: we should make the half stuff work with Intel hardware, - faster than table-based conversions. - - * DTK: Some people are getting a working box. Nick has one on the - way, will do a dry run to make sure USD works. Take OpenEXR for a - spin, too. It’s a mac mini crammed full of hardware. Probably - rigged it up to run an ipad arm chipset. - - diff --git a/ASWF/tsc-meetings/2020-09-10.md b/ASWF/tsc-meetings/2020-09-10.md deleted file mode 100644 index 8c4458f048..0000000000 --- a/ASWF/tsc-meetings/2020-09-10.md +++ /dev/null @@ -1,79 +0,0 @@ -# 9/10/2020 - -### Attending: - -* Cary Phillips -* Christina Tempelaar-Lietz -* Joseph Goldstone -* Kimball Thurston -* Nick Porcino -* Peter Hillman - -### Discussion: - -* Need help with Issue #821, Damaged OpenEXR files can cause - Undefined-shift operators in B44 uncompress. The expected behavior - is not clear. Cary will contact Florian, who appears to be the - original author. - -* Discussion of exception handling: - - * Imath PR #47 introduces Frustum::projectPointToScreen_noexcept(), - but that's inconsistent with Vec3::normalize() and - Vec3::normalizeExc(). - - * Kimball: If we were designing it today, we'd write separate - classes, one that handles/throws exceptions and one that doesn't. - - * Peter: but sometimes the throw/don't-throw decision is in the use - (tight loop), not in the definition of the data itself. - - * We assume the most critical use case is code that must be compiled - with a compiler that doesn't support exceptions (games code). - - * The consensus is: Continue the paradigm of the Vec classes: the - ordinary function name does not throw; a parallel function with - the suffice "Exc" does throw. We also wrap the throwing code in - #if's so that it's possible to omit it at compile time. - - * More untangling is necessary. The integer specializations of - Vec::normalize() throw if the vector is not along a principal - axis. And Matrix22::inverse(bool) takes an argument. These should - all be made consistent. And noexcept added. - -* Discussion of branch names. It came up again at yesterday's TAC - meeting. Larry seems to favor the emerging GitHub - conventions. Kimball still prefers dev/release. - - * Discussion of the default branch: consensus is it should be - "release". If someone clones the repo, they should get the release - branch. That way, they build off of what is closest to the - released code, although it may not be an actual release, because - PR's may have been merged into the branch since the latest - release. But that's still reasonable. Soon, our dev branch is - going to contain major changes, so it's good that you have to be - intentional about working with it. - - * The name "release" sounds like it's an actual release, but it's - not. Would it be better called "releases", since it's the branch - that has the record of all past releases? - - * The typical download/install process should download the tarball - or pull from a specific release tag (v2.5.3), but we can't assume - all inexperienced users do that. Better to make the typical - behavior as understandable as possible. - - * When someone clones the repo, fixes a bug, and submits a PR, that - PR is then likely to be against the release branch, not dev/main. - That's OK, even good. During the review of the PR, we - (maintainers) should discuss whether the change should 1) go into - dev instead, 2) get merged into dev as well, or 2) go into release - only. Cary: better to make this decision and do the merge as we - go, PR by PR, rather than letting them accumulate and then having - to do a bunch of merging and cherry picking prior to a release. - - * In the two-branch workflow, we will always pay attention to what - branch a PR goes against. Not an issue now, but see other - advantages to having two releases, so this seems reasonable. - - \ No newline at end of file diff --git a/ASWF/tsc-meetings/2020-09-24.md b/ASWF/tsc-meetings/2020-09-24.md deleted file mode 100644 index d2adc6579f..0000000000 --- a/ASWF/tsc-meetings/2020-09-24.md +++ /dev/null @@ -1,38 +0,0 @@ -# 9/24/2020 - -### Attending: - -* Cary Phillips -* Christina Tempelaar-Lietz -* Joseph Goldstone -* Kimball Thurston -* Nick Porcino -* Peter Hillman -* Larry Gritz -* Rod Bogart -* Owen Thompson - -### Discussion: - -* Joseph raised the issue of "Standard Optional Attributes", should - the be added to the reference implementation? We raised the issue - around SIGGRAPH and Open Source Days but got no feedback. How do we - get feedback from the community? Suggestion: Just send it to Josh - Pines, John Cortell, and the usual suspects at major facilities. - -* The attributes don’t affect the image, they just help with - interpeting the data. - -* Peter: put an image in the openexr-images repo that illustrates the - new attributes, so it gives people an opportunity to actually see - what it would look like. - -* Rod: We have been working on an optimization about reading really - big exrs as fast as possible. At 8Kx4K, we can get about 3 per - second. Tried memory mapping, got to 5/sec. Structured buffer on - the GPU, using GPU to decoded the data got to 18/sec. But it’s - specific to particular EXR. Is this something we should consider - supporting at the library level? - -* Rod: one option is use something other than EXR. Please say no. - diff --git a/ASWF/tsc-meetings/2020-10-08.md b/ASWF/tsc-meetings/2020-10-08.md deleted file mode 100644 index 3633d57f6a..0000000000 --- a/ASWF/tsc-meetings/2020-10-08.md +++ /dev/null @@ -1,81 +0,0 @@ -# 10/8/2020 - -### Attending: - -* Cary Phillips -* Christina Tempelaar-Lietz -* Joseph Goldstone -* Kimball Thurston -* Peter Hillman -* Larry Gritz -* Rod Bogart -* Owen Thompson - -### Discussion: - -* Need help with Issue #821, Damaged OpenEXR files can cause - Undefined-shift operators in B44 uncompress. The expected behavior - is not clear. Cary will contact Florian, who appears to be the - original author. - -* Discussion of exception handling: - - * Imath PR #47 introduces Frustum::projectPointToScreen_noexcept(), - but that's inconsistent with Vec3::normalize() and - Vec3::normalizeExc(). - - * Kimball: If we were designing it today, we'd write separate - classes, one that handles/throws exceptions and one that doesn't. - - * Peter: but sometimes the throw/don't-throw decision is in the use - (tight loop), not in the definition of the data itself. - - * We assume the most critical use case is code that must be compiled - with a compiler that doesn't support exceptions (games code). - - * The consensus is: Continue the paradigm of the Vec classes: the - ordinary function name does not throw; a parallel function with - the suffice "Exc" does throw. We also wrap the throwing code in - #if's so that it's possible to omit it at compile time. - - * More untangling is necessary. The integer specializations of - Vec::normalize() throw if the vector is not along a principal - axis. And Matrix22::inverse(bool) takes an argument. These should - all be made consistent. And noexcept added. - -* Discussion of branch names. It came up again at yesterday's TAC - meeting. Larry seems to favor the emerging GitHub - conventions. Kimball still prefers dev/release. - - * Discussion of the default branch: consensus is it should be - "release". If someone clones the repo, they should get the release - branch. That way, they build off of what is closest to the - released code, although it may not be an actual release, because - PR's may have been merged into the branch since the latest - release. But that's still reasonable. Soon, our dev branch is - going to contain major changes, so it's good that you have to be - intentional about working with it. - - * The name "release" sounds like it's an actual release, but it's - not. Would it be better called "releases", since it's the branch - that has the record of all past releases? - - * The typical download/install process should download the tarball - or pull from a specific release tag (v2.5.3), but we can't assume - all inexperienced users do that. Better to make the typical - behavior as understandable as possible. - - * When someone clones the repo, fixes a bug, and submits a PR, that - PR is then likely to be against the release branch, not dev/main. - That's OK, even good. During the review of the PR, we - (maintainers) should discuss whether the change should 1) go into - dev instead, 2) get merged into dev as well, or 2) go into release - only. Cary: better to make this decision and do the merge as we - go, PR by PR, rather than letting them accumulate and then having - to do a bunch of merging and cherry picking prior to a release. - - * In the two-branch workflow, we will always pay attention to what - branch a PR goes against. Not an issue now, but see other - advantages to having two releases, so this seems reasonable. - - \ No newline at end of file diff --git a/ASWF/tsc-meetings/2020-10-22.md b/ASWF/tsc-meetings/2020-10-22.md deleted file mode 100644 index 9e4badea8c..0000000000 --- a/ASWF/tsc-meetings/2020-10-22.md +++ /dev/null @@ -1,187 +0,0 @@ -# 10/22/2020 - -### Attending: - -* Cary Phillips -* Christina Tempelaar-Lietz -* Eric Enderton -* Joseph Goldstone -* Kimball Thurston -* Larry Gritz -* Nick Porcino -* Owen Thompson -* Peter Hillman -* Steve Parker - -### Discussion: - -* ASWF project survey: should OpenEXR participate? - - * Larry: we struggle to enumerate what questions to ask. - - * Cary: the generic questions that Larry contributed to the survey - are interesting to us, but the survey is not likely to reach the - larger OpenEXR community. - - * Rod: We've asked questions before in email and GitHub Issues and - not gotten much response, on issues like "should we support - autotools?" - -* GPU acceleration of EXR reading: - - * Steve Parker of NVIDIA, Rod, Kimball met to discuss how to - efficiently read exrs directly to GPU. - - * Steve: reading compressed files, decompress on the GPU. Not tiled - and mipmapped already. The right thing to do is read off of disk, - minimally, only as needed. - - * Steve: The motivation is that compressed files exist. - - * Reading data is fine, all well and good, until you get to the - point where you need to operate on the data. Then you need to - decompress it. Haven’t touched format conversions. - - * Upshot is, 1 month ago, RTXIO was announced, a combination of - technologies for decompression and GPU direct storage, CUDA - technology. For a Windows and DirectX ecosystem. - - * End goal is to have all these pieces available as a part of the - architecture. Working with Microsoft on the direct storage. Watch - this space to hear more about it. - - * A lot of the foundations are there in GPU direct storage. For EXR, - the host would open a file and read its header and offset - table. This gives the host enough information to deal with - it. Processing of the remainder of the file would move to GPU - memory. This is what we’re in the middle of. - - * Eric: The host reads the header, then never reads the file again. - - * Larry: what’s the programming model? Steve: a combination of a - memcopy interface. Posix pread semantics: start at this offset, - read this number of bytes. - - * Larry: a new library, or built into the CUDA drivers? Steve: the - bulk is built into the header drivers. - - * Larry: what if you don’t have the right kind of network hardware? - The situation is that we don’t know where people will draw the - files from, so should just transparently work in the fallback - case. - - * Steve: thelibrary needs to separate the header reading from the file reading. - - * Larry: Tangential thing, we have control over what compression - methods are supported in the library and used out in the - world. But if there was different lossless compression, we could - add a new method. - - * Need two options: - - 1. GPU able to handle files that are out there. - - 2. We need something that a GPU could process more efficiently. - - * Larry: Nobody wants uncompressed files. - - * Steve: we’re primarily interested in decompressing. We can - decompress fast enough on the GPU that it can saturate. So it’s - faster to move the compressed data. - - * Rod: we’re in the process of thinking about changes in the - library. We should consider them now. We should find a way to - incorporate them. - - * Steve: the offset table doesn’t really have enough information. If - you only have it on the host, you have to make some - assumptions. It would be nice if the offset table has the offset - and the size. - - * Surprise from reading the spec: Some tiles can be uncompressed. If - some of the tiles are larger compressed, it stores the original - data. - - * Eric: backwards compatible metadata, could start decompression at - an offset. - - * Kimball: Should look at encoding some other information about - compression types in offset tables. - - * Rod: The header requires parsing to find the data you want. The - trick at Epic is we’re doing that on the header. And just - streaming the pixel data to the GPU. Have to go looking for the - pixel data. Should be easy to skip to the pixel data quickl, skip - over attributes you don’t need. - - * Steve: Some numbers: Multiple GB of data/second. One tile per - microsecond. You have one millisecond to pull a thousand tiles out - of a file. - - * Rod: getting a sense for what size image, and what frames per - second. Zip compression is 2:1. 8K latlong, 4K wide. - - * Kimball: the IO core in the writer is built around pread. So that - should be ready to go, in terms of hooking it into the CUDA IO - thing. - - * Two sides to the work: - - 1. general exr library should be better about it - - 2. another addon that knows about the GPU. The OpenEXR library - should not have GPUisms in it. Has to go somewhere - else. Ideally the library supports that “somwhere else” - - * Kimball: we have an example at Weta, a custom stream. - - * Steve: 200 RGB data, 8K image, 2:1 compression, then you could - read about 200 per second. - - * Rod: At Epic, our experience is getting less than 20. - - * Steve: PCGen4 gives another factor of 4. - - * Should be able to get 25 Gb/second out of them. We still hae room - on the GPU to do other things that just read OpenEXR files. Read - multiple streams simultaneously. Most of the bottlenecks on are on - the Windows side. - - * Rod: can read only int data, but OpenEXR is shorts. Have to - swizzle the data. We have to reinterpret at as fp16. Should be - able to swizzle two shorts simultaneously. - - * Kimball: I hadn’t considered changes to the chunk table. Would - make the CPU side faster. Would sacrifice some of the corrupt file - data processing. - - * Peter: Each chunk has the same information in the header. Change - the chunk table so the chunk headers are duplicate. - - * Peter: A compression format could put padding in it, so the data - is aligned and easy to skip over. - - * Kimball: I started work on core because of texture access. Don’t - know that the sparse texture architecture would be. Allow alterate - ordering in an EXR file? - - * Larry: we depend on the fact that it’s tiled as well as mipmapped. - - * Steve: a huge image, I want to chop out a portion of it. Seek time - is not a big deal any more. - - * Peter: you can store tiles in any order. - - * Steve: Small optimization, MIP-fail, tiles what are 1x1 or 4x4, - storing those continuously. - - * Larry: But once you’re using solid state storage, there’s no such - thing as seek time. - - * Steve: technically there is overhead, but it’s small. But with - pread, you have only one system call. - -* Action items? - - * Kimball: I didn’t finish cleaning up IlmBase out of the RC3 - library. As soon as that’s done, I’ll push up my C library. diff --git a/ASWF/tsc-meetings/2020-11-05.md b/ASWF/tsc-meetings/2020-11-05.md deleted file mode 100644 index 4c9754aa1a..0000000000 --- a/ASWF/tsc-meetings/2020-11-05.md +++ /dev/null @@ -1,88 +0,0 @@ -# 11/5/2020 - -### Attending: - -* Cary Phillips -* Christina Tempelaar-Lietz -* Eskil Steenberg -* Joseph Goldstone -* Kimball Thurston -* Larry Gritz -* Nick Porcino -* Owen Thompson -* Peter Hillman - -### Discussion: - -* State of the RC-3 branch: - - * Kimball: Has anyone looked at the branch? Was going to just merge, - couldn’t figure out ow to do a pull request. - - * MacOS and Windows now work in the CI, for the RC-3 branch. - - * Python is off by default, so default OpenEXR build avoids all - reference to boost. - - * Kimball: Some more cleanup that I’d like to do. - - * Majority of the changes are eorganization, redoing directory structure. - - * Cleaned out the IlmBase, removed config dependencies, simpler config path. - - * Code should still work the same way. - - * To get Windows build to work, I had to fix some of the DLL exports - tht weren’t being defined correctly. - - * Imath is also now building on Windows. - - * Removed non-c++11 stuff, may cause some people some grief. Removes - so much code. We're willing to accept the consequences. - -* The Imath python bindings still need some cleanup - - * Still references some IlmBase stuff. - - * Most of the PyImathConfig.h and PyImathConfigInternal.h symbols - are unnecessary and can be removed. - - * No need to duplicate HAVE_LARGE_STACK with ImathConfig - - * Need to clean out PyIex stuff. If PYIMATH_ENABLE_EXCEPTIONS is on, - the code won't compile becuase it references Iex. We need to - clearly state that we're entirely removing PyIex from - distribution. - -* Joseph: No further progress with community on Standard Optional - Attributes. They need a comment that says what they are. - - * Have not done: the alignment of camera viewing direction, camera - up vector direction, should be linked. Have not had time to think - about it. - -* A bunch of fuzz reports have come in. - - * Peter: It's current running my newly configured test, plus the - original tests. But my new test isn’t finding any. It handles - memory allocation better, so that may be why. - - * Some of the out of memory things are worth investigating. - - * The most recent repott was an overflow where you can have more - than INT_MAX pixels in a file. - -* CLA: - - * Cary: Lucasfilm has finally agreed to the new CLA, with Disney's approval. - - * Kimball: Weta is still confued about why they need to sign - something new, but it should be quick. - - * Nick: Pixar is close to approval on OpenTimelineIO. - - * Larry: Sony still working on OSL. - - * Christina: Has Epic signed? Not sure, but check with Michael - Dolan, he'll know. And beware that your individual name also needs - to be added to the approved list by your CLA manager. diff --git a/ASWF/tsc-meetings/2020-11-19.md b/ASWF/tsc-meetings/2020-11-19.md deleted file mode 100644 index 7980ffc150..0000000000 --- a/ASWF/tsc-meetings/2020-11-19.md +++ /dev/null @@ -1,130 +0,0 @@ -# 11/19/2020 - -### Attending: - -* Cary Phillips -* Christina Tempelaar-Lietz -* Joseph Goldstone -* Kimball Thurston -* Larry Gritz -* Nick Porcino -* Owen Thompson -* Peter Hillman - -### Discussion: - -* Imath PR #66: Use likely/unlikely to improve certain vector - ops. - - * This applies the builtin_expect to if statements to assist with - optimization. This is the result of engineers at Intel going over - things with a fine-tooth comb. - - * The general rule is that the directive is appropriate when you’re - detecting an error that is truly exceptional. - - * Does MSVC have the same feature? Maybe, someone should check. But - at least now all we have to do is extend the macro. - - * #66 also includes a change to a line to invoke std::abs(), - technically shouldn't go in the same PR, but fine as is. - -* Imath #65 Deprecate Math in favor of std:: - - * In the name of portability, std:: is better. - - * Kimball: There are some cases where I didn’t want to call the std - version because it does extra error checking. But you can tell the - compiler to use the unsafe function - - * Should we get rid of the Math class entirely? This PR removes all uses of the class but leaves it in the code. - - * Nick: Every line that goes is less debt. - - * Kimball: IlmThread in OpenEXR has the deprecation stiff, for mutex and lock. - - * Larry will port that over to this class. - -* #60 Make Matrix implementation more SIMD friendly - - * Unrolled assignments are faster than memset/memcpy. - - * These came about by an attempt to autofectorize the code. - - * Also included: a fix to Matrix33::setScale(), which attempted to - mimic Matrix44::setScale() by not affecting the final row, which - for M44 is the translation. But that doesn't ake sense for a 3x3 - matrix. Nick wrote the original code at ILM years ago, an - abandoned effort. All agree to regard the current behavior as a - bug and fix it to conform to the most logical behavior and affect - all rows. - -* Imath #59 Hide Vec and Matrix exceptions from Cuda - - * This PR #ifdef's out the throw calls under CUDA. - - * Would it be better to #ifdef out the entire function? - - * Or alternatively, remove the HOST_DEVICE decorator, which will - prevent them from bei ng compiled under CUDA altogether. - - * Nick: A little churn in CUDA code doesn’t set off alarm bells, - it’s expected to be a bit volitile, so this shouldn't cause a - problem. - - * One gotcha: M44::inverse(bool singExc) if invoked explicitly via - inverse(false). But the argument-less version is available. - -# Imath PR #58 Make separate test calls for each test - - * Not sure why the CLA test failed. Cary will fix it and merge. - -* openexr PR #865: Add a conditional to prevent analysis on forks - - * Larry: GitHub says they’re disabling actions on all forks, which - should address this. - - * Kimball: this was the suggested fix, although it wasn't the most - thorough of investigations. - -* openexr PR #862 E2K: added initial support of MCST Elbrus 2000 CPU architecture - - * Elbrus 2000 is a Russian supercomputer. It has all the same - registers, but not the same assembly syntax. - - * Nick: I was hoping that the directives could be specified at cmake - time. The code in question is a part of highly nested bits at - compile-time. Can those pathways be selected at cmake time? I - couldn’t tell. - - * It’s only used in the test of the DWA compressor. - - * It's minimal extra debt, so fine to accept, subject to the CLA. - -* Larry: We haven’t yet marked things as noexcept. - - * Ideally, we do it across the board everywhere that's - applicable. Comprehensive. - - * Certainly, in the cases of dual functions, it helps with - documentation. - - * The compiler ought to be able to tell you if a function throws, - but it doesn't. - - * In C++21(?) noexcept becomes a part of the name of the function, - so it would be an ABI break. - - * Larry will pick something and do it, then that can be used as an - example. - -* Larry: OIIO builds and supports OpenEXR back to version 2.x. - - * Every downstream project is going to need to change. At source and build. - - * Nick: USD ws doing detection on OpenEXR version, to fix dependency - on OIIO. - - * Larry will write up a short guide for how downstream projects will - need to adjust to 3.0 - \ No newline at end of file diff --git a/ASWF/tsc-meetings/2020-12-03.md b/ASWF/tsc-meetings/2020-12-03.md deleted file mode 100644 index 0a6a098080..0000000000 --- a/ASWF/tsc-meetings/2020-12-03.md +++ /dev/null @@ -1,115 +0,0 @@ -# 12/3/2020 - -### Attending: - -* Cary Phillips -* Joseph Goldstone -* Kimball Thurston -* Larry Gritz -* Nick Porcino -* Owen Thompson -* Peter Hillman -* Rod Bogart - -### Discussion: - -* Larry: The 3.0 porting guide will probably be couple of pages, as a - separate doc. Haven't gotten to it yet. - -* Kimball's new C Core: - - * The C level is just about file IO. The goals is performance, - memory optimization, and thread safety. - - * We really won’t want to change the structure of the fie. - - * The PR includes code a "namespace" mechanism via macros that make - function and type names configurable at compile time. Is this - useful? - - * Similar in spirit to the jpeg library: can configure the jpeg - library as either 8bit or 12 bit; it swaps out the function - names so you can have both in the same namespace. - - * Kimball: we might have an application for this mechanism at - Weta, not really sure. - - * Code readability overhead seems high. Is it worth it? - - * If we're ever going to add it, now is the time. Easiest to put - it in at the beginning. - - * Cary: Our mission statement says to place a high value on - simplicity, reliability, maintainability, compatibility. - - * Cary: We should include this only if someone has an actual use - case. Otherwise, it's unnecessary complication with no - demonstrated benefit. - - * After discussion, Kimball will rip out the macro namespace thing. - - * Next step is to replace the guts of the C++ library with the C - library. Under the covers the gues will get swapped out, but the - external C++ class API should not change. - - * Kimball: The C layer is far more strict about types. If it - encounters garbage data it rejects the file. - -* What is the timeline for the 3.0 release? - - * Cary: There is obviously a lot more work to do to even get to a - compilable, working version, much less a thoroughly tested, - releaseable version. - - * Rod: The VFX reference platform says 3.0. - - * Could there be a build-time switch between new and old? Seems - complicated. - - * Alternatively, we could release more or less as is with the new C - core there but not yet integrated into the C++ API. This would - give access to the new code without any potentially destabilizing - changes. - - * Kimball: The biggest hindrance is the threading part of the - library. I hate that OpenEXR creates threads. To get the maximum - performance you’ll want to use the C layer. We lack a C++ layer - that makes calls threadsafe. - - * After discussion, we agree: - - * The 3.0 release will include the code reorg and bug fixes, but - without the new C core. - - * Soon after the 3.0 release, we'll release 3.1 that includes - the new C core as a side library. This gives access to the - high performance, thread-safe file IO without altering the - existing code or API. Users can access it if they want. - - * Over subsequent 3.2, 3.3, etc releases we'll migrate the C++ - api to use the new core. This is possible because the API - won't change. - -* Joseph’s Standard Optional Attributes should go into 3.0. - - * Joseph: I have a PR almost ready. Haven’t filled out the CLA yet. - - * Need to make sure there’s no existential conflict between - up-vector and world transforms in the current - implementation. Both imply things about where the camera is in - relation to objects. - -* Report from the TAC meeting on proposal for new rawtoacess project. - - * Kimball: Alex Forsythe at the Academy and I have been doing - something similar. Would like to find a better home for the - project. - - * Propose rawtoaces - a project that merges existing versions of - code into a common library. - -* Request from gregcotton for a point release that includes PR #854, - fix to config for macOS. Should we include other bug fixes? Where - do we draw the line? With 3.0 now likely in January, is that an - acceptable fix? Cary will look at what other PR's might reasonably - go into a 2.5.4 release. \ No newline at end of file diff --git a/ASWF/tsc-meetings/2020-12-17.md b/ASWF/tsc-meetings/2020-12-17.md deleted file mode 100644 index a56bbb945d..0000000000 --- a/ASWF/tsc-meetings/2020-12-17.md +++ /dev/null @@ -1,139 +0,0 @@ -# 11/17/2020 - -### Attending: - -* Cary Phillips -* Christina Tempelaar-Lietz -* Joseph Goldstone -* Kimball Thurston -* Larry Gritz -* Nick Porcino -* Peter Hillman -* Rod Bogart -* Michael B Johnson -* David Aguilar -* Robin Lowe - -### Discussion: - -* Wave: Lead of ASWF Assets working group - - * Example question we're dealing with: “How can we get a bunch of - USD asets with MaterialX materials?” - - * Instead, why don’t we approach the projects and ask them what they - would want, in the space that they care about? - - * At Apple we have some example EXR's we're trying to get clearance - to send, mostly illustrating bugs. - - * Larry: We already have openexr-images, covers the basic. - - * Two examples that frequently come up with OIIO: - - * Test cases for all crazy things with metadata, range of data formats. - - * openexr-images has a couple of deep images, but they’re very - simple caes, they aren’t indicative. We need hairy production - images that would, say, confirm an application isn't going to - run out of memory. - - * Kimball: could generate some AOV’s from the Moana scene. - - * Wave: Could we hire an intern to generate images from Moana? - - * Kimball: We don’t have a good version history. But then, backwards - compatibility isn't that much of an issues, since we don't change - the file format very often. - - * Wave: "Would like to be able to say there are 17 AOV’s in that - image." Larry: "I'd would pay so much for anyone at my studio to - use less than 50!" - - * Cary: maybe the project CII badge should include entries for - example data. Project should be encouraged to provide - representative example data. - - * Larry: OSL has a huge shader library, but everything’s - interconnected, nothing public that is representatives of - production use. - - * New features added to the library need corresponding test images. - - * Joseph: None of the compression methods are documented. Could we - get an intern to document them? Not a Google Summer of Code - intern, the project have to involve actual code. But it would be - good to get it standardized. - - * Joseph: Maybe the Academy Sci-Tech intern? Speak to Alex - Forstythe, there have been some great interns with the Academy. - -* Robin Lowe: I’m participating in the discussions on the 16-bit float - type with the C++ standards committee. - - * The C++ proposal is still active. - - * One of the key differences with 16 bit floats is how they do - rounding. C++ allows for severa kinds of rounding. OpenEXR only - does one. We don’t allow the other kinds of rounding. - - * Whatever is in hardware is going to be stamped into standards. - - * Joseph: compatibility with existing code, will it be a templated type? - - * Robin: standard type should be the native type on the - hardware. Or, these are three separate things. - - * OpenEXR is largely compatible with the Nvidia type. - - * Could typedef half to fp16. - - * “Call it half”, be done. - - * Larry: Will a standardized C++ 16-bit float be the same data - layout as our half (what IEEE 754-2008 calls "binary16", and - others call "half", "fp16", or "s10e5")? I imagine that it will, - or that one of several fp16 types will be this one -- it kinda has - to be because it's implemented already in so much hardware, - including NVIDIA, AMD, and Intel chips for quite some time. I - think there are two issues wrapped up here: - - 1. If they do have the same data layout but there is some minor - variation in operational semantics (some subtlety about - rounding modes, etc), should we change our software - implementation to match what other conforming implementations - or hardware do? I think, yes, we should. There is no merit to - doing something that's extremely subtly different from the rest - of the world for what is obviously supposed to be the same data - type. Even if we did the nonstandard thing before the standard - arrived. - - 2. If C++ defines multiple different 16 bit floating-point formats - (e.g., bfloat16) should we extend the OpenEXR file format to - accept pixels of that type? Maybe, it probably depends on how - widely it's adopted, implemented in HW, and whether it's - important to people who use OpenEXR. I know that bfloat16 is - finding favor in ML circles, but I have not investigated - whether it's a good choice for color or other things we tend to - store in images. IIRC, bfloat16 has the full range of float, - but even more limited precision than half. I don't know if it - loses so much precision that it can't represent perceptual JND, - and therefore would be a bad choice for storing color images. - -* Continue C++11 support? - - * Cary: ILM still has code that needs that requires C++11. - - * Kimball: So does Weta. - - * Larry: Then that's it, we maintain compatibility with C++11 for now. - -* Imath PR #72: Eliminate normalize and length methods for Vec - - * Cary: I recommend dropping the wonky integer methods. Better to - have missing functions that functions that do weird things. - - * Larry: This is a part of the bigger thing of trying to put - noexcept on everything. The integer methods throw exceptions, even - the ones that aren't supposed to. - \ No newline at end of file diff --git a/ASWF/tsc-meetings/2021-01-14.md b/ASWF/tsc-meetings/2021-01-14.md deleted file mode 100644 index 91ce23a898..0000000000 --- a/ASWF/tsc-meetings/2021-01-14.md +++ /dev/null @@ -1,147 +0,0 @@ -# 1/14/2021 - -### Attending: - -* Cary Phillips -* Christina Tempelaar-Lietz -* Eskil Steenburg -* John Mertic -* Joseph Goldstone -* Larry Gritz -* Nick Porcino -* Peter Hillman - -### Discussion: - -* New OpenEXR CLA - - * John: next step is for the TSC to approve the form then we will - get it operational in the EasyCLA system. Major organizations can - sign the new CLA. Once that’s happened, we transition the checks - to the new one. The new form (template) is at: - https://github.com/AcademySoftwareFoundation/tac/blob/master/process/ccla_template_aswf2020_v2.1.md - - * Official TSC Vote: in favor: Cary, Christina, Joseph, Larry, Nick, - Peter. None apposed. The new CLA is approved. - -* Imath 1.0: - - * constexpr for half type: - - * Larry: I went partway down this rathole while working on adding - noexcept. Had to back out becasue it got complicated. Much of it - can be done without trouble, but the construct that converts - from float is hard to constexpr, it does too much. And the x86 - intrinsic conversion instructions are good, but none are constexpr. - - * Nick: In the case of bit twiddling, it’s just going to work. We - want intrinsics for runtime. - - * Larry: In numeric_limits, according to C++ standard, they should - be constexpr, but they’re implemented using the float - constructor. We nneed to work around things that rely on the - constructor, probably a way to construct directly from bit - pattern. Just need to figure it out. - - * Larry will give it a stab. - - * Doxygen - - * Cary: working on doxygen comments, will reformat all the - code. Also, I need help from some doxygen experts. - - * Also need to compose a detailed summary of changes - -* Imath PRs: - - * #69 Install error on windows: - - * Adds an option for creating symbolic links, defaults to on for - Linux/Mac, off for Window. - - * Nick: Looks good. - -* OpenEXR PRs: - - * #898 Add support for Bazel - - * OK to support two build systems? - - * Nick: At Oculus, I had to maintain a file that looks like - this. Lots of organizations use it: Google, and Facebook uses a - clone. It’s a service to the community. - - * Larry: the worst case is people blame us when it doesn't work, - and we don't use it. - - * Nick: Maybe it belongs to the Contrib portion of the repo. - - * Peter: Or maybe in an entirely different repo. - - * Every time we add a file or change anything about the build, - we've got to update the Bazel config files. - - * Larry: we should only accept it on the condition the he edit our - CI files, so we’ll know when we break it. It's brittle without a - test. - - * The submitted files had many errors, lots of copy/paste left over - from another project. - - * Conclusion: Cary will respond and inquire more about the - contributor and the commitment of long-term support. - - * #895 exrcheck: make reduced memory/time modes more sensitive - - * Peter: “reduce time” mode is an option to exrcheck to skip over - reading time. It would be nice if it didn’t allocate lots of - memory, but that’s big change. - - * The fuzz execution environment has a small memory limit. - - * This doesn't fix any underlying problem, it just causes the fuzz - test to reject the input without error. - - * #885 Resolve #882 static/shared dual build - - * Nick: big cleanup, eliminates combined build. Also remove the - FLTK stuff; we removed the viewer a while ago but never cleaned - out the dependencies from CMake. - - * Nick: The change is largely mechanical. - - * Nick: The origin of the simultaneous shared/static build? That - was part of the original windows build, complicated by - compile-time header generation. We needed the generator programs - to be statically linked. Now, since the header files are checked - in, we don’t need this anymore. - - * #880 Add optional standard attributes defined in SMPTE ST 2065-4:2013 ("ACES Container File Layout") - - * Joseph: If the name of the attribute doesn’t have a period, it’s - a SMPTE standard. If it has a period, it’s not part of the - standard. - - * Joseph: I’m having a hard time pushing these through the - standards committee. - - * Joseph: So much good work being done on lens distortion now, it - will require more than lens temperature, but it’s premature to - standardize. What's likely to happen: some standards body like - the ASC will put some data in. - - * Joseph: We could include everything from the published 2013 - standards now for 3.0, then add more later when the committee - finishes. I can back out those changes. - - * Joseph: would love to discuss lens distortion. Nick: Contact - Ronald Mallet at Facebook Reality Labs. - - * Larry: 10,000’ question: converting from one image format to - anther, what do you do with the metadata? What happens if names - come from other places? Some correspond to EXIF, others - aren’t. Do we offer advice about which translate and which - don’t. - - * Joseph: I once did an Attribute Concordance. Will find it and - share. I want metadata test signal frames. diff --git a/ASWF/tsc-meetings/2021-01-28.md b/ASWF/tsc-meetings/2021-01-28.md deleted file mode 100644 index 01f7435c0d..0000000000 --- a/ASWF/tsc-meetings/2021-01-28.md +++ /dev/null @@ -1,86 +0,0 @@ -# 1/28/2021 - -### Attending: - -* Cary Phillips -* Christina Tempelaar-Lietz -* Eskil Steenburg -* Joseph Goldstone -* Kimball Thurston -* Larry Gritz -* Nick Porcino -* Peter Hillman -* Simran Spiller - -### Discussion: - - -Weta: Bob the builder. A way of applying changesets. -Larry: Ryan Botriel’s presentation to the CI working group. Sony’s. -Separate libraries? - - -* Half constexpr - - * Larry's PR #82 is the first of two, just cleans up limits. Larry: - a result of going down a rathole adding constexpr everywhere possible. - - * Cary: This changes the value of HALF_MIN. Now that there's - HALF_NRM_MIN and HALF_DENRM_MIN, better to remove HALF_MIN - altogether. - - * Should we look at what the upcoming C++ standard says? No point. - - * The half-to-float and float-to-half conversions can’t be constexpr - because they use the lookup tables. And the arithmetic operators - convert to float, so they can. - - * The intrinsic conversion instructions aren’t constexpr either, for - some reason. - -* Doxygen - - * Cary: Doxygen changes touched every line of every file. - - * The documentation configuration uses Doxygen/Breathe/Sphinx. - - * Work-in-progress readthedocs page: https://cary-ilm-imath.readthedocs.io/en/latest/index.html - - * Larry: Merge the doxygen PR first, I'll then merge the limits PR, - then submit the second PR with the rest of the constexpr changes. - - * Larry: we can finesse it later. - -* Larry: one other Vec change that I'd like to get in: a way of - interpreting any storage block as a Vec2/Vec3/Vec4. - -* Revisit the proposed changes to Vec storage, to use a union and - avoid the &x in the index operator. Should we? Cary: I think it - makes the code hard to read. Kimball: Not really. - -* 3.0 Porting guide: still in progress. - -* Harsh Patel/Apple optimization: Optimization potential for - readChunkOffsetTables for MultiPartInput files: Kimball's core - rewrite makes this obsolete. Improved threading comes with the new core. - -* #885 Resolve #882 static/shared dual build - - * Nick: Working on the CLA, not sure why it isn't working. - -* #880 Add optional standard attributes defined in SMPTE ST 2065-4:2013 - - * Joseph: Arri legal is still considering it, haven't signed off yet. - - * We have deadline to get approval. - -* #877 ImfCompressor: use STATIC_HUFFMAN for tiled DWAB files (fix #344) - - * Peter's new test now tests this. The CI hasn't run on this PR - since the test was added. Let's just merge the PR and fix it if - it breaks. - -* #868 Make the default symbol visibility hidden for unixen builds - - * Kimball will clean it up. - diff --git a/ASWF/tsc-meetings/2021-02-11.md b/ASWF/tsc-meetings/2021-02-11.md deleted file mode 100644 index 293fa24684..0000000000 --- a/ASWF/tsc-meetings/2021-02-11.md +++ /dev/null @@ -1,71 +0,0 @@ -# 1/28/2021 - -### Attending: - -* Cary Phillips -* Christina Tempelaar-Lietz -* Joseph Goldstone -* Kimball Thurston -* Larry Gritz -* Nick Porcino -* Peter Hillman - -### Discussion: - -* Google Summer of Code: - - * Suggestion: PyBind11 for imath and openexr. - - * Rust: Kimball:: I’m doing the C layer so it’s easy to bind - against. The ASWF working group is potentially making tooling to - make it easier to do binding, but the repo will be for us. Might - find a student who’s into rust. - - * Part of Alembic’s bindings uses the PyImath bindings. - - * Would be nice to see first-class python bindings for openexr. - - * ffmpeg exr encoder/decoder use the C layer. But ffmpeg is - super-particular about everything. They want C code. - - * Put GSoC project proposals on a Wiki page - -* Joseph: Have you ever dealt with content that was acquired by a - camera where the view plane is not perpendicular to the viewing - axis? Has consequences for focal distance. Perfect shouldnt’ be the - enemy of the good here? Anyone who does this would know the math - already. - -* Kimball: Nvidia has been playing around with the C branch. - -* 2.5.5 release is ready. - -* #91 Interoperability constructors - - * Larry: Error messages are not helpful. Some people’s vector - classes look like array’s, some are like structs. - -* #909 Add idmanifest attribute support - - * From DigiPro presentation. Has been production tested at Weta. - - * How does it relate to cryptomatte? It’s designed to work with - cryptomattte encoding scheme. Two issues: - - 1. how you put the numbers in the image, - - 2. how you associate names with numbers. - - * Including it in the library would encourage standardizations. - -* #898 Add support for Bazel - - * Agree to accept, expecting @vertexwahn to provide the support. - - * Should make an entry in the CI to build with Bazel. - -* #868 Make the default symbol visibility hidden for unixen builds - - * Kimball: Looked at it, but hadn’t patched it up yet. I’ll do that - this weekend. - diff --git a/ASWF/tsc-meetings/2021-02-25.md b/ASWF/tsc-meetings/2021-02-25.md deleted file mode 100644 index 4325cb1c9b..0000000000 --- a/ASWF/tsc-meetings/2021-02-25.md +++ /dev/null @@ -1,70 +0,0 @@ -# 2/25/2021 - -### Attending: - -* Cary Phillips -* Christina Tempelaar-Lietz -* Joseph Goldstone -* Kimball Thurston -* Larry Gritz -* Nick Porcino -* Peter Hillman - -### Discussion: - -* Larry: sorting out issues with identifying dependencies when you - have more than one version of a library installed on a system. Our - CI doesn't test this case. If OpenEXR is installed in /usr/include - but you want to use another one, it's not getting the -I's in the - right order. - -* Interop constructors: - - * Larry: I have a custom vector class that is already partially - aware of Imath classes that's leading to compilation problems. Can - probably get right of the old conversion constructs. - - * Nick: I just finished stripping out the last Eigen. - - * Larry: would like to test with MaterialX. They’re so far down - their road that we probably can’t convince them to use Imath. But - interop would be nice. - -* CLA's: - - * Christina: Epic is still in progress. - - * Kimball: Weta approval meeting is happening soon. - - * Joseph: No word from ARRI. - -* Symbol visibility: - - * Kimball: GitHub did something weird in rebasing/merging #868. - - * Linux is fine, Windows is fine, but macOS is not because it uses a - different kind of multi-level symbol management. Not just clang, - it’s specific to macOS. - - * Nick: Let's discuss with George ElKoura about what they did for USD. - - * Kimball: We should make the change in Imath. It's the Vec2,3,4 and - Matrix classes that are the real issue. - -* Nick: still tripped up on the Windows install directory problem. If - you specify an install directory, Imath libraries don’t go to the - right place, they try to go to C:\Program FIles (x86)\Imath which is - a cmake-ism for default installations, as opposed to a generally - accepted best practice, in my opinion. - -* Nick: will look at the multiple python bindings. - -* Include path: - - * The modern "correct" thing to do is to #include - but most use of OpenEXR has never done this. - - * But at least the OpenEXR headers have Imf/Imath prefix strings, so - it hasn't been a problem to install them in one directory. - - * Proposed fix: include -I for both include *and* include/OpenEXR. diff --git a/ASWF/tsc-meetings/2021-03-11.md b/ASWF/tsc-meetings/2021-03-11.md deleted file mode 100644 index ba05438247..0000000000 --- a/ASWF/tsc-meetings/2021-03-11.md +++ /dev/null @@ -1,67 +0,0 @@ -# 3/11/2021 - -### Attending: - -* Cary Phillips -* Dan Rolinek -* Joseph Goldstone -* Kimball Thurston -* Larry Gritz -* Nick Porcino -* Peter Hillman - -### Discussion: - -* Symbol visibility: - - * Foundry guy confirms what Chris from Pixar says. - - * Kimball: couple of things: the dynamic cast solution I came up - with really bothers me, but I did it so that the macOS version works. - Fundamental issue is with attributes. - - * Typeinfo that gets cooked into the the library is not the same as - where you use it. GCC is fine because it uses the type name, not - code. I believe we can correctly export those templated types. If - that works. - - * Kimball: I believe I can export the type infos. Same solution - that the foundry guy was proposing, the export macro. Can get rid - of the dynamic_cast stuff. Will work on it this weekend. - - * Should apply to Imath as well. Haven’t gone header-only yet. But - there are no virtuals in Imath. - -* Weta and Epic should have now signed CLA 2.1 ARRI is waiting for - OCIO to change, then they’ll sign both. - -* Joseph: Standard optional attributes: the definitions in there are - less ambiguous than the code today, but the definitions might be - invalidated if I get my way with the SYMPE. Camera position is not - locked won int terms of whether is focul plan or entry point. - Ambiguity is in the comments, not the code, but that’s all there is. - Can we add the code now without the comments. Reserves the keyword, - so people don’t start using them. - - * Larry: could make a wiki page. People would see it regardless of what. - - * Joseph: I’ll identity the ones that will go through with no - fuss. I’ll strip down the PR, then someone else can submit. - -* Nick: CMake install prefix doesn’t get transmitted to Imath. - - * OTIO is replacing OTIO’s math with Imath. Imath config was being - installed into the build directory not the install directory. - - * We’re doing a fairly new thing, CMake external dependency - features, it could be that external dependencies have subtleties - that we need to account for. - -* Fuzz issue is a timeout. Takes the fuzz test more than a minute to - decompress. - -* ThreadPool destruction. Larry: It’s been screwing up OIIO, not 100% - sure what the fix is. Happens every nth time. It’s on shutdown, it’s - not doing anything tricky. Log doesn’t tell you anything, other than - never terminating. - diff --git a/ASWF/tsc-meetings/2021-03-25.md b/ASWF/tsc-meetings/2021-03-25.md deleted file mode 100644 index 82ada20263..0000000000 --- a/ASWF/tsc-meetings/2021-03-25.md +++ /dev/null @@ -1,90 +0,0 @@ -# 3/25/2021 - -### Attending: - -* Cary Phillips -* Christina Tempelaar-Lietz -* Eskill Steenberg -* Joseph Goldstone -* Kimball Thurston -* Larry Gritz -* Nick Porcino -* Serio Roja - -### Discussion: - -* nvcc 10.1 errors on the detector templates in ImathTypeTraits.h. Not - sure what's going on, but #if-ing them out is sufficient. - -* Get final changes in for the 3.0 release over the weekend, then cut - a new beta release, say, Monday. Then let it sit unchanged for - several days until April 1, when that exact code becomes the - release. - -* We need better coordination with the VES committee regarding release - schedules and vendor demands. - -* ImfAttribute symbol warnings: not propagating a setting? Export is - stubbed out for Windows, that may be the issue. Nick will investigate. - -* Setting the tag on Imath that openexr pulls to build. Once Imath 3.0 - is officially released, set the RB-3.0 branch of OpenEXR to pull - from that. But leave openexr/master pulling from Imath/master. That - way, we have some CI pulling on the master branch from another repo. - -* CLA status: Weta and Epic still in progress. - -* "Release” branch: The goal is that the thing called "release" is - always the latest. Have a branch called "release" and update it to - point to the release tag after a release. It's not a branch to merge - into, and doesn't have to be fast-forwarded, just set to the proper - commit. - -* Release notes technique: Larry: I heavily edit. - -* Windows Deadlocking: NickP says it's the hopper, haven’t - forgotten. The person who submitted gave a minimal repo case. It’s - on shutdown. Intermittent and only on Windows. Deadlocks on - shutdown. Possible solution: dllmain? Some users wish OpenEXR didn't - have custom threadpool, just use TBB. - -* Some users keep long-lived cmake caches. We’ve baked the namespaces - into cmake variables but namespaces update on every minor release. - Should the default be a empty string, require setting? - - * Larry: the build/install instructions should be: “Start with 'rm - build'” so there's no chance old cmake caches mess up the build - for users who aren't cmake experts. - - * And CMake 3.13 has -S/-B options: cmake -B my/build/dir -S my/src/dir - -* gh command line tool is your friend. https://cli.github.com/ - -* Joseph: The SMPTE committee working on the 5-year revision of the - ACES Container has taken a careful look at its charter and thinks - the group should limit itself to color-related metadata changes in - their efforts. Back in 2012, when we created the original document, - there was no ASWF, OpenEXR development was effectively dead, and so - we though we were doing something useful by putting in some - VFX-supporting attributes into the ACES Container - specification. That utility was never realized because no one moved - those attributes into the reference implementation, though. - - The PR that I had put in to reconcile the two worlds, implementing - in ImfStandardAttributes.{h, cpp} and the accompanying unit test, - doesn’t make sense now. I do think there is utility in moving SOME - of that stuff into the reference implementation, but I think the - semantics and the names and the interrelationships need to be - defined by VFX professionals. - - Certainly we have a lot of VFX professionals in the OpenEXR TSC, but - many of us are constrained by our employers in what we can say about - useful lens metadata. I have proposed to the VES, in email, the idea - that they do it, or rather, that the executives who form the VES - Technical Committee designate people at their companies who have the - expertise, and that (crucially) they give them permission to speak - up. Not to divulge their most advanced techniques, but to at least - give feedback upon what I propose to move over from the ACES - container spec. They agreed to hear me out, and I am presenting - during their meeting on the 8th, a week and a half from now. - diff --git a/ASWF/tsc-meetings/2021-04-07.md b/ASWF/tsc-meetings/2021-04-07.md deleted file mode 100644 index 74aef3455c..0000000000 --- a/ASWF/tsc-meetings/2021-04-07.md +++ /dev/null @@ -1,119 +0,0 @@ -# 4/7/2021 - -### Attending: - -* Cary Phillips -* Christina Tempelaar-Lietz -* Eskil Steenberg -* Kimball Thurston -* Larry Gritz -* Peter Hillman -* Nick Porcino - -### Discussion: - -* Issue - [#996](https://github.com/AcademySoftwareFoundation/openexr/issues/996) - The exception occurs inside the call: ImfOpenInputFile(). - - * Almost certainly something that's been fixed, the stack trace is - identical to others. It's from OpenEXR v2.3. - -* Issue [#136](https://github.com/AcademySoftwareFoundation/Imath/issues/136) -Cmake targets provide wrong include dirs and libraries. - - * Nick: Most likely user error, it seems to be doing the right thing. - - * Need to confirm that OpenEXR works properly as a subproject. - - * Larry: I'm experiencing something weird with OIIO. OpenEXRConfig.h - is missing, I don’t understand the transitive dependencies. Not - sure what’s going on. But I may have some insight to share. - -* Is LibraryDefine.cmake necessary? - - * Kimball: The CMake book says there should be a config pseudo - library that’s generating the Config.h. - - * LibraryDefine.cmake can probably be removed. Probably a result of - moving everything together in the reorganization. - -* PR - [#995](https://github.com/AcademySoftwareFoundation/openexr/issues/995) -Don't impose C++14 on downstream projects - - * Proposing a change. We compile for c++14 by default, but we make it - impossible for downstream projects to use C++11. - - * Only affects downstream projects that consume OpenEXR/Imath that - wants to use C++11. It was a downstream user of OIIO. - -* CI: - - * Would be useful to have a basic project that consumes OpenEXR, as - a sanity check. - -* 3.1/Core - - * Kimball: done a clean up of the API. May make one more change. I’m - pretty close, basic writing is finished. Writing tests. - - * What is the sequence for integrating this with the C++ side? - - * Can you mix and match? Yes, they’re totally separate. I have - performance tests of reading with each. - - * Want to be able to convert the type from half to float, or have to - include the half-to-float table. - - * Is that necessary in the C API? It’s mean to be lightweight. A lot of - these does-it-under-the hood thing end up being performance - problems. - - * ES: As a C programmer, I’d like that conversion. - - * ffmpeg requires a C api. - - * Nick: Just do this: - - #if __cplusplus__ - struct half_t {} - #else - class half { - ... - - * What about fuzz tests? Peter: we have our own fuzz - test. Imf::checkFile() is the entry point. C API could be added to - that. - -* 3.1 branch? - - * 3.1 would be both API’s but independent of each other. - - * 3.1 -> 3.2 is fine as long as source doesn’t change, but ABI can change. - - * There already is a C API. It’s t2o functions that reads a 4 - channel rgb single part. Too simple to be useful. - -* Weta CLA? Will sort it out. - -* VES discussion at TAC meeting: - - * May is the draft of the reference platform. - - * Sunset guidelines? No hard answers. But they’ll go away and consider it. - - * It puts a burden on the CI. - -* Security: how far back should we support? - - * Should announce a policy change, something like "We will support - 3.1, 3.0, and 2.5. Backport as requested. - - * How hard is it to backport to 2.4? Things have changed, it might - be error prone. - - * New fuzz issues aren't easy to test in 2.4 because that release - doesn't include the test program. - - diff --git a/ASWF/tsc-meetings/2021-04-22.md b/ASWF/tsc-meetings/2021-04-22.md deleted file mode 100644 index d5fc0cc62d..0000000000 --- a/ASWF/tsc-meetings/2021-04-22.md +++ /dev/null @@ -1,118 +0,0 @@ -# 4/7/2021 - -### Attending: - -* Cary Phillips -* Christina Tempelaar-Lietz -* Joseph Goldstone -* Kimball Thurston -* Larry Gritz -* Nick Porcino -* Peter Hillman -* Stela Espindola - -### Discussion: - -Cmake targets provide wrong include dirs and libraries #136 - -* CMake: - - * Kimball: Can we simplify further? I tried to replicate behavior of autoconf. - - * It's already been simplfied, but if anyone can point to any - features that can be removed, please do. - - * Should we backport the CMake setup from 2.5 to 2.4? Nick: It - should be possible. - - * Required version of cmake? Imath PR - [#138](https://github.com/AcademySoftwareFoundation/Imath/pull/138) - suggests setting the minimum at 3.10 instead of 3.12. - - * Kimball: python bindings require 3.12, so technically we could - require 3.12 only if compiling the python bindings. - - * Larry: It’s too complicated to sort out all the scenarios, easier - to just pick a more modern version and require that. - - * Nick: CMP077 improves handling of non-cached variabes and is - necessary to make Vstudio and Xcode liveable. 3.12 is the last bad - version. 3.13 is the first version that enables CMP077. - - * Larry: 3.13 is the first with -B -S - - * Nick: submoduling is becoming more common. - - * Larry: we shouldn’t downgrade and then find a problem and change our minds. - - * Larry: it’s a nothing-burger to install cmake, it shouldn't be a - problem to require anyone a more modern version. - - * Kimball: How to suggest to people to use the standard FindPackage? - Nvidia has a crazy FindOpenEXR for Optix. - -* VFX reference platform: - - * USD is using a new feature of TBB that requires VP 2019. - - * Everybody’s got to compile USD these days. - - * Can we forget about 2017 and 2018? Seems so. - - -* Iex: - - * Kimball: can we combine all of OpenEXR into a single library? - - * Cary: I would consider retiring Iex completely, just have it throw std::exceptions. - - * Larry: Those kind of changes require a lot of work by downstream - projects. Better to be cautious. Changes like that should be at a - 4.0 break. - -* Imath PR [#136](https://github.com/AcademySoftwareFoundation/Imath/pull/136) - - * Nick: The variables that he refers to refer to interface - libraries, but we don’t have transitive inclusions. - - * Peter: He’s looking for the compile flags, but looking for them in - the wrong place. - -* New WIP C Core: - - * KDT: I have most of the C library side of things ready to go. It’s - getting close. Merge to master? - - * Cary: It’s purely additional, doesn't modify existing code, so it - should be fine. But best to make an initial release as a beta. - -* C version of half - - * Kimball: I couldn't help myself. A guy came up with much smaller - version of the half to float conversion. It produces bitwise - identical results to current version, but with a much smaller - lookup table, combined with some shift operations. - - * Nick: have you tried it on godbolt? - - * Peter: You can always construct a test that is slower, if your - test access the lookup table sequentially to avoid cache - thrashing. But on average it may be faster. - - * Go ahead and submit, we can play with it. - -* Kimball: time to start doing the fp16 extensions. - -* Metadata - - * Joseph: The best way to determine which of the camera metadata the - in PR - [#880](https://github.com/AcademySoftwareFoundation/openexr/pull/880) - is to talk to users of it and find out what they want. Usually not - an option because the users aren't available to us, or won’t - talk. Proposal is in, a metadata spreadsheet comparing SMPTE - standard and the current reference standard. ASC definitely wants - to pick this up. We were trying to do everything the ACES - container was trying to do, but we should drop that. We can drop - the problematic ones, only bringin the good ones. - diff --git a/ASWF/tsc-meetings/2021-05-06.md b/ASWF/tsc-meetings/2021-05-06.md deleted file mode 100644 index 0f6e570902..0000000000 --- a/ASWF/tsc-meetings/2021-05-06.md +++ /dev/null @@ -1,136 +0,0 @@ -# 4/7/2021 - -### Attending: - -* Alban Fichet -* Cary Phillips -* Christina Tempelaar-Lietz -* Eskil Steenberg -* Joseph Goldstone -* Kimball Thurston -* Larry Gritz -* Peter Hillman -* Nick Porcino - -### Discussion: - -* Spectral Images: - - * Alban Fichet joined to discuss a method for storing spectral data - in OpenEXR images, described in an openexr-dev discussion post and - an upcoming JCGT publication available here: - - https://drive.google.com/file/d/1qSM7wnhhEGGx6NRIY2KcA3CYbyHj8mNe/view?usp=sharing - - * A convention in CG for spectral rendering. EXR is convenient - standard. It would be helpful if OpenEXR is willing to publicize - it. - - * Peter: Just now reading the email and seeing the pdf. But in - general, it looks good. - - * Would a custom attribute type work better? If the types are - standard, backwards compatibility is easier, but a custom type - could make the API easier to use. - - * An array of floats would be great. But that would require two - arrays of float per spectra. - - * The values are wavelengths and values. - - * Eskil: somebody asked about layer names. ACES has some conventions - (“left eye”, “right eye”). The best naming matches what people are - already using, so it should come from studios. Joseph: we’ve had a - hard time getting even attribute names out of studios. “That’s - our secret sauce” - - * Alban: it's a hierarchy of layers. Typically, RGB plus 8 - additional layers for a typical rendered image. - - * Alban: we want two things: - - * Joseph: should there be accompanying metadata: low end, high end, - and band width? In attribute names, or in metadata? - - * Eskil: you want the response curve. - - * Joseph: remember how we stored chromaticities. Carry around pairs - of floats and have to remember which is which, or a special type. - - * Joseph: if spectral curves were a thing, I would use them in a heartbeat. - - * Need to be clear: either the name defines the frequency or the - metadata defines it. - - * Peter: What happens if you have multiple layers within an - image. A dirt layer and a underlying (macbeth layer and dirt on - top) layer. What happens with a spectral version of each of those - layers? What happens if you’re trying to combine two spectral - images with different spectral channels. You might have layers - that are quite different. Separate layers for ambient and diffuse, - for example. - - * A vote for putting the spectrum names in the layer name. - - - * Peter: your example has spaces in attribute names (“Camera - response”) but typically they don’t so they’ll look like variable - names. - - * ES: I would vote to not have the frequency in the name. - - * Joseph: do we have examples of compound types that consist of - compound types? Not that anyone is aware of. - - * Peter: the ID manifest is an example of complicated data. - - * Peter: it's a good idea to keep the header size small. - - * The attribute itself is a list of spectra so it’s only stored once. - - * Kimball: there is a vector of float. - - * Joseph: there's difference between the reference and in SMPTE - 2064-4 standard. - - * Kimball: - - * Manuka has a model of the spectral response of the camera. - - * We record some aspects in the exr. - - * In terms of exr, we store what camera definition. - - * We’re not storing specific spectral information. - - * We have this range and these nm buckets, maybe 20 buckets within - that, that’s the approximation of the curve. But we don’t output - the accumulation buffers. Nor do we have spectral exrs. - -* 3.1 release - - * Kimball: I’ve redone the half so there’s a C version of - conversion. Added a performance test. Several configuration options. - - * I’ve asked Anders and the rust folks to look at the API. - - * Larry: What scheduling constraints do the two projects have? They - have their tool that produces bindings, but is OpenEXR depending - on them? - - * Should we make a 4th repo for bindings? Does OIIO? Larry: No, all - in one. Nick: OTIO has a separate one. Larry: does the core OTIO - repo trigger the other repo to validate? Nick: No, other way - around. - - * Kimball: should have the main API checked in within the next week. - - * I’m not confident that I’ve written enough tests. I’ve written - attribute tests, but for the file IO I’ve only picked some tests. - Just duplicate the tests? - - * Set July 1 as a beta release target date, then early August for - the official release. - - * Should we set up a wiki page for our roadmap? Yes. - diff --git a/CHANGES.md b/CHANGES.md index 2d1ec9dc01..bee840a417 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,9 @@ + + + # OpenEXR Release Notes +* [Version 3.1.6](#version-316-march-9-2023) March 9, 2023 * [Version 3.1.5](#version-315-april-11-2022) April 11, 2022 * [Version 3.1.4](#version-314-january-26-2022) January 27, 2022 * [Version 3.1.3](#version-313-october-27-2021) October 27, 2021 @@ -56,6 +60,126 @@ * [Version 1.0.1](#version-101) * [Version 1.0](#version-10) +## Version 3.1.6 (March 9, 2023) + +Patch release that address various bug/build issues and optimizations: + +* NEON optimizations for ZIP reading +* Enable fast Huffman & Huffman zig-zag transform for Arm Neon +* Support relative and absolute libdir/incluedir in pkg-config generation +* Fix for reading memory mapped files with DWA compression +* Enable SSE4 support on Windows +* Fast huf decoder +* CMake config for generating docs is now BUILD_DOC + +Also, this release includes a major update and reorganization of the repo +documentation and website. + +In addition, numerous typos and misspellings in comments and doxygen +content have been fixed via +[``codespell``](https://github.com/codespell-project/codespell). + +Specific OSS-fuzz issues address: + +* OSS-fuzz [52730](https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=52730) Heap-buffer-overflow in fasthuf_initialize +* OSS-fuzz [49698](https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=49698) Heap-buffer-overflow in fasthuf_decode +* OSS-fuzz [47517](https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=47517) Integer-overflow in reconstruct_chunk_table +* OSS-fuzz [47503](https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=47503) Heap-buffer-overflow in uncompress_b44_impl +* OSS-fuzz [47483](https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=47483) Heap-buffer-overflow in generic_unpack + +### Merged Pull Requests + +* [1348](https://github.com/AcademySoftwareFoundation/openexr/pull/1348) +NEON optimizations for ZIP reading (reconstruct and interleave) +* [1347](https://github.com/AcademySoftwareFoundation/openexr/pull/1347) +Reduce memory in ``testDeepScanLineBasic`` +* [1346](https://github.com/AcademySoftwareFoundation/openexr/pull/1346) +Add pointers to installing doxygen/sphinx to the build instructions +* [1345](https://github.com/AcademySoftwareFoundation/openexr/pull/1345) +Add execution of the examples to test suite +* [1344](https://github.com/AcademySoftwareFoundation/openexr/pull/1344) +Sphinx warnings by default now cause doc build to fail +* [1343](https://github.com/AcademySoftwareFoundation/openexr/pull/1343) +Removew tmpDir.h from OpenEXRUtilTest/OpenEXRFuzzTest CMakeLists.txt +* [1341](https://github.com/AcademySoftwareFoundation/openexr/pull/1341) +Update PortingGuide.rst +* [1340](https://github.com/AcademySoftwareFoundation/openexr/pull/1340) +Remove duplicate ``tmpDir.h`` files +* [1339](https://github.com/AcademySoftwareFoundation/openexr/pull/1339) +Build docs in CI, and rename ``DOCS`` CMake config variable to ``BUILD_DOCS`` +* [1338](https://github.com/AcademySoftwareFoundation/openexr/pull/1338) +Add header files for IDEs +* [1337](https://github.com/AcademySoftwareFoundation/openexr/pull/1337) +Fix documentation glitches +* [1336](https://github.com/AcademySoftwareFoundation/openexr/pull/1336) +Fix sphinx extensions in conf.py and requirements.txt +* [1335](https://github.com/AcademySoftwareFoundation/openexr/pull/1335) +More doc reorg +* [1333](https://github.com/AcademySoftwareFoundation/openexr/pull/1333) +Fix for reading memory mapped files with DWA compression +* [1332](https://github.com/AcademySoftwareFoundation/openexr/pull/1332) +Reorganize repo/readthedocs documentation +* [1331](https://github.com/AcademySoftwareFoundation/openexr/pull/1331) +Add missing license/copyright +* [1330](https://github.com/AcademySoftwareFoundation/openexr/pull/1330) +Support relative and absolute libdir/incluedir in pkg-config generation +* [1329](https://github.com/AcademySoftwareFoundation/openexr/pull/1329) +Fix missing guard check +* [1323](https://github.com/AcademySoftwareFoundation/openexr/pull/1323) +Enable fast Huffman & Huffman zig-zag transform for Arm Neon +* [1321](https://github.com/AcademySoftwareFoundation/openexr/pull/1321) +Fix MSVC Debug build with internal zlib +* [1317](https://github.com/AcademySoftwareFoundation/openexr/pull/1317) +Add CIFuzz GitHub action +* [1316](https://github.com/AcademySoftwareFoundation/openexr/pull/1316) +Fix compiler warnings from gcc-12 +* [1315](https://github.com/AcademySoftwareFoundation/openexr/pull/1315) +Fix Visual Studio on ARM Compilation +* [1312](https://github.com/AcademySoftwareFoundation/openexr/pull/1312) +Problem: warning C4244: initializing: conversion from double to unsigned int, possible loss of data +* [1311](https://github.com/AcademySoftwareFoundation/openexr/pull/1311) +Clean up CONTRIBUTING.md +* [1296](https://github.com/AcademySoftwareFoundation/openexr/pull/1296) +Check for null pointer passed to ``memcpy`` +* [1295](https://github.com/AcademySoftwareFoundation/openexr/pull/1295) +Remove TSC meeting notes from repo +* [1294](https://github.com/AcademySoftwareFoundation/openexr/pull/1294) +Change reference to ``IlmBase`` to ``Imath`` in ``README.md +*`` [1293](https://github.com/AcademySoftwareFoundation/openexr/pull/1293) +Update Christina's affiliation +* [1292](https://github.com/AcademySoftwareFoundation/openexr/pull/1292) +Fix typo in the documentation's example reading class +* [1290](https://github.com/AcademySoftwareFoundation/openexr/pull/1290) +fix huf memory boundary checks +* [1289](https://github.com/AcademySoftwareFoundation/openexr/pull/1289) +Fix a typo breaking the link to ``Imath`` repository in readme +* [1287](https://github.com/AcademySoftwareFoundation/openexr/pull/1287) +Using ``PRId64`` in place of ``%ld`` in ``chunk.c`` +* [1286](https://github.com/AcademySoftwareFoundation/openexr/pull/1286) +Fix NDK compile error +* [1279](https://github.com/AcademySoftwareFoundation/openexr/pull/1279) +Fix for IDE Headers +* [1276](https://github.com/AcademySoftwareFoundation/openexr/pull/1276) +add missed ``#include `` statement +* [1274](https://github.com/AcademySoftwareFoundation/openexr/pull/1274) +Enable SSE4 support on Windows #2 +* [1272](https://github.com/AcademySoftwareFoundation/openexr/pull/1272) +Fix remaining typos +* [1271](https://github.com/AcademySoftwareFoundation/openexr/pull/1271) +Fix typos in ``src/lib/OpenEXR`` +* [1269](https://github.com/AcademySoftwareFoundation/openexr/pull/1269) +Add fast huf decoder +* [1268](https://github.com/AcademySoftwareFoundation/openexr/pull/1268) +Address OSS Fuzz Issues +* [1264](https://github.com/AcademySoftwareFoundation/openexr/pull/1264) +Add missing 11#include `` required by gcc-13 +* [1261](https://github.com/AcademySoftwareFoundation/openexr/pull/1261) +prevent integer overflow in ``DeepScanlineInputFile`` with huge images +* [1260](https://github.com/AcademySoftwareFoundation/openexr/pull/1260) +prevent integer overflow of lineOffsetSize +* [1259](https://github.com/AcademySoftwareFoundation/openexr/pull/1259) +Add explicit casts around the usage of zlib datatypes to avoid warnings on Windows + ## Version 3.1.5 (April 11, 2022) Patch release that address various bug/build/doc issues: @@ -80,7 +204,7 @@ Integer-overflow in internal_exr_compute_chunk_offset_size * OSS-fuzz [44084](https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=44084) Out-of-memory in openexr_exrcheck_fuzzer -Merged Pull Requests: +### Merged Pull Requests * [1251](https://github.cmo/AcademySoftwareFoundation/openexr/pull/1251) Add disable reconstruct flag @@ -147,7 +271,7 @@ Specific OSS-fuzz issues: * OSS-fuzz [40231](https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=40231) Heap-buffer-overflow in hufDecode * OSS-fuzz [40091](https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=40091) Heap-buffer-overflow in hufDecode -Merged Pull Requests: +### Merged Pull Requests * [1225](https://github.com/AcademySoftwareFoundation/openexr/pull/1225) Bazel build: Update Imath @@ -286,7 +410,8 @@ Specific OSS-fuzz issues: * OSS-fuzz [39323](https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=39323) Integer-overflow in Imf_3_1::readCoreTiledPart -Merged Pull Requests: +### Merged Pull Requests + * [1187](https://github.com/AcademySoftwareFoundation/openexr/pull/1187) Add size check to memory stream check program * [1186](https://github.com/AcademySoftwareFoundation/openexr/pull/1186) @@ -370,7 +495,7 @@ Specific OSS-fuzz issues: * OSS-fuzz [39084](https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=39084) Divide-by-zero in Imf_3_1::RGBtoXYZ -Merged Pull Requests: +### Merged Pull Requests * [1159](https://github.com/AcademySoftwareFoundation/openexr/pull/1159) Fix unterminated string causing issue with print @@ -435,7 +560,7 @@ Patch release that fixes build failures on various systems, introduces CMake ``CMAKE_CROSSCOMPILING_EMULATOR`` support, and fixes a few other minor issues. -Merged Pull Requests: +### Merged Pull Requests * [1117](https://github.com/AcademySoftwareFoundation/openexr/pull/1117) Improve handling of ``#include <*intrin.h>`` @@ -524,7 +649,7 @@ Limitations: particular chunk is corrupt, this is handled such that the other chunks may be read without rendering the context unusable -Merged Pull Requests: +### Merged Pull Requests * [1097](https://github.com/AcademySoftwareFoundation/openexr/pull/1097) Include exported OpenEXR headers with "" instead of <> * [1092](https://github.com/AcademySoftwareFoundation/openexr/pull/1092) Document current standard optional attributes @@ -584,7 +709,7 @@ Specific OSS-fuzz issues: * OSS-fuzz [33741](https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=33741) Integer-overflow in Imf_3_0::getScanlineChunkOffsetTableSize * OSS-fuzz [32620](https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=32620) Out-of-memory in openexr_exrcheck_fuzzer -Merged Pull Requests: +### Merged Pull Requests * [1015](https://github.com/AcademySoftwareFoundation/openexr/pull/1015) Improvements for Bazel build support * [1011](https://github.com/AcademySoftwareFoundation/openexr/pull/1011) Restore fix to macOS universal 2 build lost from #854 @@ -654,7 +779,7 @@ Beta patch release: * OSS-fuzz [32067](https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=32067) Out-of-memory in openexr_exrcheck_fuzzer ([966](https://github.com/AcademySoftwareFoundation/openexr/pull/966)) * OSS-fuzz [31172](https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=31172) Timeout in openexr_exrcheck_fuzzer ([987](https://github.com/AcademySoftwareFoundation/openexr/pull/987)) -Merged Pull Requests: +### Merged Pull Requests * [989](https://github.com/AcademySoftwareFoundation/openexr/pull/989) Release notes for 3.0.1-beta * [988](https://github.com/AcademySoftwareFoundation/openexr/pull/988) Remove deprecated argument to getChunkOffsetTableSize() diff --git a/CMakeLists.txt b/CMakeLists.txt index 58546ddb5b..3bf174fa9e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,7 +19,7 @@ endif() # configuration files ####################################### -project(OpenEXR VERSION 3.1.5 LANGUAGES C CXX) +project(OpenEXR VERSION 3.1.6 LANGUAGES C CXX) set(OPENEXR_VERSION_RELEASE_TYPE "" CACHE STRING "Extra version tag string for OpenEXR build, such as -dev, -beta1, etc.") @@ -30,7 +30,7 @@ set(OPENEXR_VERSION_API "${OpenEXR_VERSION_MAJOR}_${OpenEXR_VERSION_MINOR}") # See https://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html # # Library API version (CMake's library VERSION attribute) is of the -# form CURRENT.REVISION.AGE; the CMake SOVERSION attribute corresonds +# form CURRENT.REVISION.AGE; the CMake SOVERSION attribute corresponds # to just CURRENT. These produce a .so and a symlink symlink, e.g.: # libOpenEXR-3_1.so.29 -> libOpenEXR-3_1.so.29.0.0 # ^ ^ ^ ^ @@ -44,7 +44,7 @@ set(OPENEXR_VERSION_API "${OpenEXR_VERSION_MAJOR}_${OpenEXR_VERSION_MINOR}") # 3. API changed: CURRENT+1.0.0 # set(OPENEXR_LIBTOOL_CURRENT 30) -set(OPENEXR_LIBTOOL_REVISION 5) +set(OPENEXR_LIBTOOL_REVISION 6) set(OPENEXR_LIBTOOL_AGE 1) set(OPENEXR_LIB_VERSION "${OPENEXR_LIBTOOL_CURRENT}.${OPENEXR_LIBTOOL_REVISION}.${OPENEXR_LIBTOOL_AGE}") set(OPENEXR_LIB_SOVERSION ${OPENEXR_LIBTOOL_CURRENT}) @@ -71,11 +71,16 @@ message(STATUS "Configure ${OPENEXR_PACKAGE_NAME}, library API version: ${OPENEX # Add all source in subdirectories ####################################### +if(BUILD_TESTING AND NOT OPENEXR_IS_SUBPROJECT) + # Enable testing *before* adding any subdirectories that may include tests + enable_testing() +endif() + # Include these two modules without enable/disable options add_subdirectory(src/lib) add_subdirectory(src/bin) -# Tell CMake where to find the OpenEXRConfig.cmake file. Makes it posible to call +# Tell CMake where to find the OpenEXRConfig.cmake file. Makes it possible to call # find_package(OpenEXR) in downstream projects set(OpenEXR_DIR "${CMAKE_CURRENT_BINARY_DIR}/cmake" CACHE PATH "" FORCE) # Add an empty OpenEXRTargets.cmake file for the config to use. @@ -112,7 +117,6 @@ endif() include(CTest) if(BUILD_TESTING AND NOT OPENEXR_IS_SUBPROJECT) - enable_testing() add_subdirectory(src/test) endif() @@ -122,8 +126,8 @@ if(NOT OPENEXR_IS_SUBPROJECT) include(cmake/clang-format.cmake) endif() -option(DOCS "Set ON to build html documentation") -if (DOCS AND NOT OPENEXR_IS_SUBPROJECT) +option(BUILD_DOCS "Set ON to build html documentation") +if (BUILD_DOCS AND NOT OPENEXR_IS_SUBPROJECT) option(INSTALL_DOCS "Set ON to install html documentation" ON) add_subdirectory(docs) endif() diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 160ef4cbe6..33b4e37762 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -1,3 +1,6 @@ + + + # Code of Conduct The OpenEXR project abides by Linux Foundation's code of conduct, diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2d5a712fb6..d9b8d27989 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,3 +1,6 @@ + + + # Contributing to OpenEXR Thank you for your interest in contributing to OpenEXR. This document @@ -12,11 +15,11 @@ explains our contribution process and procedures: For a description of the roles and responsibilities of the various members of the OpenEXR community, see [GOVERNANCE](GOVERNANCE.md), and -for further details, see the project's [Technical +for further details, see the OpenEXR project's [Technical Charter](ASWF/charter/OpenEXR-Technical-Charter.md). Briefly, -Contributors are anyone who submits content to the project, Committers -review and approve such submissions, and the Technical Steering -Committee provides general project oversight. +a "contributor" is anyone who submits content to the project, a +"committer" reviews and approves such submissions, and the "Technical +Steering Committee" provides general project oversight and governance. ## Getting Information @@ -64,7 +67,7 @@ among the project community. ### How to Report a Security Vulnerability If you think you've found a potential vulnerability in OpenEXR, please -refer to [SECURITY.md] to responsibly disclose it. +refer to [SECURITY.md](SECURITY.md) to responsibly disclose it. ### How to Contribute a Bug Fix or Change @@ -76,7 +79,7 @@ To contribute code to the project, first read over the [GOVERNANCE](GOVERNANCE.m * An understanding of the project's development workflow. -* Legal authorization, that is, you need to have signed a Contributor +* Legal authorization, that is, you need to have signed a contributor License Agreement. See below for details. ## Legal Requirements @@ -121,7 +124,7 @@ comments. Click that link to sign the form. The downloadable PDF's on the EasyCLA page are provided for reference only. To execute the signature, sign the form online through the -releveant links. +relevant links. The OpenEXR CLAs are the standard forms used by Linux Foundation projects and [recommended by the ASWF @@ -163,10 +166,10 @@ contributions should be done on top of it. After sufficient work is done on the master branch and the OpenEXR leadership determines that a release is due, we will bump the relevant internal versioning and tag a commit with the corresponding version -number, e.g. v2.0.1. Each Minor version also has its own “Release +number, e.g. v2.0.1. Each minor version also has its own “Release Branch”, e.g. RB-1.1. This marks a branch of code dedicated to that -Major.Minor version, which allows upstream bug fixes to be -cherry-picked to a given version while still allowing the master +``major.minor version``, which allows upstream bug fixes to be +cherry-picked to a given version while still allowing the ``main`` branch to continue forward onto higher versions. This basic repository structure keeps maintenance low, while remaining simple to understand. @@ -225,13 +228,13 @@ with a separate pull request. 4. Create a Github pull request from your topic branch. -5. Pull requests will be reviewed by project Committers and Contributors, +5. Pull requests will be reviewed by project committers and contributors, who may discuss, offer constructive feedback, request changes, or approve the work. -6. Upon receiving the required number of Committer approvals (as -outlined in [Required Approvals](#required-approvals)), a Committer -other than the PR contributor may merge changes into the master +6. Upon receiving the required number of committer approvals (as +outlined in [Required Approvals](#required-approvals)), a committer +other than the PR contributor may merge changes into the ``main`` branch. ### Code Review and Required Approvals @@ -239,9 +242,9 @@ branch. Modifications of the contents of the OpenEXR repository are made on a collaborative basis. Anyone with a GitHub account may propose a modification via pull request and it will be considered by the project -Committers. +committers. -Pull requests must meet a minimum number of Committer approvals prior +Pull requests must meet a minimum number of committer approvals prior to being merged. Rather than having a hard rule for all PRs, the requirement is based on the complexity and risk of the proposed changes, factoring in the length of time the PR has been open to @@ -250,41 +253,42 @@ approval rules for merging: * Core design decisions, large new features, or anything that might be perceived as changing the overall direction of the project should be -discussed at length in the mail list before any PR is submitted, in -order to: solicit feedback, try to get as much consensus as possible, -and alert all the stakeholders to be on the lookout for the eventual -PR when it appears. +discussed at length in the mail list or TSC meetings before any PR is +submitted, in order to solicit feedback, try to get as much consensus +as possible, and alert all the stakeholders to be on the lookout for +the eventual PR when it appears. -* Small changes (bug fixes, docs, tests, cleanups) can be approved and -merged by a single Committer. +* Trivial changes that don't affect functionality (typos, docs, tests) +can be approved by the committer without review, after waiting at +least 48 hours. * Big changes that can alter behavior, add major features, or present -a high degree of risk should be signed off by TWO Committers, ideally +a high degree of risk should be signed off by TWO committers, ideally one of whom should be the "owner" for that section of the codebase (if a specific owner has been designated). If the person submitting the PR is him/herself the "owner" of that section of the codebase, then only -one additional Committer approval is sufficient. But in either case, a +one additional committer approval is sufficient. But in either case, a 48 hour minimum is helpful to give everybody a chance to see it, unless it's a critical emergency fix (which would probably put it in the previous "small fix" category, rather than a "big feature"). * Escape valve: big changes can nonetheless be merged by a single -Committer if the PR has been open for over two weeks without any -unaddressed objections from other Committers. At some point, we have +committer if the PR has been open for over two weeks without any +unaddressed objections from other committers. At some point, we have to assume that the people who know and care are monitoring the PRs and that an extended period without objections is really assent. -Approval must be from Committers who are not authors of the change. If -one or more Committers oppose a proposed change, then the change +Approval must be from committers who are not authors of the change. If +one or more committers oppose a proposed change, then the change cannot be accepted unless: -* Discussions and/or additional changes result in no Committers -objecting to the change. Previously-objecting Committers do not +* Discussions and/or additional changes result in no committers +objecting to the change. Previously-objecting committers do not necessarily have to sign-off on the change, but they should not be opposed to it. * The change is escalated to the TSC and the TSC votes to approve the -change. This should only happen if disagreements between Committers +change. This should only happen if disagreements between committers cannot be resolved through discussion. Committers may opt to elevate significant or controversial @@ -295,78 +299,33 @@ required. ### Test Policy All functionality in the library must be covered by an automated -test. Each library has a companion ``Test`` project - ``ImathTest``, -``HalfTest``, ``OpenEXRTest`, etc. This test suite is collectively +test. Each library has a companion ``Test`` project, e.g. ``OpenEXRTest``, +``OpenEXRCoreTest``, ``OpenEXRUtilTest``, etc. This test suite is collectively expected to validate the behavior of very part of the library. -* Any new functionality should be accompanied by a test that validates +* All new functionality should be accompanied by a test that validates its behavior. * Any change to existing functionality should have tests added if they don't already exist. -The test should should be run, via ``make check``, before submitting a -pull request. +The test should should be run, via: + + make test + +before submitting a pull request. In addition, the ``OpenEXRFuzzTest`` project validates the library by feeding it corrupted input data. This test is time-consuming (possible over 24 hours), so it will only be run occasionally, but it must succeed before a release is made. -### Project Issue Handling Process - -Incoming new issues are labeled promptly by the TSC using GitHub labels. - -The labels include: - -* **Autotools** - A problem with the autoconf configuration setup. - -* **Bug** - A bug in the source code. Something appears to be - functioning improperly: a compile error, a crash, unexpected behavior, etc. - -* **Build/Install Issue** - A problem with building or installing the - library: configuration file, external dependency, a compile error - with a release version that prevents installation. - -* **C++** - A C++ compilation issue: a compiler warning, syntax issue, - or language usage or suggested upgrade. - -* **CMake** - A build issue with the CMake configuration files. - -* **CVE** - A security vulnerability bug. - -* **Documentation** - The project documentation: developer or user - guide, web site, project policies, etc. - -* **Feature Request** - A suggested change or addition of - functionality to the library. - -* **Mac OS** - A build issue specific to Mac OS. - -* **MinGW** - An issue specific to MinGW - -* **Modification** - A modification to the code, refactoring or - optimization without significant additional behavior - -* **Needs Info** - Issue is waiting for more information from the - submitter. - -* **Question/Problem/Help** - A request for help or further - investigation, possibly just user error or misunderstanding. - -* **Test Failure** - One of the automated tests is failing, or an - analysis tool is reporting problematic behavior. - -* **TSC** - To be discussed in the technical steering committee. - -* **Windows** - A build issue specific to Windows - -* **Won't Fix** - No further action will taken. - ## Coding Style #### Formatting +The coding style of the library source code is enforced via Clang format, with the configuration defined in [.clang-format](.clang-format). + When modifying existing code, follow the surrounding formatting conventions so that new or modified code blends in with the current code. @@ -426,7 +385,7 @@ All headers should contain: Because OpenEXR must deal properly with large images, whose width and/or height approach the maximum allowable in 32-bit signed -integers, take special care that integer arithmatic doesn't overlow, +integers, take special care that integer arithmetic doesn't overflow, and make it as clear as possible exactly what the code is doing, especially in the edge cases. @@ -440,7 +399,7 @@ To clarify the intention, prefer to cast between types using x = (size_t) y; x = size_t (y); -Prefer to use ``std::numeric_limits<>`` instead of preprocesser +Prefer to use ``std::numeric_limits<>`` instead of preprocessor define's such as ``INT_MAX``: // good: @@ -487,11 +446,11 @@ For public APIs, use Doxygen-style comments (start with `///`), such as: ## Versioning Policy OpenEXR uses [semantic versioning](https://semver.org), which labels -each version with three numbers: Major.Minor.Patch, where: +each version with three numbers: ``major.minor.patch``, where: -* **MAJOR** indicates incompatible API changes -* **MINOR** indicates functionality added in a backwards-compatible manner -* **PATCH** indicates backwards-compatible bug fixes +* ``major`` - indicates incompatible API changes +* ``minor`` - indicates functionality added in a backwards-compatible manner +* ``patch`` - indicates backwards-compatible bug fixes ## Creating a Release @@ -503,21 +462,9 @@ To create a new release from the master branch: improvements. Include the summary in ``CHANGES.md`` and also in the Release comments. - Include the log of all changes since the last release, via: - - git log v2.2.1...v2.3.0 --date=short --pretty=format:"[%s](https://github.com/AcademySoftwareFoundation/openexr/commit/%H) ([%an](@%ae) %ad)" + Include the log of all PR's included beyond the previous release. - Include diff status via: - - git diff --stat v2.2.1 - 2. Create a new release on the GitHub Releases page. -3. Tag the release with name beginning with '``v``', e.g. '``v2.3.0``'. - -4. Download and sign the release tarball, as described -[here](https://wiki.debian.org/Creating%20signed%20GitHub%20releases), +3. Tag the release with name beginning with ``v``', e.g. ``v2.3.0``. -5. Attach the detached ``.asc`` signature file to the GitHub release as a -binary file. - diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index cb3db9d9c9..9fde40b23f 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -1,3 +1,6 @@ + + + This is a list of contributors to the OpenEXR project, sorted alphabetically by first name. @@ -51,6 +54,7 @@ If you know of missing, please email: info@openexr.com. * Paul Schneider * Peter Hillman * Peter Steneteg +* Phil Barrett * Piotr Stanczyk * Ralph Potter * Reto Kromer diff --git a/Contrib/DtexToExr/PxDeepUtils.h b/Contrib/DtexToExr/PxDeepUtils.h index 62d90f2c29..b4d09da3f3 100644 --- a/Contrib/DtexToExr/PxDeepUtils.h +++ b/Contrib/DtexToExr/PxDeepUtils.h @@ -277,7 +277,7 @@ inline bool IsInfinity( T i_f ) } //-***************************************************************************** -// A zero-nan functon, which actually zeros inf as well. +// A zero-nan function, which actually zeros inf as well. template inline T ZeroNAN( T i_f ) { diff --git a/Contrib/DtexToExr/m4/compilelinkrun.m4 b/Contrib/DtexToExr/m4/compilelinkrun.m4 index 5080523126..04832ba652 100644 --- a/Contrib/DtexToExr/m4/compilelinkrun.m4 +++ b/Contrib/DtexToExr/m4/compilelinkrun.m4 @@ -26,10 +26,10 @@ dnl $6: body section of sourcecode for a c++ test program dnl The test program should make use of a library that is supposed to dnl be tested. dnl -dnl $7: the action to be perfomed if the test succeeds +dnl $7: the action to be performed if the test succeeds dnl (e.g. AC_MSG_RESULT("OpenEXR test program succeeded")) dnl -dnl $8 the action to be perfomed if the test fails +dnl $8 the action to be performed if the test fails dnl (e.g. AC_MSG_ERROR("OpenEXR test program failed")) dnl diff --git a/Contrib/DtexToExr/m4/path.pkgconfig.m4 b/Contrib/DtexToExr/m4/path.pkgconfig.m4 index b677299bca..0c6d1e7b98 100644 --- a/Contrib/DtexToExr/m4/path.pkgconfig.m4 +++ b/Contrib/DtexToExr/m4/path.pkgconfig.m4 @@ -7,7 +7,7 @@ AC_DEFUN([AM_PATH_PKGCONFIG], [ dnl sets cflags and ldflags -dnl TEST_CXXFLAGS and TEST_LDFLAGS, by trying thes following +dnl TEST_CXXFLAGS and TEST_LDFLAGS, by trying the following dnl until something works: dnl dnl 1 - try the test_prefix @@ -21,14 +21,14 @@ dnl $1: arg_cxxflags - CXXFLAGS variable to set dnl dnl $2: arg-ldflags - LDFLAGS variable to set dnl -dnl $3: package name (the package being checked), as requried by pkg-config +dnl $3: package name (the package being checked), as required by pkg-config dnl dnl $4: arg_include_subdir dnl the name of the subdirectory name that is tacked on to dnl the end of the include path e.g. "OpenEXR" in dnl /usr/local/include/OpenEXR dnl -dnl $5: arg_default_libs - default libraries, used if pkgconfig doesnt work +dnl $5: arg_default_libs - default libraries, used if pkgconfig doesn't work dnl dnl $6: arg_test_prefix dnl the argument passed to configure specifying a directory to diff --git a/GOVERNANCE.md b/GOVERNANCE.md index b2711498ad..d985eff038 100644 --- a/GOVERNANCE.md +++ b/GOVERNANCE.md @@ -1,11 +1,14 @@ + + + # OpenEXR Project Roles and Responsibilities OpenEXR is a project of the Academy Software Foundation and relies on the ASWF governance policies, supported by the Linux Foundation. -There are three primary project roles: Contributors submit code to the -project; Committers approve code to be included into the project; and -the Technical Steering Committee (TSC) provides overall high-level +There are three primary project roles: a "contributor" submits code to the +project; a "committer" approves code to be included into the project; and +the "Technical Steering Committee" (TSC) provides overall high-level project guidance. * [Contributors](#Contributors) @@ -15,12 +18,12 @@ project guidance. ## Contributors The OpenEXR project grows and thrives from assistance from -Contributors. Contributors include anyone in the community that -submits code, documentation, or other technical artifacts to the +contributors. A contributor is anyone in the community who submits +code, bug fixes, documentation, or other technical artifacts to the project. However, such contributions must be approved by a project -Committer before they become a part of the project. +committer before they become a part of the project. -Anyone can be a Contributor. You need no formal approval from the +Anyone can be a contributor. You need no formal approval from the project, beyond the legal forms. ### How to Become a Contributor @@ -34,12 +37,12 @@ project, beyond the legal forms. ## Committers -Project Committers have merge access on the OpenEXR GitHub repository -and are responsible for approving submissions by Contributors. +Project committers have merge access on the OpenEXR GitHub repositories +and are responsible for approving submissions by contributors. ### Committer Responsibilities -Typical activities of a Committer include: +Typical activities of a committer include: * Helping users and novice contributors. @@ -54,17 +57,17 @@ Typical activities of a Committer include: * Ensuring that changes and new code meet acceptable standards and are in the long-term interest of the project. -* Participation in working groups. +* Participating in working groups. * Merging pull requests. ### How to Become a Committer -Any existing Committer can nominate an individual making significant +Any existing committer can nominate an individual making significant and valuable contributions to the OpenEXR project to become a new -Committer. New committers are approved by vote of the TSC. +committer. New committers are approved by vote of the TSC. -If you are interested in becomming a Committer, contact the TSC at +If you are interested in becoming a committer, contact the TSC at info@openexr.com. ## Technical Steering Committee @@ -82,7 +85,7 @@ The responsibilities of the TSC include: * GitHub repository administration. -* Maintaining the list of additional Committers. +* Maintaining the list of additional committers. * Appointing representatives to work with other open source or open standards communities. @@ -109,7 +112,7 @@ represents the project at ASWF TAC meetings. * Peter Hillman - Weta Digital, Ltd. * Kimball Thurston - Weta Digital, Ltd. * Nick Porcino - Pixar Animation Studios -* Christina Tempelaar-Lietz - Epic Games +* Christina Tempelaar-Lietz - Industrial Light & Magic * Joseph Goldstone - ARRI * John Mertic - The Linux Foundation @@ -118,8 +121,8 @@ represents the project at ASWF TAC meetings. All meetings of the TSC are open to participation by any member of the OpenEXR community. Meeting times are listed in the [ASWF technical community calendar](https://lists.aswf.io/g/tac/calendar), currently -each Thursday at 1pm Pacific Time via Zoom video conference. The TSC -Chair moderates the meeting, or appoints another TSC member to +each Thursday at 1:30pm Pacific Time via Zoom video conference. The +TSC Chair moderates the meeting, or appoints another TSC member to moderate in his or her absence. Items are added to the TSC agenda which are considered contentious or @@ -129,10 +132,10 @@ technical direction of the project. The intention of the agenda is not to approve or review all patches. That should happen continuously on GitHub and be handled by -the larger group of Committers. +the larger group of committers. -Any community member or Contributor can ask that something be reviewed -by the TSC at the meeting by logging a GitHub issue. Any Committer, +Any community member or contributor can ask that something be reviewed +by the TSC at the meeting by logging a GitHub issue. Any committer, TSC member, or the meeting chair can bring the issue to the TSC's attention by applying the `TSC` label. diff --git a/LICENSE.md b/LICENSE.md index b2a016ed19..0443514b78 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,3 +1,6 @@ + + + Copyright (c) Contributors to the OpenEXR Project. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: diff --git a/README.md b/README.md index 9b440a729b..5e35846266 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,6 @@ + + + [![License](https://img.shields.io/github/license/AcademySoftwareFoundation/openexr)](LICENSE.md) [![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/2799/badge)](https://bestpractices.coreinfrastructure.org/projects/2799) [![Build Status](https://github.com/AcademySoftwareFoundation/openexr/workflows/CI/badge.svg)](https://github.com/AcademySoftwareFoundation/openexr/actions?query=workflow%3ACI) @@ -6,7 +9,7 @@ # OpenEXR - + OpenEXR provides the specification and reference implementation of the EXR file format, the professional-grade image storage format of the @@ -20,103 +23,7 @@ OpenEXR is widely used in host application software where accuracy is critical, such as photorealistic rendering, texture access, image compositing, deep compositing, and DI. -### About OpenEXR - -OpenEXR is a project of the [Academy Software -Foundation](https://www.aswf.io). The format and library were -originally developed by Industrial Light & Magic and first released -in 2003. Weta Digital, Walt Disney Animation Studios, Sony Pictures -Imageworks, Pixar Animation Studios, DreamWorks, and other studios, -companies, and individuals have made contributions to the code base. - -OpenEXR is included in the [VFX Reference -Platform](https://vfxplatform.com). - -### OpenEXR Features - -* High dynamic range and color precision. -* Support for 16-bit floating-point, 32-bit floating-point, and - 32-bit integer pixels. -* Multiple image compression algorithms, both lossless and lossy. Some of - the included codecs can achieve 2:1 lossless compression ratios on images - with film grain. The lossy codecs have been tuned for visual quality and - decoding performance. -* Extensibility. New compression codecs and image types can easily be added - by extending the C++ classes included in the OpenEXR software distribution. - New image attributes (strings, vectors, integers, etc.) can be added to - OpenEXR image headers without affecting backward compatibility with - existing OpenEXR applications. -* Support for stereoscopic image workflows and a generalization - to multi-views. -* Flexible support for deep data: pixels can store a variable-length list - of samples and, thus, it is possible to store multiple values at different - depths for each pixel. Hard surfaces and volumetric data representations - are accommodated. -* Multipart: ability to encode separate, but related, images in one file. - This allows for access to individual parts without the need to read other - parts in the file. -* Versioning: OpenEXR source allows for user configurable C++ - namespaces to provide protection when using multiple versions of the - library in the same process space. - -### OpenEXR and Imath Version 3 - -With the release of OpenEXR 3, the Imath library formerly distributed -via the IlmBase component of OpenEXR is now an independent library -dependency, available for download from https:://github.com/AcademySoftwareFoundation/Imath. -You can choose to build OpenEXR against an external installation of -Imath, or the default CMake configuration will download and build it -automatically during the OpenEXR build process. Note that the half -16-bit floating point data type is included in Imath. - -See the [porting -guide](https://github.com/AcademySoftwareFoundation/Imath/blob/master/docs/PortingGuide2-3.md) -for details about differences from previous releases and how to -address them. Also refer to the porting guide for details about -changes to Imath. - -#### New Features in OpenEXR v3.1 - -The 3.1 release of OpenEXR introduces a new library, OpenEXRCore, -which is the result of a significant re-thinking of how OpenEXR -manages file I/O and provides access to image data. It begins to -address long-standing scalability issues with multithreaded image -reading and writing. - -The OpenEXRCore library provides thread-safe, non-blocking access to -files, which was not possible with the current API, where the -framebuffer management is separate from read requests. It is written -entirely in C and provides a new C-language API alongside the existing -C++ API. This new low-level API allows applications to do custom -unpacking of EXR data, such as on the GPU, while still benefiting from -efficient I/O, file validation, and other semantics. It provides -efficient direct access to EXR files in texturing applications. This C -library also introduces an easier path to implementing OpenEXR -bindings in other languages, such as Rust. - -The 3.1 release represents a technology preview for upcoming -releases. The initial release is incremental; the existing API and -underlying behavior has not changed. The new API is available now for -performance validation testing, and then in future OpenEXR releases, -the C++ API will migrate to use the new core in stages. It is not the -intention to entirely deprecate the C++ API, nor must all applications -re-implement EXR I/O in terms of the C library. The C API does not, -and will not, provide the rich set of utility classes that exist in -the C++ layer. The 3.1 release of the OpenEXRCore library simply -offers new functionality for specialty applications seeking the -highest possible performance. In the future, the ABI will evolve, but -the API will remain consistent, or only have additions. - -See [Reading and Writing OpenEXR Image Files with the C-language -API](https://openexr.readthedocs.io/en/latest/OpenEXRCoreAPI.html) -for more information. - -### Supported Platforms - -OpenEXR builds on Linux, macOS, Microsoft Windows, and is -cross-compilable on other systems. - -### OpenEXR Project Mission +## OpenEXR Project Mission The goal of the OpenEXR project is to keep the EXR format reliable and modern and to maintain its place as the preferred image format for @@ -136,77 +43,113 @@ OpenEXR is intended solely for 2D data. It is not appropriate for storage of volumetric data, cached or lit 3D scenes, or more complex 3D data such as light fields. -The goals of the IlmBase project are simplicity, ease of use, -correctness and verifiability, and breadth of adoption. IlmBase is not +The goals of the Imath project are simplicity, ease of use, +correctness and verifiability, and breadth of adoption. Imath is not intended to be a comprehensive linear algebra or numerical analysis package. -### OpenEXR Project Governance +## Project Governance -OpenEXR is hosted by the Academy Software Foundation. See -[GOVERNANCE](GOVERNANCE.md) for more information about how the project -operates. +OpenEXR is a project of the [Academy Software +Foundation](https://www.aswf.io). See the project's [governance +policies](GOVERNANCE.md), [contribution guidelines](CONTRIBzuTING.md), and [code of conduct](CODE_OF_CONDUCT) +for more information. -The OpenEXR project is dedicated to promoting a harassment-free -community. Read our [code of conduct](CODE_OF_CONDUCT.md). +# Quick Start -## Developer Quick Start +See the [technical documentation](https://openexr.readthedocs.io) for +complete details, but to get started, the "hello, world" `.exr` writer program is: -See [INSTALL](INSTALL.md) for instructions on downloading and building OpenEXR -from source. + #include + #include + #include + + int + main() + { + try { + int width = 10; + int height = 10; + + Imf::Array2D pixels(width, height); + for (int y=0; y + + # Security Policy ## Reporting a Vulnerability @@ -7,7 +10,7 @@ report it by emailing security@openexr.org. Only Technical Steering Committee members and Academy Software Foundation project management have access to these messages. Include detailed steps to reproduce the issue, and any other information that could aid an investigation. Our -policy is to respond to vulernability reports within 14 days. +policy is to respond to vulnerability reports within 14 days. Our policy is to address critical security vulnerabilities rapidly and post patches as quickly as possible. diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index b11f41b92d..ec51f639eb 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -180,12 +180,23 @@ add_library(${PROJECT_NAME}::Config ALIAS IlmThreadConfig) ####### Install pkg-config files if requested if(OPENEXR_INSTALL_PKG_CONFIG) + + # Prepend prefix for includedir only if CMAKE_INSTALL_INCLUDEDIR is relative + if(IS_ABSOLUTE "${CMAKE_INSTALL_INCLUDEDIR}") + set(PKG_CONFIG_INSTALL_INCLUDEDIR "${CMAKE_INSTALL_INCLUDEDIR}") + else() + set(PKG_CONFIG_INSTALL_INCLUDEDIR "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}") + endif() + + # Prepend exec_prefix for libdir only if CMAKE_INSTALL_LIBDIR is relative + if(IS_ABSOLUTE "${CMAKE_INSTALL_LIBDIR}") + set(PKG_CONFIG_INSTALL_LIBDIR "${CMAKE_INSTALL_LIBDIR}") + else() + set(PKG_CONFIG_INSTALL_LIBDIR "\${exec_prefix}/${CMAKE_INSTALL_LIBDIR}") + endif() + # use a helper function to avoid variable pollution, but pretty simple function(openexr_pkg_config_help pcinfile) - set(prefix ${CMAKE_INSTALL_PREFIX}) - set(exec_prefix "\${prefix}") - set(libdir ${CMAKE_INSTALL_FULL_LIBDIR}) - set(includedir ${CMAKE_INSTALL_FULL_INCLUDEDIR}) string(TOUPPER "${CMAKE_BUILD_TYPE}" uppercase_CMAKE_BUILD_TYPE) set(LIB_SUFFIX_DASH ${OPENEXR_LIB_SUFFIX}${CMAKE_${uppercase_CMAKE_BUILD_TYPE}_POSTFIX}) if(OPENEXR_ENABLE_THREADING AND TARGET Threads::Threads) diff --git a/cmake/FindPythonPackage.cmake b/cmake/FindPythonPackage.cmake new file mode 100644 index 0000000000..2e1a81169b --- /dev/null +++ b/cmake/FindPythonPackage.cmake @@ -0,0 +1,79 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright Contributors to the OpenColorIO Project. +# +# Locate a Python package +# +# Variables defined by this module: +# _FOUND +# +# Usage: +# find_python_package(Jinja2 2.10.1) +# +# If the package is not installed in a standard path, add it to the PYTHONPATH +# environment variable before running CMake. +# + +find_package(Python QUIET COMPONENTS Interpreter) + +macro(find_python_package package) + # Some Python packages have "-" in the PyPi name, but are replaced with "_" + # in the actual package name. + string(REPLACE "-" "_" _PKG_IMPORT ${package}) + + # Parse options + foreach(_ARG ${ARGN}) + if(_ARG STREQUAL "REQUIRED") + set(_PKG_REQUIRED TRUE) + endif() + if(_PREV_ARG STREQUAL "REQUIRES") + set(_PKG_REQUIRES ${_ARG}) + endif() + set(_PREV_ARG ${_ARG}) + endforeach() + + if(NOT TARGET ${package}) + add_custom_target(${package}) + if(_PKG_REQUIRES) + add_dependencies(${package} ${_PKG_REQUIRES}) + unset(_PKG_REQUIRES) + endif() + set(_${package}_TARGET_CREATE TRUE) + endif() + + set(_PKG_INSTALL TRUE) + + # Try importing Python package + execute_process( + COMMAND + "${Python_EXECUTABLE}" -c "import ${_PKG_IMPORT}" + RESULT_VARIABLE + _PKG_IMPORT_RESULT + OUTPUT_QUIET ERROR_QUIET + ) + + if(_PKG_IMPORT_RESULT EQUAL 0) + set(${package}_FOUND TRUE) + + # Get the package's location + execute_process( + COMMAND + "${Python_EXECUTABLE}" -c + "import ${_PKG_IMPORT}, os; print(os.path.dirname(${_PKG_IMPORT}.__file__))" + OUTPUT_VARIABLE + _PKG_DIR + ERROR_QUIET + ) + string(STRIP "${_PKG_DIR}" _PKG_DIR) + message(STATUS "Found ${package}: ${_PKG_DIR}") + + else() + set(${package}_FOUND FALSE) + set(_FIND_ERR "Could NOT find ${package} (import ${_PKG_IMPORT} failed)") + + if(_PKG_REQUIRED) + message(FATAL_ERROR "${_FIND_ERR}") + endif() + message(STATUS "${_FIND_ERR}") + endif() + +endmacro() diff --git a/cmake/FindSphinx.cmake b/cmake/FindSphinx.cmake index 89640a59a1..02b869d92b 100644 --- a/cmake/FindSphinx.cmake +++ b/cmake/FindSphinx.cmake @@ -1,3 +1,6 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) Contributors to the OpenEXR Project. + #Look for an executable called sphinx-build find_program(SPHINX_EXECUTABLE NAMES sphinx-build diff --git a/cmake/IexConfig.h.in b/cmake/IexConfig.h.in index c9e4d4d3ee..17132860bf 100644 --- a/cmake/IexConfig.h.in +++ b/cmake/IexConfig.h.in @@ -13,13 +13,13 @@ // C++ namespace configuration / options // -// Current internal library namepace name +// Current internal library namespace name // #define IEX_INTERNAL_NAMESPACE_CUSTOM @IEX_NAMESPACE_CUSTOM@ #define IEX_INTERNAL_NAMESPACE @IEX_INTERNAL_NAMESPACE@ // -// Current public user namepace name +// Current public user namespace name // #define IEX_NAMESPACE_CUSTOM @IEX_NAMESPACE_CUSTOM@ diff --git a/cmake/IlmThreadConfig.h.in b/cmake/IlmThreadConfig.h.in index 1019a092d5..a47f37b2b8 100644 --- a/cmake/IlmThreadConfig.h.in +++ b/cmake/IlmThreadConfig.h.in @@ -16,13 +16,13 @@ #cmakedefine01 ILMTHREAD_HAVE_POSIX_SEMAPHORES // -// Current internal library namepace name +// Current internal library namespace name // #define ILMTHREAD_INTERNAL_NAMESPACE_CUSTOM @ILMTHREAD_NAMESPACE_CUSTOM@ #define ILMTHREAD_INTERNAL_NAMESPACE @ILMTHREAD_INTERNAL_NAMESPACE@ // -// Current public user namepace name +// Current public user namespace name // #define ILMTHREAD_NAMESPACE_CUSTOM @ILMTHREAD_NAMESPACE_CUSTOM@ diff --git a/cmake/LibraryDefine.cmake b/cmake/LibraryDefine.cmake index d19d6fc46c..254b42a399 100644 --- a/cmake/LibraryDefine.cmake +++ b/cmake/LibraryDefine.cmake @@ -19,7 +19,7 @@ function(OPENEXR_DEFINE_LIBRARY libname) # Use ${OPENEXR_CXX_STANDARD} to determine the standard we use to compile # OpenEXR itself. But the headers only require C++11 features, so that's - # all we need to pass on as interface reqirements to downstream projects. + # all we need to pass on as interface requirements to downstream projects. # For example, it's fine for an OpenEXR built with C++14 to be called from # an app that is compiled with C++11; OpenEXR needn't force the app to # also use C++14. diff --git a/cmake/OpenEXR.pc.in b/cmake/OpenEXR.pc.in index 24741b790b..c58420ec59 100644 --- a/cmake/OpenEXR.pc.in +++ b/cmake/OpenEXR.pc.in @@ -3,11 +3,11 @@ ## Copyright (c) Contributors to the OpenEXR Project. ## -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ -OpenEXR_includedir=@includedir@/OpenEXR +prefix=@CMAKE_INSTALL_PREFIX@ +exec_prefix=${prefix} +libdir=@PKG_CONFIG_INSTALL_LIBDIR@ +includedir=@PKG_CONFIG_INSTALL_INCLUDEDIR@ +OpenEXR_includedir=${includedir}/OpenEXR libsuffix=@LIB_SUFFIX_DASH@ Name: OpenEXR diff --git a/cmake/OpenEXRConfig.cmake.in b/cmake/OpenEXRConfig.cmake.in index ff533f0e8b..09a5941073 100644 --- a/cmake/OpenEXRConfig.cmake.in +++ b/cmake/OpenEXRConfig.cmake.in @@ -1,3 +1,6 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) Contributors to the OpenEXR Project. + @PACKAGE_INIT@ include(CMakeFindDependencyMacro) diff --git a/cmake/OpenEXRConfig.h.in b/cmake/OpenEXRConfig.h.in index 203633861a..6bc048f614 100644 --- a/cmake/OpenEXRConfig.h.in +++ b/cmake/OpenEXRConfig.h.in @@ -23,13 +23,13 @@ // C++ namespace configuration / options // -// Current internal library namepace name +// Current internal library namespace name // #define OPENEXR_IMF_INTERNAL_NAMESPACE_CUSTOM @OPENEXR_NAMESPACE_CUSTOM@ #define OPENEXR_IMF_INTERNAL_NAMESPACE @OPENEXR_INTERNAL_IMF_NAMESPACE@ // -// Current public user namepace name +// Current public user namespace name // #define OPENEXR_IMF_NAMESPACE_CUSTOM @OPENEXR_NAMESPACE_CUSTOM@ diff --git a/cmake/OpenEXRSetup.cmake b/cmake/OpenEXRSetup.cmake index 5cb50bd1d5..e3d373b387 100644 --- a/cmake/OpenEXRSetup.cmake +++ b/cmake/OpenEXRSetup.cmake @@ -72,7 +72,7 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_DEBUG_POSTFIX "_d" CACHE STRING "Suffix for debug builds") if(NOT OPENEXR_IS_SUBPROJECT) - # Usual cmake option to build shared libraries or not, only overriden if OpenEXR is a top level project, + # Usual cmake option to build shared libraries or not, only overridden if OpenEXR is a top level project, # in general this setting should be explicitly configured by the end user option(BUILD_SHARED_LIBS "Build shared library" ON) endif() @@ -220,12 +220,19 @@ if(OPENEXR_FORCE_INTERNAL_ZLIB OR NOT TARGET ZLIB::ZLIB) set(zlibstaticlibname "z") endif() + if(MSVC) + set(zlibpostfix "d") + endif() + if(NOT (APPLE OR WIN32) AND BUILD_SHARED_LIBS AND NOT OPENEXR_FORCE_INTERNAL_ZLIB) add_library(zlib_shared SHARED IMPORTED GLOBAL) add_dependencies(zlib_shared zlib_external) set_property(TARGET zlib_shared PROPERTY IMPORTED_LOCATION "${zlib_INTERNAL_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}${zliblibname}${CMAKE_SHARED_LIBRARY_SUFFIX}" ) + set_property(TARGET zlib_static PROPERTY + IMPORTED_LOCATION_DEBUG "${zlib_INTERNAL_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}${zliblibname}${zlibpostfix}${CMAKE_SHARED_LIBRARY_SUFFIX}" + ) target_include_directories(zlib_shared INTERFACE "${zlib_INTERNAL_DIR}/include") endif() @@ -234,6 +241,9 @@ if(OPENEXR_FORCE_INTERNAL_ZLIB OR NOT TARGET ZLIB::ZLIB) set_property(TARGET zlib_static PROPERTY IMPORTED_LOCATION "${zlib_INTERNAL_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}${zlibstaticlibname}${CMAKE_STATIC_LIBRARY_SUFFIX}" ) + set_property(TARGET zlib_static PROPERTY + IMPORTED_LOCATION_DEBUG "${zlib_INTERNAL_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}${zlibstaticlibname}${zlibpostfix}${CMAKE_STATIC_LIBRARY_SUFFIX}" + ) target_include_directories(zlib_static INTERFACE "${zlib_INTERNAL_DIR}/include") if(NOT (APPLE OR WIN32) AND BUILD_SHARED_LIBS AND NOT OPENEXR_FORCE_INTERNAL_ZLIB) @@ -251,7 +261,7 @@ option(OPENEXR_FORCE_INTERNAL_IMATH "Force using an internal imath" OFF) # Check to see if Imath is installed outside of the current build directory. set(IMATH_REPO "https://github.com/AcademySoftwareFoundation/Imath.git" CACHE STRING "Repo for auto-build of Imath") -set(IMATH_TAG "v3.1.5" CACHE STRING +set(IMATH_TAG "v3.1.7" CACHE STRING "Tag for auto-build of Imath (branch, tag, or SHA)") if(NOT OPENEXR_FORCE_INTERNAL_IMATH) #TODO: ^^ Release should not clone from master, this is a place holder diff --git a/docs/API.rst b/docs/API.rst new file mode 100644 index 0000000000..d2fce2bbed --- /dev/null +++ b/docs/API.rst @@ -0,0 +1,19 @@ +.. + SPDX-License-Identifier: BSD-3-Clause + Copyright Contributors to the OpenEXR Project. + +.. _The OpenEXR API: + +The OpenEXR API +############### + +.. toctree:: + :caption: API + :maxdepth: 2 + + HelloWorld + ReadingAndWritingImageFiles + OpenEXRCoreAPI + +* :ref:`genindex` + diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt index e3f363fda4..993e1694bf 100644 --- a/docs/CMakeLists.txt +++ b/docs/CMakeLists.txt @@ -6,6 +6,9 @@ set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH}) find_package(Doxygen REQUIRED) find_package(Sphinx REQUIRED) +include(FindPythonPackage) +find_python_package(sphinx-press-theme REQUIRED) + set(DOXYGEN_INPUT_DIR ${PROJECT_SOURCE_DIR}/src/lib/OpenEXRCore) set(DOXYGEN_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/doxygen) set(DOXYGEN_INDEX_FILE ${DOXYGEN_OUTPUT_DIR}/html/index.html) @@ -16,6 +19,8 @@ set(SPHINX_SOURCE ${CMAKE_CURRENT_SOURCE_DIR}) set(SPHINX_BUILD ${CMAKE_CURRENT_BINARY_DIR}/sphinx) set(SPHINX_INDEX_FILE ${SPHINX_BUILD}/index.html) +set(SPHINX_OPTS "-W" CACHE STRING "Sphinx build options") + configure_file(${DOXYFILE_IN} ${DOXYFILE_OUT} @ONLY) file(MAKE_DIRECTORY ${DOXYGEN_OUTPUT_DIR}) @@ -28,7 +33,7 @@ add_custom_command(OUTPUT ${DOXYGEN_INDEX_FILE} add_custom_command(OUTPUT ${SPHINX_INDEX_FILE} COMMAND - ${SPHINX_EXECUTABLE} -b html + ${SPHINX_EXECUTABLE} -b html ${SPHINX_OPTS} # Tell Breathe where to find the Doxygen output -Dbreathe_projects.OpenEXR=${DOXYGEN_OUTPUT_DIR}/xml ${SPHINX_SOURCE} ${SPHINX_BUILD} diff --git a/docs/Doxyfile.in b/docs/Doxyfile.in index 1ef4bcaaac..4776467070 100644 --- a/docs/Doxyfile.in +++ b/docs/Doxyfile.in @@ -1,3 +1,6 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) Contributors to the OpenEXR Project. + PROJECT_NAME = "OpenEXR" GENERATE_LATEX = NO GENERATE_MAN = NO diff --git a/docs/HelloWorld.rst b/docs/HelloWorld.rst new file mode 100644 index 0000000000..bb5846bedb --- /dev/null +++ b/docs/HelloWorld.rst @@ -0,0 +1,43 @@ +.. + SPDX-License-Identifier: BSD-3-Clause + Copyright Contributors to the OpenEXR Project. + +.. _Hello: + +Hello, World +############ + +.. toctree:: + :caption: Hello, World + :maxdepth: 1 + +A simple program to write a simple ``.exr`` file of an image of 10x10 +pixels with values that are a ramp in green and blue: + +.. literalinclude:: src/writer/writer.cpp + +And the ``CMakeLists.txt`` file to build: + +.. literalinclude:: src/writer/CMakeLists.txt + +To build: + +.. literalinclude:: src/writer/build.sh + +For more details, see :ref:`The OpenEXR API`. + +And a simple program to read an ``.exr`` file: + +.. literalinclude:: src/reader/reader.cpp + + +And the ``CMakeLists.txt`` file to build: + +.. literalinclude:: src/reader/CMakeLists.txt + +To build: + +.. literalinclude:: src/reader/build.sh + + + diff --git a/docs/InterpretingDeepPixels.rst b/docs/InterpretingDeepPixels.rst index 8cad5e68a1..ca0ace131e 100644 --- a/docs/InterpretingDeepPixels.rst +++ b/docs/InterpretingDeepPixels.rst @@ -1,3 +1,7 @@ +.. + SPDX-License-Identifier: BSD-3-Clause + Copyright Contributors to the OpenEXR Project. + Interpreting OpenEXR Deep Pixels ################################ @@ -185,6 +189,7 @@ the following table: .. list-table:: :header-rows: 1 + :align: left * - Color or auxiliary channel base name - Matching alpha channel base name @@ -205,6 +210,7 @@ channel. .. list-table:: :header-rows: 1 + :align: left * - Channel name - Associated alpha channel @@ -423,22 +429,18 @@ total opacity and color are the same as in the original sample. For the depth channels, the new samples are: -.. list-table:: - - * - .. math:: S_{i,new}\left( Z \right) = \ S_{i}\left( Z \right) - - .. math:: S_{i + 1,new}\left( Z \right) = \ z - * - .. math:: S_{i,new}\left( \text{ZBack} \right) = \ z - - .. math:: S_{i + 1,new}\left( \text{ZBack} \right) = \ S_{i}\left( \text{ZBack} \right) +.. math:: S_{i,new}\left( Z \right) = \ S_{i}\left( Z \right) +.. math:: S_{i + 1,new}\left( Z \right) = \ z +.. math:: S_{i,new}\left( \text{ZBack} \right) = \ z +.. math:: S_{i + 1,new}\left( \text{ZBack} \right) = \ S_{i}\left( \text{ZBack} \right) For a color channel, ``c``, and its associated alpha channel, :math:`\alpha`, the new samples are: -.. list-table:: - - * - .. math:: S_{i,new}\left( \alpha \right) = \alpha_{i}(z) - - .. math:: S_{i + 1,new}\left( \alpha \right) = \alpha_{i}({S_{i}\left( Z \right) + S}_{i}\left( \text{ZBack} \right) - z) - * - .. math:: S_{i,new}\left( c \right) = c_{i}(z) - - .. math:: S_{i + 1,new}\left( c \right) = c_{i}\left( {S_{i}\left( Z \right) + S}_{i}\left( \text{ZBack} \right) - z \right) +.. math:: S_{i,new}\left( \alpha \right) = \alpha_{i}(z) +.. math:: S_{i + 1,new}\left( \alpha \right) = \alpha_{i}({S_{i}\left( Z \right) + S}_{i}\left( \text{ZBack} \right) - z) +.. math:: S_{i,new}\left( c \right) = c_{i}(z) +.. math:: S_{i + 1,new}\left( c \right) = c_{i}\left( {S_{i}\left( Z \right) + S}_{i}\left( \text{ZBack} \right) - z \right) If it is not done exactly right, splitting a sample can lead to large rounding errors for the colors of the new samples when the opacity of diff --git a/docs/MultiViewOpenEXR.rst b/docs/MultiViewOpenEXR.rst index 861acb2acf..58f827a3c6 100644 --- a/docs/MultiViewOpenEXR.rst +++ b/docs/MultiViewOpenEXR.rst @@ -1,3 +1,7 @@ +.. + SPDX-License-Identifier: BSD-3-Clause + Copyright Contributors to the OpenEXR Project. + Storing Multi-View Images in OpenEXR Files ########################################## @@ -255,6 +259,7 @@ For example, the following table shows several different combinations of .. list-table:: :header-rows: 1 + :align: left * - views listed in ``multiView`` attribute - channel names diff --git a/docs/OpenEXRCoreAPI.rst b/docs/OpenEXRCoreAPI.rst index 7aabfa1959..90aaf856dd 100644 --- a/docs/OpenEXRCoreAPI.rst +++ b/docs/OpenEXRCoreAPI.rst @@ -1,5 +1,9 @@ -Reading and Writing OpenEXR Image Files with the C-language API -############################################################### +.. + SPDX-License-Identifier: BSD-3-Clause + Copyright Contributors to the OpenEXR Project. + +Reading and Writing Image Files with the C-language API +####################################################### The OpenEXRCore library has a few notable features to consider prior to beginning use: @@ -257,7 +261,7 @@ Context .. doxygentypedef:: exr_context_t .. doxygentypedef:: exr_const_context_t -.. doxygenstruct:: _exr_context_initializer +.. doxygenstruct:: _exr_context_initializer_v3 :members: .. doxygentypedef:: exr_context_initializer_t @@ -281,7 +285,7 @@ Decoding Encoding ^^^^^^^^ -.. doxygenenum:: transcoding_pipeline_buffer_id +.. doxygenenum:: exr_transcoding_pipeline_buffer_id .. doxygenstruct:: _exr_encode_pipeline :members: diff --git a/docs/OpenEXRFileLayout.rst b/docs/OpenEXRFileLayout.rst index 5479e6676a..d028b11151 100644 --- a/docs/OpenEXRFileLayout.rst +++ b/docs/OpenEXRFileLayout.rst @@ -1,3 +1,7 @@ +.. + SPDX-License-Identifier: BSD-3-Clause + Copyright Contributors to the OpenEXR Project. + OpenEXR File Layout ################### @@ -43,7 +47,8 @@ the file layout are required to support the new multi-part and deep data features: .. list-table:: - + :align: left + * - Feature - Description - See @@ -93,7 +98,8 @@ start of the file). OpenEXR uses the following six integer data types: .. list-table:: - + :align: left + * - name - signed - size in bytes @@ -133,6 +139,7 @@ The following table lists the names and sizes of OpenEXR's floating-point data types: .. list-table:: + :align: left * - name - size in bytes @@ -304,6 +311,7 @@ All valid combinations of the version field bits are as follows: .. list-table:: :header-rows: 1 + :align: left * - Description - Compatible with @@ -424,6 +432,7 @@ attributes: .. list-table:: :header-rows: 1 + :align: left * - attribute name - attribute type @@ -455,6 +464,7 @@ one or more tiles: .. list-table:: :header-rows: 1 + :align: left * - attribute name - attribute type @@ -476,6 +486,7 @@ This attribute can be used in the header for multi-part files: .. list-table:: :header-rows: 1 + :align: left * - attribute name - attribute type @@ -492,6 +503,7 @@ deep data OpenEXR files. .. list-table:: :header-rows: 1 + :align: left * - attribute name - attribute type @@ -530,6 +542,7 @@ deep data (deepscanline or deeptile): .. list-table:: :header-rows: 1 + :align: left * - attribute name - attribute type @@ -631,6 +644,7 @@ same format: .. list-table:: :header-rows: 1 + :align: left * - part type - type attribute @@ -658,6 +672,7 @@ may be stored together as a scan line block. The number of scan lines per block depends on how the pixel data are compressed: .. list-table:: + :align: left * - ``NO_COMPRESSION`` - 1 diff --git a/docs/PortingGuide.rst b/docs/PortingGuide.rst new file mode 100644 index 0000000000..9b91a580b2 --- /dev/null +++ b/docs/PortingGuide.rst @@ -0,0 +1,605 @@ +.. + SPDX-License-Identifier: BSD-3-Clause + Copyright Contributors to the OpenEXR Project. + +.. _porting: + +OpenEXR/Imath 2.x to 3.x Porting Guide +###################################### + +This porting guide outlines the several areas where switching from OpenEXR +2.x to OpenEXR 3.x + Imath 3.x will require source code or build changes of +downstream software. + +In each case, we will often explain both how to change if you are expecting +3.x only hereafter, or usually a more complex accommodation if you want to +keep compatibility with both 2.x and 3.x. + +OpenEXR and Imath Are Different Packages +======================================== + +If your use of OpenEXR was only for the sake of using the math classes and +utilities, maybe you were unhappy that you needed to download and build the +full OpenEXR dependency. You are in luck -- now Imath is a separate, very +lightweight open source package. You can use Imath functionality without +needing any of OpenEXR, which as of 3.x only includes the parts you need to +read and write OpenEXR image files. + +The parts of "IlmBase" that were ``Imath`` and ``half`` are now repackaged +as the ``Imath`` library. The ``IlmThread`` and ``Iex`` libraries have been +folded into the OpenEXR package, since they were were not necessary to +the rest of Imath. + +When building OpenEXR 3.x, note that if Imath 3.x library is not found +already installed at build time, it will be automatically downloaded and +built as part of the OpenEXR build. + +Background +========== + +Why is this happening? Here is the relevant history. + +The OpenEXR project has historically consisted of four separate subprojects: + +* ``OpenEXR`` - the Imf image format +* ``IlmBase`` - supporting utilities (Imath, Half, Iex, IlmThread) +* ``PyIlmBase`` - python bindings for the IlmBase libraries +* ``OpenEXR_Viewers`` - code for an example EXR image viewer + +Prior to the 2.4 release in 2019, OpenEXR relied primarily on the Gnu +autotools build system and was released as four separate tarballs +(ilmbase, pyilmbase, openexr, openexr_viewers) that were constructed +via the Gnu tools. This gave direct access to the "IlmBase" libraries +independent of the OpenEXR format library. The project also included +CMake files but CMake support was incomplete. + +With the adoption of OpenEXR by the Academy Software Foundation in +2019, the technical steering committee made several key changes: + +1. Drop support for autotools in favor of CMake. A significant portion + of the OpenEXR user base uses Windows, which the Gnu autotools does + not support. Supporting two build systems is a maintenance burden + that the TSC opted to avoid. We now assume that all modern users of + OpenEXR can reasonably be expected to rely on CMake. + +2. Rely on GitHub's automatic release packaging mechanism. This + packages the entire contents of package in a single + tarball. Separate tarballs are no longer generated by the Gnu + autotools setup. + +3. Deprecate the OpenEXR_Viewers code. It was impossibly out of date + and of little modern value. + +Thus, with the 2.4 release, the "IlmBase" libraries are no longer +distributed in a form that is readily separable from the rest of +OpenEXR. The build and installation process for the overall OpenEXR +project is complicated by the fact it consists of four separate +projects, which added significant complexity to the CMake setup. + +Because Imath is generally useful to the community, the TSC decided to +simplify the configuration by separating Imath into its own independent +project, maintained and released independently of OpenEXR, and +introducing it as a new external dependency of OpenEXR. + +To further simplify matters, the new Imath library includes the half +data type directly, rather than maintaining it in a separate +library. Also, the community at large has a strong desire for simple +vector/matrix utilities that are unencumbered by Iex, the IlmBase +library that provides higher-level exception classes, and even +further, a clear delineation between functionality that (1) relies on +exception handlings and (2) is free from exceptions. As a result, +support for Iex has been removed from Imath, and the Iex library is +now packaged as a component of OpenEXR. + +The Imath python bindings are a part of Imath as a configuration +option, although support is off by default to simplify the build process +for most users. + +New Library Names and Repository Structures +=========================================== + +The new repositories place all source code under the ``src`` top-level +subdirectory. + +Imath: +------ + +.. code-block:: + + src + ├── Imath + ├── ImathTest + └── python + ├── config + ├── PyImath + ├── PyImathNumpy + ├── PyImathTest + ├── PyImathNumpyTest + └── PyImathSpeedTest + + +OpenEXR: +-------- + +The ``IlmImf`` library has been renamed ``OpenEXR``. No header files have +changed names, only their locations in the repo have changes. + +.. code-block:: + + src + ├── bin + │ ├── exr2aces + │ ├── exrbuild + │ ├── exrcheck + │ ├── exrenvmap + │ ├── exrheader + │ ├── exrmakepreview + │ ├── exrmaketiled + │ ├── exrmultipart + │ ├── exrmultiview + │ └── exrstdattr + ├── lib + │ ├── Iex + │ ├── IexMath + │ ├── IlmThread + │ ├── OpenEXR + │ └── OpenEXRUtil + ├── examples + └── test + ├── IexTest + ├── OpenEXRTest + ├── OpenEXRUtilTest + └── OpenEXRFuzzTest + + +Finding and Using OpenEXR and Imath CMake Configs +================================================= + +OpenEXR/Imath 3.x Only +---------------------- + +If you are *only* concerned with OpenEXR/Imath 3.x going forward, this is +the recommended way to find the libraries in a downstream project that uses +the CMake build system: + +.. code-block:: + + find_package(Imath CONFIG) + find_package(OpenEXR CONFIG) + +Note that the second line may be omitted if you only need the Imath +portions. + +And then your project can reference the imported targets like this: + +.. code-block:: + + target_link_libraries (my_target + PRIVATE + OpenEXR::OpenEXR + Imath::Imath + Imath::Half + ) + +You only need the parts you use, so for example, if you only need Half and +Imath, you can omit the OpenEXR target. Also note that in our example above, +we have used the ``PRIVATE`` label, but you should specify them as ``PUBLIC`` if +you are exposing those classes in your own package's public interface. + + +Accommodating OpenEXR/Imath 3.x or OpenEXR 2.x +---------------------------------------------- + +On the other hand, to accommodate both 2.x and 3.x, it's admittedly +inconvenient because the packages and the import targets have changed their +names. We have found the following idioms to work: + +Finding either/both packages: + +.. code-block:: + + # First, try to find just the right config files + find_package(Imath CONFIG) + if (NOT TARGET Imath::Imath) + # Couldn't find Imath::Imath, maybe it's older and has IlmBase? + find_package(IlmBase CONFIG) + endif () + find_package(OpenEXR CONFIG) + +To link against them, we use CMake generator expressions so that we can +reference *both* sets of targets, but it will only use the ones +corresponding to the package version that was found. + +.. code-block:: + + target_link_libraries (my_target + PRIVATE + # For OpenEXR/Imath 3.x: + $<$:OpenEXR::OpenEXR> + $<$:Imath::Imath> + $<$:Imath::Half> + # For OpenEXR 2.4/2.5: + $<$:OpenEXR::IlmImf> + $<$:IlmBase::Imath> + $<$:IlmBase::Half> + $<$:IlmBase::IlmThread> + $<$:IlmBase::Iex> + ) + +Again, you can eliminate the references to any of the individual libaries +that you don't actually need for your application. + +Simultaneous Static/Shared Build +-------------------------------- + +The OpenEXR 2.x CMake configuration had options to simultaneously +build both shared and statically linked libraries. This has been +deprecated. A CMake configuration setting specifies whether to build +static or shared, but if you want both, you will need to run cmake and +build twice. + +Simultaneous Python 2/3 Build +----------------------------- + +The PyIlmBase 2.x CMake configuration had options to simultaneously +build both python2 and python3 bindings. This has been deprecated. +A CMake configuration setting specifies whether to build for +python 2 or python 3, but if you want both, you will need to run +cmake and build twice. + +Imath Include Files Are in a Different Subdirectory +=================================================== + +Imath 3.0 will copy its headers to some ``include/Imath`` subdirectory +instead of the old ``include/OpenEXR``. + +OpenEXR/Imath 3.x Only +---------------------- + +If you know that you are only using Imath 3.x, then just change any +include directions, like this: + +.. code-block:: + + #include + #include + +to the new locations: + +.. code-block:: + + #include + #include + +Accommodating OpenEXR/Imath 3.x or OpenEXR 2.x +---------------------------------------------- + +If you want your software to be able to build against either OpenEXR 2.x or +3.x (depending on which dependency is available at build time), we recommend +using a more complicated idiom: + +.. code-block:: + + // The version can reliably be found in this header file from OpenEXR, + // for both 2.x and 3.x: + #include + #define COMBINED_OPENEXR_VERSION ((10000*OPENEXR_VERSION_MAJOR) + \ + (100*OPENEXR_VERSION_MINOR) + \ + OPENEXR_VERSION_PATCH) + + // There's just no easy way to have an ``#include`` that works in both + // cases, so we use the version to switch which set of include files we + // use. + #if COMBINED_OPENEXR_VERSION >= 20599 /* 2.5.99: pre-3.0 */ + # include + # include + #else + // OpenEXR 2.x, use the old locations + # include + # include + #endif + +Include Files Include Fewer Other Headers +========================================= + +Extraneous ``#include`` statements have been removed from some header +files, which can lead to compile failures in application code that +previously included certain headers indirectly. + +For example, the Imath header files no longer include ``float.h``, so +application code that references symbols such as ``FLT_MAX`` may need +to add an explicit ``#include `` or equivalent. + +If your application code reports compile errors due to undefined or +incompletely-defined Imath or OpenEXR data types, locate the Imath or +OpenEXR header file that defines the type and include it explicitly. + +Symbols Are Hidden by Default +============================= + +To reduce library size and make linkage behavior similar across +platforms, Imath and OpenEXR now build with directives that make +symbol visibility hidden by default, with specific externally-visible +symbols explicitly marked for export. See the :doc:`SymbolVisibility` +and the appropriate ``*Export.h`` header file for more details. + +Imath Now Uses Standard C++ Exceptions and ``noexcept`` +======================================================= + +In OpenEXR 2.x, the Imath functions that threw exceptions used to throw +various Iex varieties. + +In Imath 3.x, these functions just throw ``std::exception`` varieties that +correspond to the failure (e.g., ``std::invalid_argument``, +``std::domain_error``, etc.). For that reason, all of the Iex exceptions are +now only part of the OpenEXR library (where they are still used in the same +manner they were for OpenEXR 2.x). + +Imath 3.x has very few functions that throw exceptions. Each is clearly +marked as such, and each has a version that does not throw exceptions (so +that it may be used from code where exceptions are avoided). The functions +that do not throw exceptions are now marked ``noexcept``. + +Some Headers and Classes Have Been Removed from Imath 3.x +========================================================= + +* The ``Math`` class (and ``ImathMath.h`` header file) are + deprecated. All of the ``Math`` functionality is subsumed by C++11 + ``std::`` math functions. For example, calls to + ``Imath::Math::abs(x)`` should be replaced with ``std::abs(x)``. + +* The ``Limits`` class (and the ``ImathLimits.h`` and + ``ImathHalfLimits.h`` headers) have been removed entirely. All uses of + ``Limits<>`` should be replaced with the appropriate + ``std::numeric_limits<>`` method call. The Imath-specific versions + predated C++11, and were not only redundant in a C++11 world, but + also potentially confusing because some of their functions behaved + quite differently than the ``std::numeric_limits`` method with the + same name. We are following the precept that if C++11 does something + in a standard way, we should not define our own equivalent function + (and especially not define it in a way that doesn't match the + standard behavior). + +* ``Vec::normalize()`` and ``length()`` methods, for integer ``T`` types, + have been removed. Also the standalone ``project()`` and + ``orthogonal()`` functions are no longer defined for vectors made of + integer elements. These all had behavior that was hard to understand + and probably useless. They still work as expected for vectors of + floating-point types. + +* The ``Int64`` and ``SInt64`` types are deprecated in favor of the + now-standard ``int64_t`` and ``uint64_t``. + +File/Class-specific Changes +=========================== + +``half`` in ``half.h`` +---------------------- + +* The half type is now in the ``Imath`` namespace, but a compile-time + option puts it in the global namespace, except when compiling for + CUDA, in which case the 'half' type refers to the CUDA type: + +.. code-block:: + + #ifndef __CUDACC__ + using half = IMATH_INTERNAL_NAMESPACE::half; + #else + #include + #endif + + If you desire to use Imath::half inside a CUDA kernal, you can refer + to it via the namespace, or define ``CUDA_NO_HALF`` to avoid the CUDA + type altogether. + +* ``HALF_MIN`` has changed value. It is now the smallest **normalized** + positive value, returned by ``std::numeric_limits::min()``. + +* New constructor from a bit pattern: + +.. code-block:: + + enum FromBitsTag + { + FromBits + }; + + constexpr half(FromBitsTag, unsigned short bits) noexcept; + +``Imath::Box`` in ``ImathBox.h`` +----------------------------------- + +* ``baseTypeMin()`` is replaced with ``baseTypeLowest()`` + +``Color3``, ``Color4`` in ``ImathColor.h`` +------------------------------------------------ + +* ``baseTypeMin()`` is replaced with ``baseTypeLowest()`` + +``Imath::Frustum`` in ``ImathFrustum.h`` +------------------------------------------- + +Akin to the ``Vec`` classes, there are now seperate API calls for +throwing and non-throwing functions: + +These functions previously threw exceptions but now do not throw and +are marked ``noexcept``: + +* ``Frustum::projectionMatrix() noexcept`` + +* ``Frustum::aspect() noexcept`` + +* ``Frustum::set() noexcept`` + +* ``Frustum::projectPointToScreen() noexcept`` + +* ``Frustum::ZToDepth() noexcept`` + +* ``Frustum::DepthToZ() noexcept`` + +* ``Frustum::screenRadius() noexcept`` + +* ``Frustum::localToScreen() noexcept`` + +These functions throw ``std::domain_error`` exceptions when the +associated frustum is degenerate: + +* ``Frustum::projectionMatrixExc()`` + +* ``Frustum::aspectExc()`` + +* ``Frustum::setExc()`` + +* ``Frustum::projectPointToScreenExc()`` + +* ``Frustum::ZToDepthExc()`` + +* ``Frustum::DepthToZExc()`` + +* ``Frustum::screenRadiusExc()`` + +* ``Frustum::localToScreenExc()`` + +``Imath::Interval`` in ``ImathInterval.h`` +--------------------------------------------- + +New methods/functions: + +* ``Interval::operator !=`` + +* ``Interval::makeInfinite()`` + +* ``IntervalisInfinite()`` + +* ``operator<< (std::ostream& s, const Interval&)`` + +``ImathMatrixAlgo.h`` +--------------------- + +* ``checkForZeroScaleInRow()`` and ``extractAndRemoveScalingAndShear()`` + throw ``std::domain_error`` exceptions instead of ``Iex::ZeroScale`` + +``Matrix22``, ``Matrix33``, ``Matrix44`` in ``ImathMatrix.h`` +---------------------------------------------------------------------- + +* ``baseTypeMin()`` is replaced with ``baseTypeLowest()`` + +* ``invert(bool singExc = false)`` is replace by: + + - ``invert() noexcept`` + + - ``invert(bool)`` which optionally throws an ``std::invalid_argument`` + exception. + +* ``inverse(bool singExc = false)`` is replace by: + + - ``inverse() noexcept`` + + - ``inverse(bool)`` which optionally throws an ``std::invalid_argument`` + exception. + +* ``gjInvert(bool singExc = false)`` is replace by: + + - ``gjInvert()`` noexcept + + - ``gjInvert(bool)`` which optionally throws an + ``std::invalid_argument`` exception. + +* ``gJinverse(bool singExc = false)`` is replace by: + + - ``gjInverse()`` noexcept + + - ``gjInverse(bool)`` which optionally throws an + ``std::invalid_argument`` exception. + +New functions: + +* ``operator<< (std::ostream& s, const Matrix22&)`` + +* ``operator<< (std::ostream& s, const Matrix33&)`` + +* ``operator<< (std::ostream& s, const Matrix44&)`` + +Other changes: + +* Initialization loops unrolled for efficiency + +* inline added where appropriate + +``ImathRoots.h`` +---------------- + +* When compiling for CUDA, the ``complex`` type comes from ``thrust`` + rather than ``std`` + +``Shear6`` in ``ImathShear.h`` +------------------------------ + +* ``baseTypeMin()`` is replaced with ``baseTypeLowest()`` + +``ImathVecAlgo.h`` +------------------ + +The following functions are no longer defined for integer-based +vectors, because such behavior is not clearly defined: + +* ``project (const Vec& s, const Vec& t)`` + +* ``orgthogonal (const Vec& s, const Vec& t)`` + +* ``reflect (const Vec& s, const Vec& t)`` + +``Vec2``, ``Vec3``, ``Vec4`` in ``ImathVec.h`` +------------------------------------------------------- + +* ``baseTypeMin()`` is replaced with ``baseTypeLowest()`` + +* The following methods are removed (via ``= delete``) for integer-based + vectors because the behavior is not clearly defined and thus prone + to confusion: + + - ``length()`` - although the length is indeed defined, its proper value + is floating point and can thus not be represented by the 'T' + return type. + + - ``normalize()`` + + - ``normalizeExc()`` + + - ``normalizeNonNull()`` + + - ``normalized()`` + + - ``normalizedExc()`` + + - ``normalizedNonNull()`` + +* Interoperability Constructors: The Vec and Matrix classes now have + constructors that take as an argument any data object of similar + size and layout. + +Imath Python Changes +==================== + +In general, the changes in Imath at the C++ level are reflected in the +python bindings. In particular: + +* The following methods are removed for integer-based + vector and matrix objects and arrays: + + - ``length()`` + - ``normalize()`` + - ``normalizeExc()`` + - ``normalizeNonNull()`` + - ``normalized()`` + - ``normalizedExc()`` + - ``normalizedNonNull()`` + +* ``baseTypeMin()`` is replaced with ``baseTypeLowest()`` for: + + - ``Vec2``, ``Vec3``, ``Vec4`` + - ``Color3``, ``Color4`` + - ``Matrix22``, ``Matrix33``, ``Matrix44`` + - ``Box`` + - ``Shear6`` + diff --git a/docs/ReadingAndWritingImageFiles.rst b/docs/ReadingAndWritingImageFiles.rst index 82ab1e1a9c..94d921d0e3 100644 --- a/docs/ReadingAndWritingImageFiles.rst +++ b/docs/ReadingAndWritingImageFiles.rst @@ -1,5 +1,9 @@ -Reading and Writing OpenEXR Image Files with the OpenEXR Library -################################################################ +.. + SPDX-License-Identifier: BSD-3-Clause + Copyright Contributors to the OpenEXR Project. + +Reading and Writing Image Files with the OpenEXR Library +######################################################## Document Purpose and Audience ============================= @@ -37,7 +41,8 @@ the following eight C++ classes: .. list-table:: :header-rows: 1 - + :align: left + * - - tiles - scan lines @@ -544,7 +549,7 @@ other three arguments define the memory address of pixel ``(x,y)`` as **Note:** ``base`` is of type ``char*``, and that offsets from ``base`` are not implicitly multiplied by the size of an individual pixel, as in the RGBA-only interface. ``xStride`` and ``yStride`` must -explictly take the size of the pixels into account. +explicitly take the size of the pixels into account. With the values specified in our example, the OpenEXR library computes the address of the G channel of pixel ``(x,y)`` like this: @@ -797,6 +802,7 @@ each with a different resolution. Each version is called a stored in the file. There are three different level modes: .. list-table:: + :align: left * - ``ONE_LEVEL`` - The file contains only a single, full-resolution level. A ONE_LEVEL @@ -1462,7 +1468,7 @@ exception. If ``read(c,n)`` hits the end of the file after reading throw Iex::InputExc ("Unexpected end of file."); } - return feof (_file); + return !feof (_file); } ``tellg()`` returns the current reading position, in bytes, from the @@ -1897,7 +1903,7 @@ of a three-dimensional scene as seen from a particular 3D location. Every pixel in the image corresponds to a 3D direction, and the data stored in the pixel represent the amount of light arriving from this direction. In 3D rendering applications, environment maps are often -used for image-based lighting techniques that appoximate how objects +used for image-based lighting techniques that approximate how objects are illuminated by their surroundings. Environment maps with enough dynamic range to represent even the brightest light sources in the environment are sometimes called "light probe images." @@ -1910,6 +1916,7 @@ pixel locations and 3D directions. ``Envmap`` is an enumeration type. Two values are possible: .. list-table:: + :align: left * - ``ENVMAP_LATLONG`` - **Latitude-Longitude Map** The environment is projected onto @@ -1985,7 +1992,7 @@ To specify the compression algorithm, set the ``compression()`` value on the ``Header`` object: .. code-block:: - :linenos + :linenos: Header header (width, height); header.channels().insert ("G", Channel (HALF)); @@ -2038,7 +2045,7 @@ previous versions. The default DWA compression level is 45.0f. Alternatively, set the compression level on the ``Header`` object: .. code-block:: - :linenos + :linenos: Header header (width, height); header.channels().insert ("G", Channel (HALF)); diff --git a/docs/StandardOptionalAttributes.rst b/docs/StandardOptionalAttributes.rst index 7b4390c901..6b0eca5ecd 100644 --- a/docs/StandardOptionalAttributes.rst +++ b/docs/StandardOptionalAttributes.rst @@ -1,6 +1,13 @@ +.. + SPDX-License-Identifier: BSD-3-Clause + Copyright Contributors to the OpenEXR Project. + Standard Optional Attributes ############################ +.. toctree:: + :caption: Standard Optional Attributes + By default, OpenEXR files have the following attributes: **chromaticities** diff --git a/docs/SymbolVisibility.md b/docs/SymbolVisibility.md deleted file mode 100644 index 41c9207bbd..0000000000 --- a/docs/SymbolVisibility.md +++ /dev/null @@ -1,103 +0,0 @@ -# Symbol Visibility in OpenEXR - -## Overview - -Managing symbol visibility in a C++ library can reduce library sizes, -and with the extra information, the optimizer may produce faster -code. To take advantage of this, OpenEXR 3.0 is switching to -explicitly manage symbols on all platforms, with a hidden-by-default -behavior on unix-based platforms. Managing symbols has always been -required for Windows DLLs, where one must explicitly tag functions for -import and export as appropriate. - -For C, this is trivial: just tag public functions or global variable -as default visibility and leave everything else defaulting to -hidden. However, in C++, this is not exactly the same story. Functions -and globals are of course the same. And class member functions are -largely the same, and other than the attribute specification -mechanics, follow the same rules between gcc, clang, and -msvc. However, types have richer information than they do in C. So, -unless extra work is done, concepts for RTTI like the typeinfo and the -vtable for virtual classes will be hidden, and not visible. These are -referred to as "vague" linkage objects in some discussions. - -It is with the "vague" linkage objects where different properties -arise. For example, if you have a template, it is happily instantiated -in multiple compile units. If the typeinfo is hidden for one library, -then this may cause things like dynamic_cast to fail because then the -same typeinfo is not used, and even though one might think that -ImfAttribute are the same in two places, because they -are instantiated in separate places, they may be considered different -types. To compound the issue, there are different rules for this in -different implementations. For example, a default gcc under linux -allows one to link against otherwise private "vague" linkage objects -such that the typeinfo ends up as the same entity. clang, for MacOS -anyway, follows a stricter approach and keeps those types separate, -perhaps due to the two level namespace they maintain for symbols. - -Unfortunately, this is not clearly discussed as an overview of the -differences between platforms, hence this document to add -clarity. Each compiler / platform describes their own behavior, but -not how that behaves relative to -others. [libc++](https://libcxx.llvm.org/docs/DesignDocs/VisibilityMacros.html) -from the llvm project is the closest to providing comparitive -information, where by looking at how they define their macros and the -comments surrounding, one can infer the behavior among at least -windows DLL mode, then gcc vs. clang for unixen. Other compilers, for -example, Intel's icc, tend to adopt the behavior of the predominant -compiler for that platform (i.e. msvc under windows, gcc under linux), -and so can generally adopt that behavior and are ignored here. If this -is not true, the ifdef rules in the various library *Export.h headers -within OpenEXR may need to be adjusted, and this table updated. - -As a summary, below is a table of the attribute or declspec that needs -to be used for a particular C++ entity to be properly exported. This -does not address weak symbols, ABI versioning, and only focusing on -visibility. Under Windows DLL rules, if one exports the entire class, -it also exports the types for the member types as well, which is not -desired, so these are marked as N/A even though the compiler does -allow that to happen. - - -| C++ vs Compiler | MSVC | mingw | gcc | clang | -|-----------------|---------------------|---------------------|-----------------------|----------------------------| -| function | dllexport/dllimport | dllexport/dllimport | visibility("default") | visibility("default") | -| hide a function | N/A | N/A | visibility("hidden") | visibility("hidden") | -| class(typeinfo) | N/A | N/A | visibility("default") | visibility("default") | -| template class | N/A | N/A | visibility("default") | type_visibility("default") | -| template data | N/A | N/A | visibility("default") | visibility("default") | -| class template
instantiation | dllexport/dllimport | N/A | N/A | visibility("default") | -| enum | N/A | N/A | auto unhides (N/A) | type_visibility("default") | -| extern template | N/A | dllexport/dllimport | visibility("default") | visibility("default") | - -With this matrix in mind, we can see the maximal set of macros we need to -provide throughout the code. *NB*: This does not mean that we need to -declare all of these, just that they might be needed. `XXX` should be -substituted for the particular library name being compiled. - -| macro name | purpose | -|--------------------------------|------------------------------------------------------------------| -| `XXX_EXPORT` | one of export or import for windows, visibility for others | -| `XXX_EXPORT_TYPE` | for declaring a class / struct as public (for typeinfo / vtable) | -| `XXX_HIDDEN` | used to explicitly hide, especially members of types | -| `XXX_EXPORT_TEMPLATE_TYPE` | stating the template type should be visible | -| `XXX_EXPORT_EXTERN_TEMPLATE` | exporting template types (i.e. extern side of extern template) | -| `XXX_EXPORT_TEMPLATE_INSTANCE` | exporting specific template instantiations (in cpp code) | -| `XXX_EXPORT_TEMPLATE_DATA` | exporting templated data blocks | -| `XXX_EXPORT_ENUM` | exporting enum types | - -For a new library, the preference might be to call `XXX_EXPORT` -something like `XXX_FUNC`, and rename things such as `XXX_EXPORT_TYPE` -to `XXX_TYPE` for simplicity. However, historically, OpenEXR has used -the `_EXPORT` tag, and so that is preserved for consistency. - -## References - -LLVM libc++ visibility macros: -https://libcxx.llvm.org/docs/DesignDocs/VisibilityMacros.html - -GCC visibility wiki: -https://gcc.gnu.org/wiki/Visibility - -Apple library design docs: -https://developer.apple.com/library/archive/documentation/DeveloperTools/Conceptual/DynamicLibraries/100-Articles/DynamicLibraryDesignGuidelines.html diff --git a/docs/SymbolVisibility.rst b/docs/SymbolVisibility.rst new file mode 100644 index 0000000000..0208747d64 --- /dev/null +++ b/docs/SymbolVisibility.rst @@ -0,0 +1,157 @@ +.. + SPDX-License-Identifier: BSD-3-Clause + Copyright Contributors to the OpenEXR Project. + +.. _Symbol Visibility in OpenEXR: + +Symbol Visibility in OpenEXR +############################ + +Managing symbol visibility in a C++ library can reduce library sizes, +and with the extra information, the optimizer may produce faster +code. To take advantage of this, OpenEXR 3.0 is switching to +explicitly manage symbols on all platforms, with a hidden-by-default +behavior on unix-based platforms. Managing symbols has always been +required for Windows DLLs, where one must explicitly tag functions for +import and export as appropriate. + +For C, this is trivial: just tag public functions or global variable +as default visibility and leave everything else defaulting to +hidden. However, in C++, this is not exactly the same story. Functions +and globals are of course the same. And class member functions are +largely the same, and other than the attribute specification +mechanics, follow the same rules between gcc, clang, and +msvc. However, types have richer information than they do in C. So, +unless extra work is done, concepts for RTTI like the typeinfo and the +vtable for virtual classes will be hidden, and not visible. These are +referred to as "vague" linkage objects in some discussions. + +It is with the "vague" linkage objects where different properties +arise. For example, if you have a template, it is happily instantiated +in multiple compile units. If the typeinfo is hidden for one library, +then this may cause things like dynamic_cast to fail because then the +same typeinfo is not used, and even though one might think that +``ImfAttribute`` are the same in two places, because they +are instantiated in separate places, they may be considered different +types. To compound the issue, there are different rules for this in +different implementations. For example, a default gcc under linux +allows one to link against otherwise private "vague" linkage objects +such that the typeinfo ends up as the same entity. clang, for MacOS +anyway, follows a stricter approach and keeps those types separate, +perhaps due to the two level namespace they maintain for symbols. + +Unfortunately, this is not clearly discussed as an overview of the +differences between platforms, hence this document to add +clarity. Each compiler / platform describes their own behavior, but +not how that behaves relative to others. `libc++ +`_ from +the llvm project is the closest to providing comparative information, +where by looking at how they define their macros and the comments +surrounding, one can infer the behavior among at least windows DLL +mode, then gcc vs. clang for unixen. Other compilers, for example, +Intel's icc, tend to adopt the behavior of the predominant compiler +for that platform (i.e. msvc under windows, gcc under linux), and so +can generally adopt that behavior and are ignored here. If this is not +true, the ifdef rules in the various library ``Export.h`` headers +within OpenEXR may need to be adjusted, and this table updated. + +As a summary, below is a table of the attribute or declspec that needs +to be used for a particular C++ entity to be properly exported. This +does not address weak symbols, ABI versioning, and only focusing on +visibility. Under Windows DLL rules, if one exports the entire class, +it also exports the types for the member types as well, which is not +desired, so these are marked as N/A even though the compiler does +allow that to happen. + +.. list-table:: + :header-rows: 1 + :align: left + + * - C++ vs Compiler + - MSVC + - mingw + - gcc + - clang + * - function + - ``dllexport/dllimport`` + - ``dllexport/dllimport`` + - ``visibility("default")`` + - ``visibility("default")`` + * - hide a function + - N/A + - N/A + - ``visibility("hidden")`` + - ``visibility("hidden")`` + * - ``class(typeinfo)`` + - N/A + - N/A + - ``visibility("default")`` + - ``visibility("default")`` + * - template class + - N/A + - N/A + - ``visibility("default")`` + - ``type_visibility("default")`` + * - template data + - N/A + - N/A + - ``visibility("default")`` + - ``visibility("default")`` + * - class template instantiation + - ``dllexport/dllimport`` + - N/A + - N/A + - ``visibility("default")`` + * - enum + - N/A + - N/A + - auto unhides (N/A) + - ``type_visibility("default")`` + * - extern template + - N/A + - ``dllexport/dllimport`` + - ``visibility("default")`` + - ``visibility("default")`` + +With this matrix in mind, we can see the maximal set of macros we need to +provide throughout the code. *NB*: This does not mean that we need to +declare all of these, just that they might be needed. ``XXX`` should be +substituted for the particular library name being compiled +(``OPENEXR``, ``OPENEXRUTIL``, ``OPENEXRCORE``, ``IEX``, +``ILMTHREAD``, ``IMATH``). + +.. list-table:: + :header-rows: 1 + :align: left + + * - macro name + - purpose + * - ``XXX_EXPORT`` + - one of export or import for windows, visibility for others + * - ``XXX_EXPORT_TYPE`` + - for declaring a class / struct as public (for typeinfo / vtable) + * - ``XXX_HIDDEN`` + - used to explicitly hide, especially members of types + * - ``XXX_EXPORT_TEMPLATE_TYPE`` + - stating the template type should be visible + * - ``XXX_EXPORT_EXTERN_TEMPLATE`` + - exporting template types (i.e. extern side of extern template) + * - ``XXX_EXPORT_TEMPLATE_INSTANCE`` + - exporting specific template instantiations (in cpp code) + * - ``XXX_EXPORT_TEMPLATE_DATA`` + - exporting templated data blocks + * - ``XXX_EXPORT_ENUM`` + - exporting enum types + +For a new library, the preference might be to call ``XXX_EXPORT`` +something like ``XXX_FUNC``, and rename things such as ``XXX_EXPORT_TYPE`` +to ``XXX_TYPE`` for simplicity. However, historically, OpenEXR has used +the ``_EXPORT`` tag, and so that is preserved for consistency. + +--------- + +* LLVM libc++ visibility macros: https://libcxx.llvm.org/docs/DesignDocs/VisibilityMacros.html + +* GCC visibility wiki: https://gcc.gnu.org/wiki/Visibility + +* Apple library design docs: https://developer.apple.com/library/archive/documentation/DeveloperTools/Conceptual/DynamicLibraries/100-Articles/DynamicLibraryDesignGuidelines.html diff --git a/docs/TechnicalIntroduction.rst b/docs/TechnicalIntroduction.rst index 570448e7d3..9a92eeb8d1 100644 --- a/docs/TechnicalIntroduction.rst +++ b/docs/TechnicalIntroduction.rst @@ -1,24 +1,18 @@ +.. + SPDX-License-Identifier: BSD-3-Clause + Copyright Contributors to the OpenEXR Project. + +.. _Technical Introduction to OpenEXR: + Technical Introduction to OpenEXR ################################# .. toctree:: - :maxdepth: 3 - -Document Purpose and Audience -============================= - -OpenEXR is an open-source high-dynamic-range image file format that -was developed by Industrial Light & Magic. This document presents a -brief overview of OpenEXR. + :caption: Technical Introduction Features of OpenEXR =================== -Starting in 1999, Industrial Light & Magic developed OpenEXR, a -high-dynamic-range image file format for use in digital visual effects -production. In early 2003, after using and refining the file format -for two years, ILM released OpenEXR as an open-source C++ library. - A unique combination of features makes OpenEXR a good fit for high-quality image processing and storage applications: @@ -31,7 +25,6 @@ high-quality image processing and storage applications: formats have around 7 to 10 stops. **good color resolution** - With 16-bit floating-point numbers, color resolution is 1024 steps per f-stop, as opposed to somewhere around 20 to 70 steps per f-stop for most 8-bit file formats. Even after significant processing (for @@ -39,7 +32,6 @@ high-quality image processing and storage applications: noticeable color banding. **compatible with graphics hardware** - The 16-bit floating-point data format is fully compatible with the 16-bit frame-buffer data format used in some new graphics hardware. Images can be transferred back and forth between an @@ -57,14 +49,12 @@ high-quality image processing and storage applications: compression schemes can be added in the future. **arbitrary image channels** - OpenEXR images can contain an arbitrary number and combination of image channels, for example red, green, blue, and alpha; luminance and sub-sampled chroma channels; depth, surface normal directions, or motion vectors. **scan line and tiled images, multi-resolution images** - Pixels in an OpenEXR file can be stored either as scan lines or as tiles. Tiled image files allow random-access to rectangular sub-regions of an image. Multiple versions of a tiled image, each @@ -79,7 +69,6 @@ high-quality image processing and storage applications: display very large images. **ability to store additional data** - Often it is necessary to annotate images with additional data; for example, color timing information, process tracking data, or camera position and view direction. OpenEXR allows storing of an arbitrary @@ -88,7 +77,6 @@ high-quality image processing and storage applications: not understand. **easy-to-use C++ and C programming interfaces** - In order to make writing and reading OpenEXR files easy, the file format was designed together with a C++ programming interface. Two levels of access to image files are provided: a fully general @@ -109,28 +97,24 @@ high-quality image processing and storage applications: library. **fast multi-threaded file reading and writing** - The OpenEXR library supports multi-threaded reading or writing of an OpenEXR image file: while one thread performs low-level file input or output, multiple other threads simultaneously encode or decode individual pieces of the file. **portability** - The OpenEXR file format is hardware and operating system independent. While implementing the C and C++ programming interfaces, an effort was made to use only language features and library functions that comply with the C and C++ ISO standards. **multi-view** - A “multi-view” image shows the same scene from multiple different points of view. A common application is 3D stereo imagery, where a left-eye and a right-eye view of a scene are stored in a single file. **deep data** - Support for a new data type has been added: deep data. Deep images store an arbitrarily long list of data at each pixel location. This is different from multichannel or 'deep channel images' which can @@ -144,7 +128,6 @@ high-quality image processing and storage applications: atmospheric effects such fog). **multi-part** - Multi-part files allow for storing multiple images in one OpenEXR file. One important application is to store layers of channels separately. This allows for faster access when only a subset of the @@ -230,6 +213,7 @@ For a few channel names, interpretation of the data is predefined: .. list-table:: :header-rows: 1 + :align: left * - name - interpretation @@ -250,6 +234,7 @@ Three channel data types are currently supported: .. list-table:: :header-rows: 1 + :align: left * - type name - description @@ -270,11 +255,11 @@ determine for which of the pixels in the image's data window data are stored in the file. Data for a pixel at pixel space coordinates (x, y) are stored only if - x mod s :sub:`x` = 0 +.. math:: x \mod{s_x} = 0 and - y mod s :sub:`y` = 0. +.. math:: y \mod{s_y} = 0 For RGBA (red, green, blue, alpha) images, s\ :sub:`x` and s\ :sub:`y` are 1 for all channels, and each channel contains data for every @@ -325,9 +310,9 @@ rectangles, called *tiles*. Each tile contains p\ :sub:`x` by p\ :sub:`x`) by ceil(h/p\ :sub:`y`) tiles, where w and h are the width and height of the data window: - w = x\ :sub:`max` - x\ :sub:`min` + 1 +.. math:: w = x_max - x_min + 1 - h = y\ :sub:`max` - y\ :sub:`min` + 1 +.. math:: h = y_max - y_min + 1 The upper left corner of the upper left tile is aligned with the upper left corner of the data window, at (x\ :sub:`min`, y\ :sub:`min`). The @@ -425,6 +410,7 @@ are present. .. list-table:: :header-rows: 1 + :align: left * - rounding mode - level resolution @@ -508,6 +494,7 @@ headers: .. list-table:: :header-rows: 1 + :align: left * - attribute name - description @@ -544,13 +531,14 @@ information, process tracking data, or camera position and view direction. Those data can be packaged as extra attributes in the image file's header. -Multi-view header attributes +Multi-View Header Attributes ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This attribute is required in the header for multi-view OpenEXR files. .. list-table:: :header-rows: 1 + :align: left * - attribute name - notes @@ -573,6 +561,7 @@ deep data OpenEXR files. .. list-table:: :header-rows: 1 + :align: left * - attribute name - notes @@ -604,6 +593,7 @@ deep data (deepscanline or deeptile): .. list-table:: :header-rows: 1 + :align: left * - name - notes @@ -756,6 +746,7 @@ Supported compression schemes: .. list-table:: :header-rows: 1 + :align: left * - name - description @@ -1010,7 +1001,8 @@ with more than three color channels. .. list-table:: :header-rows: 1 - + :align: left + * - name - interpretation * - Y @@ -1059,6 +1051,7 @@ data you are handling, always use the appropriate channel name. .. list-table:: :header-rows: 1 + :align: left * - name - definition @@ -1114,10 +1107,197 @@ the OpenEXR library defines a set of standard attributes for commonly used data, such as colorimetric data (see `RGB Color`_, time and place where an image was recorded, or the owner of an image file's content. Whenever possible, application programs should store data in -standard attributes, instead of defining their own. For a current list -of all standard attributes, see the OpenEXR library's source code. The -list grows over time as OpenEXR users identify new types of data they -would like to represent in a standard way. +standard attributes, instead of defining their own. + +By default, OpenEXR files have the following attributes: + +**chromaticities** + For RGB images, specifies the CIE (x,y) chromaticities of the + primaries and the white point. + +**whiteLuminance** + For RGB images, defines the luminance, in Nits (candelas per square + meter) of the RGB value (1.0, 1.0, 1.0). + + If the chromaticities and the whiteLuminance of an RGB image are + known, then it is possible to convert the image's pixels from RGB to + CIE XYZ tristimulus values. + +**adoptedNeutral** + Specifies the CIE (x,y) coordinates that should be considered + neutral during color rendering. Pixels in the image file whose + (x,y) coordinates match the adoptedNeutral value should be mapped to + neutral values on the display. + + +**renderingTransform**, lookModTransform + Specify the names of the CTL functions that implements the intended + color rendering and look modification transforms for this image. + +**xDensity** + Horizontal output density, in pixels per inch. The image's vertical + output density is xDensity * pixelAspectRatio. + +**owner** + Name of the owner of the image. + +**comments** + Additional image information in human-readable form, for example a + verbal description of the image. + +**capDate** + The date when the image was created or captured, in local time, and + formatted as ``YYYY:MM:DD hh:mm:ss``, where ``YYYY`` is the year (4 + digits, e.g. 2003), ``MM`` is the month (2 digits, 01, 02, ... 12), + ``DD`` is the day of the month (2 digits, 01, 02, ... 31), hh is the + hour (2 digits, 00, 01, ... 23), mm is the minute, and ss is the + second (2 digits, 00, 01, ... 59). + +**utcOffset** + Universal Coordinated Time (UTC), in seconds: UTC == local time + + utcOffset + +**longitude**, **latitude**, **altitude** + For images of real objects, the location where the image was + recorded. Longitude and latitude are in degrees east of Greenwich + and north of the equator. Altitude is in meters above sea level. + For example, Kathmandu, Nepal is at longitude 85.317, latitude + 27.717, altitude 1305. + +**focus** + The camera's focus distance, in meters. + +**exposure** + Exposure time, in seconds. + +**aperture** + The camera's lens aperture, in f-stops (focal length of the lens + divided by the diameter of the iris opening). + +**isoSpeed** + The ISO speed of the film or image sensor that was used to record + the image. + +**envmap** + If this attribute is present, the image represents an environment + map. The attribute's value defines how 3D directions are mapped to + 2D pixel locations. + +**keyCode** + For motion picture film frames. Identifies film manufacturer, film + type, film roll and frame position within the roll. + +**timeCode** + Time and control code + +**wrapmodes** + Determines how texture map images are extrapolated. If an OpenEXR + file is used as a texture map for 3D rendering, texture coordinates + (0.0, 0.0) and (1.0, 1.0) correspond to the upper left and lower + right corners of the data window. If the image is mapped onto a + surface with texture coordinates outside the zero-to-one range, then + the image must be extrapolated. This attribute tells the renderer + how to do this extrapolation. The attribute contains either a pair + of comma-separated keywords, to specify separate extrapolation modes + for the horizontal and vertical directions; or a single keyword, to + specify extrapolation in both directions (e.g. "clamp,periodic" or + "clamp"). Extra white space surrounding the keywords is allowed, + but should be ignored by the renderer ("clamp, black " is equivalent + to "clamp,black"). The keywords listed below are predefined; some + renderers may support additional extrapolation modes: + + **black** + pixels outside the zero-to-one range are black + + **clamp** + texture coordinates less than 0.0 and greater than 1.0 are clamped + to 0.0 and 1.0 respectively. + + **periodic** + the texture image repeats periodically + + **mirror** + the texture image repeats periodically, but every other instance + is mirrored + +**framesPerSecond** + Defines the nominal playback frame rate for image sequences, in + frames per second. Every image in a sequence should have a + framesPerSecond attribute, and the attribute value should be the + same for all images in the sequence. If an image sequence has no + framesPerSecond attribute, playback software should assume that the + frame rate for the sequence is 24 frames per second. + + In order to allow exact representation of NTSC frame and field + rates, framesPerSecond is stored as a rational number. A rational + number is a pair of integers, n and d, that represents the value + n/d. + +**multiView** + Defines the view names for multi-view image files. A multi-view + image contains two or more views of the same scene, as seen from + different viewpoints, for example a left-eye and a right-eye view + for stereo displays. The multiView attribute lists the names of the + views in an image, and a naming convention identifies the channels + that belong to each view. + +**worldToCamera** + For images generated by 3D computer graphics rendering, a matrix + that transforms 3D points from the world to the camera coordinate + space of the renderer. + + The camera coordinate space is left-handed. Its origin indicates + the location of the camera. The positive x and y axes correspond to + the "right" and "up" directions in the rendered image. The positive + z axis indicates the camera's viewing direction. (Objects in front + of the camera have positive z coordinates.) + + Camera coordinate space in OpenEXR is the same as in Pixar's + Renderman. + +**worldToNDC** + For images generated by 3D computer graphics rendering, a matrix + that transforms 3D points from the world to the Normalized Device + Coordinate (NDC) space of the renderer. + + NDC is a 2D coordinate space that corresponds to the image plane, + with positive x and pointing to the right and y positive pointing + down. The coordinates (0, 0) and (1, 1) correspond to the upper + left and lower right corners of the OpenEXR display window. + + To transform a 3D point in word space into a 2D point in NDC space, + multiply the 3D point by the worldToNDC matrix and discard the z + coordinate. + + NDC space in OpenEXR is the same as in Pixar's Renderman. + +**deepImageState** + Specifies whether the pixels in a deep image are sorted and + non-overlapping. + + Note: this attribute can be set by application code that writes a + file in order to tell applications that read the file whether the + pixel data must be cleaned up prior to image processing operations + such as flattening. The OpenEXR library does not verify that the + attribute is consistent with the actual state of the pixels. + Application software may assume that the attribute is valid, as long + as the software will not crash or lock up if any pixels are + inconsistent with the deepImageState attribute. + +**originalDataWindow** + If application software crops an image, then it should save the data + window of the original, un-cropped image in the originalDataWindow + attribute. + +**dwaCompressionLevel** + Sets the quality level for images compressed with the DWAA or DWAB + method. + +**ID Manifest** + ID manifest. See `A scheme for storing object ID manifests in + openEXR images + `_ for details. + Premultiplied vs. Un-Premultiplied Color Channels ------------------------------------------------- @@ -1127,7 +1307,7 @@ represent alpha or opacity: 0.0 means the pixel is transparent; 1.0 means the pixel is opaque. By convention, all color channels are premultiplied by alpha, so that - composite = foreground + (1-alpha) × background +.. math:: \text{composite} = \text{foreground} + (1-\text{alpha}) × \text{background} performs a correct "over" operation. @@ -1135,7 +1315,7 @@ Describing the color channels as "premultiplied" is a shorthand for describing a correct "over" operation. With un-premultiplied color channels "over" operations would require computing - composite = alpha × foreground + (1-alpha) × background. +.. math:: \text{composite} = \text{alpha} × \text{foreground} + (1-\text{alpha}) × \text{background}. "Premultiplied" does not mean that pixels with zero alpha and non-zero color channels are illegal. Such a pixel represents an object that @@ -1158,7 +1338,7 @@ alpha. After reading an OpenEXR image such an application must undo the premultiplication by dividing the color channels by alpha. This division fails when alpha is zero. The application software could set all color channels to zero wherever the alpha channel is zero, but -this might alter the image in an irreversable way. For example, the +this might alter the image in an irreversible way. For example, the flame on top of a candle would simply disappear and could not be recovered. @@ -1172,21 +1352,6 @@ when the image is saved in a new OpenEXR file. Depending on the application software there may be other ways to preserve color information in pixels with zero alpha. -Credits -======= - -The ILM OpenEXR file format was designed and implemented by Florian -Kainz, Wojciech Jarosz, and Rod Bogart. The PIZ compression scheme is -based on an algorithm by Christian Rouet. Josh Pines helped extend the -PIZ algorithm for 16-bit and found optimizations for the float-to-half -conversions. Drew Hess packaged and adapted ILM's internal source code -for public release and maintains the OpenEXR software -distribution. The PXR24 compression method is based on an algorithm -written by Loren Carpenter at Pixar Animation Studios. - -OpenEXR was developed at Industrial Light & Magic, a division of Lucas -Digital Ltd. LLC, Marin County, California. - .. [1] ``Z`` and ``ZBack`` distances are the z-coordinate of the point in camera space (that is, the distance to plane on which point lies), not the diff --git a/docs/TheoryDeepPixels.rst b/docs/TheoryDeepPixels.rst index 1976a29c9c..86d657b232 100644 --- a/docs/TheoryDeepPixels.rst +++ b/docs/TheoryDeepPixels.rst @@ -1,11 +1,17 @@ +.. + SPDX-License-Identifier: BSD-3-Clause + Copyright Contributors to the OpenEXR Project. + Theory of Deep Samples ###################### -This document derives the techniques for splitting and combining two non-solid samples of -equal depth and thickness. These should should be used by deep image "flattening" algorithms to compute the combined colour of two samples. The formulas are defined in the document :doc:`InterpretingDeepPixels`. This document derives those formulas, and is for information only. - - +This document derives the techniques for splitting and combining two +non-solid samples of equal depth and thickness. These should should be +used by deep image "flattening" algorithms to compute the combined +colour of two samples. The formulas are defined in the document +:doc:`InterpretingDeepPixels`. This document derives those formulas, +and is for information only. Definitions =========== @@ -92,7 +98,7 @@ Alpha vs Transparency OpenEXR images use alpha :math:`\alpha` instead of transparency. :math:`T=1-\alpha`: if :math:`\alpha=1` (so :math:`T=0`) then all light is absorbed; if :math:`\alpha=0` (so :math:`T=1`), then all light is -transmitted and the material is transparent. Subsituting :math:`T` into :eq:`absorb` and :eq:`two` combined alpha of two objects is given by the *screen* compositing operation: +transmitted and the material is transparent. Substituting :math:`T` into :eq:`absorb` and :eq:`two` combined alpha of two objects is given by the *screen* compositing operation: .. math:: \alpha_c = 1-(1-\alpha_1)(1-\alpha_2) diff --git a/docs/about.rst b/docs/about.rst new file mode 100644 index 0000000000..b1d0e83440 --- /dev/null +++ b/docs/about.rst @@ -0,0 +1,130 @@ +.. + SPDX-License-Identifier: BSD-3-Clause + Copyright Contributors to the OpenEXR Project. + +.. _About OpenEXR: + +About OpenEXR +============= + +.. toctree:: + :caption: About + +.. sidebar:: + + .. image:: images/OpenEXR_Reel_2020.png + :target: https://www.youtube.com/embed/X0khNMmEJEI + :width: 325 + +OpenEXR is a project of the `Academy Software Foundation +`_. The format and library were originally +developed at Industrial Light & Magic and first released as open +source in 2003. Weta Digital, Walt Disney Animation Studios, Sony +Pictures Imageworks, Pixar Animation Studios, DreamWorks, and other +studios, companies, and individuals have made contributions to the +code base. + +Read the origin story of OpenEXR on the `ASWF Blog +`_. + +OpenEXR is included in the `VFX Reference Platform `_. + +OpenEXR Features +---------------- + +* High dynamic range and color precision. +* Support for 16-bit floating-point, 32-bit floating-point, and + 32-bit integer pixels. +* Multiple image compression algorithms, both lossless and lossy. Some of + the included codecs can achieve 2:1 lossless compression ratios on images + with film grain. The lossy codecs have been tuned for visual quality and + decoding performance. +* Extensibility. New compression codecs and image types can easily be added + by extending the C++ classes included in the OpenEXR software distribution. + New image attributes (strings, vectors, integers, etc.) can be added to + OpenEXR image headers without affecting backward compatibility with + existing OpenEXR applications. +* Support for stereoscopic image workflows and a generalization + to multi-views. +* Flexible support for deep data: pixels can store a variable-length list + of samples and, thus, it is possible to store multiple values at different + depths for each pixel. Hard surfaces and volumetric data representations + are accommodated. +* Multipart: ability to encode separate, but related, images in one file. + This allows for access to individual parts without the need to read other + parts in the file. +* Versioning: OpenEXR source allows for user configurable C++ + namespaces to provide protection when using multiple versions of the + library in the same process space. + +OpenEXR and Imath Version 3 +---------------------------- + +With the release of OpenEXR 3, the Imath library formerly distributed +via the IlmBase component of OpenEXR is now an independent library +dependency, available for download from +https://github.com/AcademySoftwareFoundation/Imath. You can choose to +build OpenEXR against an external installation of Imath, or the +default CMake configuration will download and build it automatically +during the OpenEXR build process. Note that the half 16-bit floating +point data type is included in Imath. + +See :doc:`PortingGuide` for details about differences from previous +releases and how to address them. Also refer to the porting guide for +details about changes to Imath. + +New Features in OpenEXR v3.1 +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The 3.1 release of OpenEXR introduces a new library, OpenEXRCore, +which is the result of a significant re-thinking of how OpenEXR +manages file I/O and provides access to image data. It begins to +address long-standing scalability issues with multithreaded image +reading and writing. + +The OpenEXRCore library provides thread-safe, non-blocking access to +files, which was not possible with the current API, where the +framebuffer management is separate from read requests. It is written +entirely in C and provides a new C-language API alongside the existing +C++ API. This new low-level API allows applications to do custom +unpacking of EXR data, such as on the GPU, while still benefiting from +efficient I/O, file validation, and other semantics. It provides +efficient direct access to EXR files in texturing applications. This C +library also introduces an easier path to implementing OpenEXR +bindings in other languages, such as Rust. + +The 3.1 release represents a technology preview for upcoming +releases. The initial release is incremental; the existing API and +underlying behavior has not changed. The new API is available now for +performance validation testing, and then in future OpenEXR releases, +the C++ API will migrate to use the new core in stages. It is not the +intention to entirely deprecate the C++ API, nor must all applications +re-implement EXR I/O in terms of the C library. The C API does not, +and will not, provide the rich set of utility classes that exist in +the C++ layer. The 3.1 release of the OpenEXRCore library simply +offers new functionality for specialty applications seeking the +highest possible performance. In the future, the ABI will evolve, but +the API will remain consistent, or only have additions. + +See :doc:`ReadingAndWritingImageFiles` for more information. + +Credits +======= + +The ILM OpenEXR file format was originally designed and implemented at +Industrial Light & Magic by Florian Kainz, Wojciech Jarosz, and Rod +Bogart. The PIZ compression scheme is based on an algorithm by +Christian Rouet. Josh Pines helped extend the PIZ algorithm for 16-bit +and found optimizations for the float-to-half conversions. Drew Hess +packaged and adapted ILM's internal source code for public release and +maintains the OpenEXR software distribution. The PXR24 compression +method is based on an algorithm written by Loren Carpenter at Pixar +Animation Studios. + +For a complete list of contributors see the `CONTRIBUTORS.md +`_ +file. + + + + diff --git a/docs/concepts.rst b/docs/concepts.rst new file mode 100644 index 0000000000..65fb979280 --- /dev/null +++ b/docs/concepts.rst @@ -0,0 +1,21 @@ +.. + SPDX-License-Identifier: BSD-3-Clause + Copyright Contributors to the OpenEXR Project. + +.. _OpenEXR Concepts: + +OpenEXR Concepts +################ + +.. toctree:: + :caption: Concepts + :maxdepth: 2 + + TechnicalIntroduction + StandardOptionalAttributes + MultiViewOpenEXR + InterpretingDeepPixels + TheoryDeepPixels + OpenEXRFileLayout + PortingGuide + SymbolVisibility diff --git a/docs/conf.py b/docs/conf.py index 5116b678db..30f240c194 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,4 +1,8 @@ #!/usr/bin/env python3 + +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) Contributors to the OpenEXR Project. + # -*- coding: utf-8 -*- # # ReadTheDocs-Breathe documentation build configuration file, created by @@ -139,9 +143,19 @@ #html_theme = 'agogo' #html_theme = 'default' # good #html_theme = 'nature' # too green -html_theme = 'bizstyle' # OK #html_theme = 'sphinxdoc' +html_theme = 'bizstyle' # OK + +html_theme = "press" +html_theme_options = { + "external_links": [ + ("Github", "https://github.com/AcademySoftwareFoundation/openexr"), + ] +} + + + # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. @@ -159,12 +173,12 @@ # The name of an image file (relative to this directory) to place at the top # of the sidebar. -html_logo = "images/openexr-stacked-color.png" +html_logo = "images/openexr-horizontal-color.png" # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. -#html_favicon = None +html_favicon = "images/openexr-fav.ico" # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, diff --git a/docs/images/OpenEXR_Reel_2020.png b/docs/images/OpenEXR_Reel_2020.png new file mode 100644 index 0000000000..7ca1807fc8 Binary files /dev/null and b/docs/images/OpenEXR_Reel_2020.png differ diff --git a/docs/images/openexr-fav.ico b/docs/images/openexr-fav.ico new file mode 100644 index 0000000000..96cf23a802 Binary files /dev/null and b/docs/images/openexr-fav.ico differ diff --git a/docs/images/openexr-horizontal-color.png b/docs/images/openexr-horizontal-color.png new file mode 100644 index 0000000000..6974a631cd Binary files /dev/null and b/docs/images/openexr-horizontal-color.png differ diff --git a/docs/images/windowExample1.small.png b/docs/images/windowExample1.small.png new file mode 100644 index 0000000000..ab366578e7 Binary files /dev/null and b/docs/images/windowExample1.small.png differ diff --git a/docs/index.rst b/docs/index.rst index 98fb08d942..c1128efdb6 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,9 +1,19 @@ -OpenEXR |version| Technical Documentation -========================================= +.. + SPDX-License-Identifier: BSD-3-Clause + Copyright Contributors to the OpenEXR Project. -.. sidebar:: OpenEXR +.. _OpenEXR: - .. image:: images/windowExample1.png +OpenEXR +####### + +.. toctree:: + :caption: OpenEXR + :maxdepth: 1 + +.. sidebar:: + + .. image:: images/windowExample1.small.png OpenEXR provides the specification and reference implementation of the EXR file format, the professional-grade image storage format of the @@ -17,69 +27,76 @@ OpenEXR is widely used in host application software where accuracy is critical, such as photorealistic rendering, texture access, image compositing, deep compositing, and DI. -OpenEXR Features - -* High dynamic range and color precision. -* Support for 16-bit floating-point, 32-bit floating-point, and - 32-bit integer pixels. -* Multiple image compression algorithms, both lossless and lossy. Some of - the included codecs can achieve 2:1 lossless compression ratios on images - with film grain. The lossy codecs have been tuned for visual quality and - decoding performance. -* Extensibility. New compression codecs and image types can easily be added - by extending the C++ classes included in the OpenEXR software distribution. - New image attributes (strings, vectors, integers, etc.) can be added to - OpenEXR image headers without affecting backward compatibility with - existing OpenEXR applications. -* Support for stereoscopic image workflows and a generalization - to multi-views. -* Flexible support for deep data: pixels can store a variable-length list - of samples and, thus, it is possible to store multiple values at different - depths for each pixel. Hard surfaces and volumetric data representations - are accommodated. -* Multipart: ability to encode separate, but related, images in one file. - This allows for access to individual parts without the need to read other - parts in the file. -* Versioning: OpenEXR source allows for user configurable C++ - namespaces to provide protection when using multiple versions of the - library in the same process space. - -Technical Documents -################### +OpenEXR is a project of the `Academy Software Foundation +`_. -.. toctree:: - :maxdepth: 1 - TechnicalIntroduction - ReadingAndWritingImageFiles - OpenEXRCoreAPI - OpenEXRFileLayout - MultiViewOpenEXR - InterpretingDeepPixels - TheoryDeepPixels - StandardOptionalAttributes - -* :ref:`genindex` +Imath +===== -Resources -######### +The OpenEXR project includes `Imath `_, +a basic, light-weight, and efficient C++ representation of 2D and 3D +vectors and matrices and other simple but useful mathematical objects, +functions, and data types common in computer graphics applications, +including the `half +`_ 16-bit +floating-point type. -- Download: https://github.com/AcademySoftwareFoundation/openexr -- Install Help: `INSTALL.md `_ -- Porting Help: `Imath/OpenEXR Version 2->3 Porting Guide `_ -- License: `BSD License `_ -- Reference images: https://github.com/AcademySoftwareFoundation/openexr-images +Imath also includes optional python bindings for all types and +functions, including optimized implementations of vector and matrix +arrays. -About OpenEXR -############# +Quick Start +=========== -OpenEXR is a project of the `Academy Software Foundation -`_. The format and library were originally -developed by Industrial Light & Magic and first released in 2003. -Weta Digital, Walt Disney Animation Studios, Sony Pictures Imageworks, -Pixar Animation Studios, DreamWorks, and other studios, companies, and -individuals have made contributions to the code base. +For a simple program that uses the C++ API to read and write a ``.exr`` file, see the +:doc:`HelloWorld` examples. + +Community +========= + +* **Ask a question:** + + - Email: `openexr-dev@lists.aswf.io `_ -OpenEXR is included in the `VFX Reference Platform `_. + - Slack: `academysoftwarefdn#openexr `_ + +* **Attend a meeting:** + + - Technical Steering Committee meetings are open to the + public, fortnightly on Thursdays, 1:30pm Pacific Time. + + - Calendar: https://lists.aswf.io/g/openexr-dev/calendar + +* **Report a bug:** + + - Submit an Issue: https://github.com/AcademySoftwareFoundation/openexr/issues + +* **Report a security vulnerability:** + + - Email security@openexr.com + +* **Contribute a Fix, Feature, or Improvement:** + + - Read the `Contribution Guidelines + `_ + and `Code of Conduct + `_ + + - Sign the `Contributor License Agreement + `_ + + - Submit a Pull Request: https://github.com/AcademySoftwareFoundation/openexr/pulls + +Resources +========= + +- Reference images: https://github.com/AcademySoftwareFoundation/openexr-images +- Security policy: `SECURITY.md `_ +- Release notes: `CHANGES.md + `_ +- Contributors: `CONTRIBUTORS.md `_ +- Porting Guide: :doc:`PortingGuide` + +.. include:: toc_redirect.rst - diff --git a/INSTALL.md b/docs/install.rst similarity index 54% rename from INSTALL.md rename to docs/install.rst index ad8dbb502d..a601fc714c 100644 --- a/INSTALL.md +++ b/docs/install.rst @@ -1,26 +1,54 @@ -# Building and Installation +.. + SPDX-License-Identifier: BSD-3-Clause + Copyright Contributors to the OpenEXR Project. -## Download +.. _Install: -To build the latest release of OpenEXR, begin by downloading the -source from the GitHub Releases page: -https://github.com/AcademySoftwareFoundation/openexr/releases. +Install +======== -To build from the latest development version, which may not be stable, -clone the GitHub repo and build from the master branch: +.. toctree:: + :caption: Install + +The OpenEXR library is available for download and installation in +binary form via package managers on many Linux distributions. See +`https://pkgs.org/download/openexr +`_ for a complete list. The common +ones that generally provide current releases include: - % git clone https://github.com/AcademySoftwareFoundation/openexr +* `Fedora `_ +* `Gentoo `_ +* `Ubuntu `_ -You can alternatively download the repository tarball file either via -a browser, or on the Linux/macOS via the command line using ``wget`` -or ``curl``: +Beware that some distributions are out of date and only provide +distributions of outdated releases OpenEXR. We recommend against using +OpenEXR v2, and we *strongly* recommend against using OpenEXR v1. - % curl -L https://github.com/AcademySoftwareFoundation/openexr/tarball/master | tar xv +On macOS, we do not recommend installation via HomeBrew because the +distribution is outdated. -In the instructions that follow, we will refer to the top-level -directory of the source code tree as ``$openexr_source_directory``. +Also note that the official OpenEXR project does not provide supported +python bindings. ``pip install openexr`` installs the `openexrpython +`_ module, which is not +affiliated with the OpenEXR project or the ASWF. Please direct +questions there. -## Prerequisites +Build from Source +----------------- + +OpenEXR builds on Linux, macOS, Microsoft Windows via CMake, and is +cross-compilable on other systems. + +Download the source from the `GitHub releases page +`_ +page, or clone the `repo `_. + +The ``release`` branch of the repo always points to the most advanced +release. + + +Prerequisites +~~~~~~~~~~~~~ Make sure these are installed on your system before building OpenEXR: @@ -34,21 +62,29 @@ The instructions that follow describe building OpenEXR with CMake. Note that as of OpenEXR 3, the Gnu autoconf bootstrap/configure build system is no longer supported. -## Linux/macOS Quick Start +Linux/macOS +~~~~~~~~~~~ -To build via CMake, first choose a location for the build directory, -which we will refer to as ``$build_directory``. +To build via CMake, you need to first identify three directories: - % mkdir $build_directory - % cd $build_directory - % cmake $openexr_source_directory - % make - % make install +1. The source directory, i.e. the top-level directory of the + downloaded source archive or cloned repo, referred to below as ``$srcdir`` +2. A temporary directory to hold the build artifacts, referred to below as + ``$builddir`` +3. A destination directory into which to install the + libraries and headers, referred to below as ``$installdir``. + +To build: +.. code-block:: + + $ cd $builddir + $ cmake $srcdir --install-prefix $installdir + $ cmake --build $builddir --target install --config Release Note that the CMake configuration prefers to apply an out-of-tree build process, since there may be multiple build configurations (i.e. debug and release), one per folder, all pointing at once source -tree, hence the ``$build_directory`` noted above, referred to in CMake +tree, hence the ``$builddir`` noted above, referred to in CMake parlance as the *build directory*. You can place this directory wherever you like. @@ -58,7 +94,8 @@ no arguments, as above, ``make install`` installs the header files in ``/usr/local/include``, the object libraries in ``/usr/local/lib``, and the executable programs in ``/usr/local/bin``. -## Windows Quick Start +Windows +~~~~~~~ Under Windows, if you are using a command line-based setup, such as cygwin, you can of course follow the above. For Visual Studio, cmake @@ -69,39 +106,12 @@ installs the headers, libraries, and programs into ``/usr/local``, but you can specify a local install directory to cmake via the ``CMAKE_INSTALL_PREFIX`` variable: - % cmake .. -DCMAKE_INSTALL_PREFIX=$openexr_install_directory - -## Porting Applications from OpenEXR v2 to v3 - -See the [porting -guide](https://github.com/AcademySoftwareFoundation/Imath/blob/master/docs/PortingGuide2-3.md) -for details about differences from previous releases and how to -address them. Also refer to the porting guide for details about -changes to Imath. +.. code-block:: -## Documentation - -The OpenEXR technical documentation at -[openexr.readthedocs.io](https://openexr.readthedocs.io) is generated -via [Sphinx](https://www.sphinx-doc.org) with the -[Breathe](https://breathe.readthedocs.io) extension using information -extracted from header comments by [Doxgen](https://www.doxygen.nl). - -To build the documentation locally from the source headers and -``.rst`` files, set the CMake option ``DOCS=ON``. This adds -``Doxygen`` and ``Sphinx`` CMake targets. Local documentation -generation is off by default. - -Building the documentation requires that sphinx, breathe, and doxygen -are installed. - -Note that the [openexr.readthedocs.io](https://openexr.readthedocs.io) -documentation takes the place of the formerly distributed .pdf -documents in the ``docs`` folder, although readthedocs supports -downloading of documentation in pdf format, for those who prefer it -that way. + $ cmake .. -DCMAKE_INSTALL_PREFIX=$openexr_install_directory -## Library Names +Library Names +------------- By default the installed libraries follow a pattern for how they are named. This is done to enable multiple versions of the library to be @@ -114,105 +124,137 @@ If you are building dynamic libraries, once you have configured, built, and installed the libraries, you should see the following pattern of symlinks and files in the install lib folder: +.. code-block:: + libOpenEXR.so -> libOpenEXR-3_1.so libOpenEXR-3_1.so -> libOpenEXR-3_1.so.30 libOpenEXR-3_1.so.30 -> libOpenEXR-3_1.so.30.3.0 libOpenEXR-3_1.so.30.3.0 (the shared object file) The ``-3_1`` suffix encodes the major and minor version, which can be -configured via the ``OPENEXR_LIB_SUFFIX`` CMake setting. The "30" +configured via the ``OPENEXR_LIB_SUFFIX`` CMake setting. The ``30`` corresponds to the so version, or in ``libtool`` terminology the -_current_ shared object version; the "3" denotes the ``libtool`` -_revision_, and the "0" denotes the ``libtool`` _age_. See the -[``libtool``](https://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html#Updating-version-info) +``current`` shared object version; the `3` denotes the ``libtool`` +``revision``, and the ``0`` denotes the ``libtool`` ``age``. See the +`libtool +`_ documentation for more details. -## Imath Dependency +Imath Dependency +---------------- -OpenEXR depends on -[Imath](https://github.com/AcademySoftwareFoundation/Imath). If a -suitable installation of Imath cannot be found, CMake will -automatically download it at configuration time. To link against an -existing installation of Imath, add the Imath directory to the +OpenEXR depends on `Imath +`_. If a suitable +installation of Imath cannot be found, CMake will automatically +download it at configuration time. To link against an existing +installation of Imath, add the Imath directory to the ``CMAKE_PREFIX_PATH`` setting: - % mkdir $build_directory - % cd $build_directory - % cmake -DCMAKE_PREFIX_PATH=$imath_install_directory \ +.. code-block:: + + $ mkdir $build_directory + $ cd $build_directory + $ cmake -DCMAKE_PREFIX_PATH=$imath_install_directory \ -DCMAKE_INSTALL_PREFIX=$openexr_install_destination \ $openexr_source_directory - % cmake --build . --target install --config Release + $ cmake --build . --target install --config Release Alternatively, you can specify the ``Imath_DIR`` variable: - % mkdir $build_directory - % cd $build_directory - % cmake -DImath_DIR=$imath_config_directory \ +.. code-block:: + + $ mkdir $build_directory + $ cd $build_directory + $ cmake -DImath_DIR=$imath_config_directory \ -DCMAKE_INSTALL_PREFIX=$openexr_install_destination \ $openexr_source_directory - % cmake --build . --target install --config Release + $ cmake --build . --target install --config Release Note that ``Imath_DIR`` should point to the directory that includes the ``ImathConfig.cmake`` file, which is typically the ``lib/cmake/Imath`` folder of the root install directory where Imath is installed. -Please see ``cmake/OpenEXRSetup.cmake`` for other customization options. +See below for other customization options. -## Custom Namespaces +Porting Applications from OpenEXR v2 to v3 +------------------------------------------ -If you are interested in controlling custom namespace declarations or -similar options, you are encouraged to look at the ``CMakeLists.txt`` -infrastructure. The settings can be found in -``cmake/OpenEXRSetup.cmake``. As per usual, these settings can also be -seen and/or edited using any of the various gui editors for working -with cmake such as ``ccmake``, ``cmake-gui``, as well as some of the -IDEs in common use. +See the :doc:`PortingGuide` for details about differences from previous +releases and how to address them. Also refer to the porting guide for +details about changes to Imath. -## Cross Compiling / Specifying Specific Compilers +Building the Documentation +-------------------------- -When trying to either cross-compile for a different platform, or for -tasks such as specifying a compiler set to match the [VFX reference -platform](https://vfxplatform.com), cmake provides the idea of a -toolchain which may be useful instead of having to remember a chain of -configuration options. It also means that platform-specific compiler -names and options are out of the main cmake file, providing better -isolation. +The OpenEXR technical documentation at `https://openexr.readthedocs.io +`_ is generated via `Sphinx +`_ with the `Breathe +`_ extension using information +extracted from header comments by `Doxygen `_. -A toolchain file is simply just a cmake script that sets all the -compiler and related flags and is run very early in the configuration -step to be able to set all the compiler options and such for the -discovery that cmake performs automatically. These options can be set -on the command line still if that is clearer, but a theoretical -toolchain file for compiling for VFX Platform 2015 is provided in the -source tree at cmake/Toolchain-Linux-VFX_Platform15.cmake which will -hopefully provide a guide how this might work. +To build the documentation locally from the source headers and +``.rst`` files, set the CMake option ``BUILD_DOCS=ON``. This adds +``Doxygen`` and ``Sphinx`` CMake targets and enables building the docs +by default. generation is off by default. -For cross-compiling for additional platforms, there is also an -included sample script in cmake/Toolchain-mingw.cmake which shows how -cross compiling from Linux for Windows may work. The compiler names -and paths may need to be changed for your environment. +Building the documentation requires that ``sphinx``, ``breathe``, and +``doxygen`` are installed. It further requires the `sphinx-press-theme +`_, as indicated in the +`requirements.txt +`_ +file. -More documentation: +See the `doxygen downloads page +`_ for how to install it. Binary +distributions are available for many systems, so you likely do not +need to build from source. On Debian/Ubuntu, for example: -* Toolchains: https://cmake.org/cmake/help/v3.12/manual/cmake-toolchains.7.html -* Cross compiling: https://gitlab.kitware.com/cmake/community/wikis/doc/cmake/ +.. code-block:: + + $ sudo apt-get install doxygen + +Similarly, see the `sphinx installation page +`_ for +how to install it. On Debian/Ubuntu: + +.. code-block:: + + $ sudo apt-get install python3-sphinx + +And to install `sphinx-press-theme +`_: + +.. code-block:: + + $ pip3 install sphinx_press_theme + +Note that the `https://openexr.readthedocs.io `_ +documentation takes the place of the formerly distributed .pdf +documents in the ``docs`` folder, although readthedocs supports +downloading of documentation in pdf format, for those who prefer it +that way. + +CMake Build-time Configuration Options +-------------------------------------- -## CMake Configuration Options The default CMake configuration options are stored in ``cmake/OpenEXRSetup.cmake``. To see a complete set of option variables, run: - % cmake -LAH $openexr_source_directory +.. code-block:: + + $ cmake -LAH $openexr_source_directory You can customize these options three ways: 1. Modify the ``.cmake`` files in place. 2. Use the UI ``cmake-gui`` or ``ccmake``. -2. Specify them as command-line arguments when you invoke cmake. +3. Specify them as command-line arguments when you invoke cmake. -### Library Naming Options: +Library Naming Options +~~~~~~~~~~~~~~~~~~~~~~ * ``OPENEXR_LIB_SUFFIX`` @@ -220,7 +262,8 @@ You can customize these options three ways: libraries. Default is ``-_`` version string. Please see the section on library names -### Imath Dependency: +Imath Dependency +~~~~~~~~~~~~~~~~ * ``CMAKE_PREFIX_PATH`` @@ -236,7 +279,8 @@ You can customize these options three ways: file, which is typically the ``lib/cmake/Imath`` folder of the root install directory. -### Namespace Options: +Namespace Options +~~~~~~~~~~~~~~~~~ * ``OPENEXR_IMF_NAMESPACE`` @@ -277,7 +321,8 @@ You can customize these options three ways: Whether the namespace has been customized (so external users know) -### Component Options: +Component Options +~~~~~~~~~~~~~~~~~ * ``BUILD_TESTING`` @@ -298,10 +343,10 @@ You can customize these options three ways: Build and install the example code. Default is ``ON``. -### Additional CMake Options: +Additional CMake Options +~~~~~~~~~~~~~~~~~~~~~~~~ -See the cmake documentation for more information -(https://cmake.org/cmake/help/v3.12/) +See the CMake documentation for more information (https://cmake.org/cmake/help/v3.12/). * ``CMAKE_BUILD_TYPE`` @@ -343,15 +388,44 @@ See the cmake documentation for more information Echo all compile commands during make. Default is ``OFF``. -## Cmake Tips and Tricks: +Cross Compiling / Specifying Specific Compilers +----------------------------------------------- + +When trying to either cross-compile for a different platform, or for +tasks such as specifying a compiler set to match the `VFX reference +platform `_, cmake provides the idea of a +toolchain which may be useful instead of having to remember a chain of +configuration options. It also means that platform-specific compiler +names and options are out of the main cmake file, providing better +isolation. + +A toolchain file is simply just a cmake script that sets all the +compiler and related flags and is run very early in the configuration +step to be able to set all the compiler options and such for the +discovery that cmake performs automatically. These options can be set +on the command line still if that is clearer, but a theoretical +toolchain file for compiling for VFX Platform 2015 is provided in the +source tree at ``cmake/Toolchain-Linux-VFX_Platform15.cmake`` which +will hopefully provide a guide how this might work. + +For cross-compiling for additional platforms, there is also an +included sample script in ``cmake/Toolchain-mingw.cmake`` which shows +how cross compiling from Linux for Windows may work. The compiler +names and paths may need to be changed for your environment. + +More documentation: + +* Toolchains: https://cmake.org/cmake/help/v3.12/manual/cmake-toolchains.7.html +* Cross compiling: https://gitlab.kitware.com/cmake/community/wikis/doc/cmake/ + +Ninja +----- -If you have ninja (https://ninja-build.org/) installed, it is faster +If you have `Ninja `_ installed, it is faster than make. You can generate ninja files using cmake when doing the initial generation: - % cmake -G “Ninja” .. +.. code-block:: -If you would like to confirm compile flags, you don’t have to specify -the verbose configuration up front, you can instead run + $ cmake -G “Ninja” .. - % make VERBOSE=1 diff --git a/docs/license.rst b/docs/license.rst new file mode 100644 index 0000000000..f6e0227d78 --- /dev/null +++ b/docs/license.rst @@ -0,0 +1,33 @@ +.. + SPDX-License-Identifier: BSD-3-Clause + Copyright Contributors to the OpenEXR Project. + +.. _License: + +License +======= + +.. toctree:: + :caption: License + +OpenEXR is licensed under the BSD-3-Clause license. Contributions to the +library should abide by that license unless otherwised approved by the OCIO +TSC and ASWF Governing Board. + +See `LICENSE.md +`__ +on GitHub. + +Copyright (c) Contributors to the OpenEXR Project. All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + +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. + +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. + +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/docs/news.rst b/docs/news.rst new file mode 100644 index 0000000000..1e13858500 --- /dev/null +++ b/docs/news.rst @@ -0,0 +1,1465 @@ +.. + SPDX-License-Identifier: BSD-3-Clause + Copyright Contributors to the OpenEXR Project. + +.. _News: + +.. _release notes: https://github.com/AcademySoftwareFoundation/openexr/blob/main/CHANGES.md +.. _imath release notes: https://github.com/AcademySoftwareFoundation/Imath/blob/main/CHANGES.md + +News +#### + +.. toctree:: + :caption: News + +Nov 7, 2022 - Imath v3.1.6 Released +=================================== + +Patch release with miscellaneous bug/doc/build fixes. + +* fix memory leak in ``V3fArrayFromBuffer`` +* Add ```` for ``int64_t`` +* Initialize ``x`` in ``testRoots.cpp:solve()`` to suppress compiler warning +* Fix gcc compiler warning in ``testFun.cpp`` +* Test return value of ``extractSHRT`` to avoid uninitialized reference +* Fix example code so it compiles as is +* Cuda safety in several headers +* Fix markdown and typos in ``README.md`` +* Do not warn if half.h has already being included +* Fix compiler warnings on windows +* Remove irrelevant cvs ignore files +* Update sphinx version + +April 11, 2022 - OpenEXR v3.1.5 Released +======================================== + +Patch release that address various bug/build/doc issues: + +* Add backwards-compatibilty flags to the core library to match + original behavior of the the c++ library. Fixes reading of certain + files by the new core. +* Fix build failures on MSVC14 and MSVC 2022 +* Fix build failure on latest 64-bit Ubuntu +* Documentation refers to primary branch as "main" +* Update the CI workflow matrix to VFX-CY2022 +* Update auto-fetch Imath version to v3.1.5 + +Specific OSS-fuzz issues addressed: + +* `OSS-fuzz 46309 `_ Heap-buffer-overflow in ``Imf_3_1::memstream_read`` +* `OSS-fuzz 46083 `_ Out-of-memory in ``openexr_exrcheck_fuzzer`` +* `OSS-fuzz 45899 `_ Int``eger-overflow in internal_exr_compute_chunk_offset_size`` +* `OSS-fuzz 44084 `_ Out-of-memory in ``openexr_exrcheck_fuzzer`` + +March 29, 2022 - Imath v3.1.5 Released +====================================== + +Patch release with miscellaneous bug/doc/build fixes. + +In particular, this fixes an issue that could lead to incorrect values +for numeric_limits. This also updates the CI workflow matrix to +VFX-CY2022. + +* Update CI workflow matrix for VFX-CY2022 +* Use ``_WIN32`` instead of ``_MSC_VER`` to fix mingw build +* Fix 32-bit x86 build failure with 16c instructions +* Move ``numeric_limits`` specializations into ``half.h`` +* Change references to ``master`` branch to ``main`` + + +January 27, 2021 - OpenEXR v3.1.4 Released +========================================== + +Patch release that addresses various issues: + +* Several bug fixes to properly reject invalid input upon read +* A check to enable SSE2 when building with Visual Studio +* A check to fix building with VisualStudio on ARM64 +* Update the automatically-downloaded version of Imath to v3.1.4 +* Miscellaneous documentation improvements + +This addresses one public security vulnerability: + +* `CVE-2021-45942 `_ Heap-buffer-overflow in ``Imf_3_1::LineCompositeTask::execute`` + +Specific OSS-fuzz issues: + +* `OSS-fuzz 43961 `_ Heap-buffer-overflow in ``generic_unpack`` +* `OSS-fuzz 43961 `_ Heap-buffer-overflow in ``generic_unpack`` +* `OSS-fuzz 43916 `_ Heap-buffer-overflow in ``hufDecode`` +* `OSS-fuzz 43763 `_ Heap-buffer-overflow in ``internal_huf_decompress`` +* `OSS-fuzz 43745 `_ Floating-point-exception in ``internal_exr_compute_tile_information`` +* `OSS-fuzz 43744 `_ Divide-by-zero in ``internal_exr_compute_tile_information`` +* `OSS-fuzz 42197 `_ Out-of-memory in ``openexr_exrcheck_fuzzer`` +* `OSS-fuzz 42001 `_ Timeout in ``openexr_exrcheck_fuzzer`` +* `OSS-fuzz 41999 `_ Heap-buffer-overflow in ``Imf_3_1::LineCompositeTask::execute`` +* `OSS-fuzz 41669 `_ Integer-overflow in ``Imf_3_1::rleUncompress`` +* `OSS-fuzz 41625 `_ Heap-buffer-overflow in ``uncompress_b44_impl`` +* `OSS-fuzz 41416 `_ Heap-buffer-overflow in ``Imf_3_1::LineCompositeTask::execute`` +* `OSS-fuzz 41075 `_ Integer-overflow in ``Imf_3_1::copyIntoDeepFrameBuffer`` +* `OSS-fuzz 40704 `_ Crash in ``Imf_3_1::DeepTiledInputFile::readPixelSampleCounts`` +* `OSS-fuzz 40702 `_ Null-dereference in bool ``Imf_3_1::readDeepTile`` +* `OSS-fuzz 40701 `_ Null-dereference in bool ``Imf_3_1::readDeepTile`` +* `OSS-fuzz 40423 `_ Out-of-memory in ``openexr_exrcheck_fuzzer`` +* `OSS-fuzz 40234 `_ Heap-buffer-overflow in ``generic_unpack`` +* `OSS-fuzz 40231 `_ Heap-buffer-overflow in ``hufDecode`` +* `OSS-fuzz 40091 + `_ + Heap-buffer-overflow in ``hufDecode`` + +See the `release notes`_ for more details. + +Download OpenEXR v3.1.4 from https://github.com/AcademySoftwareFoundation/OpenEXR/releases/tag/v3.1.4. + + +January 21, 2021 - Imath v3.1.4 Released +======================================== + +Patch release with miscellaneous bug/doc/build fixes. + +* Added missing check ``_M_IX86`` or ``_M_X64`` when using ``__lzcnt``. +* ``SolveNormalizedCubic`` fix to return proper real root +* Add docs target only if not a subproject +* Fix docs race condition and make installation optional +* Remove dead PyImath code and references to ilmbase +* Use ``equalWithAbsError`` instead of equal operator for float +* Fix sphinx warnings and man page filenames +* Adding missing stdexcept header +* Use ``.x`` instead of ``operator[]`` for better SIMD auto-vectorization +* Successor/predecessor functions use ``isnan()`` and ``isinf()`` +* Fix python imath export +* Cuda safety fixes + +See the `imath release notes`_ for more details. + +Download Imath v3.1.4 from https://github.com/AcademySoftwareFoundation/Imath/releases/tag/v3.1.4. + +October 27, 2021 - OpenEXR v3.1.3 Released +========================================== + +Patch release with a change to default zip compression level: + +* Default zip compression level is now 4 (instead of 6), which in + our tests improves compression times by 2x with only a tiny drop in + compression ratio. + +* ``setDefaultZipCompression()`` and ``setDefaultDwaCompression()`` now set + default compression levels for writing. + +* The Header now has ``zipCompressionLevel()`` and + ``dwaCompressionLevel()`` to get/set the levels used for writing. + +Also, various bug fixes, build improvements, and documentation updates. In particular: + +* Fixes a build failure with Imath prior to v3.1 +* Fixes a bug in detecting invalid chromaticity values + +See the `release notes`_ for more details. + +Download OpenEXR v3.1.3 from https://github.com/AcademySoftwareFoundation/OpenEXR/releases/tag/v3.1.3. + +Oct 4, 2021 - OpenEXR v3.1.2 Released +===================================== + +Patch release with various bug fixes, build improvements, and +documentation updates. in particular: + +* Fix a test failure on arm7 +* Proper handling of pthread with glibc 2.34+ +* Miscellaneous fixes for handling of invalid input by the new + OpenEXRCore library + +With this version, the OpenEXR technical documentation formerly +distributed exclusivly as pdf's is now published online at +https://openexr.readthedocs.io, with the document source now +maintained as .rst files in the repo's docs subfolder. + +Specific OSS-fuzz issues: + +* `OSS-fuzz 39196 `_ Stack-buffer-overflow in ``dispatch_print_error`` +* `OSS-fuzz 39198 `_ Direct-leak in ``exr_attr_chlist_add_with_length`` +* `OSS-fuzz 39206 `_ Direct-leak in ``extract_attr_string_vector`` +* `OSS-fuzz 39212 `_ Heap-use-after-free in ``dispatch_print_error`` +* `OSS-fuzz 39205 `_ Timeout in ``openexr_exrcheck_fuzzer`` +* `OSS-fuzz 38912 `_ Integer-overflow in ``Imf_3_1::bytesPerDeepLineTable`` +* `OSS-fuzz 39084 `_ Divide-by-zero in ``Imf_3_1::RGBtoXYZ`` + +See the `release notes`_ for more details. + +Download OpenEXR v3.1.2 from https://github.com/AcademySoftwareFoundation/OpenEXR/releases/tag/v3.1.2. + +Sep 2, 2021 - Imath v3.1.3 Released +=================================== + +Patch release with miscellaneous minor fixes. + +See the `imath release notes`_ for more details. + +Download Imath v3.1.3 from https://github.com/AcademySoftwareFoundation/Imath/releases/tag/v3.1.3. + +Aug 2, 2021 - OpenEXR v3.1.1 Released +===================================== + +Patch release that fixes build failures on various systems (ARM64 +macOS, FreeBSD), introduces CMake +``CMAKE_CROSSCOMPILING_EMULATOR`` support, and fixes a few other +minor issues. + +See the `release notes`_ for more details. + +Download OpenEXR v3.1.1 from https://github.com/AcademySoftwareFoundation/OpenEXR/releases/tag/v3.1.1. + +July 31, 2021 - Imath v3.1.2 Released +===================================== + +Patch release that fixes a potential Windows build issue + +Download Imath v3.1.2 from https://github.com/AcademySoftwareFoundation/Imath/releases/tag/v3.1.2. + +July 22, 2021 - OpenEXR v3.1.0 Released +======================================= + +The 3.1 release of OpenEXR introduces a new library, OpenEXRCore, +which is the result of a significant re-thinking of how OpenEXR +manages file I/O and provides access to image data. It begins to +address long-standing scalability issues with multithreaded image +reading and writing. + +The OpenEXRCore library provides thread-safe, non-blocking access to +files, which was not possible with the current API, where the +framebuffer management is separate from read requests. It is written +entirely in C and provides a new C-language API alongside the existing +C++ API. This new low-level API allows applications to do custom +unpacking of EXR data, such as on the GPU, while still benefiting from +efficient I/O, file validation, and other semantics. It provides +efficient direct access to EXR files in texturing applications. This C +library also introduces an easier path to implementing OpenEXR +bindings in other languages, such as Rust. + +The 3.1 release represents a technology preview for upcoming +releases. The initial release is incremental; the existing API and +underlying behavior has not changed. The new API is available now for +performance validation testing, and then in future OpenEXR releases, +the C++ API will migrate to use the new core in stages. It is not the +intention to entirely deprecate the C++ API, nor must all applications +re-implement EXR I/O in terms of the C library. The C API does not, +and will not, provide the rich set of utility classes that exist in +the C++ layer. The 3.1 release of the OpenEXRCore library simply +offers new functionality for specialty applications seeking the +highest possible performance. In the future, the ABI will evolve, but +the API will remain consistent, or only have additions. + +Technical Design +---------------- + +The OpenEXRCore API introduces a ``context`` object to manage file +I/O. The context provides customization for I/O, memory allocation, +and error handling. This makes it possible to use a decode and/or +encode pipeline to customize how the chunks are written and read, and +how they are packed or unpacked. + +The OpenEXRCore library is built around the concept of “chunks”, or +atomic blocks of data in a file, the smallest unit of data to be read +or written. The contents of a chunk vary from file to file based on +compression (i.e. zip and zips) and layout (scanline +vs. tiled). Currently this is either 1, 16, or 32 scanlines, or 1 tile +(or subset of a tile on edge boundaries / small mip level). + +The OpenEXRCore library is specifically designed for multipart EXR +files. It will continue to produce legacy-compatible single part files +as needed, but the API assumes you are always dealing with a +multi-part file. It also fully supports attributes, although being C, +it lacks some of the C++ layer’s abstraction. + +Limitations +----------- + +* No support yet for DWAA and DWAB compression during decode and + encode pipelines. The low-level chunk I/O still works with DWAA and + DWAB compressed files, but the encoder and decoder are not yet + included in this release. + +* For deep files, reading of deep data is functional, but the path for + encoding deep data into chunk-level data (i.e. packing and + compressing) is not yet complete. + +* For both of these deficiencies, it is easy to define a custom + routine to implement this, should it be needed prior to the library + providing full support. + +* No attempt to search through the file and find missing chunks is + made when a corrupt chunk table is encountered. However, if a + particular chunk is corrupt, this is handled such that the other + chunks may be read without rendering the context unusable + +Download OpenEXR v3.1.0 from +https://github.com/AcademySoftwareFoundation/openexr/releases/tag/v3.1.0. + +July 20, 2021 - Imath v3.1.1 +---------------------------- + +Patch release that fixes a build failure on ARM64 macOS + +Download Imath v3.1.1 from +https://github.com/AcademySoftwareFoundation/Imath/releases/tag/v3.1.1. + +July 13, 2021 - Imath v3.1.0 Released +===================================== + +Minor release with new features: + +* Optimized half-to-float and float-to-half conversion, using F16C SSE + instruction set if available. Non-SSE conversion eliminates the + float-to-half exponent lookup table, and half-to-float conversion + provides a compile-time-optional bit shifting that is slower but + eliminates the need for the lookup table, for applications where + memory is limited. + +* Half-to-float and float-to-half conversion is also available as + C-language functions ``imath_half_to_float()`` and + ``imath_float_to_half()``. + +* All new conversions produced identical results, and new options are + off by default to ensure backwards compatibility. See + https://imath.readthedocs.io for more info. + +* ``NOEXCEPT`` specifier can be eliminated at compile-time via the + ``IMATH_USE_NOEXCEPT`` CMake option. + +* Python bindings: + + * FixedArray objects support a "read only" state. + * FixedArray objects support python buffer protocol. + + +* Optimized 4x4 matrix multiplication. + +Download Imath v3.1.0 from +https://github.com/AcademySoftwareFoundation/Imath/releases/tag/v3.1.0. + +July 1, 2021 - OpenEXR v3.0.5 Released +====================================== + +Patch release that fixes problems with library symlinks and +pkg-config, as well as miscellaneous bugs/security issues. + +Download OpenEXR v3.0.5 from +https://github.com/AcademySoftwareFoundation/openexr/releases/tag/v3.0.5. + +June 16, 2021 - OpenEXR v2.5.7 Released +======================================= + +Patch release for v2.5 with security and build fixes: + +* `OSS-fuzz 28051 `_ Heap-buffer-overflow in ``Imf_2_5::copyIntoFrameBuffer`` +* `OSS-fuzz 28155 `_ Crash in ``Imf_2_5::PtrIStream::read`` +* Fix broken symlink and pkg-config lib suffix for cmake debug builds + +Download OpenEXR v2.5.7 from https://github.com/AcademySoftwareFoundation/openexr/releases/tag/v2.5.7. + +June 3, 2021 - OpenEXR v3.0.4 Released +====================================== + +Patch release that corrects a problem with the release version numbers +in v3.0.2/v3.0.3, and with the referenced Imath release. + +Download OpenEXR v3.0.4 from https://github.com/AcademySoftwareFoundation/openexr/releases/tag/v3.0.4. + +June 1, 2021 - Imath v3.0.4 Released +==================================== + +Patch release that corrects a problem with the release version number +of v3.0.2 + +Download Imath v3.0.4 from https://github.com/AcademySoftwareFoundation/Imath/releases/tag/v3.0.4. + +May 18, 2021 - OpenEXR v3.0.3 Released +====================================== + +Patch release that fixes a regression in v3.0.2 the prevented headers +from being installed properly. + +Download OpenEXR v3.0.3 from https://github.com/AcademySoftwareFoundation/openexr/releases/tag/v3.0.3. + +May 17, 2021 - OpenEXR v3.0.2 Released +====================================== + +Patch release with miscellaneous bug/build fixes, primarily: + +* Fix TimeCode.frame max value +* Don't impose C++14 on downstream projects +* Restore fix to macOS universal 2 build lost from #854 + +Specific OSS-fuzz issues: + +* `OSS-fuzz 33741 `_ Integer-overflow in ``Imf_3_0::getScanlineChunkOffsetTableSize`` +* `OSS-fuzz 32620 `_ Out-of-memory in ``openexr_exrcheck_fuzzer`` + +Download OpenEXR v3.0.2 from https://github.com/AcademySoftwareFoundation/openexr/releases/tag/v3.0.2. + +May 17, 2021 - OpenEXR v2.5.6 Released +====================================== + +Patch release for v2.5 that fixes a regression in +``Imath::succf()/Imath::predf()``. + +Download OpenEXR v2.5.6 from https://github.com/AcademySoftwareFoundation/openexr/releases/tag/v2.5.6. + +
+ +May 17, 2021 - OpenEXR v2.4.3 Released +====================================== + +Patch release for v2.4 that addresses the following security vulnerabilities: + +* `CVE-2021-20296 `_ Segv on unknown address in ``Imf_2_5::hufUncompress`` - Null Pointer dereference +* `CVE-2021-3479 `_ Out-of-memory in ``openexr_exrenvmap_fuzzer`` +* `CVE-2021-3478 `_ Out-of-memory in ``openexr_exrcheck_fuzzer`` +* `CVE-2021-3477 `_ Heap-buffer-overflow in ``Imf_2_5::DeepTiledInputFile::readPixelSampleCounts`` +* `CVE-2021-3476 `_ Undefined-shift in ``Imf_2_5::unpack14`` +* `CVE-2021-3475 `_ Integer-overflow in ``Imf_2_5::calculateNumTiles`` +* `CVE-2021-3474 `_ Undefined-shift in ``Imf_2_5::FastHufDecoder::FastHufDecoder`` + +Also: + +* Fixed regression in ``Imath::succf()`` and ``Imath::predf()`` when negative values are given + +Download OpenEXR v2.4.3 from https://github.com/AcademySoftwareFoundation/openexr/releases/tag/v2.4.3. + +May 16, 2021 - Imath v3.0.2 Released +==================================== + +Patch release with miscellaneous bug/build fixes, primarily: + +* Fix regression in ``succf()`` and ``predf()`` +* Don't impose C++14 on downstream projects + +Download Imath v3.0.2 from https://github.com/AcademySoftwareFoundation/Imath/releases/tag/v3.0.2. + +April 1, 2021 - OpenEXR and Imath v3.0 Released +=============================================== + +The OpenEXR Project and the Academy Software Foundation (ASWF) +announced the official release of OpenEXR and Imath version 3.0, now +available for developers to integrate into their applications. + +The 3.0 release of OpenEXR addresses a number of security issues and +introduces several new features, including ID Manifest attributes, but +it is primarily a major restructuring and simplification of the build +process and modernization of the code that involves moving Imath to an +external project dependency. + +Largely backwards compatible with previous releases, Imath 3.0 brings +the library up to modern standards for performance and utility. By +promoting Imath as a project independent of OpenEXR, we hope to +encourage its use throughout the motion picture and computer graphics +community. + +See the `Imath +`_ +and `OpenEXR +`_ +release notes for details and the `porting guide +`_ +for more information about the differences with previous versions. And +read the documentation at https://imath.readthedocs.io. And please report any problems and +share your feedback either through the GitHub repo or +`openexr-dev@lists.aswf.io `_. + +March 28, 2021 - OpenEXR v3.0.1-beta Released +============================================= + +Beta patch release: + +* `OSS-fuzz 32370 `_ Out-of-memory in openexr_exrcheck_fuzzer +* `OSS-fuzz 32067 `_ account for size of pixels when estimating memory + +March 28, 2021 - Imath v3.0.1-beta Released +=========================================== + +Beta patch release: + +* ``#if IMATH_FOREIGN_VECTOR_INTEROP`` around type detectors +* Forward declarations only if header is not included + +March 16, 2020 - OpenEXR v3.0.0-beta Released +============================================= + +OpenEXR version v3.0.0-beta is available for download at https://github.com/AcademySoftwareFoundation/openexr/releases/tag/v3.0.0-beta. + +Major release with major build restructing, security improvements, and +new features: + +* Restructuring: + + * The IlmBase/PyIlmBase submodules have been separated into the + Imath project, now included by OpenEXR via a CMake submodule + dependency, fetched automatically via CMake's FetchContent if + necessary. + * The library is now called ``libOpenEXR`` (instead of + ``libIlmImf``). No header files have been renamed, they + retain the ``Imf`` prefix. + * Symbol linkage visibility is limited to specific public symbols. + + +* Build improvements: + + * No more simultaneous static/shared build option. + Gnu autoconf/bootstrap/configure build setup has been retired. + * Community-provided support for bazel. + +* New Features: + + * ID Manifest Attributes, as described in `` + `"A Scheme for Storing Object ID Manifests in OpenEXR Images" + Peter Hillman, DigiPro 18: Proceedings of the 8th Annual Digital + Production Symposium, August 2018. `_, + * New program: exrcheck validates the contents of an EXR file. + +* Changes: + + * EXR files with no channels are no longer allowed. + * Hard limit on the size of deep tile sizes; tiles must be less than + 230 pixels. + * Tiled DWAB files used STATIC_HUFFMAN compression. + * ``Int64`` and ``SInt64`` types are deprecated in ``favor`` + of ``uint64_t`` and ``int64_t``. + * Header files have been pruned of extraneous ``#include``'s + ("Include What You Use"), which may generate compiler errors in + application source code from undefined symbols or + partially-defined types. These can be resolved by identifying and + including the appropriate header. + * See the :doc:`PortingGuide` for details about differences + from previous releases and how to address them. + * Also refer to the porting guide for details about changes to + Imath. + +Specific OSS-fuzz issues addressed include: + +* `OSS-fuzz 24573 `_ Out-of-memory in ``openexr_exrenvmap_fuzzer`` +* `OSS-fuzz 24857 `_ Out-of-memory in ``openexr_exrheader_fuzzer`` +* `OSS-fuzz 25002 `_ Out-of-memory in ``openexr_deepscanlines_fuzzer`` +* `OSS-fuzz 25648 `_ Out-of-memory in ``openexr_scanlines_fuzzer`` +* `OSS-fuzz 26641 `_ Invalid-enum-value in ``readSingleImage`` +* `OSS-fuzz 28051 `_ Heap-buffer-overflow in ``Imf_2_5::copyIntoFrameBuffer`` +* `OSS-fuzz 28155 `_ Crash in ``Imf_2_5::PtrIStream::read`` +* `OSS-fuzz 28419 `_ Out-of-memory in ``openexr_exrcheck_fuzzer`` +* `OSS-fuzz 29393 `_ Timeout in ``openexr_exrcheck_fuzzer`` +* `OSS-fuzz 29423 `_ Integer-overflow in ``Imf_2_5::DwaCompressor::initializeBuffers`` +* `OSS-fuzz 29653 `_ Integer-overflow in ``Imf_2_5::DwaCompressor::initializeBuffers`` +* `OSS-fuzz 29682 `_ Out-of-memory in ``openexr_exrcheck_fuzzer`` +* `OSS-fuzz 30115 `_ Timeout in ``openexr_exrcheck_fuzzer`` +* `OSS-fuzz 30249 `_ Out-of-memory in ``openexr_exrcheck_fuzzer`` +* `OSS-fuzz 30605 `_ Out-of-memory in ``openexr_exrcheck_fuzzer`` +* `OSS-fuzz 30616 `_ Timeout in ``openexr_exrcheck_fuzzer`` +* `OSS-fuzz 30969 `_ Direct-leak in ``Imf_2_5::DwaCompressor::LossyDctDecoderBase::execute`` +* `OSS-fuzz 31015 `_ Direct-leak in ``Imf_2_5::TypedAttribute::readValueFrom`` +* `OSS-fuzz 31044 `_ Timeout in ``openexr_exrcheck_fuzzer`` +* `OSS-fuzz 31072 `_ Out-of-memory in ``openexr_exrcheck_fuzzer`` +* `OSS-fuzz 31221 `_ Integer-overflow in bool ``Imf_2_5::readDeepTile`` +* `OSS-fuzz 31228 `_ Integer-overflow in bool ``Imf_2_5::readDeepTile`` +* `OSS-fuzz 31291 `_ Sanitizer CHECK failure in ``((0 ""Address is not in memory and not in shadow?"")) != (0)"" (0x0, 0x0)`` +* `OSS-fuzz 31293 `_ Segv on unknown address in ``Imf_2_5::copyIntoFrameBuffer`` +* `OSS-fuzz 31390 `_ Out-of-memory in ``openexr_exrcheck_fuzzer`` +* `OSS-fuzz 31539 `_ Out-of-memory in ``openexr_exrcheck_fuzzer`` + +March 15, 2021 - Imath v3.0.0-beta Released +=========================================== + +Imath version v3.0.0-beta is available for download at https://github.com/AcademySoftwareFoundation/Imath/releases/tag/v3.0.0-beta. + +First release of Imath independent of OpenEXR. + +See the :doc:`PortingGuide` for details about differences from +previous releases. + +Summary: + +* Imath includes the half type, formerly in a separate Half library. +* Headers are installed in ``Imath/`` subdirectory. +* All appropriate methods are marked constexpr, noexcept +* Appropriate declaration include CUDA ``__host__`` and ``__device__`` directives. +* Throwing methods throw std exceptions instead of ``Iex``. +* New Vec and Matrix interoperability constructors for conversion from other similar type objects. +* Symbol linkage visibility is limited to specific public symbols. +* python bindings are off by default, available by setting ``PYTHON=ON`` +* Deprecated features: +* ``std::numeric_limits`` replaces ``Imath::limits``. +* ``Int64`` and ``SInt64`` are deprecated in favor of ``uint64_t`` and ``int64_t``. + +February 12, 2021 - OpenEXR v2.5.5 Released +=========================================== + +OpenEXR version v2.5.5 is available for download at https://github.com/AcademySoftwareFoundation/openexr/releases/tag/v2.5.5. + +Patch release with various bug/sanitizer/security fixes, primarily +related to reading corrupted input files, but also a fix for universal +build support on macOS. + +Specific OSS-fuzz issues include: + +* `OSS-fuzz 30291 `_ Timeout in ``openexr_exrcheck_fuzzer`` +* `OSS-fuzz 29106 `_ Heap-buffer-overflow in ``Imf_2_5::FastHufDecoder::decode`` +* `OSS-fuzz 28971 `_ Undefined-shift in ``Imf_2_5::cachePadding`` +* `OSS-fuzz 29829 `_ Integer-overflow in ``Imf_2_5::DwaCompressor::initializeBuffers`` +* `OSS-fuzz 30121 `_ Out-of-memory in ``openexr_exrcheck_fuzzer`` + +December 31, 2020 - OpenEXR v2.5.4 Released +=========================================== + +OpenEXR version v2.5.4 is available for download at https://github.com/AcademySoftwareFoundation/openexr/releases/tag/v2.5.4. + +Patch release with various bug/sanitizer/security fixes, primarily +related to reading corrupted input files. + +Specific OSS-fuzz issues include: + +* `OSS-fuzz 24854 `_ Segv on unknown address in ``Imf_2_5::hufUncompress`` +* `OSS-fuzz 24831 `_ Undefined-shift in ``Imf_2_5::FastHufDecoder::FastHufDecoder`` +* `OSS-fuzz 24969 `_ Invalid-enum-value in ``Imf_2_5::TypedAttribute::writeValueTo`` +* `OSS-fuzz 25297 `_ Integer-overflow in ``Imf_2_5::calculateNumTiles`` +* `OSS-fuzz 24787 `_ Undefined-shift in ``Imf_2_5::unpack14`` +* `OSS-fuzz 25326 `_ Out-of-memory in ``openexr_scanlines_fuzzer`` +* `OSS-fuzz 25399 `_ Heap-buffer-overflow in ``Imf_2_5::FastHufDecoder::FastHufDecoder`` +* `OSS-fuzz 25415 `_ Abrt in ``__cxxabiv1::failed_throw`` +* `OSS-fuzz 25370 `_ Out-of-memory in ``openexr_exrenvmap_fuzzer`` +* `OSS-fuzz 25501 `_ Out-of-memory in ``openexr_scanlines_fuzzer`` +* `OSS-fuzz 25505 `_ Heap-buffer-overflow in ``Imf_2_5::copyIntoFrameBuffer`` +* `OSS-fuzz 25562 `_ Integer-overflow in ``Imf_2_5::hufUncompress`` +* `OSS-fuzz 25740 `_ Null-dereference READ in ``Imf_2_5::Header::operator`` +* `OSS-fuzz 25743 `_ Null-dereference in ``Imf_2_5::MultiPartInputFile::header`` +* `OSS-fuzz 25913 `_ Out-of-memory in ``openexr_exrenvmap_fuzzer`` +* `OSS-fuzz 26229 `_ Undefined-shift in ``Imf_2_5::hufDecode`` +* `OSS-fuzz 26658 `_ Out-of-memory in ``openexr_scanlines_fuzzer`` +* `OSS-fuzz 26956 `_ Heap-buffer-overflow in ``Imf_2_5::DeepTiledInputFile::readPixelSampleCounts`` +* `OSS-fuzz 27409 `_ Out-of-memory in ``openexr_exrcheck_fuzzer`` +* `OSS-fuzz 25892 `_ Divide-by-zero in ``Imf_2_5::calculateNumTiles`` +* `OSS-fuzz 25894 `_ Floating-point-exception in ``Imf_2_5::precalculateTileInfo`` + +August 12, 2020 - OpenEXR v2.5.3 Released +========================================= + +OpenEXR version v2.5.3 is available for download at https://github.com/AcademySoftwareFoundation/openexr/releases/tag/v2.5.3. + +Patch release with various bug/security fixes and build/install fixes, plus a performance optimization: + +* Various sanitizer/fuzz-identified issues related to handling of invalid input +* Fixes to misc compiler warnings +* Cmake fix for building on arm64 macOS (#772) +* Read performance optimization (#782) +* Fix for building on non-glibc (#798) +* Fixes to tests + +June 15, 2020 - OpenEXR v2.5.2 Released +======================================= + +OpenEXR version v2.5.2 is available for download at https://github.com/AcademySoftwareFoundation/openexr/releases/tag/v2.5.2. + +Patch release with various bug/security and build/install fixes: + +* Invalid input could cause a heap-use-after-free error in ``DeepScanLineInputFile::DeepScanLineInputFile()`` +* Invalid chunkCount attributes could cause heap buffer overflow in ``getChunkOffsetTableSize()`` +* Invalid tiled input file could cause invalid memory access ``TiledInputFile::TiledInputFile()`` +* ``OpenEXRConfig.h`` now correctly sets ``OPENEXR_PACKAGE_STRING`` to ``OpenEXR`` (rather than ``IlmBase``) +* Various Windows build fixes + +June 15, 2020 - OpenEXR v2.4.2 Released +======================================= + +OpenEXR version v2.4.2 is available for download at https://github.com/AcademySoftwareFoundation/openexr/releases/tag/v2.4.2. + +Patch release that backports various recent bug/security fixes: + +* Invalid input could cause a heap-use-after-free error in ``DeepScanLineInputFile::DeepScanLineInputFile()`` +* Invalid chunkCount attributes could cause heap buffer overflow in ``getChunkOffsetTableSize()`` +* Invalid tiled input file could cause invalid memory access TiledInputFile::TiledInputFile() +* OpenEXRConfig.h now correctly sets ``OPENEXR_PACKAGE_STRING`` to ``OpenEXR`` (rather than ``IlmBase``) + +May 11, 2020 - OpenEXR v2.5.1 Released +====================================== + +OpenEXR version v2.5.1 is available for download at https://github.com/AcademySoftwareFoundation/openexr/releases/tag/v2.5.1. + +v2.5.1 is a patch release that corrects the SO version for the v2.5 +release, which missed getting bumped in v2.5.0. + +This release also fixes an improper failure in IlmImfTest when running on ARMv7 and AAarch64. + +May 6, 2020 - OpenEXR v2.5.0 Released +===================================== + +OpenEXR version v2.5.0 is available for download at https://github.com/AcademySoftwareFoundation/openexr/releases/tag/v2.5.0. + +This is a minor release with miscellaneous bug fixes and small features + +Summary: + +* No more build-time header generation: ``toFloat.h``, ``eLut.h``, + ``b44ExpLogTable.h``, and ``dwaLookups.h`` are now ordinary header + files, no longer generated on the fly. +* New ``StdISSTream`` class, an "input" ``stringstream`` version of + ``StdOSStream`` +* New ``Matrix22`` class in Imath +* Chromaticity comparison operator now includes white (formerly + ignored) +* Various cmake fixes +* Bug fixes for various memory leaks +* Bug fixes for various invalid memory accesses +* New checks to detect damaged input files +* ``OpenEXR_Viewers`` has been deprecated, removed from the top-level + cmake build and documentation. + +See the `release notes`_ for more details. + +April 30, 2020 - OpenEXR v2.2.2 Released +======================================== + +OpenEXR version v2.2.2 is available for download at https://github.com/AcademySoftwareFoundation/openexr/releases/tag/v2.2.2. + +This is a patch release of OpenEXR v2.2 that includes fixes for the following security vulnerabilities: + +* `CVE-2020-11765 `_ + There is an off-by-one error in use of the ImfXdr.h read function by + DwaCompressor::Classifier::Classifier, leading to an out-of-bounds + read. +* `CVE-2020-11764 `_ + There is an out-of-bounds write in copyIntoFrameBuffer in + ImfMisc.cpp. +* `CVE-2020-11763 `_ + There is an std::vector out-of-bounds read and write, as + demonstrated by ImfTileOffsets.cpp. +* `CVE-2020-11762 `_ + There is an out-of-bounds read and write in + DwaCompressor::uncompress in ImfDwaCompressor.cpp when handling the + UNKNOWN compression case. +* `CVE-2020-11761 `_ + There is an out-of-bounds read during Huffman uncompression, as + demonstrated by FastHufDecoder::refill in ImfFastHuf.cpp. +* `CVE-2020-11760 `_ + There is an out-of-bounds read during RLE uncompression in + rleUncompress in ImfRle.cpp. +* `CVE-2020-11759 `_ + Because of integer overflows in + CompositeDeepScanLine::Data::handleDeepFrameBuffer and + readSampleCountForLineBlock, an attacker can write to an + out-of-bounds pointer. +* `CVE-2020-11758 `_ + There is an out-of-bounds read in ImfOptimizedPixelReading.h. + +See the `release notes`_ for more details. + +Feb 11, 2020 - OpenEXR v2.4.1 Released +====================================== + +OpenEXR version v2.4.1 is available for download at https://github.com/AcademySoftwareFoundation/openexr/releases/tag/v2.4.1. + +This is a patch release that addresses miscellaneous bugs. + +Summary: + +* Various fixes for memory leaks and invalid memory accesses +* Various fixes for integer overflow with large images. +* Various cmake fixes for build/install of python modules. +* ImfMisc.h is no longer installed, since it's a private header. + +Sep 19, 2019 - OpenEXR v2.4.0 Released +====================================== + +OpenEXR version v2.4.0 is available for download at https://github.com/AcademySoftwareFoundation/openexr/releases/tag/v2.4.0. + +This release contains no major new functionality, although it does +include many miscellaneous bug and security fixes. The major new +feature is a completely rewritten CMake setup, which should work +reliably on Linux, macOS, and Windows. The installation instructions +and project documentation are also freshly revised. See the release +notes for the complete details. + +The project also now supports continuous integration via Azure +Pipelines and code analysis via SonarCloud, services supported by the +Academy Software Foundation. Links to the dashboards are through +the"Azure Pipelines" and "quality gate" badges at the top the GitHub +repo home page. + +Summary of changes: + +* Completely re-written CMake configuration files +* Improved support for building on Windows, via CMake +* Improved support for building on macOS, via CMake +* All code compiles without warnings on gcc, clang, msvc +* Cleanup of license and copyright notices +* floating-point exception handling is disabled by default +* New Slice::Make method to reliably compute base pointer for a slice. +* Miscellaneous bug fixes + +This version fixes the following security vulnerabilities: + +* CVE-2018-18444 Issue #351 Out of Memory +* CVE-2018-18443 Issue #350 heap-buffer-overflow + +Sep 5, 2019 - OpenEXR v2.4.0-beta.1 Released +============================================ + +OpenEXR version v2.4.0-beta.1 is available for download at https://github.com/AcademySoftwareFoundation/openexr/releases/tag/v2.4.0-beta.1. + +This release contains no major new functionality, although it does +include many miscellaneous bug and security fixes. The major new +feature is a completely rewritten CMake setup, which should work +reliably on Linux, macOS, and Windows. The installation instructions +and project documentation are also freshly revised. See the release +notes for the complete details. + +The project also now supports continuous integration via Azure +Pipelines and code analysis via SonarCloud, services supported by the +Academy Software Foundation. Links to the dashboards are through +the"Azure Pipelines" and "quality gate" badges at the top the GitHub +repo home page. + +Summary of changes: + +* Completely re-written CMake configuration files +* Improved support for building on Windows, via CMake +* Improved support for building on macOS, via CMake +* All code compiles without warnings on gcc, clang, msvc +* Cleanup of license and copyright notices +* floating-point exception handling is disabled by default +* New Slice::Make method to reliably compute base pointer for a slice. +* Miscellaneous bug fixes + +This version fixes the following security vulnerabilities: +* CVE-2018-18444 Issue #351 Out of Memory +* CVE-2018-18443 Issue #350 heap-buffer-overflow + +May 1, 2019 Academy Software Foundation Adopts OpenEXR +====================================================== + +OpenEXR has been adopted by the `Academy Software Foundation `_. + +August 13, 2018 - OpenEXR 2.3.0 Released +======================================== + +OpenEXR v2.3.0 has been released and is available for download. + +Features/Improvements: +* ThreadPool overhead improvements, enable custom thread pool to be registered via ThreadPoolProvider class +* Fixes to enable custom namespaces for Iex, Imf +* Improve read performance for deep/zipped data, and SIMD-accelerated uncompress support +* Added rawPixelDataToBuffer() function for access to compressed scanlines +* Iex::BaseExc no longer derived from std::string. +* Imath throw() specifiers removed +* Initial Support for Python 3 + +Bugs: +* 25+ various bug fixes (see detailed Release Notes for the full list) + +Build Fixes: +* Various fixes to the cmake and autoconf build infrastructures +* Various changes to support compiling for C++11 / C++14 / C++17 and GCC 6.3.1 +* Various fixes to address Windows build issues +* 60+ total build-related fixes (see detailed Release Notes for the full list) + +See the `release notes`_ for more details. + +OpenEXR source can be obtained from the downloads section of `www.openexr.com `_ or from the project page on github: https://github.com/AcademySoftwareFoundation/openexr. + +November 30, 2017 - OpenEXR 2.2.1 Released +========================================== + +OpenEXR v2.2.1 has been released and is available for download. + +This maintenance release addresses the reported OpenEXR security vulnerabilities, specifically CVE-2017-9110, CVE-2017-9111, CVE-2017-9112, CVE-2017-9113, CVE-2017-9114, CVE-2017-9115, CVE-2017-9116. + +OpenEXR source can be obtained from the downloads section of `www.openexr.com `_ or from the project page on github: https://github.com/AcademySoftwareFoundation/openexr. + +August 10, 2014 - OpenEXR v2.2.0 Released +========================================= + +OpenEXR v2.2.0 has been released and is available for download. + +This release includes the following components: +* OpenEXR: v2.2.0 +* IlmBase: v2.2.0 +* PyIlmBase: v2.2.0 +* OpenEXR_Viewers: v2.2.0 + +This significant new features of this release include: + +* **DreamWorks Lossy Compression** A new high quality, + high performance lossy compression codec contributed by DreamWorks + Animation. This codec allows control over variable lossiness to + balance visual quality and file size. This contribution also + includes performance improvements that speed up the PIZ codec. + +* **IlmImfUtil** A new library intended to aid in + development of image file manipulation utilities that support the + many types of OpenEXR images. + +This release also includes improvements to cross-platform build support using CMake. + +OpenEXR source can be obtained from the downloads section of +www.openexr.com or from the project page +on github: https://github.com/AcademySoftwareFoundation/openexr. + +November 25, 2013 - OpenEXR v2.1.0 Released +=========================================== + +OpenEXR v2.1.0 has been released and is available for download. + +This release includes the following components (version locked): + +* OpenEXR: v2.1.0 +* IlmBase: v2.1.0 +* PyIlmBase: v2.1.0 +* OpenEXR_Viewers: v2.1.0 + +This release includes a refactoring of the optimised read paths for +RGBA data, optimisations for some of the python bindings to Imath, +improvements to the cmake build environment as well as additional +documentation describing deep data in more detail. + +April 9, 2013 - OpenEXR v2.0 Released +===================================== + +Industrial Light & Magic (ILM) and Weta Digital announce the release +of OpenEXR 2.0, the major version update of the open source high +dynamic range file format first introduced by ILM and maintained and +expanded by a number of key industry leaders including Weta Digital, +Pixar Animation Studios, Autodesk and others. + +The release includes a number of new features that align with the +major version number increase. Amongst the major improvements are: + +* Deep Data support- Pixels can now store a variable-length list of + samples. The main rationale behind deep images is to enable the + storage of multiple values at different depths for each + pixel. OpenEXR 2.0 supports both hard-surface and volumetric + representations for Deep Compositing workflows. + +* Multi-part Image Files - With OpenEXR 2.0, files can now contain a + number of separate, but related, data parts in one file. Access to + any part is independent of the others, pixels from parts that are + not required in the current operation don't need to be accessed, + resulting in quicker read times when accessing only a subset of + channels. The multipart interface also incorporates support for + Stereo images where views are stored in separate parts. This makes + stereo OpenEXR 2.0 files significantly faster to work with than the + previous multiview support in OpenEXR. + +* Optimized pixel reading - decoding RGB(A) scanline images has been + accelerated on SSE processors providing a significant speedup when + reading both old and new format images, including multipart and + multiview files. + +* Namespacing - The library introduces versioned namespaces to avoid + conflicts between packages compiled with different versions of the + library. + +Although OpenEXR 2.0 is a major version update, files created by the +new library that don't exercise the new feature set are completely +backwards compatible with previous versions of the library. By using +the OpenEXR 2.0 library, performance improvements, namespace versions +and basic multi-part/deep reading support should be available to +applications without code modifications. + +This code is designed to support Deep Compositing - a revolutionary +compositing workflow developed at Weta Digital that detached the +rendering of different elements in scene. In particular, changes in +one layer could be rendered separately without the need to re-render +other layers that would be required to handle holdouts in a +traditional comp workflow or sorting of layers in complex scenes with +elements moving in depth. Deep Compositing became the primary +compositing workflow on Avatar and has seen wide industry adoption. +The technique allows depth and color value to be stored for every +pixel in a scene allowing for much more efficient handling of large +complex scenes and greater freedom for artists to iterate. + +True to the open source ethos, a number of companies contributed to +support the format and encourage adoption. Amongst others, Pixar +Animation Studios has contributed its DtexToExr converter to the +OpenEXR repository under a Microsoft Public License, which clears any +concerns about existing patents in the area, and Autodesk provided +performance optimizations geared towards real-time post-production +workflows. + +Extensive effort has been put in ensuring all requirements were met to +help a wide adoption, staying true to the wide success of +OpenEXR. Many software companies were involved in the beta cycle to +insure support amongst a number of industry leading +applications. Numerous packages like SideFX's Houdini, Autodesk's +Maya, Solid Angle's Arnold renderer, Sony Pictures Imageworks' Open +Image IO have already announced their support of the format. + +Open EXR 2.0 is an important step in the adoption of deep compositing +as it provides a consistent file format for deep data that is easy to +read and work with throughout a visual effects pipeline. The Foundry +has build OpenEXR 2.0 support into its Nuke Compositing application as +the base for the Deep Compositing workflows. + +OpenEXR 2.0 is already in use at both Weta Digital and Industrial +Light & Magic. ILM took advantage of the new format on Marvel's The +Avengers and two highly anticipated summer 2013 releases, Pacific Rim +and The Lone Ranger. Recent examples of Weta Digital's use of the +format also include *Marvel's Avengers* as well as +*Prometheus* and *The Hobbit*. In addition, a large +number of visual effects studios have already integrated a deep +workflow into their compositing pipelines or are in the process of +doing so including:, Sony Pictures Imageworks, Pixar Animation +Studios, Rhythm & Hues, Fuel and MPC. + +In addition to visual effects, the new additions to the format, means +that depth data can also be assigned to two-dimensional data for a use +in many design fields including, architecture, graphic design, +automotive and product prototyping. + +July 31st, 2012 - OpenEXR v1.7.1 Released +========================================= + +OpenEXR v1.7.1 has been released and is available for download. This release includes the following components: + +* OpenEXR: v1.7.1 +* IlmBase: v1.0.3 +* PyIlmBase: v1.0.0 (introduces a Boost dependency) +* OpenEXR_Viewers: v1.0.2 + +Of particular note is the introduction of PyIlmBase. This module forms +a comprehensive set of python bindings to the IlmBase module. + +In addition, contained in this release is a number of additions to +Imath as well as a minor tweak to Imath::Frustrum (for better support +for Windows platforms) as well as other minor fixes, including +correction for soname version of IlmImf. + +June 18, 2012 - OpenEXR v2 Released +=================================== + +We're pleased to announce the first public Beta release of OpenEXR v2. + +Development of OpenEXR v2 has been undertaken in a collaborative +environment (cf. previous ``github`` announcement) comprised of +Industrial Light & Magic, Weta Digital as well as a number of other +contributors. Some of the new features included in the Beta.1 release +of OpenEXR v2 are: + +* Deep Data. Pixels can now store a variable length list of samples. + The main rationale behind deep-images is to have multiple values at + different depths for each pixel. OpenEXR v2 supports both hard + surface and volumetric representation requirements for deep + compositing workflows. + +* Multi-part image files. With OpenEXR v2, files can now contain a + number of separate, but related, images in one file. Access to any + part is independent of the others; in particular, no access of data + need take place for unrequested parts. + +In addition, OpenEXR v2 also contains platform independent mechanisms +for handling co-existing library version conflicts in the same process +space. (Currently implemented in IlmImf) + +Finally, a reminder that this is a Beta release and potentially +incompatible changes may be introduced in future releases prior to the +v2.0.0 production version. + +OpenEXR v2Beta.1 can be found at https://github.com/AcademySoftwareFoundation/openexr/tree/v2_beta.1. + +June 18, 2012 +============= + +We're pleased to announce that the OpenEXR source code is moving to +``github.com``. You can browse, download and branch the code at +http://www.github.com/AcademySoftwareFoundation/openexr. + +We're looking forward to taking advantage of the collaborative +features presented by ``git`` and ``github.com`` and of course +community contributions. Please see the developer Wiki pages for more +information regarding participation. + +July 23, 2010 +============= + +New feature version of OpenEXR is now available. This release +includes support for stereoscopic images, please see the adjoining +documentation in the :doc:`MultiViewOpenEXR`. (Many thanks to +Weta Digital for their contribution.) In addition, we added support +for targeting 64 bit Windows, fixes for buffer overruns and a number +of other minor fixes, additions and optimisations. Please see the +Changelog files for more detailed information. + +OpenEXR 1.7.0, OpenEXR_Viewers 1.0.2, IlmBase 1.0.2 and +OpenEXR-Images-1.7.0 can be downloaded from the `release page `_. + +October 22, 2007 +================ + +New versions of OpenEXR and CTL are now available. + +This release fixes a buffer overrun in OpenEXR and a Windows build +problem in CTL, and it removes a few unnecessary files from the +.tar.gz packages. + +OpenEXR 1.6.1, OpenEXR_Viewers 1.0.1 and IlmBase 1.0.1 can be +downloaded from the `release page `_. +CTL 1.4.1 and OpenEXR_CTL 1.0.1 can be downloaded +from +`http://www.oscars.org/science-technology/council/projects/ctl.html +`_. + +August 3, 2007 +============== + +New stable versions of OpenEXR and CTL are now available. + +The source code has been tested on Linux, Mac OS X and Windows (Visual +Studio 7 and 8). + + +Here's a summary of what has changed since the last release: + +* OpenEXR 1.6.0 + + * Reduced generational loss in B44- and B44A-compressed images. + + * Added B44A compression. This is a variation of B44, but with a + better compression ratio for images with large uniform areas, such + as in an alpha channel. + + * Bug fixes. + +* CTL 1.4.0 + + * Added new functions to the CTL standard library: 3x3 matrix + support, 1D lookup tables with cubic interpolation. + + * Added new "ctlversion" statement to the language. + + * Bug fixes. + +* OpenEXR_CTL 1.0.0 + + * Applying CTL transforms to a frame buffer is multi-threaded. + + * Bug fixes. + +* OpenEXR_Viewers 1.0.0 + + * Implemented new naming conventions for CTL parameters. + +* IlmBase 1.0.0 + + * Half now implements "round to nearest even" mode. + +OpenEXR 1.6.0, OpenEXR_Viewers 1.0.0 and IlmBase 1.0.0 can be +downloaded from the downloads section of +www.openexr.com. CTL 1.4.0 and OpenEXR_CTL 1.0.0 can be downloaded +from http://www.oscars.org/council/ctl.html. + +January 22, 2007 +================ + +The Color Transformation Language, or CTL, is a programming language +for digital color management. Color management requires translating +images between different representations or color spaces. CTL allows +users to describe color transforms in a concise and unambiguous way by +expressing them as programs. In order to apply a given transform to +an image, a color management system instructs a CTL interpreter to +load and run the CTL program that describes the transform. + +The image viewers included in the OpenEXR software distribution, +exrdisplay and playexr, both support color rendering via CTL. For +more information see `http://www.openexr.com/OpenEXRViewers.pdf +`_. + +Sorce code and documentation for the CTL interpreter can be downloaded +from http://ampasctl.sourceforge.net. Please note the +license under which CTL is distributed; it is similar but not +identical to the OpenEXR license. + + +January 4, 2007 +=============== + +OpenEXR wins an Academy Award for Technical Achievement. + +The Academy of Motion Picture Arts and Sciences today announced the 15 +winners of Scientific and Technical Academy Awards. A Technical +Achievement Award goes to Florian Kainz for the design and engineering +of OpenEXR, a software package implementing 16-bit, floating-point, +high dynamic range image files. Widely adopted, OpenEXR is engineered +to meet the requirements of the visual effects industry by providing +for lossless and lossy compression of tiered and tiled images. + +Congratulations to all for making OpenEXR such a success!!! + +`Click here for the official Press Release `_ + +December 15, 2006 +================= + +A new development version of OpenEXR is now available. We have tested +the code in this version internally at ILM, but we would like to get +feedback from others before we release a production version. + +The new version includes several significant changes: + +* OpenEXR supports a new image compression method, called B44. It has + a fixed compression rate of 2.28:1, or 4.57:1 if used in ``combination`` + with luminance/chroma encoding. B44-compressed images can be + uncompressed fast enough to support real-time playback of image + sequences. + +* The new playexr program plays back moving image sequences. Playexr + is multi-threaded and utilizes the threading capabilities of the + IlmImf library that were introduced in OpenEXR 1.3.0. The program + plays back B44-compressed images with fairly high-resolution in ``real`` + time on commodity hardware. + +* The playexr program and a new version of the existing exrdisplay + image viewer both support color rendering via color transforms + written in the new Color Transformation Language or CTL. CTL is not + part of OpenEXR; it will be released separately. CTL support in + playexr and exrdisplay is optional; the programs can be built and + will run without CTL. + +* In preparation for the release of CTL, OpenEXR has been split into + three separate packages: + +* IlmBase 0.9.0 includes the Half, Iex, Imath and IlmThread libraries + +* OpenEXR 1.5.0 includes the IlmImf library, programming examples and + utility programs such as exrheader or exrenvmap + +* OpenEXRViewers 0.9.0 includes the playexr and exrdisplay programs + +* The "Technical Introduction to OpenEXR" document now includes a + recommendation for storing CIE XYZ pixel data in OpenEXR files. + +* A new "OpenEXR Image Viewing Software" document describes the + playexr and exrdisplay programs. It briefly explains real-time + playback and color rendering, and includes recommendations for + testing if other image viewing software displays OpenEXR images + correctly. + +* The OpenEXR sample image set now includes B44-compressed files and + files with CIE XYZ pixel data. + +August 8, 2006 +============== + +We have released an updated set of sample OpenEXR images. This +release includes several new images that are useful for testing +OpenEXR applications. The images are organized by subdirectory +according to their image type or purpose. Several of these +subdirectories contain README files that explain the contents of the +images in those subdirectories. + +August 2, 2006 +============== + +OpenEXR 1.4.0 is now available. This is the next major +production-ready release of OpenEXR and offers full compatibility with +our last production release, which was 1.2.2. This version obsoletes +versions 1.3.x, which were test versions for 1.4.0. If you have been +using 1.3.x, please upgrade to 1.4.0.
+ +June 8, 2006 +============ + +OpenEXR 1.3.0 is now available. + +This is a test release. The major new feature in this version is +support for multithreaded file I/O. We've been testing the threaded +code internally at ILM for a few months, and we have not encountered +any bugs, but we'd like to get some feedback from others before we +release the production version. + +Here's a summary of the changes since version 1.2.2: + +* Support for multithreaded file reading and writing. + +* Support for Intel-based OS X systems. + +* Support for Visual Studio 2005. + +* Better handling of PLATFORM_* and HAVE_* macros. + +* Updated documentation. + +* Bug fixes related to handling of incomplete and damaged files. + +* Numerous bug fixes and cleanups to the autoconf-based build system. + +* Removed support for the following configurations that were + previously supported. Some of these configurations may happen to + continue to function, but we can't help you if they don't, largely + because we don't have any way to test them: + + * IRIX + * OSF1 + * SunOS + * OS X versions prior to 10.3. + * gcc on any platform prior to version 3.3 + + +March 15, 2005 +============== + +We're pleased to announce the release of OpenEXR 1.2.2. This is a +relatively minor update to the project, with the following changes: + +* New build system for Windows; support for DLLs. +* Switched documentation from HTML to PDF format. +* IlmImf: support for image layers in ``ChannelList.`` +* IlmImf: added ``isComplete()`` method to file classes to check whether a + file is complete. +* IlmImf: exposed ``staticInitialize()`` in ``ImfHeader.h`` in order to allow + thread-safe library initialization in multithreaded applications. +* IlmImf: New "time code" standard attribute. +* exrdisplay: support for displaying wrap-around texture map images. +* exrmaketiled: can now specify wrap mode. +* IlmImf: New "wrapmodes" standard attribute to indicate extrapolation + mode for mipmaps and ripmaps. +* IlmImf: New "key code" standard attribute to identify motion picture + film frames. +* Imath: Removed ``TMatrix`` classes; these classes are still + under development and are too difficult to keep in sync with OpenEXR + CVS. + +August 10, 2004 +=============== + +ILM's OpenEXR color management proposal, presented at the Siggraph +2004 "OpenEXR, Film and Color" Birds of a Feather meeting, is now +available online. See the documentation section. + +June 6, 2004 +============ + +OpenEXR 1.2.1 is now available. This is a fairly minor release, +mostly just a few tweaks, a few bug fixes, and some new documentation. +Here are the most important changes: + +* reduced memory footprint of exrenvmap and exrmaketiled utilities. +* IlmImf: new helper functions to determine whether a file is an + OpenEXR file, and whether it's scanline- or tile-based. +* IlmImf: bug fix for PXR24 compression with ySampling != 1. +* Better support for gcc 3.4. +* Warning cleanups in Visual C++. + +May 11, 2004 +============ + +OpenEXR 1.2.0 is now available. This is the first official, +production-ready release since OpenEXR 1.0.7. If you have been using +the development 1.1 series, please switch to 1.2.0 as soon as +possible. + +We believe that OpenEXR 1.2.0 is ready for use in shipping +applications. We have been using it in production at ILM for several +months now with no problems. + +There are quite a few major new features in the 1.2 series as compared +to the original 1.0 series: + +* Support for tiled images, including mipmaps and ripmaps. Note that + software based on the 1.0 series cannot read or write tiled images. + However, simply by recompiling your software against the 1.2 + release, any code that reads scanline images can read tiled images, + too. + +* A new Pxr24 compressor, contributed by Pixar Animation Studios. + Values produced by the Pxr24 compressor provide the same range as + 32-bit floating-point numbers with slightly less precision, and + compress quite a bit better. The Pxr24 compressor stores UINT and + HALF channels losslessly, and for these data types performs + similarly to the ZIP compressor. + +* OpenEXR now supports high dynamic-range YCA (luminance/chroma/alpha) + images with subsampled chroma channels. These files are supported + via the RGBA convenience interface, so that data is presented to the + application as RGB(A) but stored in the file as YC(A). OpenEXR also + supports Y and YA (black-and-white/black-and-white with alpha) + images. + +* An abstracted file I/O interface, so that you can use OpenEXR with + interfaces other than C++'s iostreams. + +* Several new utilities for manipulating tiled image files. + +See the downloads section to download the source code and sample +images. + +Mar 27, 2004 +============ + +OpenEXR 1.1.1 is now available. This another development release. We +expect to release a stable version, 1.2, around the end of April. +Version 1.1.1 includes support for PXR24 compression, and for +high-dynamic-range luminance/chroma images with subsampled chroma +channels. Version 1.1.1 also fixes a bug in the 1.1.0 tiled file +format. + +Mar 27, 2004 +============ + +We are pleased to announce that Pixar Animation Studios has +contributed code to OpenEXR for a new lossy compression method, which +compresses 32-bit floating-point data quite a bit better than +OpenEXR's other compressors. This new compressor is called PXR24 and +is available as of the 1.1.1 development release of OpenEXR. It will +also be included in the upcoming 1.2 stable release. Thanks to Loren +Carpenter and Dana Batali of Pixar, for making this happen! + +Feb 6, 2004 +=========== + +OpenEXR 1.1.0 is now available. This is a major new release with +support for tiled images, multi-resolution files (mip/ripmaps), +environment maps, and abstracted file I/O. We've also released a new +set of images that demonstrate these features, and updated the +CodeWarrior project and Photoshop plugins for this release. See the +downloads section for the source code and the new images. + +Jan 8, 2004 +=========== + +Industrial Light & Magic has released the source code for an OpenEXR +Shake plugin. The plugin is supported on Shake 3.0 on the GNU/Linux +and MacOS X platforms. See the downloads section. + +Jan 7, 2004 +=========== + +OpenEXR 1.0.7 is now available. In addition to some bug fixes, this +version adds support for some new standard attributes, such as primary +and white point chromaticities, lens aperture, film speed, image +acquisition time and place, and more. If you want to use these new +attributes in your applications, see the ImfStandardAttributes.h +header file for documentation. + +Our project hosting site, Savannah, is still recovering from a +compromise last month, so in the meantime, we're hosting file +downloads here. Some of the files are not currently available, but +we're working to restore them. + +April 3, 2003 +============= + +OpenEXR release 1.0.5 is now available. It includes support for +Windows and improved support for OS X. It also includes support for +hardware rendering of OpenEXR images on NVIDIA GeForce FX and Quadro +FX video cards. See the downloads section for source code and +prebuilt packages for Windows, OS X 10.2, and RedHat. + +April 3, 2003 +============= + +Industrial Light & Magic has released the source code for an OpenEXR +display driver for Pixar's Renderman. This display driver is covered +under the OpenEXR free software license. See the downloads section +for the source code. + +January 22, 2003 +================ + +openexr.com web site is officially launched. + + diff --git a/docs/requirements.txt b/docs/requirements.txt index cd6467ed82..d030b3b5db 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1 +1,3 @@ +sphinx == 4.4.0 breathe +sphinx-press-theme diff --git a/docs/src/reader/CMakeLists.txt b/docs/src/reader/CMakeLists.txt new file mode 100644 index 0000000000..f33f3df026 --- /dev/null +++ b/docs/src/reader/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.12) +project(exrreader) +find_package(OpenEXR REQUIRED) + +add_executable(${PROJECT_NAME} reader.cpp) +target_link_libraries(${PROJECT_NAME} OpenEXR::OpenEXR) + diff --git a/docs/src/reader/build.sh b/docs/src/reader/build.sh new file mode 100755 index 0000000000..7cd8c5801a --- /dev/null +++ b/docs/src/reader/build.sh @@ -0,0 +1,3 @@ +$ mkdir _build +$ cmake -S . -B _build +$ cmake --build _build diff --git a/docs/src/reader/reader.cpp b/docs/src/reader/reader.cpp new file mode 100644 index 0000000000..22e026dabd --- /dev/null +++ b/docs/src/reader/reader.cpp @@ -0,0 +1,25 @@ +#include +#include +#include + +int +main() +{ + try { + Imf::RgbaInputFile file("hello.exr"); + Imath::Box2i dw = file.dataWindow(); + int width = dw.max.x - dw.min.x + 1; + int height = dw.max.y - dw.min.y + 1; + + Imf::Array2D pixels(width, height); + + file.setFrameBuffer(&pixels[0][0], 1, width); + file.readPixels(dw.min.y, dw.max.y); + + } catch (const std::exception &e) { + std::cerr << "error reading image file hello.exr:" << e.what() << std::endl; + return 1; + } + + return 0; +} diff --git a/docs/src/writeDeepScanlineFile.cpp b/docs/src/writeDeepScanlineFile.cpp index ca10508cdc..e4943ef166 100644 --- a/docs/src/writeDeepScanlineFile.cpp +++ b/docs/src/writeDeepScanlineFile.cpp @@ -36,7 +36,7 @@ writeDeepScanlineFile(const char filename[], (char *) (&dataZ[0][0] - dataWindow.min.x - dataWindow.min.y * width), - sizeof (float *) * 1, // xStride for pointe + sizeof (float *) * 1, // xStride for pointer sizeof (float *) * width, // yStride for pointer array sizeof (float) * 1)); // stride for Z data sample diff --git a/docs/src/writer/CMakeLists.txt b/docs/src/writer/CMakeLists.txt new file mode 100644 index 0000000000..79052a6ac7 --- /dev/null +++ b/docs/src/writer/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.12) +project(exrwriter) +find_package(OpenEXR REQUIRED) + +add_executable(${PROJECT_NAME} writer.cpp) +target_link_libraries(${PROJECT_NAME} OpenEXR::OpenEXR) + diff --git a/docs/src/writer/build.sh b/docs/src/writer/build.sh new file mode 100755 index 0000000000..7cd8c5801a --- /dev/null +++ b/docs/src/writer/build.sh @@ -0,0 +1,3 @@ +$ mkdir _build +$ cmake -S . -B _build +$ cmake --build _build diff --git a/docs/src/writer/writer.cpp b/docs/src/writer/writer.cpp new file mode 100644 index 0000000000..6367ee6d06 --- /dev/null +++ b/docs/src/writer/writer.cpp @@ -0,0 +1,25 @@ +#include +#include +#include + +int +main() +{ + int width = 10; + int height = 10; + + Imf::Array2D pixels(width, height); + for (int y=0; y libIlmThread-3_1.so diff --git a/share/ci/scripts/linux/yum/install_docs_env.sh b/share/ci/scripts/linux/yum/install_docs_env.sh new file mode 100755 index 0000000000..c97f661b87 --- /dev/null +++ b/share/ci/scripts/linux/yum/install_docs_env.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: BSD-3-Clause +# Copyright Contributors to the OpenColorIO Project. + +set -ex + +HERE=$(dirname $0) + +bash $HERE/install_doxygen.sh latest +pip3 install -r $HERE/../../../../../docs/requirements.txt diff --git a/share/ci/scripts/linux/yum/install_doxygen.sh b/share/ci/scripts/linux/yum/install_doxygen.sh new file mode 100755 index 0000000000..d51d2611fe --- /dev/null +++ b/share/ci/scripts/linux/yum/install_doxygen.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: BSD-3-Clause +# Copyright Contributors to the OpenColorIO Project. + +set -ex + +DOXYGEN_VERSION="$1" + +if [ "$DOXYGEN_VERSION" == "latest" ]; then + yum install -y doxygen +else + yum install -y doxygen-${DOXYGEN_VERSION} +fi diff --git a/src/bin/exrcheck/main.cpp b/src/bin/exrcheck/main.cpp index d9812e479d..ff42c8f885 100644 --- a/src/bin/exrcheck/main.cpp +++ b/src/bin/exrcheck/main.cpp @@ -4,6 +4,8 @@ #include #include +#include +#include #include #include #include @@ -31,8 +33,7 @@ usageMessage (const char argv0[]) cerr << " -t : avoid spending excessive time (some files will not be fully checked)\n"; cerr << " -s : use stream API instead of file API\n"; cerr << " -c : add core library checks\n"; - cerr << " -v : print OpenEXR and Imath software libary version info\n"; - + cerr << " -v : print OpenEXR and Imath software library version info\n"; } @@ -106,7 +107,7 @@ main(int argc, char **argv) else if (!strcmp (argv[i], "-m")) { // - // note for further memory reduction, calls to the folowing could be added here + // note for further memory reduction, calls to the following could be added here // CompositeDeepScanLine::setMaximumSampleCount(); // Header::setMaxImageSize(); // Header::setMaxTileSize(); diff --git a/src/bin/exrenvmap/CMakeLists.txt b/src/bin/exrenvmap/CMakeLists.txt index c798a6559a..66f1363c3f 100644 --- a/src/bin/exrenvmap/CMakeLists.txt +++ b/src/bin/exrenvmap/CMakeLists.txt @@ -3,12 +3,19 @@ add_executable( exrenvmap blurImage.cpp + blurImage.h EnvmapImage.cpp + EnvmapImage.h main.cpp makeCubeMap.cpp + makeCubeMap.h makeLatLongMap.cpp + makeLatLongMap.h + namespaceAlias.h readInputImage.cpp + readInputImage.h resizeImage.cpp + resizeImage.h ) target_link_libraries(exrenvmap OpenEXR::OpenEXR) diff --git a/src/bin/exrenvmap/blurImage.cpp b/src/bin/exrenvmap/blurImage.cpp index 4024affc0d..daa2cfa1c6 100644 --- a/src/bin/exrenvmap/blurImage.cpp +++ b/src/bin/exrenvmap/blurImage.cpp @@ -60,8 +60,8 @@ blurImage (EnvmapImage &image1, bool verbose) // * Repeatedly resample the image, each time shrinking // it to no less than half its current size, until the // width of each cube face is MAX_IN_WIDTH pixels. - // - // * Multiply each pixel by a weight that is proportinal + // + // * Multiply each pixel by a weight that is proportional // to the solid angle subtended by the pixel as seen // from the center of the environment cube. // @@ -149,7 +149,7 @@ blurImage (EnvmapImage &image1, bool verbose) { // - // Multiply each pixel by a weight that is proportinal + // Multiply each pixel by a weight that is proportional // to the solid angle subtended by the pixel. // diff --git a/src/bin/exrenvmap/makeLatLongMap.h b/src/bin/exrenvmap/makeLatLongMap.h index 55a8dbb689..4809291b53 100644 --- a/src/bin/exrenvmap/makeLatLongMap.h +++ b/src/bin/exrenvmap/makeLatLongMap.h @@ -17,7 +17,6 @@ #include #include "namespaceAlias.h" - void makeLatLongMap (EnvmapImage &image, IMF::Header &header, @@ -27,7 +26,7 @@ makeLatLongMap (EnvmapImage &image, int tileHeight, IMF::LevelMode levelMode, IMF::LevelRoundingMode roundingMode, - IMF::Compression compresssion, + IMF::Compression compression, int mapWidth, float filterRadius, int numSamples, diff --git a/src/bin/exrenvmap/readInputImage.cpp b/src/bin/exrenvmap/readInputImage.cpp index 726cd892fe..be04763b7e 100644 --- a/src/bin/exrenvmap/readInputImage.cpp +++ b/src/bin/exrenvmap/readInputImage.cpp @@ -119,7 +119,7 @@ readSixImages (const char inFileName[], // // Generate six file names by replacing the first '%' character in // inFileName with +X, -X, ... -Z. Interpreting the corresponding - // image files as the six sides of a cube, assembe a single cube- + // image files as the six sides of a cube, assemble a single cube- // face map image. // diff --git a/src/bin/exrmakepreview/CMakeLists.txt b/src/bin/exrmakepreview/CMakeLists.txt index bb8b548efd..a017d264ac 100644 --- a/src/bin/exrmakepreview/CMakeLists.txt +++ b/src/bin/exrmakepreview/CMakeLists.txt @@ -4,6 +4,7 @@ add_executable(exrmakepreview main.cpp makePreview.cpp + makePreview.h ) target_link_libraries(exrmakepreview OpenEXR::OpenEXR) set_target_properties(exrmakepreview PROPERTIES diff --git a/src/bin/exrmakepreview/main.cpp b/src/bin/exrmakepreview/main.cpp index c79814866b..0feb61dcff 100644 --- a/src/bin/exrmakepreview/main.cpp +++ b/src/bin/exrmakepreview/main.cpp @@ -141,8 +141,8 @@ main(int argc, char **argv) if (previewWidth <= 0) { - cerr << "Preview image width must be greather than zero." << endl; - return 1; + cerr << "Preview image width must be greater than zero." << endl; + return 1; } // diff --git a/src/bin/exrmaketiled/CMakeLists.txt b/src/bin/exrmaketiled/CMakeLists.txt index 1bc6cf42e2..a20133ee4f 100644 --- a/src/bin/exrmaketiled/CMakeLists.txt +++ b/src/bin/exrmaketiled/CMakeLists.txt @@ -1,10 +1,13 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright (c) Contributors (c) to the OpenEXR Project. -add_executable(exrmaketiled +add_executable(exrmaketiled Image.cpp + Image.h main.cpp makeTiled.cpp + makeTiled.h + namespaceAlias.h ) target_link_libraries(exrmaketiled OpenEXR::OpenEXR) set_target_properties(exrmaketiled PROPERTIES diff --git a/src/bin/exrmaketiled/main.cpp b/src/bin/exrmaketiled/main.cpp index b78da6ef32..9d861fae94 100644 --- a/src/bin/exrmaketiled/main.cpp +++ b/src/bin/exrmaketiled/main.cpp @@ -52,7 +52,7 @@ usageMessage (const char argv0[], bool verbose = false) " is produced, image channel c will be resampled\n" " without low-pass filtering. This option can\n" " be specified multiple times to disable low-pass\n" - " filtering for mutiple channels.\n" + " filtering for multiple channels.\n" "\n" "-e x y when a MIPMAP_LEVELS or RIPMAP_LEVELS image\n" " is produced, low-pass filtering takes samples\n" diff --git a/src/bin/exrmultipart/exrmultipart.cpp b/src/bin/exrmultipart/exrmultipart.cpp index b53f921e03..d1cdd866db 100644 --- a/src/bin/exrmultipart/exrmultipart.cpp +++ b/src/bin/exrmultipart/exrmultipart.cpp @@ -596,7 +596,7 @@ separate (vector in, const char* out, bool override) int numOutputs; vector fornamecheck; - // add check for existance of the file + // add check for existence of the file try { MultiPartInputFile temp (filename.c_str()); @@ -662,7 +662,8 @@ separate (vector in, const char* out, bool override) } delete inputimage; - cout << "\n" << "Seperate Success" << endl; + cout << "\n" + << "Separate Success" << endl; } void diff --git a/src/bin/exrmultiview/CMakeLists.txt b/src/bin/exrmultiview/CMakeLists.txt index 05ad081648..ba352e067d 100644 --- a/src/bin/exrmultiview/CMakeLists.txt +++ b/src/bin/exrmultiview/CMakeLists.txt @@ -3,8 +3,11 @@ add_executable(exrmultiview Image.cpp + Image.h main.cpp makeMultiView.cpp + makeMultiView.h + namespaceAlias.h ) target_link_libraries(exrmultiview OpenEXR::OpenEXR) set_target_properties(exrmultiview PROPERTIES diff --git a/src/examples/CMakeLists.txt b/src/examples/CMakeLists.txt index 901e15f40e..6b882939ea 100644 --- a/src/examples/CMakeLists.txt +++ b/src/examples/CMakeLists.txt @@ -14,15 +14,30 @@ endif() add_executable(OpenEXRExamples drawImage.cpp + drawImage.h generalInterfaceExamples.cpp + generalInterfaceExamples.h generalInterfaceTiledExamples.cpp + generalInterfaceTiledExamples.h lowLevelIoExamples.cpp + lowLevelIoExamples.h main.cpp + namespaceAlias.h previewImageExamples.cpp + previewImageExamples.h rgbaInterfaceExamples.cpp + rgbaInterfaceExamples.h rgbaInterfaceTiledExamples.cpp + rgbaInterfaceTiledExamples.h ) + target_link_libraries(OpenEXRExamples OpenEXR::OpenEXR) +set_target_properties(OpenEXRExamples PROPERTIES + RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin" +) +if(WIN32 AND BUILD_SHARED_LIBS) + target_compile_definitions(OpenEXRExamples PRIVATE OPENEXR_DLL) +endif() # Examples install( @@ -46,6 +61,7 @@ install( DESTINATION ${CMAKE_INSTALL_DOCDIR}/examples ) -if(WIN32 AND BUILD_SHARED_LIBS) - target_compile_definitions(OpenEXRExamples PRIVATE OPENEXR_DLL) + +if(BUILD_TESTING) + add_test(NAME OpenEXR.OpenEXRExamples COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) endif() diff --git a/src/lib/Iex/CMakeLists.txt b/src/lib/Iex/CMakeLists.txt index 84a5d64fa5..48185cc200 100644 --- a/src/lib/Iex/CMakeLists.txt +++ b/src/lib/Iex/CMakeLists.txt @@ -5,6 +5,7 @@ openexr_define_library(Iex PRIV_EXPORT IEX_EXPORTS CURDIR ${CMAKE_CURRENT_SOURCE_DIR} SOURCES + IexMathFpu.h IexBaseExc.cpp IexMathFloatExc.cpp IexMathFpu.cpp diff --git a/src/lib/Iex/IexBaseExc.h b/src/lib/Iex/IexBaseExc.h index 68eaf357de..a5e798d4b0 100644 --- a/src/lib/Iex/IexBaseExc.h +++ b/src/lib/Iex/IexBaseExc.h @@ -180,7 +180,7 @@ DEFINE_EXC_EXP (IEX_EXPORT, TypeExc, BaseExc) // An object is an inappropriate // BaseExc is thrown. The stack-tracing routine should return a // string that contains a printable representation of the program's // current call stack. This string will be stored in the BaseExc -// object; the string is accesible via the BaseExc::stackTrace() +// object; the string is accessible via the BaseExc::stackTrace() // method. // // setStackTracer(0) diff --git a/src/lib/Iex/IexMathExc.h b/src/lib/Iex/IexMathExc.h index d304a3d425..725cac075c 100644 --- a/src/lib/Iex/IexMathExc.h +++ b/src/lib/Iex/IexMathExc.h @@ -11,10 +11,10 @@ IEX_INTERNAL_NAMESPACE_HEADER_ENTER -//--------------------------------------------------------- -// Exception classess which correspond to specific floating +//-------------------------------------------------------- +// Exception classes which correspond to specific floating // point exceptions. -//--------------------------------------------------------- +//-------------------------------------------------------- DEFINE_EXC_EXP (IEX_EXPORT, OverflowExc, MathExc) // Overflow DEFINE_EXC_EXP (IEX_EXPORT, UnderflowExc, MathExc) // Underflow diff --git a/src/lib/Iex/IexMathFloatExc.h b/src/lib/Iex/IexMathFloatExc.h index 89da5aa7bf..9830d403dd 100644 --- a/src/lib/Iex/IexMathFloatExc.h +++ b/src/lib/Iex/IexMathFloatExc.h @@ -34,7 +34,7 @@ int getMathExcOn(); //------------------------------------------------------------------------ -// A classs that temporarily sets floating point exception trapping +// A class that temporarily sets floating point exception trapping // and conversion, and later restores the previous settings. // // Example: diff --git a/src/lib/Iex/IexMathFpu.cpp b/src/lib/Iex/IexMathFpu.cpp index b73e98f182..996bae84f0 100644 --- a/src/lib/Iex/IexMathFpu.cpp +++ b/src/lib/Iex/IexMathFpu.cpp @@ -251,7 +251,7 @@ restoreControlRegs (const ucontext_t & ucon, bool clearExceptions) inline void restoreControlRegs (const ucontext_t & ucon, bool clearExceptions) { -# if defined(__GLIBC__) && defined(__i386__) +# if (defined(__GLIBC__) && defined(__i386__)) || defined(__ANDROID_API__) setCw ((ucon.uc_mcontext.fpregs->cw & cwRestoreMask) | cwRestoreVal); #else setCw ((ucon.uc_mcontext.fpregs->cwd & cwRestoreMask) | cwRestoreVal); diff --git a/src/lib/OpenEXR/CMakeLists.txt b/src/lib/OpenEXR/CMakeLists.txt index 12fb254a1a..a4e0c2497e 100644 --- a/src/lib/OpenEXR/CMakeLists.txt +++ b/src/lib/OpenEXR/CMakeLists.txt @@ -5,6 +5,30 @@ openexr_define_library(OpenEXR PRIV_EXPORT OPENEXR_EXPORTS CURDIR ${CMAKE_CURRENT_SOURCE_DIR} SOURCES + ImfAutoArray.h + ImfB44Compressor.h + ImfCheckedArithmetic.h + ImfCompressor.h + ImfDwaCompressor.h + ImfDwaCompressorSimd.h + ImfFastHuf.h + ImfInputPartData.h + ImfInputStreamMutex.h + ImfMisc.h + ImfOptimizedPixelReading.h + ImfOutputPartData.h + ImfOutputStreamMutex.h + ImfPizCompressor.h + ImfPxr24Compressor.h + ImfRle.h + ImfRleCompressor.h + ImfScanLineInputFile.h + ImfSimd.h + ImfSystemSpecific.h + ImfTileOffsets.h + ImfTiledMisc.h + ImfZip.h + ImfZipCompressor.h b44ExpLogTable.h dwaLookups.h ImfAcesFile.cpp diff --git a/src/lib/OpenEXR/ImfArray.h b/src/lib/OpenEXR/ImfArray.h index 37183a7e85..b840b99bd2 100644 --- a/src/lib/OpenEXR/ImfArray.h +++ b/src/lib/OpenEXR/ImfArray.h @@ -191,7 +191,7 @@ inline Array2D::Array2D (): _sizeX(0), _sizeY (0), _data (0) { - // emtpy + // empty } @@ -200,7 +200,7 @@ inline Array2D::Array2D (long sizeX, long sizeY): _sizeX (sizeX), _sizeY (sizeY), _data (new T[sizeX * sizeY]) { - // emtpy + // empty } diff --git a/src/lib/OpenEXR/ImfB44Compressor.cpp b/src/lib/OpenEXR/ImfB44Compressor.cpp index a013174371..cb92a94078 100644 --- a/src/lib/OpenEXR/ImfB44Compressor.cpp +++ b/src/lib/OpenEXR/ImfB44Compressor.cpp @@ -219,7 +219,7 @@ pack (const unsigned short s[16], // // Compute a set of running differences, r[0] ... r[14]: // Find a shift value such that after rounding off the - // rightmost bits and shifting all differenes are between + // rightmost bits and shifting all differences are between // -32 and +31. Then bias the differences so that they // end up between 0 and 63. // @@ -618,7 +618,7 @@ B44Compressor::compress (const char *inPtr, } // - // For each channel, detemine how many pixels are stored + // For each channel, determine how many pixels are stored // in the input buffer, and where those pixels will be // placed in _tmpBuffer. // diff --git a/src/lib/OpenEXR/ImfChannelList.h b/src/lib/OpenEXR/ImfChannelList.h index 4a056cbd5e..4e60268ed7 100644 --- a/src/lib/OpenEXR/ImfChannelList.h +++ b/src/lib/OpenEXR/ImfChannelList.h @@ -53,7 +53,7 @@ struct IMF_EXPORT_TYPE Channel // human perception of the quantity represented by this channel // is closer to linear or closer to logarithmic. Compression // methods may optimize image quality by adjusting pixel data - // quantization acording to this hint. + // quantization according to this hint. // For example, perception of red, green, blue and luminance is // approximately logarithmic; the difference between 0.1 and 0.2 // is perceived to be roughly the same as the difference between diff --git a/src/lib/OpenEXR/ImfCompositeDeepScanLine.cpp b/src/lib/OpenEXR/ImfCompositeDeepScanLine.cpp index 0516bcc218..9250ed164a 100644 --- a/src/lib/OpenEXR/ImfCompositeDeepScanLine.cpp +++ b/src/lib/OpenEXR/ImfCompositeDeepScanLine.cpp @@ -507,7 +507,7 @@ CompositeDeepScanLine::readPixels (int start, int end) vector num_sources ( total_pixels); //number of parts with non-zero sample count - size_t overall_sample_count = + int64_t overall_sample_count = 0; // sum of all samples in all images between start and end // @@ -561,7 +561,7 @@ CompositeDeepScanLine::readPixels (int start, int end) // allocate pointers for channel data // - size_t offset = 0; + int64_t offset = 0; for (size_t pixel = 0; pixel < total_pixels; pixel++) { diff --git a/src/lib/OpenEXR/ImfDeepScanLineInputFile.cpp b/src/lib/OpenEXR/ImfDeepScanLineInputFile.cpp index 2bcc64f800..10abd0a30a 100644 --- a/src/lib/OpenEXR/ImfDeepScanLineInputFile.cpp +++ b/src/lib/OpenEXR/ImfDeepScanLineInputFile.cpp @@ -1047,11 +1047,11 @@ newLineBufferTask // // when handling files with dataWindows with a large number of pixels, -// the sampleCount values are not precached and Data::sampleCount is not asigned -// instead, the sampleCount is read every time readPixels() is called +// the sampleCount values are not precached and Data::sampleCount is not +// assigned instead, the sampleCount is read every time readPixels() is called // and sample counts are stored in LineBuffer::_tempCountBuffer instead // (A square image that is 16k by 16k pixels has gBigFileDataWindowSize pixels, -// andthe sampleCount table would take 1GiB of memory to store) +// and the sampleCount table would take 1GiB of memory to store) // const uint64_t gBigFileDataWindowSize = (1<<28); @@ -1128,9 +1128,21 @@ void DeepScanLineInputFile::initialize(const Header& header) for (int i = 0; i < _data->maxY - _data->minY + 1; i++) _data->gotSampleCount[i] = false; - _data->maxSampleCountTableSize = min(_data->linesInBuffer, _data->maxY - _data->minY + 1) * - (_data->maxX - _data->minX + 1) * - sizeof(unsigned int); + int64_t imageHeight = static_cast(_data->maxY) - static_cast(_data->minY) + 1; + int64_t imageWidth = static_cast(_data->maxX) - static_cast(_data->minX) +1; + + int64_t tableSize = min (static_cast(_data->linesInBuffer), imageHeight) * imageWidth + * sizeof (unsigned int); + + if (tableSize>std::numeric_limits::max() ) + { + THROW (IEX_NAMESPACE::ArgExc, + "Deep scanline image size " + << imageWidth << " x " << imageHeight + << " exceeds maximum size"); + } + _data->maxSampleCountTableSize =tableSize; + _data->sampleCountTableBuffer.resizeErase(_data->maxSampleCountTableSize); @@ -1227,8 +1239,8 @@ DeepScanLineInputFile::DeepScanLineInputFile throw; } - // - // not multiPart - allocate stream data and intialise as normal + // + // not multiPart - allocate stream data and initialise as normal // try { @@ -1303,7 +1315,7 @@ DeepScanLineInputFile::DeepScanLineInputFile } // - // not multiPart - allocate stream data and intialise as normal + // not multiPart - allocate stream data and initialise as normal // try { @@ -1703,7 +1715,7 @@ DeepScanLineInputFile::readPixels (int scanLine1, int scanLine2) } // - // Exeption handling: + // Exception handling: // // LineBufferTask::execute() may have encountered exceptions, but // those exceptions occurred in another thread, not in the thread diff --git a/src/lib/OpenEXR/ImfDeepScanLineOutputFile.cpp b/src/lib/OpenEXR/ImfDeepScanLineOutputFile.cpp index 19c8c9471e..5c5c5cdc72 100644 --- a/src/lib/OpenEXR/ImfDeepScanLineOutputFile.cpp +++ b/src/lib/OpenEXR/ImfDeepScanLineOutputFile.cpp @@ -1333,7 +1333,7 @@ DeepScanLineOutputFile::writePixels (int numScanLines) } // - // Exeption handling: + // Exception handling: // // LineBufferTask::execute() may have encountered exceptions, but // those exceptions occurred in another thread, not in the thread diff --git a/src/lib/OpenEXR/ImfDeepTiledInputFile.cpp b/src/lib/OpenEXR/ImfDeepTiledInputFile.cpp index 50f6b2e827..03adc84647 100644 --- a/src/lib/OpenEXR/ImfDeepTiledInputFile.cpp +++ b/src/lib/OpenEXR/ImfDeepTiledInputFile.cpp @@ -1351,7 +1351,7 @@ DeepTiledInputFile::readTiles (int dx1, int dx2, int dy1, int dy2, int lx, int l } // - // Exeption handling: + // Exception handling: // // TileBufferTask::execute() may have encountered exceptions, but // those exceptions occurred in another thread, not in the thread diff --git a/src/lib/OpenEXR/ImfDeepTiledInputFile.h b/src/lib/OpenEXR/ImfDeepTiledInputFile.h index b01330f3b3..aa768a378d 100644 --- a/src/lib/OpenEXR/ImfDeepTiledInputFile.h +++ b/src/lib/OpenEXR/ImfDeepTiledInputFile.h @@ -19,6 +19,7 @@ #include "ImfTileDescription.h" +#include #include OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER @@ -313,7 +314,7 @@ class IMF_EXPORT_TYPE DeepTiledInputFile : public GenericInputFile // dy must lie in the interval [0, numYTiles(ly)-1] // // lx must lie in the interval [0, numXLevels()-1] - // ly must lie in the inverval [0, numYLevels()-1] + // ly must lie in the interval [0, numYLevels()-1] // // readTile(dx, dy, level) is a convenience function used // for ONE_LEVEL and MIPMAP_LEVELS files. It calls @@ -370,7 +371,7 @@ class IMF_EXPORT_TYPE DeepTiledInputFile : public GenericInputFile // dy must lie in the interval [0, numYTiles(ly)-1] // // lx must lie in the interval [0, numXLevels()-1] - // ly must lie in the inverval [0, numYLevels()-1] + // ly must lie in the interval [0, numYLevels()-1] // // readPixelSampleCounts(dx1, dx2, dy1, dy2, lx, ly) reads all // the sample counts for tiles within range diff --git a/src/lib/OpenEXR/ImfDeepTiledInputPart.h b/src/lib/OpenEXR/ImfDeepTiledInputPart.h index e5f950a931..86caeb2179 100644 --- a/src/lib/OpenEXR/ImfDeepTiledInputPart.h +++ b/src/lib/OpenEXR/ImfDeepTiledInputPart.h @@ -10,6 +10,7 @@ #include "ImfTileDescription.h" +#include #include OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER @@ -269,7 +270,7 @@ class IMF_EXPORT_TYPE DeepTiledInputPart // dy must lie in the interval [0, numYTiles(ly)-1] // // lx must lie in the interval [0, numXLevels()-1] - // ly must lie in the inverval [0, numYLevels()-1] + // ly must lie in the interval [0, numYLevels()-1] // // readTile(dx, dy, level) is a convenience function used // for ONE_LEVEL and MIPMAP_LEVELS files. It calls @@ -327,7 +328,7 @@ class IMF_EXPORT_TYPE DeepTiledInputPart // dy must lie in the interval [0, numYTiles(ly)-1] // // lx must lie in the interval [0, numXLevels()-1] - // ly must lie in the inverval [0, numYLevels()-1] + // ly must lie in the interval [0, numYLevels()-1] // // readPixelSampleCounts(dx1, dx2, dy1, dy2, lx, ly) reads all // the sample counts for tiles within range diff --git a/src/lib/OpenEXR/ImfDeepTiledOutputFile.cpp b/src/lib/OpenEXR/ImfDeepTiledOutputFile.cpp index 2f369d2554..5a4b5c5eeb 100644 --- a/src/lib/OpenEXR/ImfDeepTiledOutputFile.cpp +++ b/src/lib/OpenEXR/ImfDeepTiledOutputFile.cpp @@ -899,7 +899,7 @@ TileBufferTask::execute () int xOffsetForData = slice.xTileCoords ? tileRange.min.x : 0; int yOffsetForData = slice.yTileCoords ? tileRange.min.y : 0; - // (TOOD) treat sample count offsets differently. + // (TODO) treat sample count offsets differently. copyFromDeepFrameBuffer (writePtr, slice.base, _ofd->sampleCountSliceBase, @@ -1590,7 +1590,7 @@ DeepTiledOutputFile::writeTiles (int dx1, int dx2, int dy1, int dy2, } // - // Exeption handling: + // Exception handling: // // TileBufferTask::execute() may have encountered exceptions, but // those exceptions occurred in another thread, not in the thread diff --git a/src/lib/OpenEXR/ImfDeepTiledOutputFile.h b/src/lib/OpenEXR/ImfDeepTiledOutputFile.h index 97a3aa04a1..e1e838d2e5 100644 --- a/src/lib/OpenEXR/ImfDeepTiledOutputFile.h +++ b/src/lib/OpenEXR/ImfDeepTiledOutputFile.h @@ -309,7 +309,7 @@ class IMF_EXPORT_TYPE DeepTiledOutputFile : public GenericOutputFile // dy must lie in the interval [0, numYTiles(ly) - 1] // // lx must lie in the interval [0, numXLevels() - 1] - // ly must lie in the inverval [0, numYLevels() - 1] + // ly must lie in the interval [0, numYLevels() - 1] // // writeTile(dx, dy, level) is a convenience function // used for ONE_LEVEL and MIPMAP_LEVEL files. It calls diff --git a/src/lib/OpenEXR/ImfDeepTiledOutputPart.h b/src/lib/OpenEXR/ImfDeepTiledOutputPart.h index f42c78d832..47f902d6e0 100644 --- a/src/lib/OpenEXR/ImfDeepTiledOutputPart.h +++ b/src/lib/OpenEXR/ImfDeepTiledOutputPart.h @@ -250,7 +250,7 @@ class IMF_EXPORT_TYPE DeepTiledOutputPart // dy must lie in the interval [0, numYTiles(ly) - 1] // // lx must lie in the interval [0, numXLevels() - 1] - // ly must lie in the inverval [0, numYLevels() - 1] + // ly must lie in the interval [0, numYLevels() - 1] // // writeTile(dx, dy, level) is a convenience function // used for ONE_LEVEL and MIPMAP_LEVEL files. It calls diff --git a/src/lib/OpenEXR/ImfDwaCompressor.cpp b/src/lib/OpenEXR/ImfDwaCompressor.cpp index 19f6b15c75..d8f50f8b1f 100644 --- a/src/lib/OpenEXR/ImfDwaCompressor.cpp +++ b/src/lib/OpenEXR/ImfDwaCompressor.cpp @@ -18,11 +18,11 @@ // into the start of the data block, making a self-contained file. // If initializeDefaultChannelRules() doesn't quite suite your naming // conventions, you can adjust the rules without breaking decoder -// compatability. +// compatibility. // // If we're going to lossy compress R, G, or B channels, it's easier // to toss bits in a more perceptual uniform space. One could argue -// at length as to what constitutes perceptually uniform, expecially +// at length as to what constitutes perceptually uniform, especially // when storing either scene/input/focal plane referred and output referred // data. // @@ -55,10 +55,10 @@ // // For each DCT component, we want to find a quantized value that // is within +- the per-component error. Pick the quantized value -// that has the fewest bits set in its' binary representation. -// Brute-forcing the search would make for extremly inefficient -// compression. Fortunatly, we can precompute a table to assist -// with this search. +// that has the fewest bits set in its' binary representation. +// Brute-forcing the search would make for extremely inefficient +// compression. Fortunately, we can precompute a table to assist +// with this search. // // For each 16-bit float value, there are at most 15 other values with // fewer bits set. We can precompute these values in a compact form, since @@ -120,8 +120,13 @@ #include "ImathBox.h" #include "ImathVec.h" #include "half.h" -#include "halfLimits.h" +#include +#include +#include +#include +#include +#include #include #include #include @@ -150,7 +155,7 @@ OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_ENTER namespace { // - // Function pointer to dispatch to an approprate + // Function pointer to dispatch to an appropriate // convertFloatToHalf64_* impl, based on runtime cpu checking. // Should be initialized in DwaCompressor::initializeFuncs() // @@ -1191,7 +1196,7 @@ DwaCompressor::LossyDctDecoderBase::unRleAc // high byte is 0xff, then insert the number of 0's // as indicated by the low byte. // - // Otherwise, just copy the number verbaitm. + // Otherwise, just copy the number verbatim. // int lastNonZero = 0; @@ -1687,8 +1692,8 @@ DwaCompressor::LossyDctEncoderBase::quantize (half src, float errorTolerance) // Try to do a simple RLE scheme to reduce run's of 0's. This // differs from the jpeg EOB case, since EOB just indicates that // the rest of the block is zero. In our case, we have lots of -// NaN symbols, which shouldn't be allowed to occur in DCT -// coefficents - so we'll use them for encoding runs. +// NaN symbols, which shouldn't be allowed to occur in DCT +// coefficients - so we'll use them for encoding runs. // // If the high byte is 0xff, then we have a run of 0's, of length // given by the low byte. For example, 0xff03 would be a run @@ -1936,7 +1941,7 @@ DwaCompressor::compress // // We might not be dealing with any color data, in which - // case the AC buffer size will be 0, and deferencing + // case the AC buffer size will be 0, and dereferencing // a vector will not be a good thing to do. // @@ -2105,7 +2110,7 @@ DwaCompressor::compress // // For RLE, bash the bytes up so that the first bytes of each - // pixel are contingous, as are the second bytes, and so on. + // pixel are contiguous, as are the second bytes, and so on. // for (unsigned int y = 0; y < rowPtrs[chan].size(); ++y) @@ -2166,14 +2171,15 @@ DwaCompressor::compress if (*unknownUncompressedSize > 0) { - uLongf inSize = (uLongf)(*unknownUncompressedSize); - uLongf outSize = compressBound (inSize); + uLong inSize = static_cast (*unknownUncompressedSize); + uLong outSize = compressBound (inSize); - if (Z_OK != ::compress2 ((Bytef *)outDataPtr, - &outSize, - (const Bytef *)_planarUncBuffer[UNKNOWN], - inSize, - 9)) + if (Z_OK != ::compress2 ( + reinterpret_cast (outDataPtr), + &outSize, + reinterpret_cast (_planarUncBuffer[UNKNOWN]), + inSize, + 9)) { throw IEX_NAMESPACE::BaseExc ("Data compression (zlib) failed."); } @@ -2205,16 +2211,16 @@ DwaCompressor::compress case DEFLATE: { - uLongf destLen = compressBound ( - (*totalAcUncompressedCount) * sizeof (unsigned short)); - - if (Z_OK != ::compress2 - ((Bytef *)outDataPtr, - &destLen, - (Bytef *)_packedAcBuffer, - (uLong)(*totalAcUncompressedCount - * sizeof (unsigned short)), - 9)) + uLong sourceLen = static_cast (*totalAcUncompressedCount * sizeof (unsigned short)); + uLong destLen = compressBound (sourceLen); + + if (Z_OK != + ::compress2 ( + reinterpret_cast (outDataPtr), + &destLen, + reinterpret_cast (_packedAcBuffer), + sourceLen, + 9)) { throw IEX_NAMESPACE::InputExc ("Data compression (zlib) failed."); } @@ -2258,14 +2264,15 @@ DwaCompressor::compress _planarUncBuffer[RLE], (signed char *)_rleBuffer); - uLongf dstLen = compressBound ((uLongf)*rleUncompressedSize); + uLong srcLen = static_cast (*rleUncompressedSize); + uLong dstLen = compressBound (srcLen); - if (Z_OK != ::compress2 - ((Bytef *)outDataPtr, - &dstLen, - (Bytef *)_rleBuffer, - (uLong)(*rleUncompressedSize), - 9)) + if (Z_OK != ::compress2 ( + reinterpret_cast (outDataPtr), + &dstLen, + reinterpret_cast (_rleBuffer), + srcLen, + 9)) { throw IEX_NAMESPACE::BaseExc ("Error compressing RLE'd data."); } @@ -2346,10 +2353,12 @@ DwaCompressor::uncompress // Flip the counters from XDR to NATIVE // + std::array counterBuf; + memcpy (counterBuf.data (), inPtr, counterBuf.size() * sizeof (uint64_t)); for (int i = 0; i < NUM_SIZES_SINGLE; ++i) { - uint64_t *dst = (((uint64_t *)inPtr) + i); - const char *src = (char *)(((uint64_t *)inPtr) + i); + uint64_t* dst = counterBuf.data() + i; + const char* src = (char*) (counterBuf.data() + i); Xdr::read (src, *dst); } @@ -2358,7 +2367,7 @@ DwaCompressor::uncompress // Unwind all the counter info // - const uint64_t *inPtr64 = (const uint64_t*) inPtr; + const uint64_t* inPtr64 = counterBuf.data(); uint64_t version = *(inPtr64 + VERSION); uint64_t unknownUncompressedSize = *(inPtr64 + UNKNOWN_UNCOMPRESSED_SIZE); @@ -2508,13 +2517,14 @@ DwaCompressor::uncompress "(corrupt header)."); } - uLongf outSize = (uLongf)unknownUncompressedSize; + uLong inSize = static_cast (unknownCompressedSize); + uLong outSize = static_cast (unknownUncompressedSize); - if (Z_OK != ::uncompress - ((Bytef *)_planarUncBuffer[UNKNOWN], - &outSize, - (Bytef *)compressedUnknownBuf, - (uLong)unknownCompressedSize)) + if (Z_OK != ::uncompress ( + reinterpret_cast (_planarUncBuffer[UNKNOWN]), + &outSize, + reinterpret_cast (compressedUnknownBuf), + inSize)) { throw IEX_NAMESPACE::BaseExc("Error uncompressing UNKNOWN data."); } @@ -2548,16 +2558,15 @@ DwaCompressor::uncompress break; - case DEFLATE: - { - uLongf destLen = - (int)(totalAcUncompressedCount) * sizeof (unsigned short); - - if (Z_OK != ::uncompress - ((Bytef *)_packedAcBuffer, - &destLen, - (Bytef *)compressedAcBuf, - (uLong)acCompressedSize)) + case DEFLATE: { + uLong destLen = static_cast (totalAcUncompressedCount * sizeof (unsigned short)); + uLong sourceLen = static_cast (acCompressedSize); + + if (Z_OK != ::uncompress ( + reinterpret_cast (_packedAcBuffer), + &destLen, + reinterpret_cast (compressedAcBuf), + sourceLen)) { throw IEX_NAMESPACE::InputExc ("Data decompression (zlib) failed."); } @@ -2619,13 +2628,14 @@ DwaCompressor::uncompress "(corrupt header)."); } - uLongf dstLen = (uLongf)rleUncompressedSize; - - if (Z_OK != ::uncompress - ((Bytef *)_rleBuffer, - &dstLen, - (Bytef *)compressedRleBuf, - (uLong)rleCompressedSize)) + uLong dstLen = static_cast (rleUncompressedSize); + uLong srcLen = static_cast (rleCompressedSize); + + if (Z_OK != ::uncompress ( + reinterpret_cast (_rleBuffer), + &dstLen, + reinterpret_cast (compressedRleBuf), + srcLen)) { throw IEX_NAMESPACE::BaseExc("Error uncompressing RLE data."); } @@ -2878,6 +2888,13 @@ DwaCompressor::initializeFuncs() fromHalfZigZag = fromHalfZigZag_f16c; } +#ifdef IMF_HAVE_NEON + { + convertFloatToHalf64 = convertFloatToHalf64_neon; + fromHalfZigZag = fromHalfZigZag_neon; + } +#endif + // // Setup inverse DCT implementations // @@ -2960,11 +2977,11 @@ DwaCompressor::initializeBuffers (size_t &outBufferSize) // or for zlib compression (for DEFLATE) // - maxOutBufferSize += std::max( - 2lu * maxLossyDctAcSize + 65536lu, - static_cast(compressBound (maxLossyDctAcSize)) ); - numLossyDctChans++; - break; + maxOutBufferSize += std::max ( + 2lu * maxLossyDctAcSize + 65536lu, + static_cast (compressBound (static_cast (maxLossyDctAcSize)))); + numLossyDctChans++; + break; case RLE: { @@ -2999,17 +3016,18 @@ DwaCompressor::initializeBuffers (size_t &outBufferSize) // which could take slightly more space // - maxOutBufferSize += static_cast(compressBound (rleBufferSize)); - + maxOutBufferSize += static_cast (compressBound (static_cast (rleBufferSize))); + // // And the same goes for the UNKNOWN data // - maxOutBufferSize += static_cast(compressBound (unknownBufferSize)); + maxOutBufferSize += + static_cast (compressBound (static_cast (unknownBufferSize))); // - // Allocate a zip/deflate compressor big enought to hold the DC data - // and include it's compressed results in the size requirements + // Allocate a zip/deflate compressor big enough to hold the DC data + // and include its compressed results in the size requirements // for our output buffer // @@ -3125,8 +3143,8 @@ DwaCompressor::initializeBuffers (size_t &outBufferSize) if (planarUncBufferSize[UNKNOWN] > 0) { - planarUncBufferSize[UNKNOWN] = - static_cast( compressBound (planarUncBufferSize[UNKNOWN]) ); + planarUncBufferSize[UNKNOWN] = static_cast ( + compressBound (static_cast (planarUncBufferSize[UNKNOWN]))); } for (int i = 0; i < NUM_COMPRESSOR_SCHEMES; ++i) @@ -3255,8 +3273,8 @@ DwaCompressor::relevantChannelRules (std::vector &rules) const // // Take our initial list of channels, and cache the contents. // -// Determine approprate compression schemes for each channel, -// and figure out which sets should potentially be CSC'ed +// Determine appropriate compression schemes for each channel, +// and figure out which sets should potentially be CSC'ed // prior to lossy compression. // diff --git a/src/lib/OpenEXR/ImfDwaCompressor.h b/src/lib/OpenEXR/ImfDwaCompressor.h index 11aba86dc6..6ed0188496 100644 --- a/src/lib/OpenEXR/ImfDwaCompressor.h +++ b/src/lib/OpenEXR/ImfDwaCompressor.h @@ -168,8 +168,8 @@ class DwaCompressor: public Compressor // Populate our cached version of the channel data with // data from the real channel list. We want to // copy over attributes, determine compression schemes - // releveant for the channel type, and find sets of - // channels to be compressed from Y'CbCr data instead + // relevant for the channel type, and find sets of + // channels to be compressed from Y'CbCr data instead // of R'G'B'. // diff --git a/src/lib/OpenEXR/ImfDwaCompressorSimd.h b/src/lib/OpenEXR/ImfDwaCompressorSimd.h index 906608a0e3..b00ecc4529 100644 --- a/src/lib/OpenEXR/ImfDwaCompressorSimd.h +++ b/src/lib/OpenEXR/ImfDwaCompressorSimd.h @@ -7,11 +7,11 @@ #define IMF_DWACOMPRESSORSIMD_H_HAS_BEEN_INCLUDED // -// Various SSE accelerated functions, used by Imf::DwaCompressor. +// Various SSE accelerated functions, used by Imf::DwaCompressor. // These have been separated into a separate .h file, as the fast // paths are done with template specialization. // -// Unless otherwise noted, all pointers are assumed to be 32-byte +// Unless otherwise noted, all pointers are assumed to be 32-byte // aligned. Unaligned pointers may risk seg-faulting. // @@ -21,112 +21,106 @@ #include "OpenEXRConfig.h" #include "OpenEXRConfigInternal.h" -#include #include +#include #include OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER -#define _SSE_ALIGNMENT 32 +#define _SSE_ALIGNMENT 32 #define _SSE_ALIGNMENT_MASK 0x0F #define _AVX_ALIGNMENT_MASK 0x1F // -// A simple 64-element array, aligned properly for SIMD access. +// A simple 64-element array, aligned properly for SIMD access. // -template -class SimdAlignedBuffer64 +template class SimdAlignedBuffer64 { - public: - - SimdAlignedBuffer64(): _buffer (0), _handle (0) - { - alloc(); - } +public: + SimdAlignedBuffer64 () : _buffer (0), _handle (0) { alloc (); } - SimdAlignedBuffer64(const SimdAlignedBuffer64 &rhs): _buffer (0), _handle(0) - { - alloc(); - memcpy (_buffer, rhs._buffer, 64 * sizeof (T)); - } + SimdAlignedBuffer64 (const SimdAlignedBuffer64& rhs) + : _buffer (0), _handle (0) + { + alloc (); + memcpy (_buffer, rhs._buffer, 64 * sizeof (T)); + } - SimdAlignedBuffer64 &operator=(const SimdAlignedBuffer64 &rhs) - { - memcpy (_buffer, rhs._buffer, 64 * sizeof (T)); - return *this; - } + SimdAlignedBuffer64& operator= (const SimdAlignedBuffer64& rhs) + { + memcpy (_buffer, rhs._buffer, 64 * sizeof (T)); + return *this; + } #if __cplusplus >= 201103L - SimdAlignedBuffer64(SimdAlignedBuffer64 &&rhs) noexcept - : _buffer(rhs._buffer), _handle(rhs._handle) - { - rhs._handle = nullptr; - rhs._buffer = nullptr; - } + SimdAlignedBuffer64 (SimdAlignedBuffer64&& rhs) noexcept + : _buffer (rhs._buffer), _handle (rhs._handle) + { + rhs._handle = nullptr; + rhs._buffer = nullptr; + } - SimdAlignedBuffer64 &operator=(SimdAlignedBuffer64 &&rhs) noexcept - { - std::swap(_handle, rhs._handle); - std::swap(_buffer, rhs._buffer); - return *this; - } + SimdAlignedBuffer64& operator= (SimdAlignedBuffer64&& rhs) noexcept + { + std::swap (_handle, rhs._handle); + std::swap (_buffer, rhs._buffer); + return *this; + } #endif - ~SimdAlignedBuffer64 () - { - if (_handle) - EXRFreeAligned (_handle); - _handle = 0; - _buffer = 0; - } - - void alloc() - { - // - // Try EXRAllocAligned first - but it might fallback to - // unaligned allocs. If so, overalloc. - // + ~SimdAlignedBuffer64 () + { + if (_handle) EXRFreeAligned (_handle); + _handle = 0; + _buffer = 0; + } - _handle = (char *) EXRAllocAligned - (64 * sizeof(T), _SSE_ALIGNMENT); + void alloc () + { + // + // Try EXRAllocAligned first - but it might fallback to + // unaligned allocs. If so, overalloc. + // - if (((size_t)_handle & (_SSE_ALIGNMENT - 1)) == 0) - { - _buffer = (T *)_handle; - return; - } + _handle = (char*) EXRAllocAligned (64 * sizeof (T), _SSE_ALIGNMENT); - EXRFreeAligned(_handle); - _handle = (char *) EXRAllocAligned - (64 * sizeof(T) + _SSE_ALIGNMENT, _SSE_ALIGNMENT); + if (((size_t) _handle & (_SSE_ALIGNMENT - 1)) == 0) + { + _buffer = (T*) _handle; + return; + } - char *aligned = _handle; + EXRFreeAligned (_handle); + _handle = (char*) EXRAllocAligned ( + 64 * sizeof (T) + _SSE_ALIGNMENT, _SSE_ALIGNMENT); - while ((size_t)aligned & (_SSE_ALIGNMENT - 1)) - aligned++; + char* aligned = _handle; - _buffer = (T *)aligned; - } + while ((size_t) aligned & (_SSE_ALIGNMENT - 1)) + aligned++; - T *_buffer; + _buffer = (T*) aligned; + } - private: + T* _buffer; - char *_handle; +private: + char* _handle; }; typedef SimdAlignedBuffer64 SimdAlignedBuffer64f; typedef SimdAlignedBuffer64 SimdAlignedBuffer64us; -namespace { +namespace +{ // // Color space conversion, Inverse 709 CSC, Y'CbCr -> R'G'B' // void -csc709Inverse (float &comp0, float &comp1, float &comp2) +csc709Inverse (float& comp0, float& comp1, float& comp2) { float src[3]; @@ -134,21 +128,20 @@ csc709Inverse (float &comp0, float &comp1, float &comp2) src[1] = comp1; src[2] = comp2; - comp0 = src[0] + 1.5747f * src[2]; + comp0 = src[0] + 1.5747f * src[2]; comp1 = src[0] - 0.1873f * src[1] - 0.4682f * src[2]; comp2 = src[0] + 1.8556f * src[1]; } #ifndef IMF_HAVE_SSE2 - // // Scalar color space conversion, based on 709 primiary chromaticies. // No scaling or offsets, just the matrix // void -csc709Inverse64 (float *comp0, float *comp1, float *comp2) +csc709Inverse64 (float* comp0, float* comp1, float* comp2) { for (int i = 0; i < 64; ++i) csc709Inverse (comp0[i], comp1[i], comp2[i]); @@ -161,32 +154,32 @@ csc709Inverse64 (float *comp0, float *comp1, float *comp2) // void -csc709Inverse64 (float *comp0, float *comp1, float *comp2) +csc709Inverse64 (float* comp0, float* comp1, float* comp2) { - __m128 c0 = { 1.5747f, 1.5747f, 1.5747f, 1.5747f}; - __m128 c1 = { 1.8556f, 1.8556f, 1.8556f, 1.8556f}; + __m128 c0 = {1.5747f, 1.5747f, 1.5747f, 1.5747f}; + __m128 c1 = {1.8556f, 1.8556f, 1.8556f, 1.8556f}; __m128 c2 = {-0.1873f, -0.1873f, -0.1873f, -0.1873f}; - __m128 c3 = {-0.4682f, -0.4682f, -0.4682f, -0.4682f}; - - __m128 *r = (__m128 *)comp0; - __m128 *g = (__m128 *)comp1; - __m128 *b = (__m128 *)comp2; - __m128 src[3]; - - #define CSC_INVERSE_709_SSE2_LOOP(i) \ - src[0] = r[i]; \ - src[1] = g[i]; \ - src[2] = b[i]; \ - \ - r[i] = _mm_add_ps (r[i], _mm_mul_ps (src[2], c0)); \ - \ - g[i] = _mm_mul_ps (g[i], c2); \ - src[2] = _mm_mul_ps (src[2], c3); \ - g[i] = _mm_add_ps (g[i], src[0]); \ - g[i] = _mm_add_ps (g[i], src[2]); \ - \ - b[i] = _mm_mul_ps (c1, src[1]); \ - b[i] = _mm_add_ps (b[i], src[0]); + __m128 c3 = {-0.4682f, -0.4682f, -0.4682f, -0.4682f}; + + __m128* r = (__m128*) comp0; + __m128* g = (__m128*) comp1; + __m128* b = (__m128*) comp2; + __m128 src[3]; + +# define CSC_INVERSE_709_SSE2_LOOP(i) \ + src[0] = r[i]; \ + src[1] = g[i]; \ + src[2] = b[i]; \ + \ + r[i] = _mm_add_ps (r[i], _mm_mul_ps (src[2], c0)); \ + \ + g[i] = _mm_mul_ps (g[i], c2); \ + src[2] = _mm_mul_ps (src[2], c3); \ + g[i] = _mm_add_ps (g[i], src[0]); \ + g[i] = _mm_add_ps (g[i], src[2]); \ + \ + b[i] = _mm_mul_ps (c1, src[1]); \ + b[i] = _mm_add_ps (b[i], src[0]); CSC_INVERSE_709_SSE2_LOOP (0) CSC_INVERSE_709_SSE2_LOOP (1) @@ -211,7 +204,6 @@ csc709Inverse64 (float *comp0, float *comp1, float *comp2) #endif /* IMF_HAVE_SSE2 */ - // // Color space conversion, Forward 709 CSC, R'G'B' -> Y'CbCr // @@ -220,40 +212,39 @@ csc709Inverse64 (float *comp0, float *comp1, float *comp2) // void -csc709Forward64 (float *comp0, float *comp1, float *comp2) +csc709Forward64 (float* comp0, float* comp1, float* comp2) { float src[3]; - for (int i = 0; i<64; ++i) + for (int i = 0; i < 64; ++i) { - src[0] = comp0[i]; - src[1] = comp1[i]; - src[2] = comp2[i]; + src[0] = comp0[i]; + src[1] = comp1[i]; + src[2] = comp2[i]; - comp0[i] = 0.2126f * src[0] + 0.7152f * src[1] + 0.0722f * src[2]; + comp0[i] = 0.2126f * src[0] + 0.7152f * src[1] + 0.0722f * src[2]; comp1[i] = -0.1146f * src[0] - 0.3854f * src[1] + 0.5000f * src[2]; - comp2[i] = 0.5000f * src[0] - 0.4542f * src[1] - 0.0458f * src[2]; + comp2[i] = 0.5000f * src[0] - 0.4542f * src[1] - 0.0458f * src[2]; } } - // // Byte interleaving of 2 byte arrays: -// src0 = AAAA +// src0 = AAAA // src1 = BBBB // dst = ABABABAB // // numBytes is the size of each of the source buffers // -#ifndef IMF_HAVE_SSE2 +#ifndef IMF_HAVE_SSE2 -// -// Scalar default implementation +// +// Scalar default implementation // void -interleaveByte2 (char *dst, char *src0, char *src1, int numBytes) +interleaveByte2 (char* dst, char* src0, char* src1, int numBytes) { for (int x = 0; x < numBytes; ++x) { @@ -262,23 +253,23 @@ interleaveByte2 (char *dst, char *src0, char *src1, int numBytes) } } -#else /* IMF_HAVE_SSE2 */ +#else /* IMF_HAVE_SSE2 */ -// +// // SSE2 byte interleaving // void -interleaveByte2 (char *dst, char *src0, char *src1, int numBytes) +interleaveByte2 (char* dst, char* src0, char* src1, int numBytes) { - int dstAlignment = (size_t)dst % 16; - int src0Alignment = (size_t)src0 % 16; - int src1Alignment = (size_t)src1 % 16; + int dstAlignment = (size_t) dst % 16; + int src0Alignment = (size_t) src0 % 16; + int src1Alignment = (size_t) src1 % 16; - __m128i *dst_epi8 = (__m128i*)dst; - __m128i *src0_epi8 = (__m128i*)src0; - __m128i *src1_epi8 = (__m128i*)src1; - int sseWidth = numBytes / 16; + __m128i* dst_epi8 = (__m128i*) dst; + __m128i* src0_epi8 = (__m128i*) src0; + __m128i* src1_epi8 = (__m128i*) src1; + int sseWidth = numBytes / 16; if ((!dstAlignment) && (!src0Alignment) && (!src1Alignment)) { @@ -293,11 +284,10 @@ interleaveByte2 (char *dst, char *src0, char *src1, int numBytes) tmp0 = src0_epi8[x]; tmp1 = src1_epi8[x]; - _mm_stream_si128 (&dst_epi8[2 * x], - _mm_unpacklo_epi8 (tmp0, tmp1)); + _mm_stream_si128 (&dst_epi8[2 * x], _mm_unpacklo_epi8 (tmp0, tmp1)); - _mm_stream_si128 (&dst_epi8[2 * x + 1], - _mm_unpackhi_epi8 (tmp0, tmp1)); + _mm_stream_si128 ( + &dst_epi8[2 * x + 1], _mm_unpackhi_epi8 (tmp0, tmp1)); } // @@ -313,30 +303,32 @@ interleaveByte2 (char *dst, char *src0, char *src1, int numBytes) else if ((!dstAlignment) && (src0Alignment == 8) && (src1Alignment == 8)) { // - // Aligned stores, but catch up a few values so we can + // Aligned stores, but catch up a few values so we can // use aligned loads // - + for (int x = 0; x < std::min (numBytes, 8); ++x) { dst[2 * x] = src0[x]; dst[2 * x + 1] = src1[x]; } - if (numBytes > 8) + if (numBytes > 8) { - dst_epi8 = (__m128i*)&dst[16]; - src0_epi8 = (__m128i*)&src0[8]; - src1_epi8 = (__m128i*)&src1[8]; - sseWidth = (numBytes - 8) / 16; + dst_epi8 = (__m128i*) &dst[16]; + src0_epi8 = (__m128i*) &src0[8]; + src1_epi8 = (__m128i*) &src1[8]; + sseWidth = (numBytes - 8) / 16; - for (int x=0; x half float conversion // @@ -395,24 +388,35 @@ interleaveByte2 (char *dst, char *src0, char *src1, int numBytes) // Default boring conversion // -void -convertFloatToHalf64_scalar (unsigned short *dst, float *src) +void +convertFloatToHalf64_scalar (unsigned short* dst, float* src) { - for (int i=0; i<64; ++i) - dst[i] = ((half)src[i]).bits(); + for (int i = 0; i < 64; ++i) + dst[i] = ((half) src[i]).bits (); } +#ifdef IMF_HAVE_NEON + +void +convertFloatToHalf64_neon (unsigned short* dst, float* src) +{ + for (int i = 0; i < 64; i += 8) { + float32x4x2_t vec_fp32 = vld1q_f32_x2 (src + i); + vst1q_u16 (dst + i, vcombine_u16(vreinterpret_u16_f16(vcvt_f16_f32(vec_fp32.val[0])),vreinterpret_u16_f16(vcvt_f16_f32(vec_fp32.val[1])))); + } +} +#endif // // F16C conversion - Assumes aligned src and dst // void -convertFloatToHalf64_f16c (unsigned short *dst, float *src) +convertFloatToHalf64_f16c (unsigned short* dst, float* src) { // - // Ordinarly, I'd avoid using inline asm and prefer intrinsics. - // However, in order to get the intrinsics, we need to tell + // Ordinarily, I'd avoid using inline asm and prefer intrinsics. + // However, in order to get the intrinsics, we need to tell // the compiler to generate VEX instructions. // // (On the GCC side, -mf16c goes ahead and activates -mavc, @@ -420,14 +424,13 @@ convertFloatToHalf64_f16c (unsigned short *dst, float *src) // // Now, it's quite likely that we'll find ourselves in situations // where we want to build *without* VEX, in order to maintain - // maximum compatability. But to get there with intrinsics, + // maximum compatibility. But to get there with intrinsics, // we'd need to break out code into a separate file. Bleh. // I'll take the asm. // - #if defined IMF_HAVE_GCC_INLINEASM_X86 - __asm__ - ("vmovaps (%0), %%ymm0 \n" +#if defined IMF_HAVE_GCC_INLINEASM_X86 + __asm__("vmovaps (%0), %%ymm0 \n" "vmovaps 0x20(%0), %%ymm1 \n" "vmovaps 0x40(%0), %%ymm2 \n" "vmovaps 0x60(%0), %%ymm3 \n" @@ -451,32 +454,31 @@ convertFloatToHalf64_f16c (unsigned short *dst, float *src) "vmovdqa %%xmm1, 0x50(%1) \n" "vmovdqa %%xmm2, 0x60(%1) \n" "vmovdqa %%xmm3, 0x70(%1) \n" - #ifndef __AVX__ +# ifndef __AVX__ "vzeroupper \n" - #endif /* __AVX__ */ - : /* Output */ +# endif /* __AVX__ */ + : /* Output */ : /* Input */ "r"(src), "r"(dst) - #ifndef __AVX__ +# ifndef __AVX__ : /* Clobber */ "%xmm0", "%xmm1", "%xmm2", "%xmm3", "memory" - #else +# else : /* Clobber */ "%ymm0", "%ymm1", "%ymm2", "%ymm3", "memory" - #endif /* __AVX__ */ - ); - #else - convertFloatToHalf64_scalar (dst, src); - #endif /* IMF_HAVE_GCC_INLINEASM_X86 */ +# endif /* __AVX__ */ + ); +#else + convertFloatToHalf64_scalar (dst, src); +#endif /* IMF_HAVE_GCC_INLINEASM_X86 */ } - // // Convert an 8x8 block of HALF from zig-zag order to // FLOAT in normal order. The order we want is: // -// src dst +// src dst // 0 1 2 3 4 5 6 7 0 1 5 6 14 15 27 28 // 8 9 10 11 12 13 14 15 2 4 7 13 16 26 29 42 // 16 17 18 19 20 21 22 23 3 8 12 17 25 30 41 43 -// 24 25 26 27 28 29 30 31 9 11 18 24 31 40 44 53 +// 24 25 26 27 28 29 30 31 9 11 18 24 31 40 44 53 // 32 33 34 35 36 37 38 39 10 19 23 32 39 45 52 54 // 40 41 42 43 44 45 46 47 20 22 33 38 46 51 55 60 // 48 49 50 51 52 53 54 55 21 34 37 47 50 56 59 61 @@ -484,88 +486,87 @@ convertFloatToHalf64_f16c (unsigned short *dst, float *src) // void -fromHalfZigZag_scalar (unsigned short *src, float *dst) +fromHalfZigZag_scalar (unsigned short* src, float* dst) { - half *srcHalf = (half *)src; - - dst[0] = (float)srcHalf[0]; - dst[1] = (float)srcHalf[1]; - dst[2] = (float)srcHalf[5]; - dst[3] = (float)srcHalf[6]; - dst[4] = (float)srcHalf[14]; - dst[5] = (float)srcHalf[15]; - dst[6] = (float)srcHalf[27]; - dst[7] = (float)srcHalf[28]; - dst[8] = (float)srcHalf[2]; - dst[9] = (float)srcHalf[4]; - - dst[10] = (float)srcHalf[7]; - dst[11] = (float)srcHalf[13]; - dst[12] = (float)srcHalf[16]; - dst[13] = (float)srcHalf[26]; - dst[14] = (float)srcHalf[29]; - dst[15] = (float)srcHalf[42]; - dst[16] = (float)srcHalf[3]; - dst[17] = (float)srcHalf[8]; - dst[18] = (float)srcHalf[12]; - dst[19] = (float)srcHalf[17]; - - dst[20] = (float)srcHalf[25]; - dst[21] = (float)srcHalf[30]; - dst[22] = (float)srcHalf[41]; - dst[23] = (float)srcHalf[43]; - dst[24] = (float)srcHalf[9]; - dst[25] = (float)srcHalf[11]; - dst[26] = (float)srcHalf[18]; - dst[27] = (float)srcHalf[24]; - dst[28] = (float)srcHalf[31]; - dst[29] = (float)srcHalf[40]; - - dst[30] = (float)srcHalf[44]; - dst[31] = (float)srcHalf[53]; - dst[32] = (float)srcHalf[10]; - dst[33] = (float)srcHalf[19]; - dst[34] = (float)srcHalf[23]; - dst[35] = (float)srcHalf[32]; - dst[36] = (float)srcHalf[39]; - dst[37] = (float)srcHalf[45]; - dst[38] = (float)srcHalf[52]; - dst[39] = (float)srcHalf[54]; - - dst[40] = (float)srcHalf[20]; - dst[41] = (float)srcHalf[22]; - dst[42] = (float)srcHalf[33]; - dst[43] = (float)srcHalf[38]; - dst[44] = (float)srcHalf[46]; - dst[45] = (float)srcHalf[51]; - dst[46] = (float)srcHalf[55]; - dst[47] = (float)srcHalf[60]; - dst[48] = (float)srcHalf[21]; - dst[49] = (float)srcHalf[34]; - - dst[50] = (float)srcHalf[37]; - dst[51] = (float)srcHalf[47]; - dst[52] = (float)srcHalf[50]; - dst[53] = (float)srcHalf[56]; - dst[54] = (float)srcHalf[59]; - dst[55] = (float)srcHalf[61]; - dst[56] = (float)srcHalf[35]; - dst[57] = (float)srcHalf[36]; - dst[58] = (float)srcHalf[48]; - dst[59] = (float)srcHalf[49]; - - dst[60] = (float)srcHalf[57]; - dst[61] = (float)srcHalf[58]; - dst[62] = (float)srcHalf[62]; - dst[63] = (float)srcHalf[63]; + half* srcHalf = (half*) src; + + dst[0] = (float) srcHalf[0]; + dst[1] = (float) srcHalf[1]; + dst[2] = (float) srcHalf[5]; + dst[3] = (float) srcHalf[6]; + dst[4] = (float) srcHalf[14]; + dst[5] = (float) srcHalf[15]; + dst[6] = (float) srcHalf[27]; + dst[7] = (float) srcHalf[28]; + dst[8] = (float) srcHalf[2]; + dst[9] = (float) srcHalf[4]; + + dst[10] = (float) srcHalf[7]; + dst[11] = (float) srcHalf[13]; + dst[12] = (float) srcHalf[16]; + dst[13] = (float) srcHalf[26]; + dst[14] = (float) srcHalf[29]; + dst[15] = (float) srcHalf[42]; + dst[16] = (float) srcHalf[3]; + dst[17] = (float) srcHalf[8]; + dst[18] = (float) srcHalf[12]; + dst[19] = (float) srcHalf[17]; + + dst[20] = (float) srcHalf[25]; + dst[21] = (float) srcHalf[30]; + dst[22] = (float) srcHalf[41]; + dst[23] = (float) srcHalf[43]; + dst[24] = (float) srcHalf[9]; + dst[25] = (float) srcHalf[11]; + dst[26] = (float) srcHalf[18]; + dst[27] = (float) srcHalf[24]; + dst[28] = (float) srcHalf[31]; + dst[29] = (float) srcHalf[40]; + + dst[30] = (float) srcHalf[44]; + dst[31] = (float) srcHalf[53]; + dst[32] = (float) srcHalf[10]; + dst[33] = (float) srcHalf[19]; + dst[34] = (float) srcHalf[23]; + dst[35] = (float) srcHalf[32]; + dst[36] = (float) srcHalf[39]; + dst[37] = (float) srcHalf[45]; + dst[38] = (float) srcHalf[52]; + dst[39] = (float) srcHalf[54]; + + dst[40] = (float) srcHalf[20]; + dst[41] = (float) srcHalf[22]; + dst[42] = (float) srcHalf[33]; + dst[43] = (float) srcHalf[38]; + dst[44] = (float) srcHalf[46]; + dst[45] = (float) srcHalf[51]; + dst[46] = (float) srcHalf[55]; + dst[47] = (float) srcHalf[60]; + dst[48] = (float) srcHalf[21]; + dst[49] = (float) srcHalf[34]; + + dst[50] = (float) srcHalf[37]; + dst[51] = (float) srcHalf[47]; + dst[52] = (float) srcHalf[50]; + dst[53] = (float) srcHalf[56]; + dst[54] = (float) srcHalf[59]; + dst[55] = (float) srcHalf[61]; + dst[56] = (float) srcHalf[35]; + dst[57] = (float) srcHalf[36]; + dst[58] = (float) srcHalf[48]; + dst[59] = (float) srcHalf[49]; + + dst[60] = (float) srcHalf[57]; + dst[61] = (float) srcHalf[58]; + dst[62] = (float) srcHalf[62]; + dst[63] = (float) srcHalf[63]; } - // // If we can form the correct ordering in xmm registers, // we can use F16C to convert from HALF -> FLOAT. However, -// making the correct order isn't trivial. -// +// making the correct order isn't trivial. +// // We want to re-order a source 8x8 matrix from: // // 0 1 2 3 4 5 6 7 0 1 5 6 14 15 27 28 @@ -577,9 +578,9 @@ fromHalfZigZag_scalar (unsigned short *src, float *dst) // 48 49 50 51 52 53 54 55 21 34 37 47 50 56 59 61 // 56 57 58 59 60 61 62 63 35 36 48 49 57 58 62 63 // -// Which looks like a mess, right? +// Which looks like a mess, right? // -// Now, check out the NE/SW diagonals of (A). Along those lines, +// Now, check out the NE/SW diagonals of (A). Along those lines, // we have runs of contiguous values! If we rewrite (A) a bit, we get: // // 0 @@ -598,15 +599,15 @@ fromHalfZigZag_scalar (unsigned short *src, float *dst) // 61 62 // 63 // -// In this ordering, the columns are the rows (A). If we can 'transpose' -// (B), we'll achieve our goal. But we want this to fit nicely into -// xmm registers and still be able to load large runs efficiently. -// Also, notice that the odd rows are in ascending order, while -// the even rows are in descending order. +// In this ordering, the columns are the rows (A). If we can 'transpose' +// (B), we'll achieve our goal. But we want this to fit nicely into +// xmm registers and still be able to load large runs efficiently. +// Also, notice that the odd rows are in ascending order, while +// the even rows are in descending order. // // If we 'fold' the bottom half up into the top, we can preserve ordered -// runs accross rows, and still keep all the correct values in columns. -// After transposing, we'll need to rotate things back into place. +// runs across rows, and still keep all the correct values in columns. +// After transposing, we'll need to rotate things back into place. // This gives us: // // 0 | 42 41 40 39 38 37 36 @@ -623,179 +624,239 @@ fromHalfZigZag_scalar (unsigned short *src, float *dst) // // 36 37 38 39 40 41 42 | 0 // 1 2 | 43 44 45 46 47 48 -// 49 50 51 52 53 | 3 4 5 +// 49 50 51 52 53 | 3 4 5 // 6 7 8 9 | 54 55 56 57 (D) -// 58 59 60 | 10 11 12 13 14 +// 58 59 60 | 10 11 12 13 14 // 15 16 17 18 19 20 | 61 62 -// 61 | 21 22 23 24 25 26 27 +// 61 | 21 22 23 24 25 26 27 // 28 29 30 31 32 33 34 35 // // If we can form (D), we will then: // 1) Reverse the even rows // 2) Transpose -// 3) Rotate the rows +// 3) Rotate the rows // // and we'll have (A). // -void -fromHalfZigZag_f16c (unsigned short *src, float *dst) +void +fromHalfZigZag_f16c (unsigned short* src, float* dst) { - #if defined IMF_HAVE_GCC_INLINEASM_X86_64 - __asm__ +#if defined IMF_HAVE_GCC_INLINEASM_X86_64 + __asm__ - /* x3 <- 0 + /* x3 <- 0 * x8 <- [ 0- 7] * x6 <- [56-63] * x9 <- [21-28] * x7 <- [28-35] * x3 <- [ 6- 9] (lower half) */ - - ("vpxor %%xmm3, %%xmm3, %%xmm3 \n" - "vmovdqa (%0), %%xmm8 \n" - "vmovdqa 112(%0), %%xmm6 \n" - "vmovdqu 42(%0), %%xmm9 \n" - "vmovdqu 56(%0), %%xmm7 \n" - "vmovq 12(%0), %%xmm3 \n" - - /* Setup rows 0-2 of A in xmm0-xmm2 + + ("vpxor %%xmm3, %%xmm3, %%xmm3 \n" + "vmovdqa (%0), %%xmm8 \n" + "vmovdqa 112(%0), %%xmm6 \n" + "vmovdqu 42(%0), %%xmm9 \n" + "vmovdqu 56(%0), %%xmm7 \n" + "vmovq 12(%0), %%xmm3 \n" + + /* Setup rows 0-2 of A in xmm0-xmm2 * x1 <- x8 >> 16 (1 value) * x2 <- x8 << 32 (2 values) * x0 <- alignr([35-42], x8, 2) * x1 <- blend(x1, [41-48]) * x2 <- blend(x2, [49-56]) */ - "vpsrldq $2, %%xmm8, %%xmm1 \n" - "vpslldq $4, %%xmm8, %%xmm2 \n" - "vpalignr $2, 70(%0), %%xmm8, %%xmm0 \n" - "vpblendw $0xfc, 82(%0), %%xmm1, %%xmm1 \n" - "vpblendw $0x1f, 98(%0), %%xmm2, %%xmm2 \n" - - /* Setup rows 4-6 of A in xmm4-xmm6 + "vpsrldq $2, %%xmm8, %%xmm1 \n" + "vpslldq $4, %%xmm8, %%xmm2 \n" + "vpalignr $2, 70(%0), %%xmm8, %%xmm0 \n" + "vpblendw $0xfc, 82(%0), %%xmm1, %%xmm1 \n" + "vpblendw $0x1f, 98(%0), %%xmm2, %%xmm2 \n" + + /* Setup rows 4-6 of A in xmm4-xmm6 * x4 <- x6 >> 32 (2 values) * x5 <- x6 << 16 (1 value) * x6 <- alignr(x6,x9,14) * x4 <- blend(x4, [ 7-14]) * x5 <- blend(x5, [15-22]) */ - "vpsrldq $4, %%xmm6, %%xmm4 \n" - "vpslldq $2, %%xmm6, %%xmm5 \n" - "vpalignr $14, %%xmm6, %%xmm9, %%xmm6 \n" - "vpblendw $0xf8, 14(%0), %%xmm4, %%xmm4 \n" - "vpblendw $0x3f, 30(%0), %%xmm5, %%xmm5 \n" + "vpsrldq $4, %%xmm6, %%xmm4 \n" + "vpslldq $2, %%xmm6, %%xmm5 \n" + "vpalignr $14, %%xmm6, %%xmm9, %%xmm6 \n" + "vpblendw $0xf8, 14(%0), %%xmm4, %%xmm4 \n" + "vpblendw $0x3f, 30(%0), %%xmm5, %%xmm5 \n" - /* Load the upper half of row 3 into xmm3 + /* Load the upper half of row 3 into xmm3 * x3 <- [54-57] (upper half) */ - "vpinsrq $1, 108(%0), %%xmm3, %%xmm3\n" + "vpinsrq $1, 108(%0), %%xmm3, %%xmm3\n" - /* Reverse the even rows. We're not using PSHUFB as + /* Reverse the even rows. We're not using PSHUFB as * that requires loading an extra constant all the time, - * and we're alreadly pretty memory bound. + * and we're already pretty memory bound. */ - "vpshuflw $0x1b, %%xmm0, %%xmm0 \n" - "vpshuflw $0x1b, %%xmm2, %%xmm2 \n" - "vpshuflw $0x1b, %%xmm4, %%xmm4 \n" - "vpshuflw $0x1b, %%xmm6, %%xmm6 \n" - - "vpshufhw $0x1b, %%xmm0, %%xmm0 \n" - "vpshufhw $0x1b, %%xmm2, %%xmm2 \n" - "vpshufhw $0x1b, %%xmm4, %%xmm4 \n" - "vpshufhw $0x1b, %%xmm6, %%xmm6 \n" - - "vpshufd $0x4e, %%xmm0, %%xmm0 \n" - "vpshufd $0x4e, %%xmm2, %%xmm2 \n" - "vpshufd $0x4e, %%xmm4, %%xmm4 \n" - "vpshufd $0x4e, %%xmm6, %%xmm6 \n" - - /* Transpose xmm0-xmm7 into xmm8-xmm15 */ - - "vpunpcklwd %%xmm1, %%xmm0, %%xmm8 \n" - "vpunpcklwd %%xmm3, %%xmm2, %%xmm9 \n" - "vpunpcklwd %%xmm5, %%xmm4, %%xmm10 \n" - "vpunpcklwd %%xmm7, %%xmm6, %%xmm11 \n" - "vpunpckhwd %%xmm1, %%xmm0, %%xmm12 \n" - "vpunpckhwd %%xmm3, %%xmm2, %%xmm13 \n" - "vpunpckhwd %%xmm5, %%xmm4, %%xmm14 \n" - "vpunpckhwd %%xmm7, %%xmm6, %%xmm15 \n" - - "vpunpckldq %%xmm9, %%xmm8, %%xmm0 \n" - "vpunpckldq %%xmm11, %%xmm10, %%xmm1 \n" - "vpunpckhdq %%xmm9, %%xmm8, %%xmm2 \n" - "vpunpckhdq %%xmm11, %%xmm10, %%xmm3 \n" - "vpunpckldq %%xmm13, %%xmm12, %%xmm4 \n" - "vpunpckldq %%xmm15, %%xmm14, %%xmm5 \n" - "vpunpckhdq %%xmm13, %%xmm12, %%xmm6 \n" - "vpunpckhdq %%xmm15, %%xmm14, %%xmm7 \n" - - "vpunpcklqdq %%xmm1, %%xmm0, %%xmm8 \n" - "vpunpckhqdq %%xmm1, %%xmm0, %%xmm9 \n" - "vpunpcklqdq %%xmm3, %%xmm2, %%xmm10 \n" - "vpunpckhqdq %%xmm3, %%xmm2, %%xmm11 \n" - "vpunpcklqdq %%xmm4, %%xmm5, %%xmm12 \n" - "vpunpckhqdq %%xmm5, %%xmm4, %%xmm13 \n" - "vpunpcklqdq %%xmm7, %%xmm6, %%xmm14 \n" - "vpunpckhqdq %%xmm7, %%xmm6, %%xmm15 \n" - - /* Rotate the rows to get the correct final order. + "vpshuflw $0x1b, %%xmm0, %%xmm0 \n" + "vpshuflw $0x1b, %%xmm2, %%xmm2 \n" + "vpshuflw $0x1b, %%xmm4, %%xmm4 \n" + "vpshuflw $0x1b, %%xmm6, %%xmm6 \n" + + "vpshufhw $0x1b, %%xmm0, %%xmm0 \n" + "vpshufhw $0x1b, %%xmm2, %%xmm2 \n" + "vpshufhw $0x1b, %%xmm4, %%xmm4 \n" + "vpshufhw $0x1b, %%xmm6, %%xmm6 \n" + + "vpshufd $0x4e, %%xmm0, %%xmm0 \n" + "vpshufd $0x4e, %%xmm2, %%xmm2 \n" + "vpshufd $0x4e, %%xmm4, %%xmm4 \n" + "vpshufd $0x4e, %%xmm6, %%xmm6 \n" + + /* Transpose xmm0-xmm7 into xmm8-xmm15 */ + + "vpunpcklwd %%xmm1, %%xmm0, %%xmm8 \n" + "vpunpcklwd %%xmm3, %%xmm2, %%xmm9 \n" + "vpunpcklwd %%xmm5, %%xmm4, %%xmm10 \n" + "vpunpcklwd %%xmm7, %%xmm6, %%xmm11 \n" + "vpunpckhwd %%xmm1, %%xmm0, %%xmm12 \n" + "vpunpckhwd %%xmm3, %%xmm2, %%xmm13 \n" + "vpunpckhwd %%xmm5, %%xmm4, %%xmm14 \n" + "vpunpckhwd %%xmm7, %%xmm6, %%xmm15 \n" + + "vpunpckldq %%xmm9, %%xmm8, %%xmm0 \n" + "vpunpckldq %%xmm11, %%xmm10, %%xmm1 \n" + "vpunpckhdq %%xmm9, %%xmm8, %%xmm2 \n" + "vpunpckhdq %%xmm11, %%xmm10, %%xmm3 \n" + "vpunpckldq %%xmm13, %%xmm12, %%xmm4 \n" + "vpunpckldq %%xmm15, %%xmm14, %%xmm5 \n" + "vpunpckhdq %%xmm13, %%xmm12, %%xmm6 \n" + "vpunpckhdq %%xmm15, %%xmm14, %%xmm7 \n" + + "vpunpcklqdq %%xmm1, %%xmm0, %%xmm8 \n" + "vpunpckhqdq %%xmm1, %%xmm0, %%xmm9 \n" + "vpunpcklqdq %%xmm3, %%xmm2, %%xmm10 \n" + "vpunpckhqdq %%xmm3, %%xmm2, %%xmm11 \n" + "vpunpcklqdq %%xmm4, %%xmm5, %%xmm12 \n" + "vpunpckhqdq %%xmm5, %%xmm4, %%xmm13 \n" + "vpunpcklqdq %%xmm7, %%xmm6, %%xmm14 \n" + "vpunpckhqdq %%xmm7, %%xmm6, %%xmm15 \n" + + /* Rotate the rows to get the correct final order. * Rotating xmm12 isn't needed, as we can handle * the rotation in the PUNPCKLQDQ above. Rotating * xmm8 isn't needed as it's already in the right order */ - "vpalignr $2, %%xmm9, %%xmm9, %%xmm9 \n" - "vpalignr $4, %%xmm10, %%xmm10, %%xmm10 \n" - "vpalignr $6, %%xmm11, %%xmm11, %%xmm11 \n" - "vpalignr $10, %%xmm13, %%xmm13, %%xmm13 \n" - "vpalignr $12, %%xmm14, %%xmm14, %%xmm14 \n" - "vpalignr $14, %%xmm15, %%xmm15, %%xmm15 \n" - - /* Convert from half -> float */ - - "vcvtph2ps %%xmm8, %%ymm8 \n" - "vcvtph2ps %%xmm9, %%ymm9 \n" - "vcvtph2ps %%xmm10, %%ymm10 \n" - "vcvtph2ps %%xmm11, %%ymm11 \n" - "vcvtph2ps %%xmm12, %%ymm12 \n" - "vcvtph2ps %%xmm13, %%ymm13 \n" - "vcvtph2ps %%xmm14, %%ymm14 \n" - "vcvtph2ps %%xmm15, %%ymm15 \n" - - /* Move float values to dst */ - - "vmovaps %%ymm8, (%1) \n" - "vmovaps %%ymm9, 32(%1) \n" - "vmovaps %%ymm10, 64(%1) \n" - "vmovaps %%ymm11, 96(%1) \n" - "vmovaps %%ymm12, 128(%1) \n" - "vmovaps %%ymm13, 160(%1) \n" - "vmovaps %%ymm14, 192(%1) \n" - "vmovaps %%ymm15, 224(%1) \n" - #ifndef __AVX__ - "vzeroupper \n" - #endif /* __AVX__ */ - : /* Output */ - : /* Input */ "r"(src), "r"(dst) - : /* Clobber */ "memory", - #ifndef __AVX__ - "%xmm0", "%xmm1", "%xmm2", "%xmm3", - "%xmm4", "%xmm5", "%xmm6", "%xmm7", - "%xmm8", "%xmm9", "%xmm10", "%xmm11", - "%xmm12", "%xmm13", "%xmm14", "%xmm15" - #else - "%ymm0", "%ymm1", "%ymm2", "%ymm3", - "%ymm4", "%ymm5", "%ymm6", "%ymm7", - "%ymm8", "%ymm9", "%ymm10", "%ymm11", - "%ymm12", "%ymm13", "%ymm14", "%ymm15" - #endif /* __AVX__ */ + "vpalignr $2, %%xmm9, %%xmm9, %%xmm9 \n" + "vpalignr $4, %%xmm10, %%xmm10, %%xmm10 \n" + "vpalignr $6, %%xmm11, %%xmm11, %%xmm11 \n" + "vpalignr $10, %%xmm13, %%xmm13, %%xmm13 \n" + "vpalignr $12, %%xmm14, %%xmm14, %%xmm14 \n" + "vpalignr $14, %%xmm15, %%xmm15, %%xmm15 \n" + + /* Convert from half -> float */ + + "vcvtph2ps %%xmm8, %%ymm8 \n" + "vcvtph2ps %%xmm9, %%ymm9 \n" + "vcvtph2ps %%xmm10, %%ymm10 \n" + "vcvtph2ps %%xmm11, %%ymm11 \n" + "vcvtph2ps %%xmm12, %%ymm12 \n" + "vcvtph2ps %%xmm13, %%ymm13 \n" + "vcvtph2ps %%xmm14, %%ymm14 \n" + "vcvtph2ps %%xmm15, %%ymm15 \n" + + /* Move float values to dst */ + + "vmovaps %%ymm8, (%1) \n" + "vmovaps %%ymm9, 32(%1) \n" + "vmovaps %%ymm10, 64(%1) \n" + "vmovaps %%ymm11, 96(%1) \n" + "vmovaps %%ymm12, 128(%1) \n" + "vmovaps %%ymm13, 160(%1) \n" + "vmovaps %%ymm14, 192(%1) \n" + "vmovaps %%ymm15, 224(%1) \n" +# ifndef __AVX__ + "vzeroupper \n" +# endif /* __AVX__ */ + : /* Output */ + : /* Input */ "r"(src), "r"(dst) + : /* Clobber */ "memory", +# ifndef __AVX__ + "%xmm0", + "%xmm1", + "%xmm2", + "%xmm3", + "%xmm4", + "%xmm5", + "%xmm6", + "%xmm7", + "%xmm8", + "%xmm9", + "%xmm10", + "%xmm11", + "%xmm12", + "%xmm13", + "%xmm14", + "%xmm15" +# else + "%ymm0", + "%ymm1", + "%ymm2", + "%ymm3", + "%ymm4", + "%ymm5", + "%ymm6", + "%ymm7", + "%ymm8", + "%ymm9", + "%ymm10", + "%ymm11", + "%ymm12", + "%ymm13", + "%ymm14", + "%ymm15" +# endif /* __AVX__ */ ); - #else - fromHalfZigZag_scalar(src, dst); - #endif /* defined IMF_HAVE_GCC_INLINEASM_X86_64 */ +#else + fromHalfZigZag_scalar (src, dst); +#endif /* defined IMF_HAVE_GCC_INLINEASM_X86_64 */ +} + +#ifdef IMF_HAVE_NEON + + +void +fromHalfZigZag_neon(unsigned short* __restrict__ src, float* __restrict__ dst) +{ + uint8x16_t res_tbl[4] = { + {0, 1, 5, 6, 14, 15, 27, 28, 2 , 4 , 7 ,13, 16, 26, 29, 42}, + {3 , 8 ,12 ,17, 25, 30, 41, 43,9 ,11 ,18 ,24, 31, 40, 44, 53}, + {10 ,19 ,23 ,32, 39, 45, 52, 54,20 ,22 ,33 ,38, 46, 51, 55, 60}, + {21 ,34 ,37 ,47, 50, 56, 59, 61,35 ,36 ,48 ,49, 57, 58, 62, 63}}; + + uint8x16x4_t vec_input_l,vec_input_h; + + for (int i = 0; i < 4; i++) + { + uint8x16x2_t vec_in_u8 = vld2q_u8 ((unsigned char*)(src + 16 * i)); + vec_input_l.val[i] = vec_in_u8.val[0]; + vec_input_h.val[i] = vec_in_u8.val[1]; + } + +#pragma unroll(4) + for (int i = 0; i < 4 ; i++) { + uint8x16_t res_vec_l,res_vec_h; + res_vec_l = vqtbl4q_u8(vec_input_l,res_tbl[i]); + res_vec_h = vqtbl4q_u8(vec_input_h,res_tbl[i]); + float16x8_t res_vec_l_f16 = vreinterpretq_f16_u8(vzip1q_u8(res_vec_l,res_vec_h)); + float16x8_t res_vec_h_f16 = vreinterpretq_f16_u8(vzip2q_u8(res_vec_l,res_vec_h)); + vst1q_f32(dst + i*16, vcvt_f32_f16(vget_low_f16(res_vec_l_f16))); + vst1q_f32(dst + i*16+4, vcvt_high_f32_f16(res_vec_l_f16)); + vst1q_f32(dst + i*16+8, vcvt_f32_f16(vget_low_f16(res_vec_h_f16))); + vst1q_f32(dst + i*16+12, vcvt_high_f32_f16(res_vec_h_f16)); + } } +#endif // IMF_HAVE_NEON // // Inverse 8x8 DCT, only inverting the DC. This assumes that @@ -804,8 +865,8 @@ fromHalfZigZag_f16c (unsigned short *src, float *dst) #ifndef IMF_HAVE_SSE2 -void -dctInverse8x8DcOnly (float *data) +void +dctInverse8x8DcOnly (float* data) { float val = data[0] * 3.535536e-01f * 3.535536e-01f; @@ -813,13 +874,13 @@ dctInverse8x8DcOnly (float *data) data[i] = val; } -#else /* IMF_HAVE_SSE2 */ +#else /* IMF_HAVE_SSE2 */ void -dctInverse8x8DcOnly (float *data) +dctInverse8x8DcOnly (float* data) { - __m128 src = _mm_set1_ps (data[0] * 3.535536e-01f * 3.535536e-01f); - __m128 *dst = (__m128 *)data; + __m128 src = _mm_set1_ps (data[0] * 3.535536e-01f * 3.535536e-01f); + __m128* dst = (__m128*) data; for (int i = 0; i < 16; ++i) dst[i] = src; @@ -827,7 +888,6 @@ dctInverse8x8DcOnly (float *data) #endif /* IMF_HAVE_SSE2 */ - // // Full 8x8 Inverse DCT: // @@ -837,14 +897,14 @@ dctInverse8x8DcOnly (float *data) // This is based on the iDCT formuation (y = frequency domain, // x = spatial domain) // -// [x0] [ ][y0] [ ][y1] -// [x1] = [ M1 ][y2] + [ M2 ][y3] -// [x2] [ ][y4] [ ][y5] +// [x0] [ ][y0] [ ][y1] +// [x1] = [ M1 ][y2] + [ M2 ][y3] +// [x2] [ ][y4] [ ][y5] // [x3] [ ][y6] [ ][y7] // -// [x7] [ ][y0] [ ][y1] -// [x6] = [ M1 ][y2] - [ M2 ][y3] -// [x5] [ ][y4] [ ][y5] +// [x7] [ ][y0] [ ][y1] +// [x6] = [ M1 ][y2] - [ M2 ][y3] +// [x5] [ ][y4] [ ][y5] // [x4] [ ][y6] [ ][y7] // // where M1: M2: @@ -857,7 +917,7 @@ dctInverse8x8DcOnly (float *data) // and the constants are as defined below.. // // If you know how many of the lower rows are zero, that can -// be passed in to help speed things up. If you don't know, +// be passed in to help speed things up. If you don't know, // just set zeroedRows=0. // @@ -867,19 +927,19 @@ dctInverse8x8DcOnly (float *data) template void -dctInverse8x8_scalar (float *data) +dctInverse8x8_scalar (float* data) { const float a = .5f * cosf (3.14159f / 4.0f); const float b = .5f * cosf (3.14159f / 16.0f); const float c = .5f * cosf (3.14159f / 8.0f); - const float d = .5f * cosf (3.f*3.14159f / 16.0f); - const float e = .5f * cosf (5.f*3.14159f / 16.0f); - const float f = .5f * cosf (3.f*3.14159f / 8.0f); - const float g = .5f * cosf (7.f*3.14159f / 16.0f); + const float d = .5f * cosf (3.f * 3.14159f / 16.0f); + const float e = .5f * cosf (5.f * 3.14159f / 16.0f); + const float f = .5f * cosf (3.f * 3.14159f / 8.0f); + const float g = .5f * cosf (7.f * 3.14159f / 16.0f); float alpha[4], beta[4], theta[4], gamma[4]; - float *rowPtr = NULL; + float* rowPtr = NULL; // // First pass - row wise. @@ -892,10 +952,10 @@ dctInverse8x8_scalar (float *data) { rowPtr = data + row * 8; - alpha[0] = c * rowPtr[2]; - alpha[1] = f * rowPtr[2]; - alpha[2] = c * rowPtr[6]; - alpha[3] = f * rowPtr[6]; + alpha[0] = c * rowPtr[2]; + alpha[1] = f * rowPtr[2]; + alpha[2] = c * rowPtr[6]; + alpha[3] = f * rowPtr[6]; beta[0] = b * rowPtr[1] + d * rowPtr[3] + e * rowPtr[5] + g * rowPtr[7]; beta[1] = d * rowPtr[1] - g * rowPtr[3] - b * rowPtr[5] - e * rowPtr[7]; @@ -905,16 +965,14 @@ dctInverse8x8_scalar (float *data) theta[0] = a * (rowPtr[0] + rowPtr[4]); theta[3] = a * (rowPtr[0] - rowPtr[4]); - theta[1] = alpha[0] + alpha[3]; - theta[2] = alpha[1] - alpha[2]; - + theta[1] = alpha[0] + alpha[3]; + theta[2] = alpha[1] - alpha[2]; gamma[0] = theta[0] + theta[1]; gamma[1] = theta[3] + theta[2]; gamma[2] = theta[3] - theta[2]; gamma[3] = theta[0] - theta[1]; - rowPtr[0] = gamma[0] + beta[0]; rowPtr[1] = gamma[1] + beta[1]; rowPtr[2] = gamma[2] + beta[2]; @@ -932,36 +990,36 @@ dctInverse8x8_scalar (float *data) for (int column = 0; column < 8; ++column) { - alpha[0] = c * data[16+column]; - alpha[1] = f * data[16+column]; - alpha[2] = c * data[48+column]; - alpha[3] = f * data[48+column]; + alpha[0] = c * data[16 + column]; + alpha[1] = f * data[16 + column]; + alpha[2] = c * data[48 + column]; + alpha[3] = f * data[48 + column]; - beta[0] = b * data[8+column] + d * data[24+column] + - e * data[40+column] + g * data[56+column]; + beta[0] = b * data[8 + column] + d * data[24 + column] + + e * data[40 + column] + g * data[56 + column]; - beta[1] = d * data[8+column] - g * data[24+column] - - b * data[40+column] - e * data[56+column]; + beta[1] = d * data[8 + column] - g * data[24 + column] - + b * data[40 + column] - e * data[56 + column]; - beta[2] = e * data[8+column] - b * data[24+column] + - g * data[40+column] + d * data[56+column]; + beta[2] = e * data[8 + column] - b * data[24 + column] + + g * data[40 + column] + d * data[56 + column]; - beta[3] = g * data[8+column] - e * data[24+column] + - d * data[40+column] - b * data[56+column]; + beta[3] = g * data[8 + column] - e * data[24 + column] + + d * data[40 + column] - b * data[56 + column]; - theta[0] = a * (data[column] + data[32+column]); - theta[3] = a * (data[column] - data[32+column]); + theta[0] = a * (data[column] + data[32 + column]); + theta[3] = a * (data[column] - data[32 + column]); - theta[1] = alpha[0] + alpha[3]; - theta[2] = alpha[1] - alpha[2]; + theta[1] = alpha[0] + alpha[3]; + theta[2] = alpha[1] - alpha[2]; gamma[0] = theta[0] + theta[1]; gamma[1] = theta[3] + theta[2]; gamma[2] = theta[3] - theta[2]; gamma[3] = theta[0] - theta[1]; - data[ column] = gamma[0] + beta[0]; - data[ 8 + column] = gamma[1] + beta[1]; + data[column] = gamma[0] + beta[0]; + data[8 + column] = gamma[1] + beta[1]; data[16 + column] = gamma[2] + beta[2]; data[24 + column] = gamma[3] + beta[3]; @@ -972,277 +1030,263 @@ dctInverse8x8_scalar (float *data) } } - // // SSE2 Implementation // template void -dctInverse8x8_sse2 (float *data) +dctInverse8x8_sse2 (float* data) { - #ifdef IMF_HAVE_SSE2 - __m128 a = {3.535536e-01f,3.535536e-01f,3.535536e-01f,3.535536e-01f}; - __m128 b = {4.903927e-01f,4.903927e-01f,4.903927e-01f,4.903927e-01f}; - __m128 c = {4.619398e-01f,4.619398e-01f,4.619398e-01f,4.619398e-01f}; - __m128 d = {4.157349e-01f,4.157349e-01f,4.157349e-01f,4.157349e-01f}; - __m128 e = {2.777855e-01f,2.777855e-01f,2.777855e-01f,2.777855e-01f}; - __m128 f = {1.913422e-01f,1.913422e-01f,1.913422e-01f,1.913422e-01f}; - __m128 g = {9.754573e-02f,9.754573e-02f,9.754573e-02f,9.754573e-02f}; - - __m128 c0 = {3.535536e-01f, 3.535536e-01f, 3.535536e-01f, 3.535536e-01f}; - __m128 c1 = {4.619398e-01f, 1.913422e-01f,-1.913422e-01f,-4.619398e-01f}; - __m128 c2 = {3.535536e-01f,-3.535536e-01f,-3.535536e-01f, 3.535536e-01f}; - __m128 c3 = {1.913422e-01f,-4.619398e-01f, 4.619398e-01f,-1.913422e-01f}; - - __m128 c4 = {4.903927e-01f, 4.157349e-01f, 2.777855e-01f, 9.754573e-02f}; - __m128 c5 = {4.157349e-01f,-9.754573e-02f,-4.903927e-01f,-2.777855e-01f}; - __m128 c6 = {2.777855e-01f,-4.903927e-01f, 9.754573e-02f, 4.157349e-01f}; - __m128 c7 = {9.754573e-02f,-2.777855e-01f, 4.157349e-01f,-4.903927e-01f}; - - __m128 *srcVec = (__m128 *)data; - __m128 x[8], evenSum, oddSum; - __m128 in[8], alpha[4], beta[4], theta[4], gamma[4]; - - // - // Rows - - // - // Treat this just like matrix-vector multiplication. The - // trick is to note that: - // - // [M00 M01 M02 M03][v0] [(v0 M00) + (v1 M01) + (v2 M02) + (v3 M03)] - // [M10 M11 M12 M13][v1] = [(v0 M10) + (v1 M11) + (v2 M12) + (v3 M13)] - // [M20 M21 M22 M23][v2] [(v0 M20) + (v1 M21) + (v2 M22) + (v3 M23)] - // [M30 M31 M32 M33][v3] [(v0 M30) + (v1 M31) + (v2 M32) + (v3 M33)] - // - // Then, we can fill a register with v_i and multiply by the i-th column - // of M, accumulating across all i-s. - // - // The kids refer to the populating of a register with a single value - // "broadcasting", and it can be done with a shuffle instruction. It - // seems to be the slowest part of the whole ordeal. - // - // Our matrix columns are stored above in c0-c7. c0-3 make up M1, and - // c4-7 are from M2. - // +#ifdef IMF_HAVE_SSE2 + __m128 a = {3.535536e-01f, 3.535536e-01f, 3.535536e-01f, 3.535536e-01f}; + __m128 b = {4.903927e-01f, 4.903927e-01f, 4.903927e-01f, 4.903927e-01f}; + __m128 c = {4.619398e-01f, 4.619398e-01f, 4.619398e-01f, 4.619398e-01f}; + __m128 d = {4.157349e-01f, 4.157349e-01f, 4.157349e-01f, 4.157349e-01f}; + __m128 e = {2.777855e-01f, 2.777855e-01f, 2.777855e-01f, 2.777855e-01f}; + __m128 f = {1.913422e-01f, 1.913422e-01f, 1.913422e-01f, 1.913422e-01f}; + __m128 g = {9.754573e-02f, 9.754573e-02f, 9.754573e-02f, 9.754573e-02f}; + + __m128 c0 = {3.535536e-01f, 3.535536e-01f, 3.535536e-01f, 3.535536e-01f}; + __m128 c1 = {4.619398e-01f, 1.913422e-01f, -1.913422e-01f, -4.619398e-01f}; + __m128 c2 = {3.535536e-01f, -3.535536e-01f, -3.535536e-01f, 3.535536e-01f}; + __m128 c3 = {1.913422e-01f, -4.619398e-01f, 4.619398e-01f, -1.913422e-01f}; + + __m128 c4 = {4.903927e-01f, 4.157349e-01f, 2.777855e-01f, 9.754573e-02f}; + __m128 c5 = {4.157349e-01f, -9.754573e-02f, -4.903927e-01f, -2.777855e-01f}; + __m128 c6 = {2.777855e-01f, -4.903927e-01f, 9.754573e-02f, 4.157349e-01f}; + __m128 c7 = {9.754573e-02f, -2.777855e-01f, 4.157349e-01f, -4.903927e-01f}; + + __m128* srcVec = (__m128*) data; + __m128 x[8], evenSum, oddSum; + __m128 in[8], alpha[4], beta[4], theta[4], gamma[4]; - #define DCT_INVERSE_8x8_SS2_ROW_LOOP(i) \ - /* \ + // + // Rows - + // + // Treat this just like matrix-vector multiplication. The + // trick is to note that: + // + // [M00 M01 M02 M03][v0] [(v0 M00) + (v1 M01) + (v2 M02) + (v3 M03)] + // [M10 M11 M12 M13][v1] = [(v0 M10) + (v1 M11) + (v2 M12) + (v3 M13)] + // [M20 M21 M22 M23][v2] [(v0 M20) + (v1 M21) + (v2 M22) + (v3 M23)] + // [M30 M31 M32 M33][v3] [(v0 M30) + (v1 M31) + (v2 M32) + (v3 M33)] + // + // Then, we can fill a register with v_i and multiply by the i-th column + // of M, accumulating across all i-s. + // + // The kids refer to the populating of a register with a single value + // "broadcasting", and it can be done with a shuffle instruction. It + // seems to be the slowest part of the whole ordeal. + // + // Our matrix columns are stored above in c0-c7. c0-3 make up M1, and + // c4-7 are from M2. + // + +# define DCT_INVERSE_8x8_SS2_ROW_LOOP(i) \ + /* \ * Broadcast the components of the row \ - */ \ - \ - x[0] = _mm_shuffle_ps (srcVec[2 * i], \ - srcVec[2 * i], \ - _MM_SHUFFLE (0, 0, 0, 0)); \ - \ - x[1] = _mm_shuffle_ps (srcVec[2 * i], \ - srcVec[2 * i], \ - _MM_SHUFFLE (1, 1, 1, 1)); \ - \ - x[2] = _mm_shuffle_ps (srcVec[2 * i], \ - srcVec[2 * i], \ - _MM_SHUFFLE (2, 2, 2, 2)); \ - \ - x[3] = _mm_shuffle_ps (srcVec[2 * i], \ - srcVec[2 * i], \ - _MM_SHUFFLE (3, 3, 3, 3)); \ - \ - x[4] = _mm_shuffle_ps (srcVec[2 * i + 1], \ - srcVec[2 * i + 1], \ - _MM_SHUFFLE (0, 0, 0, 0)); \ - \ - x[5] = _mm_shuffle_ps (srcVec[2 * i + 1], \ - srcVec[2 * i + 1], \ - _MM_SHUFFLE (1, 1, 1, 1)); \ - \ - x[6] = _mm_shuffle_ps (srcVec[2 * i + 1], \ - srcVec[2 * i + 1], \ - _MM_SHUFFLE (2, 2, 2, 2)); \ - \ - x[7] = _mm_shuffle_ps (srcVec[2 * i + 1], \ - srcVec[2 * i + 1], \ - _MM_SHUFFLE (3, 3, 3, 3)); \ - /* \ + */ \ + \ + x[0] = _mm_shuffle_ps ( \ + srcVec[2 * i], srcVec[2 * i], _MM_SHUFFLE (0, 0, 0, 0)); \ + \ + x[1] = _mm_shuffle_ps ( \ + srcVec[2 * i], srcVec[2 * i], _MM_SHUFFLE (1, 1, 1, 1)); \ + \ + x[2] = _mm_shuffle_ps ( \ + srcVec[2 * i], srcVec[2 * i], _MM_SHUFFLE (2, 2, 2, 2)); \ + \ + x[3] = _mm_shuffle_ps ( \ + srcVec[2 * i], srcVec[2 * i], _MM_SHUFFLE (3, 3, 3, 3)); \ + \ + x[4] = _mm_shuffle_ps ( \ + srcVec[2 * i + 1], srcVec[2 * i + 1], _MM_SHUFFLE (0, 0, 0, 0)); \ + \ + x[5] = _mm_shuffle_ps ( \ + srcVec[2 * i + 1], srcVec[2 * i + 1], _MM_SHUFFLE (1, 1, 1, 1)); \ + \ + x[6] = _mm_shuffle_ps ( \ + srcVec[2 * i + 1], srcVec[2 * i + 1], _MM_SHUFFLE (2, 2, 2, 2)); \ + \ + x[7] = _mm_shuffle_ps ( \ + srcVec[2 * i + 1], srcVec[2 * i + 1], _MM_SHUFFLE (3, 3, 3, 3)); \ + /* \ * Multiply the components by each column of the matrix \ - */ \ - \ - x[0] = _mm_mul_ps (x[0], c0); \ - x[2] = _mm_mul_ps (x[2], c1); \ - x[4] = _mm_mul_ps (x[4], c2); \ - x[6] = _mm_mul_ps (x[6], c3); \ - \ - x[1] = _mm_mul_ps (x[1], c4); \ - x[3] = _mm_mul_ps (x[3], c5); \ - x[5] = _mm_mul_ps (x[5], c6); \ - x[7] = _mm_mul_ps (x[7], c7); \ - \ - /* \ + */ \ + \ + x[0] = _mm_mul_ps (x[0], c0); \ + x[2] = _mm_mul_ps (x[2], c1); \ + x[4] = _mm_mul_ps (x[4], c2); \ + x[6] = _mm_mul_ps (x[6], c3); \ + \ + x[1] = _mm_mul_ps (x[1], c4); \ + x[3] = _mm_mul_ps (x[3], c5); \ + x[5] = _mm_mul_ps (x[5], c6); \ + x[7] = _mm_mul_ps (x[7], c7); \ + \ + /* \ * Add across \ - */ \ - \ - evenSum = _mm_setzero_ps(); \ - evenSum = _mm_add_ps (evenSum, x[0]); \ - evenSum = _mm_add_ps (evenSum, x[2]); \ - evenSum = _mm_add_ps (evenSum, x[4]); \ - evenSum = _mm_add_ps (evenSum, x[6]); \ - \ - oddSum = _mm_setzero_ps(); \ - oddSum = _mm_add_ps (oddSum, x[1]); \ - oddSum = _mm_add_ps (oddSum, x[3]); \ - oddSum = _mm_add_ps (oddSum, x[5]); \ - oddSum = _mm_add_ps (oddSum, x[7]); \ - \ - /* \ + */ \ + \ + evenSum = _mm_setzero_ps (); \ + evenSum = _mm_add_ps (evenSum, x[0]); \ + evenSum = _mm_add_ps (evenSum, x[2]); \ + evenSum = _mm_add_ps (evenSum, x[4]); \ + evenSum = _mm_add_ps (evenSum, x[6]); \ + \ + oddSum = _mm_setzero_ps (); \ + oddSum = _mm_add_ps (oddSum, x[1]); \ + oddSum = _mm_add_ps (oddSum, x[3]); \ + oddSum = _mm_add_ps (oddSum, x[5]); \ + oddSum = _mm_add_ps (oddSum, x[7]); \ + \ + /* \ * Final Sum: \ * out [0, 1, 2, 3] = evenSum + oddSum \ * out [7, 6, 5, 4] = evenSum - oddSum \ - */ \ - \ - srcVec[2 * i] = _mm_add_ps (evenSum, oddSum); \ - srcVec[2 * i + 1] = _mm_sub_ps (evenSum, oddSum); \ - srcVec[2 * i + 1] = _mm_shuffle_ps (srcVec[2 * i + 1], \ - srcVec[2 * i + 1], \ - _MM_SHUFFLE (0, 1, 2, 3)); - - switch (zeroedRows) - { - case 0: - default: - DCT_INVERSE_8x8_SS2_ROW_LOOP (0) - DCT_INVERSE_8x8_SS2_ROW_LOOP (1) - DCT_INVERSE_8x8_SS2_ROW_LOOP (2) - DCT_INVERSE_8x8_SS2_ROW_LOOP (3) - DCT_INVERSE_8x8_SS2_ROW_LOOP (4) - DCT_INVERSE_8x8_SS2_ROW_LOOP (5) - DCT_INVERSE_8x8_SS2_ROW_LOOP (6) - DCT_INVERSE_8x8_SS2_ROW_LOOP (7) + */ \ + \ + srcVec[2 * i] = _mm_add_ps (evenSum, oddSum); \ + srcVec[2 * i + 1] = _mm_sub_ps (evenSum, oddSum); \ + srcVec[2 * i + 1] = _mm_shuffle_ps ( \ + srcVec[2 * i + 1], srcVec[2 * i + 1], _MM_SHUFFLE (0, 1, 2, 3)) + + switch (zeroedRows) + { + case 0: + default: + DCT_INVERSE_8x8_SS2_ROW_LOOP (0); + DCT_INVERSE_8x8_SS2_ROW_LOOP (1); + DCT_INVERSE_8x8_SS2_ROW_LOOP (2); + DCT_INVERSE_8x8_SS2_ROW_LOOP (3); + DCT_INVERSE_8x8_SS2_ROW_LOOP (4); + DCT_INVERSE_8x8_SS2_ROW_LOOP (5); + DCT_INVERSE_8x8_SS2_ROW_LOOP (6); + DCT_INVERSE_8x8_SS2_ROW_LOOP (7); break; - case 1: - DCT_INVERSE_8x8_SS2_ROW_LOOP (0) - DCT_INVERSE_8x8_SS2_ROW_LOOP (1) - DCT_INVERSE_8x8_SS2_ROW_LOOP (2) - DCT_INVERSE_8x8_SS2_ROW_LOOP (3) - DCT_INVERSE_8x8_SS2_ROW_LOOP (4) - DCT_INVERSE_8x8_SS2_ROW_LOOP (5) - DCT_INVERSE_8x8_SS2_ROW_LOOP (6) + case 1: + DCT_INVERSE_8x8_SS2_ROW_LOOP (0); + DCT_INVERSE_8x8_SS2_ROW_LOOP (1); + DCT_INVERSE_8x8_SS2_ROW_LOOP (2); + DCT_INVERSE_8x8_SS2_ROW_LOOP (3); + DCT_INVERSE_8x8_SS2_ROW_LOOP (4); + DCT_INVERSE_8x8_SS2_ROW_LOOP (5); + DCT_INVERSE_8x8_SS2_ROW_LOOP (6); break; - case 2: - DCT_INVERSE_8x8_SS2_ROW_LOOP (0) - DCT_INVERSE_8x8_SS2_ROW_LOOP (1) - DCT_INVERSE_8x8_SS2_ROW_LOOP (2) - DCT_INVERSE_8x8_SS2_ROW_LOOP (3) - DCT_INVERSE_8x8_SS2_ROW_LOOP (4) - DCT_INVERSE_8x8_SS2_ROW_LOOP (5) + case 2: + DCT_INVERSE_8x8_SS2_ROW_LOOP (0); + DCT_INVERSE_8x8_SS2_ROW_LOOP (1); + DCT_INVERSE_8x8_SS2_ROW_LOOP (2); + DCT_INVERSE_8x8_SS2_ROW_LOOP (3); + DCT_INVERSE_8x8_SS2_ROW_LOOP (4); + DCT_INVERSE_8x8_SS2_ROW_LOOP (5); break; - case 3: - DCT_INVERSE_8x8_SS2_ROW_LOOP (0) - DCT_INVERSE_8x8_SS2_ROW_LOOP (1) - DCT_INVERSE_8x8_SS2_ROW_LOOP (2) - DCT_INVERSE_8x8_SS2_ROW_LOOP (3) - DCT_INVERSE_8x8_SS2_ROW_LOOP (4) + case 3: + DCT_INVERSE_8x8_SS2_ROW_LOOP (0); + DCT_INVERSE_8x8_SS2_ROW_LOOP (1); + DCT_INVERSE_8x8_SS2_ROW_LOOP (2); + DCT_INVERSE_8x8_SS2_ROW_LOOP (3); + DCT_INVERSE_8x8_SS2_ROW_LOOP (4); break; - case 4: - DCT_INVERSE_8x8_SS2_ROW_LOOP (0) - DCT_INVERSE_8x8_SS2_ROW_LOOP (1) - DCT_INVERSE_8x8_SS2_ROW_LOOP (2) - DCT_INVERSE_8x8_SS2_ROW_LOOP (3) + case 4: + DCT_INVERSE_8x8_SS2_ROW_LOOP (0); + DCT_INVERSE_8x8_SS2_ROW_LOOP (1); + DCT_INVERSE_8x8_SS2_ROW_LOOP (2); + DCT_INVERSE_8x8_SS2_ROW_LOOP (3); break; - case 5: - DCT_INVERSE_8x8_SS2_ROW_LOOP (0) - DCT_INVERSE_8x8_SS2_ROW_LOOP (1) - DCT_INVERSE_8x8_SS2_ROW_LOOP (2) + case 5: + DCT_INVERSE_8x8_SS2_ROW_LOOP (0); + DCT_INVERSE_8x8_SS2_ROW_LOOP (1); + DCT_INVERSE_8x8_SS2_ROW_LOOP (2); break; - case 6: - DCT_INVERSE_8x8_SS2_ROW_LOOP (0) - DCT_INVERSE_8x8_SS2_ROW_LOOP (1) + case 6: + DCT_INVERSE_8x8_SS2_ROW_LOOP (0); + DCT_INVERSE_8x8_SS2_ROW_LOOP (1); break; - case 7: - DCT_INVERSE_8x8_SS2_ROW_LOOP (0) - break; - } + case 7: DCT_INVERSE_8x8_SS2_ROW_LOOP (0); break; + } - // - // Columns - - // - // This is slightly more straightforward, if less readable. Here - // we just operate on 4 columns at a time, in two batches. - // - // The slight mess is to try and cache sub-expressions, which - // we ignore in the row-wise pass. - // +# undef DCT_INVERSE_8x8_SS2_ROW_LOOP + // + // Columns - + // + // This is slightly more straightforward, if less readable. Here + // we just operate on 4 columns at a time, in two batches. + // + // The slight mess is to try and cache sub-expressions, which + // we ignore in the row-wise pass. + // - for (int col = 0; col < 2; ++col) - { + for (int col = 0; col < 2; ++col) + { - for (int i = 0; i < 8; ++i) - in[i] = srcVec[2 * i + col]; - - alpha[0] = _mm_mul_ps (c, in[2]); - alpha[1] = _mm_mul_ps (f, in[2]); - alpha[2] = _mm_mul_ps (c, in[6]); - alpha[3] = _mm_mul_ps (f, in[6]); - - beta[0] = _mm_add_ps (_mm_add_ps (_mm_mul_ps (in[1], b), - _mm_mul_ps (in[3], d)), - _mm_add_ps (_mm_mul_ps (in[5], e), - _mm_mul_ps (in[7], g))); - - beta[1] = _mm_sub_ps (_mm_sub_ps (_mm_mul_ps (in[1], d), - _mm_mul_ps (in[3], g)), - _mm_add_ps (_mm_mul_ps (in[5], b), - _mm_mul_ps (in[7], e))); - - beta[2] = _mm_add_ps (_mm_sub_ps (_mm_mul_ps (in[1], e), - _mm_mul_ps (in[3], b)), - _mm_add_ps (_mm_mul_ps (in[5], g), - _mm_mul_ps (in[7], d))); - - beta[3] = _mm_add_ps (_mm_sub_ps (_mm_mul_ps (in[1], g), - _mm_mul_ps (in[3], e)), - _mm_sub_ps (_mm_mul_ps (in[5], d), - _mm_mul_ps (in[7], b))); - - theta[0] = _mm_mul_ps (a, _mm_add_ps (in[0], in[4])); - theta[3] = _mm_mul_ps (a, _mm_sub_ps (in[0], in[4])); - - theta[1] = _mm_add_ps (alpha[0], alpha[3]); - theta[2] = _mm_sub_ps (alpha[1], alpha[2]); - - gamma[0] = _mm_add_ps (theta[0], theta[1]); - gamma[1] = _mm_add_ps (theta[3], theta[2]); - gamma[2] = _mm_sub_ps (theta[3], theta[2]); - gamma[3] = _mm_sub_ps (theta[0], theta[1]); - - srcVec[ col] = _mm_add_ps (gamma[0], beta[0]); - srcVec[2+col] = _mm_add_ps (gamma[1], beta[1]); - srcVec[4+col] = _mm_add_ps (gamma[2], beta[2]); - srcVec[6+col] = _mm_add_ps (gamma[3], beta[3]); - - srcVec[ 8+col] = _mm_sub_ps (gamma[3], beta[3]); - srcVec[10+col] = _mm_sub_ps (gamma[2], beta[2]); - srcVec[12+col] = _mm_sub_ps (gamma[1], beta[1]); - srcVec[14+col] = _mm_sub_ps (gamma[0], beta[0]); - } + for (int i = 0; i < 8; ++i) + in[i] = srcVec[2 * i + col]; - #else /* IMF_HAVE_SSE2 */ + alpha[0] = _mm_mul_ps (c, in[2]); + alpha[1] = _mm_mul_ps (f, in[2]); + alpha[2] = _mm_mul_ps (c, in[6]); + alpha[3] = _mm_mul_ps (f, in[6]); - dctInverse8x8_scalar (data); + beta[0] = _mm_add_ps ( + _mm_add_ps (_mm_mul_ps (in[1], b), _mm_mul_ps (in[3], d)), + _mm_add_ps (_mm_mul_ps (in[5], e), _mm_mul_ps (in[7], g))); - #endif /* IMF_HAVE_SSE2 */ -} + beta[1] = _mm_sub_ps ( + _mm_sub_ps (_mm_mul_ps (in[1], d), _mm_mul_ps (in[3], g)), + _mm_add_ps (_mm_mul_ps (in[5], b), _mm_mul_ps (in[7], e))); + + beta[2] = _mm_add_ps ( + _mm_sub_ps (_mm_mul_ps (in[1], e), _mm_mul_ps (in[3], b)), + _mm_add_ps (_mm_mul_ps (in[5], g), _mm_mul_ps (in[7], d))); + + beta[3] = _mm_add_ps ( + _mm_sub_ps (_mm_mul_ps (in[1], g), _mm_mul_ps (in[3], e)), + _mm_sub_ps (_mm_mul_ps (in[5], d), _mm_mul_ps (in[7], b))); + + theta[0] = _mm_mul_ps (a, _mm_add_ps (in[0], in[4])); + theta[3] = _mm_mul_ps (a, _mm_sub_ps (in[0], in[4])); + theta[1] = _mm_add_ps (alpha[0], alpha[3]); + theta[2] = _mm_sub_ps (alpha[1], alpha[2]); + + gamma[0] = _mm_add_ps (theta[0], theta[1]); + gamma[1] = _mm_add_ps (theta[3], theta[2]); + gamma[2] = _mm_sub_ps (theta[3], theta[2]); + gamma[3] = _mm_sub_ps (theta[0], theta[1]); + + srcVec[col] = _mm_add_ps (gamma[0], beta[0]); + srcVec[2 + col] = _mm_add_ps (gamma[1], beta[1]); + srcVec[4 + col] = _mm_add_ps (gamma[2], beta[2]); + srcVec[6 + col] = _mm_add_ps (gamma[3], beta[3]); + + srcVec[8 + col] = _mm_sub_ps (gamma[3], beta[3]); + srcVec[10 + col] = _mm_sub_ps (gamma[2], beta[2]); + srcVec[12 + col] = _mm_sub_ps (gamma[1], beta[1]); + srcVec[14 + col] = _mm_sub_ps (gamma[0], beta[0]); + } + +#else /* IMF_HAVE_SSE2 */ + + dctInverse8x8_scalar (data); + +#endif /* IMF_HAVE_SSE2 */ +} // // AVX Implementation // +// clang-format off + #define STR(A) #A #define IDCT_AVX_SETUP_2_ROWS(_DST0, _DST1, _TMP0, _TMP1, \ @@ -1293,7 +1337,7 @@ dctInverse8x8_sse2 (float *data) * they depend. * * This should work for the cases where we have 2-8 full rows. - * the 1-row case is special, and we'll handle it seperately. + * the 1-row case is special, and we'll handle it separately. */ #define IDCT_AVX_BODY \ /* ============================================== @@ -1561,11 +1605,13 @@ dctInverse8x8_sse2 (float *data) ); #endif /* __AVX__ */ +// clang-format on + template void -dctInverse8x8_avx (float *data) +dctInverse8x8_avx (float* data) { - #if defined IMF_HAVE_GCC_INLINEASM_X86_64 +#if defined IMF_HAVE_GCC_INLINEASM_X86_64 /* The column-major version of M1, followed by the * column-major version of M2: @@ -1574,77 +1620,91 @@ dctInverse8x8_avx (float *data) * M1 = [ a f -a -c ] M2 = [ d -g -b -e ] * [ a -f -a c ] [ e -b g d ] * [ a -c a -f ] [ g -e d -b ] - */ - const float sAvxCoef[32] __attribute__((aligned(32))) = { - 3.535536e-01, 3.535536e-01, 3.535536e-01, 3.535536e-01, /* a a a a */ - 4.619398e-01, 1.913422e-01, -1.913422e-01, -4.619398e-01, /* c f -f -c */ - 3.535536e-01, -3.535536e-01, -3.535536e-01, 3.535536e-01, /* a -a -a a */ - 1.913422e-01, -4.619398e-01, 4.619398e-01, -1.913422e-01, /* f -c c -f */ - - 4.903927e-01, 4.157349e-01, 2.777855e-01, 9.754573e-02, /* b d e g */ - 4.157349e-01, -9.754573e-02, -4.903927e-01, -2.777855e-01, /* d -g -b -e */ - 2.777855e-01, -4.903927e-01, 9.754573e-02, 4.157349e-01, /* e -b g d */ - 9.754573e-02, -2.777855e-01, 4.157349e-01, -4.903927e-01 /* g -e d -b */ + */ + const float sAvxCoef[32] __attribute__ ((aligned (32))) = { + 3.535536e-01, 3.535536e-01, + 3.535536e-01, 3.535536e-01, /* a a a a */ + 4.619398e-01, 1.913422e-01, + -1.913422e-01, -4.619398e-01, /* c f -f -c */ + 3.535536e-01, -3.535536e-01, + -3.535536e-01, 3.535536e-01, /* a -a -a a */ + 1.913422e-01, -4.619398e-01, + 4.619398e-01, -1.913422e-01, /* f -c c -f */ + + 4.903927e-01, 4.157349e-01, + 2.777855e-01, 9.754573e-02, /* b d e g */ + 4.157349e-01, -9.754573e-02, + -4.903927e-01, -2.777855e-01, /* d -g -b -e */ + 2.777855e-01, -4.903927e-01, + 9.754573e-02, 4.157349e-01, /* e -b g d */ + 9.754573e-02, -2.777855e-01, + 4.157349e-01, -4.903927e-01 /* g -e d -b */ }; - #define ROW0(_X) _X - #define ROW1(_X) _X - #define ROW2(_X) _X - #define ROW3(_X) _X - #define ROW4(_X) _X - #define ROW5(_X) _X - #define ROW6(_X) _X - #define ROW7(_X) _X - - if (zeroedRows == 0) { - - IDCT_AVX_ASM(data) - - } else if (zeroedRows == 1) { - - #undef ROW7 - #define ROW7(_X) - IDCT_AVX_ASM(data) - - } else if (zeroedRows == 2) { - - #undef ROW6 - #define ROW6(_X) - IDCT_AVX_ASM(data) - - } else if (zeroedRows == 3) { - - #undef ROW5 - #define ROW5(_X) - IDCT_AVX_ASM(data) - - } else if (zeroedRows == 4) { +# define ROW0(_X) _X +# define ROW1(_X) _X +# define ROW2(_X) _X +# define ROW3(_X) _X +# define ROW4(_X) _X +# define ROW5(_X) _X +# define ROW6(_X) _X +# define ROW7(_X) _X + + if (zeroedRows == 0) { IDCT_AVX_ASM (data) } + else if (zeroedRows == 1) + { - #undef ROW4 - #define ROW4(_X) - IDCT_AVX_ASM(data) +# undef ROW7 +# define ROW7(_X) + IDCT_AVX_ASM (data) + } + else if (zeroedRows == 2) + { - } else if (zeroedRows == 5) { +# undef ROW6 +# define ROW6(_X) + IDCT_AVX_ASM (data) + } + else if (zeroedRows == 3) + { - #undef ROW3 - #define ROW3(_X) - IDCT_AVX_ASM(data) +# undef ROW5 +# define ROW5(_X) + IDCT_AVX_ASM (data) + } + else if (zeroedRows == 4) + { - } else if (zeroedRows == 6) { +# undef ROW4 +# define ROW4(_X) + IDCT_AVX_ASM (data) + } + else if (zeroedRows == 5) + { - #undef ROW2 - #define ROW2(_X) - IDCT_AVX_ASM(data) +# undef ROW3 +# define ROW3(_X) + IDCT_AVX_ASM (data) + } + else if (zeroedRows == 6) + { - } else if (zeroedRows == 7) { +# undef ROW2 +# define ROW2(_X) + IDCT_AVX_ASM (data) + } + else if (zeroedRows == 7) + { + // autoformatting wants to add a space between the doubled %% + // clang-format off - __asm__( + __asm__( - /* ============================================== + /* ============================================== * Row 1D DCT * ---------------------------------------------- - */ - IDCT_AVX_SETUP_2_ROWS(0, 4, 14, 15, 0, 16, 32, 48) + */ + IDCT_AVX_SETUP_2_ROWS (0, 4, 14, 15, 0, 16, 32, 48) "vbroadcastf128 (%1), %%ymm8 \n" "vbroadcastf128 16(%1), %%ymm9 \n" @@ -1654,52 +1714,60 @@ dctInverse8x8_avx (float *data) /* Stash a vector of [a a a a | a a a a] away in ymm2 */ "vinsertf128 $1, %%xmm8, %%ymm8, %%ymm2 \n" - IDCT_AVX_MMULT_ROWS(%%ymm0) + IDCT_AVX_MMULT_ROWS (%% ymm0) "vbroadcastf128 64(%1), %%ymm8 \n" "vbroadcastf128 80(%1), %%ymm9 \n" "vbroadcastf128 96(%1), %%ymm10 \n" "vbroadcastf128 112(%1), %%ymm11 \n" - IDCT_AVX_MMULT_ROWS(%%ymm4) + IDCT_AVX_MMULT_ROWS (%% ymm4) - IDCT_AVX_EO_TO_ROW_HALVES(%%ymm0, %%ymm4, %%ymm0, %%ymm12) + IDCT_AVX_EO_TO_ROW_HALVES ( + %% ymm0, %% ymm4, %% ymm0, %% ymm12) - "vperm2f128 $0x02, %%ymm0, %%ymm12, %%ymm0 \n" + "vperm2f128 $0x02, %%ymm0, %%ymm12, %%ymm0 \n" - /* ============================================== + /* ============================================== * Column 1D DCT * ---------------------------------------------- - */ - - /* DC only, so multiple by a and we're done */ - "vmulps %%ymm2, %%ymm0, %%ymm0 \n" - - /* Copy out results */ - "vmovaps %%ymm0, (%0) \n" - "vmovaps %%ymm0, 32(%0) \n" - "vmovaps %%ymm0, 64(%0) \n" - "vmovaps %%ymm0, 96(%0) \n" - "vmovaps %%ymm0, 128(%0) \n" - "vmovaps %%ymm0, 160(%0) \n" - "vmovaps %%ymm0, 192(%0) \n" - "vmovaps %%ymm0, 224(%0) \n" - - #ifndef __AVX__ - "vzeroupper \n" - #endif /* __AVX__ */ - IDCT_AVX_OIC(data) - ); - } else { - assert(false); // Invalid template instance parameter - } - #else /* IMF_HAVE_GCC_INLINEASM_X86_64 */ + */ + + /* DC only, so multiple by a and we're done */ + "vmulps %%ymm2, %%ymm0, %%ymm0 \n" + + /* Copy out results */ + "vmovaps %%ymm0, (%0) \n" + "vmovaps %%ymm0, 32(%0) \n" + "vmovaps %%ymm0, 64(%0) \n" + "vmovaps %%ymm0, 96(%0) \n" + "vmovaps %%ymm0, 128(%0) \n" + "vmovaps %%ymm0, 160(%0) \n" + "vmovaps %%ymm0, 192(%0) \n" + "vmovaps %%ymm0, 224(%0) \n" + +# ifndef __AVX__ + "vzeroupper \n" +# endif /* __AVX__ */ + IDCT_AVX_OIC (data)); + // clang-format on + } + else + { + assert (false); // Invalid template instance parameter + } +#else /* IMF_HAVE_GCC_INLINEASM_X86_64 */ - dctInverse8x8_scalar(data); + dctInverse8x8_scalar (data); - #endif /* IMF_HAVE_GCC_INLINEASM_X86_64 */ +#endif /* IMF_HAVE_GCC_INLINEASM_X86_64 */ } +#undef IDCT_AVX_SETUP_2_ROWS +#undef IDCT_AVX_MMULT_ROWS +#undef IDCT_AVX_EO_TO_ROW_HALVES +#undef IDCT_AVX_BODY +#undef IDCT_AVX_OIC // // Full 8x8 Forward DCT: @@ -1730,10 +1798,10 @@ dctInverse8x8_avx (float *data) // s_ij = in_i + in_j // d_ij = in_i - in_j // -// rot_i(x, y) = {c_i*x + s_i*y, -s_i*x + c_i*y} +// rot_i(x, y) = {c_i*x + s_i*y, -s_i*x + c_i*y} // -// We'll run the DCT in two passes. First, run the 1D DCT on -// the rows, in-place. Then, run over the columns in-place, +// We'll run the DCT in two passes. First, run the 1D DCT on +// the rows, in-place. Then, run over the columns in-place, // and be done with it. // @@ -1743,14 +1811,14 @@ dctInverse8x8_avx (float *data) // Default implementation // -void -dctForward8x8 (float *data) +void +dctForward8x8 (float* data) { float A0, A1, A2, A3, A4, A5, A6, A7; float K0, K1, rot_x, rot_y; - float *srcPtr = data; - float *dstPtr = data; + float* srcPtr = data; + float* dstPtr = data; const float c1 = cosf (3.14159f * 1.0f / 16.0f); const float c2 = cosf (3.14159f * 2.0f / 16.0f); @@ -1760,7 +1828,7 @@ dctForward8x8 (float *data) const float c6 = cosf (3.14159f * 6.0f / 16.0f); const float c7 = cosf (3.14159f * 7.0f / 16.0f); - const float c1Half = .5f * c1; + const float c1Half = .5f * c1; const float c2Half = .5f * c2; const float c3Half = .5f * c3; const float c5Half = .5f * c5; @@ -1768,14 +1836,14 @@ dctForward8x8 (float *data) const float c7Half = .5f * c7; // - // First pass - do a 1D DCT over the rows and write the + // First pass - do a 1D DCT over the rows and write the // results back in place // - for (int row=0; row<8; ++row) + for (int row = 0; row < 8; ++row) { - float *srcRowPtr = srcPtr + 8 * row; - float *dstRowPtr = dstPtr + 8 * row; + float* srcRowPtr = srcPtr + 8 * row; + float* dstRowPtr = dstPtr + 8 * row; A0 = srcRowPtr[0] + srcRowPtr[7]; A1 = srcRowPtr[1] + srcRowPtr[2]; @@ -1784,10 +1852,10 @@ dctForward8x8 (float *data) A4 = srcRowPtr[3] - srcRowPtr[4]; A5 = srcRowPtr[5] + srcRowPtr[6]; A6 = srcRowPtr[5] - srcRowPtr[6]; - A7 = srcRowPtr[0] - srcRowPtr[7]; + A7 = srcRowPtr[0] - srcRowPtr[7]; - K0 = c4 * (A0 + A3); - K1 = c4 * (A1 + A5); + K0 = c4 * (A0 + A3); + K1 = c4 * (A1 + A5); dstRowPtr[0] = .5f * (K0 + K1); dstRowPtr[4] = .5f * (K0 - K1); @@ -1799,21 +1867,21 @@ dctForward8x8 (float *data) rot_x = A2 - A6; rot_y = A0 - A3; - dstRowPtr[2] = c6Half * rot_x + c2Half * rot_y; - dstRowPtr[6] = c6Half * rot_y - c2Half * rot_x; + dstRowPtr[2] = c6Half * rot_x + c2Half * rot_y; + dstRowPtr[6] = c6Half * rot_y - c2Half * rot_x; // // K0, K1 are active until after dst[1],dst[7] // as well as dst[3], dst[5] are computed. // - K0 = c4 * (A1 - A5); - K1 = -1 * c4 * (A2 + A6); + K0 = c4 * (A1 - A5); + K1 = -1 * c4 * (A2 + A6); // // Two ways to do a rotation: // - // rot i (x, y) = + // rot i (x, y) = // X = c_i*x + s_i*y // Y = -s_i*x + c_i*y // @@ -1857,11 +1925,11 @@ dctForward8x8 (float *data) for (int column = 0; column < 8; ++column) { - A0 = srcPtr[ column] + srcPtr[56 + column]; - A7 = srcPtr[ column] - srcPtr[56 + column]; + A0 = srcPtr[column] + srcPtr[56 + column]; + A7 = srcPtr[column] - srcPtr[56 + column]; - A1 = srcPtr[ 8 + column] + srcPtr[16 + column]; - A2 = srcPtr[ 8 + column] - srcPtr[16 + column]; + A1 = srcPtr[8 + column] + srcPtr[16 + column]; + A2 = srcPtr[8 + column] - srcPtr[16 + column]; A3 = srcPtr[24 + column] + srcPtr[32 + column]; A4 = srcPtr[24 + column] - srcPtr[32 + column]; @@ -1869,11 +1937,11 @@ dctForward8x8 (float *data) A5 = srcPtr[40 + column] + srcPtr[48 + column]; A6 = srcPtr[40 + column] - srcPtr[48 + column]; - K0 = c4 * (A0 + A3); - K1 = c4 * (A1 + A5); + K0 = c4 * (A0 + A3); + K1 = c4 * (A1 + A5); - dstPtr[ column] = .5f * (K0 + K1); - dstPtr[32+column] = .5f * (K0 - K1); + dstPtr[column] = .5f * (K0 + K1); + dstPtr[32 + column] = .5f * (K0 - K1); // // (2*dst2, 2*dst6) = rot 6 ( d12 - d56, s07 - s34 ) @@ -1882,16 +1950,16 @@ dctForward8x8 (float *data) rot_x = A2 - A6; rot_y = A0 - A3; - dstPtr[16+column] = .5f * (c6 * rot_x + c2 * rot_y); - dstPtr[48+column] = .5f * (c6 * rot_y - c2 * rot_x); + dstPtr[16 + column] = .5f * (c6 * rot_x + c2 * rot_y); + dstPtr[48 + column] = .5f * (c6 * rot_y - c2 * rot_x); // // K0, K1 are active until after dst[1],dst[7] // as well as dst[3], dst[5] are computed. // - K0 = c4 * (A1 - A5); - K1 = -1 * c4 * (A2 + A6); + K0 = c4 * (A1 - A5); + K1 = -1 * c4 * (A2 + A6); // // (2*dst3, 2*dst5) = rot -3 ( d07 - K0, d34 + K1 ) @@ -1900,8 +1968,8 @@ dctForward8x8 (float *data) rot_x = A7 - K0; rot_y = A4 + K1; - dstPtr[24+column] = .5f * (c3 * rot_x - c5 * rot_y); - dstPtr[40+column] = .5f * (c5 * rot_x + c3 * rot_y); + dstPtr[24 + column] = .5f * (c3 * rot_x - c5 * rot_y); + dstPtr[40 + column] = .5f * (c5 * rot_x + c3 * rot_y); // // (2*dst1, 2*dst7) = rot -1 ( d07 + K0, K1 - d34 ) @@ -1910,12 +1978,12 @@ dctForward8x8 (float *data) rot_x = A7 + K0; rot_y = K1 - A4; - dstPtr[ 8+column] = .5f * (c1 * rot_x - c7 * rot_y); - dstPtr[56+column] = .5f * (c7 * rot_x + c1 * rot_y); + dstPtr[8 + column] = .5f * (c1 * rot_x - c7 * rot_y); + dstPtr[56 + column] = .5f * (c7 * rot_x + c1 * rot_y); } } -#else /* IMF_HAVE_SSE2 */ +#else /* IMF_HAVE_SSE2 */ // // SSE2 implementation @@ -1925,25 +1993,25 @@ dctForward8x8 (float *data) // between rows-wise and column-wise // -void -dctForward8x8 (float *data) +void +dctForward8x8 (float* data) { - __m128 *srcVec = (__m128 *)data; + __m128* srcVec = (__m128*) data; __m128 a0Vec, a1Vec, a2Vec, a3Vec, a4Vec, a5Vec, a6Vec, a7Vec; __m128 k0Vec, k1Vec, rotXVec, rotYVec; __m128 transTmp[4], transTmp2[4]; - __m128 c4Vec = { .70710678f, .70710678f, .70710678f, .70710678f}; - __m128 c4NegVec = {-.70710678f, -.70710678f, -.70710678f, -.70710678f}; + __m128 c4Vec = {.70710678f, .70710678f, .70710678f, .70710678f}; + __m128 c4NegVec = {-.70710678f, -.70710678f, -.70710678f, -.70710678f}; - __m128 c1HalfVec = {.490392640f, .490392640f, .490392640f, .490392640f}; - __m128 c2HalfVec = {.461939770f, .461939770f, .461939770f, .461939770f}; - __m128 c3HalfVec = {.415734810f, .415734810f, .415734810f, .415734810f}; - __m128 c5HalfVec = {.277785120f, .277785120f, .277785120f, .277785120f}; - __m128 c6HalfVec = {.191341720f, .191341720f, .191341720f, .191341720f}; - __m128 c7HalfVec = {.097545161f, .097545161f, .097545161f, .097545161f}; + __m128 c1HalfVec = {.490392640f, .490392640f, .490392640f, .490392640f}; + __m128 c2HalfVec = {.461939770f, .461939770f, .461939770f, .461939770f}; + __m128 c3HalfVec = {.415734810f, .415734810f, .415734810f, .415734810f}; + __m128 c5HalfVec = {.277785120f, .277785120f, .277785120f, .277785120f}; + __m128 c6HalfVec = {.191341720f, .191341720f, .191341720f, .191341720f}; + __m128 c7HalfVec = {.097545161f, .097545161f, .097545161f, .097545161f}; - __m128 halfVec = {.5f, .5f, .5f, .5f}; + __m128 halfVec = {.5f, .5f, .5f, .5f}; for (int iter = 0; iter < 2; ++iter) { @@ -1960,16 +2028,16 @@ dctForward8x8 (float *data) // 7: 14 15 // - for (int pass=0; pass<2; ++pass) + for (int pass = 0; pass < 2; ++pass) { - a0Vec = _mm_add_ps (srcVec[ 0 + pass], srcVec[14 + pass]); - a1Vec = _mm_add_ps (srcVec[ 2 + pass], srcVec[ 4 + pass]); - a3Vec = _mm_add_ps (srcVec[ 6 + pass], srcVec[ 8 + pass]); + a0Vec = _mm_add_ps (srcVec[0 + pass], srcVec[14 + pass]); + a1Vec = _mm_add_ps (srcVec[2 + pass], srcVec[4 + pass]); + a3Vec = _mm_add_ps (srcVec[6 + pass], srcVec[8 + pass]); a5Vec = _mm_add_ps (srcVec[10 + pass], srcVec[12 + pass]); - - a7Vec = _mm_sub_ps (srcVec[ 0 + pass], srcVec[14 + pass]); - a2Vec = _mm_sub_ps (srcVec[ 2 + pass], srcVec[ 4 + pass]); - a4Vec = _mm_sub_ps (srcVec[ 6 + pass], srcVec[ 8 + pass]); + + a7Vec = _mm_sub_ps (srcVec[0 + pass], srcVec[14 + pass]); + a2Vec = _mm_sub_ps (srcVec[2 + pass], srcVec[4 + pass]); + a4Vec = _mm_sub_ps (srcVec[6 + pass], srcVec[8 + pass]); a6Vec = _mm_sub_ps (srcVec[10 + pass], srcVec[12 + pass]); // @@ -1985,29 +2053,28 @@ dctForward8x8 (float *data) srcVec[0 + pass] = _mm_add_ps (k0Vec, k1Vec); srcVec[8 + pass] = _mm_sub_ps (k0Vec, k1Vec); - srcVec[0 + pass] = _mm_mul_ps (srcVec[0 + pass], halfVec ); - srcVec[8 + pass] = _mm_mul_ps (srcVec[8 + pass], halfVec ); - + srcVec[0 + pass] = _mm_mul_ps (srcVec[0 + pass], halfVec); + srcVec[8 + pass] = _mm_mul_ps (srcVec[8 + pass], halfVec); // // Second stage; Compute out_2 and out_6 // - + k0Vec = _mm_sub_ps (a2Vec, a6Vec); k1Vec = _mm_sub_ps (a0Vec, a3Vec); - srcVec[ 4 + pass] = _mm_add_ps (_mm_mul_ps (c6HalfVec, k0Vec), - _mm_mul_ps (c2HalfVec, k1Vec)); + srcVec[4 + pass] = _mm_add_ps ( + _mm_mul_ps (c6HalfVec, k0Vec), _mm_mul_ps (c2HalfVec, k1Vec)); - srcVec[12 + pass] = _mm_sub_ps (_mm_mul_ps (c6HalfVec, k1Vec), - _mm_mul_ps (c2HalfVec, k0Vec)); + srcVec[12 + pass] = _mm_sub_ps ( + _mm_mul_ps (c6HalfVec, k1Vec), _mm_mul_ps (c2HalfVec, k0Vec)); // // Precompute K0 and K1 for the remaining stages // k0Vec = _mm_mul_ps (_mm_sub_ps (a1Vec, a5Vec), c4Vec); - k1Vec = _mm_mul_ps (_mm_add_ps (a2Vec, a6Vec), c4NegVec); + k1Vec = _mm_mul_ps (_mm_add_ps (a2Vec, a6Vec), c4NegVec); // // Third Stage, compute out_3 and out_5 @@ -2016,11 +2083,13 @@ dctForward8x8 (float *data) rotXVec = _mm_sub_ps (a7Vec, k0Vec); rotYVec = _mm_add_ps (a4Vec, k1Vec); - srcVec[ 6 + pass] = _mm_sub_ps (_mm_mul_ps (c3HalfVec, rotXVec), - _mm_mul_ps (c5HalfVec, rotYVec)); + srcVec[6 + pass] = _mm_sub_ps ( + _mm_mul_ps (c3HalfVec, rotXVec), + _mm_mul_ps (c5HalfVec, rotYVec)); - srcVec[10 + pass] = _mm_add_ps (_mm_mul_ps (c5HalfVec, rotXVec), - _mm_mul_ps (c3HalfVec, rotYVec)); + srcVec[10 + pass] = _mm_add_ps ( + _mm_mul_ps (c5HalfVec, rotXVec), + _mm_mul_ps (c3HalfVec, rotYVec)); // // Fourth Stage, compute out_1 and out_7 @@ -2029,11 +2098,13 @@ dctForward8x8 (float *data) rotXVec = _mm_add_ps (a7Vec, k0Vec); rotYVec = _mm_sub_ps (k1Vec, a4Vec); - srcVec[ 2 + pass] = _mm_sub_ps (_mm_mul_ps (c1HalfVec, rotXVec), - _mm_mul_ps (c7HalfVec, rotYVec)); + srcVec[2 + pass] = _mm_sub_ps ( + _mm_mul_ps (c1HalfVec, rotXVec), + _mm_mul_ps (c7HalfVec, rotYVec)); - srcVec[14 + pass] = _mm_add_ps (_mm_mul_ps (c7HalfVec, rotXVec), - _mm_mul_ps (c1HalfVec, rotYVec)); + srcVec[14 + pass] = _mm_add_ps ( + _mm_mul_ps (c7HalfVec, rotXVec), + _mm_mul_ps (c1HalfVec, rotYVec)); } // @@ -2058,9 +2129,9 @@ dctForward8x8 (float *data) // M3t, also done in place, the first half. // - transTmp2[0] = _mm_shuffle_ps (srcVec[ 9], srcVec[11], 0x44); + transTmp2[0] = _mm_shuffle_ps (srcVec[9], srcVec[11], 0x44); transTmp2[1] = _mm_shuffle_ps (srcVec[13], srcVec[15], 0x44); - transTmp2[2] = _mm_shuffle_ps (srcVec[ 9], srcVec[11], 0xEE); + transTmp2[2] = _mm_shuffle_ps (srcVec[9], srcVec[11], 0xEE); transTmp2[3] = _mm_shuffle_ps (srcVec[13], srcVec[15], 0xEE); // @@ -2076,14 +2147,14 @@ dctForward8x8 (float *data) // M3t, the second half. // - srcVec[ 9] = _mm_shuffle_ps (transTmp2[0], transTmp2[1], 0x88); + srcVec[9] = _mm_shuffle_ps (transTmp2[0], transTmp2[1], 0x88); srcVec[13] = _mm_shuffle_ps (transTmp2[2], transTmp2[3], 0x88); srcVec[11] = _mm_shuffle_ps (transTmp2[0], transTmp2[1], 0xDD); srcVec[15] = _mm_shuffle_ps (transTmp2[2], transTmp2[3], 0xDD); // // M1 and M2 need to be done at the same time, because we're - // swapping. + // swapping. // // First, the first half of M1t // @@ -2097,16 +2168,16 @@ dctForward8x8 (float *data) // And the first half of M2t // - transTmp2[0] = _mm_shuffle_ps (srcVec[ 8], srcVec[10], 0x44); + transTmp2[0] = _mm_shuffle_ps (srcVec[8], srcVec[10], 0x44); transTmp2[1] = _mm_shuffle_ps (srcVec[12], srcVec[14], 0x44); - transTmp2[2] = _mm_shuffle_ps (srcVec[ 8], srcVec[10], 0xEE); + transTmp2[2] = _mm_shuffle_ps (srcVec[8], srcVec[10], 0xEE); transTmp2[3] = _mm_shuffle_ps (srcVec[12], srcVec[14], 0xEE); // // Second half of M1t // - srcVec[ 8] = _mm_shuffle_ps (transTmp[0], transTmp[1], 0x88); + srcVec[8] = _mm_shuffle_ps (transTmp[0], transTmp[1], 0x88); srcVec[12] = _mm_shuffle_ps (transTmp[2], transTmp[3], 0x88); srcVec[10] = _mm_shuffle_ps (transTmp[0], transTmp[1], 0xDD); srcVec[14] = _mm_shuffle_ps (transTmp[2], transTmp[3], 0xDD); diff --git a/src/lib/OpenEXR/ImfEnvmap.h b/src/lib/OpenEXR/ImfEnvmap.h index c2639aba6a..d28e2138dc 100644 --- a/src/lib/OpenEXR/ImfEnvmap.h +++ b/src/lib/OpenEXR/ImfEnvmap.h @@ -27,7 +27,7 @@ // values. // // For each possible EnvmapAttribute value, this header file also -// defines a set of convienience functions to convert between 3D +// defines a set of convenience functions to convert between 3D // directions and 2D pixel locations. // // Most of the convenience functions defined below require a diff --git a/src/lib/OpenEXR/ImfFastHuf.cpp b/src/lib/OpenEXR/ImfFastHuf.cpp index c72e28d1ff..a8dd721fd6 100644 --- a/src/lib/OpenEXR/ImfFastHuf.cpp +++ b/src/lib/OpenEXR/ImfFastHuf.cpp @@ -11,6 +11,40 @@ #include #include +// Static enabling/disabling the fast huffman decode + + +#if defined(__clang__) +// +// Enabled for clang on Apple platforms (tested): +// + +# if defined(__APPLE__) +# define OPENEXR_IMF_ENABLE_FAST_HUF_DECODER +# endif + +#elif defined(__INTEL_COMPILER) || defined(__GNUC__) +// +// Enabled for ICC, GCC: +// __i386__ -> x86 +// __x86_64__ -> 64-bit x86 +// __e2k__ -> e2k (MCST Elbrus 2000) + +# if defined(__i386__) || defined(__x86_64__) || defined(__e2k__) +# define OPENEXR_IMF_ENABLE_FAST_HUF_DECODER +# endif + +#elif defined(_MSC_VER) +// +// Enabled for Visual Studio: +// _M_IX86 -> x86 +// _M_X64 -> 64bit x86 + +# if defined(_M_IX86) || defined(_M_X64) +# define OPENEXR_IMF_ENABLE_FAST_HUF_DECODER +# endif +#endif + OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_ENTER // @@ -64,7 +98,7 @@ FastHufDecoder::FastHufDecoder // // The 'offset' table is the position (in sorted order) of the first id - // of a given code lenght. Array is indexed by code length, like base. + // of a given code length. Array is indexed by code length, like base. // uint64_t offset[MAX_CODE_LEN + 1]; @@ -267,8 +301,8 @@ FastHufDecoder::~FastHufDecoder() // so I'm not entirely sure that we are reading fom the bit stream // properly on BE. // -// If you happen to have more obscure hardware, check that the -// byte swapping in refill() is happening sensable, add an endian +// If you happen to have more obscure hardware, check that the +// byte swapping in refill() is happening sensible, add an endian // check if needed, and fix the preprocessor magic here. // @@ -277,51 +311,32 @@ FastHufDecoder::~FastHufDecoder() ((uint64_t)(c)[3] << 32) | ((uint64_t)(c)[4] << 24) | ((uint64_t)(c)[5] << 16) | \ ((uint64_t)(c)[6] << 8) | ((uint64_t)(c)[7] ) -#ifdef __INTEL_COMPILER // ICC built-in swap for LE hosts - #if defined (__i386__) || defined(__x86_64__) - #undef READ64 - #define READ64(c) _bswap64 (*(const uint64_t*)(c)) - #endif +#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ +# ifdef __INTEL_COMPILER // ICC built-in swap for LE hosts +# if defined(__i386__) || defined(__x86_64__) +# undef READ64 +# define READ64(c) _bswap64 (*(const uint64_t*) (c)) +# endif + +# else +# ifdef __has_builtin +# if __has_builtin(__builtin_bswap64) +# undef READ64 +# define READ64(c) __builtin_bswap64 (*(const uint64_t*) (c)) +# endif +# endif +# endif #endif bool FastHufDecoder::enabled() { - #if defined(__INTEL_COMPILER) || defined(__GNUC__) - - // - // Enabled for ICC, GCC: - // __i386__ -> x86 - // __x86_64__ -> 64-bit x86 - // __e2k__ -> e2k (MCST Elbrus 2000) - - #if defined (__i386__) || defined(__x86_64__) || defined(__e2k__) - return true; - #else - return false; - #endif - - #elif defined (_MSC_VER) - - // - // Enabled for Visual Studio: - // _M_IX86 -> x86 - // _M_X64 -> 64bit x86 - - #if defined (_M_IX86) || defined(_M_X64) - return true; - #else - return false; - #endif - - #else - - // - // Unknown compiler - Be safe and disable. - // - return false; - #endif +# ifdef OPENEXR_IMF_ENABLE_FAST_HUF_DECODER + return true; +# else + return false; +# endif } // @@ -444,7 +459,7 @@ FastHufDecoder::buildTables (uint64_t *base, uint64_t *offset) // shift in 0's to bufferBack. // // The refill act takes numBits from the top of bufferBack and sticks -// them in the bottom of buffer. If there arn't enough bits in bufferBack, +// them in the bottom of buffer. If there aren't enough bits in bufferBack, // it gets refilled (to 64-bits) from the input bitstream. // @@ -515,7 +530,7 @@ FastHufDecoder::refill // // We can have cases where the previous shift of bufferBack is << 64 - // this is an undefined operation but tends to create just zeroes. - // so if we won't have any bits left, zero out bufferBack insetad of computing the shift + // so if we won't have any bits left, zero out bufferBack instead of computing the shift // if (bufferBackNumBits <= numBits) @@ -559,7 +574,7 @@ FastHufDecoder::readBits // small-ish table to accelerate decoding of short codes. // // If possible, try looking up codes into the acceleration table. -// This has a few benifits - there's no search involved; We don't +// This has a few benefits - there's no search involved; We don't // need an additional lookup to map id to symbol; we don't need // a full 64-bits (so less refilling). // @@ -680,7 +695,7 @@ FastHufDecoder::decode bufferNumBits -= codeLen; // - // If we recieved a RLE symbol (_rleSymbol), then we need + // If we received a RLE symbol (_rleSymbol), then we need // to read ahead 8 bits to know how many times to repeat // the previous symbol. Need to ensure we at least have // 8 bits of data in the buffer diff --git a/src/lib/OpenEXR/ImfFastHuf.h b/src/lib/OpenEXR/ImfFastHuf.h index c2bfb26a76..17afd1dea8 100644 --- a/src/lib/OpenEXR/ImfFastHuf.h +++ b/src/lib/OpenEXR/ImfFastHuf.h @@ -22,8 +22,8 @@ OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER // // The premise is that instead of working directly with the coded // symbols, we create a new ordering based on the frequency of symbols. -// Less frequent symbols (and thus longer codes) are ordered earler. -// We're calling the values in this ordering 'Ids', as oppsed to +// Less frequent symbols (and thus longer codes) are ordered earlier. +// We're calling the values in this ordering 'Ids', as oppsed to // 'Symbols' - which are the short values we eventually want decoded. // // With this new ordering, a few small tables can be derived ('base' diff --git a/src/lib/OpenEXR/ImfHeader.cpp b/src/lib/OpenEXR/ImfHeader.cpp index a7743784d2..9e90a40d27 100644 --- a/src/lib/OpenEXR/ImfHeader.cpp +++ b/src/lib/OpenEXR/ImfHeader.cpp @@ -1499,11 +1499,17 @@ staticInitialize () V3dAttribute::registerAttributeType(); V3fAttribute::registerAttributeType(); V3iAttribute::registerAttributeType(); - DwaCompressor::initializeFuncs(); - IDManifestAttribute::registerAttributeType(); + IDManifestAttribute::registerAttributeType(); + // + // Register functions, for example specialized functions + // for different CPU architectures. + // + + DwaCompressor::initializeFuncs (); + Zip::initializeFuncs (); - initialized = true; + initialized = true; } } diff --git a/src/lib/OpenEXR/ImfHeader.h b/src/lib/OpenEXR/ImfHeader.h index a0174ecaf4..0741402bcb 100644 --- a/src/lib/OpenEXR/ImfHeader.h +++ b/src/lib/OpenEXR/ImfHeader.h @@ -428,7 +428,7 @@ class IMF_EXPORT_TYPE Header //------------------------------------------------------------- // Sanity check -- examines the header, and throws an exception // if it finds something wrong (empty display window, negative - // pixel aspect ratio, unknown compression sceme etc.) + // pixel aspect ratio, unknown compression scheme etc...) // // set isTiled to true if you are checking a tiled/multi-res // header @@ -440,7 +440,7 @@ class IMF_EXPORT_TYPE Header //---------------------------------------------------------------- - // Maximum image size and maximim tile size: + // Maximum image size and maximum tile size: // // sanityCheck() will throw an exception if the width or height of // the data window exceeds the maximum image width or height, or diff --git a/src/lib/OpenEXR/ImfIDManifest.cpp b/src/lib/OpenEXR/ImfIDManifest.cpp index 36d9f1f895..43c1d9c4e4 100644 --- a/src/lib/OpenEXR/ImfIDManifest.cpp +++ b/src/lib/OpenEXR/ImfIDManifest.cpp @@ -55,22 +55,24 @@ namespace // map of strings to index of string in table - typedef std::map indexedStringSet; - - - - // when handling vectors/sets of strings, the string is got by deferencing the pointer/iterator - template size_t stringSize(const T &i) - { - return i->size(); - } - - template const char* cStr(const T &i) - { - return i->c_str(); - } - - /* +typedef std::map indexedStringSet; + +// when handling vectors/sets of strings, the string is got by dereferencing the pointer/iterator +template +size_t +stringSize (const T& i) +{ + return i->size (); +} + +template +const char* +cStr (const T& i) +{ + return i->c_str (); +} + +/* // but for indexedStringSet the string is the first of the iterator pair size_t stringSize(indexedStringSet::const_iterator &i ) { @@ -376,7 +378,7 @@ void IDManifest::init(const char* data, const char* endOfData) // // decode mapping table from indices in table to indices in string list - // the mapping uses smaller indices for more commonly occuring strings, since these are encoded with fewer bits + // the mapping uses smaller indices for more commonly occurring strings, since these are encoded with fewer bits // comments in serialize function describe the format // @@ -554,26 +556,29 @@ void IDManifest::init(const char* data, const char* endOfData) IDManifest::IDManifest(const CompressedIDManifest& compressed) { - // - // decompress the compressed manifest - // - - - vector uncomp(compressed._uncompressedDataSize); - uLongf outSize = compressed._uncompressedDataSize; - if(Z_OK != ::uncompress(&uncomp[0] , &outSize , (const Bytef*) compressed._data, compressed._compressedDataSize)) - { - throw IEX_NAMESPACE::InputExc ("IDManifest decompression (zlib) failed."); - } - if(outSize!=compressed._uncompressedDataSize) - { - throw IEX_NAMESPACE::InputExc ("IDManifest decompression (zlib) failed: mismatch in decompressed data size"); - } - - init((const char*) &uncomp[0],(const char*) &uncomp[0] + outSize); - - - + // + // decompress the compressed manifest + // + + vector uncomp (compressed._uncompressedDataSize); + uLong outSize = static_cast (compressed._uncompressedDataSize); + uLong inSize = static_cast (compressed._compressedDataSize); + if (Z_OK != ::uncompress ( + uncomp.data(), + &outSize, + reinterpret_cast (compressed._data), + inSize)) + { + throw IEX_NAMESPACE::InputExc ( + "IDManifest decompression (zlib) failed."); + } + if (outSize != compressed._uncompressedDataSize) + { + throw IEX_NAMESPACE::InputExc ( + "IDManifest decompression (zlib) failed: mismatch in decompressed data size"); + } + + init ((const char*) &uncomp[0], (const char*) &uncomp[0] + outSize); } @@ -1092,27 +1097,28 @@ CompressedIDManifest::CompressedIDManifest(const IDManifest& manifest) std::vector serial; - - manifest.serialize(serial); - - uLong outputSize = serial.size(); - + + manifest.serialize (serial); + + uLong outputSize = static_cast (serial.size ()); + // // allocate a buffer which is guaranteed to be big enough for compression // - uLongf compressedDataSize = compressBound(outputSize); - _data = (unsigned char*) malloc(compressedDataSize); - if(Z_OK != ::compress(_data,&compressedDataSize,(Bytef*) &serial[0],outputSize)) - { - throw IEX_NAMESPACE::InputExc("ID manifest compression failed"); - } - - // now call realloc to reallocate the buffer to a smaller size - this might free up memory - _data = (unsigned char*) realloc(_data,compressedDataSize); - - _uncompressedDataSize = outputSize; - _compressedDataSize = compressedDataSize; - + uLong compressedDataSize = compressBound (outputSize); + _data = (unsigned char*) malloc (compressedDataSize); + if (Z_OK != + ::compress ( + _data, &compressedDataSize, reinterpret_cast (serial.data ()), outputSize)) + { + throw IEX_NAMESPACE::InputExc ("ID manifest compression failed"); + } + + // now call realloc to reallocate the buffer to a smaller size - this might free up memory + _data = (unsigned char*) realloc (_data, compressedDataSize); + + _uncompressedDataSize = outputSize; + _compressedDataSize = compressedDataSize; } IDManifest::ChannelGroupManifest::ChannelGroupManifest() : _lifeTime(IDManifest::LIFETIME_STABLE) , _hashScheme(IDManifest::UNKNOWN) , _encodingScheme(IDManifest::UNKNOWN) , _insertingEntry(false) diff --git a/src/lib/OpenEXR/ImfInputFile.cpp b/src/lib/OpenEXR/ImfInputFile.cpp index c520c14e9f..848a5e25c3 100644 --- a/src/lib/OpenEXR/ImfInputFile.cpp +++ b/src/lib/OpenEXR/ImfInputFile.cpp @@ -186,7 +186,7 @@ bufferedReadPixels (InputFile::Data* ifd, int scanLine1, int scanLine2) // // bufferedReadPixels reads each row of tiles that intersect the // scan-line range (scanLine1 to scanLine2). The previous row of - // tiles is cached in order to prevent redundent tile reads when + // tiles is cached in order to prevent redundant tile reads when // accessing scanlines sequentially. // @@ -352,12 +352,10 @@ bufferedReadPixels (InputFile::Data* ifd, int scanLine1, int scanLine2) switch ( toSlice.type) { - case UINT: - { - unsigned int fill = toSlice.fillValue; - for (int x = xStart; - x <= levelRange.max.x; - x += toSlice.xSampling) + case UINT: { + unsigned int fill = static_cast(toSlice.fillValue); + for (int x = xStart; x <= levelRange.max.x; + x += toSlice.xSampling) { * reinterpret_cast(toPtr) = fill; toPtr += toSlice.xStride; diff --git a/src/lib/OpenEXR/ImfKeyCode.h b/src/lib/OpenEXR/ImfKeyCode.h index 4916797afd..45c92385ed 100644 --- a/src/lib/OpenEXR/ImfKeyCode.h +++ b/src/lib/OpenEXR/ImfKeyCode.h @@ -11,7 +11,7 @@ // class KeyCode // // A KeyCode object uniquely identifies a motion picture film frame. -// The following fields specifiy film manufacturer, film type, film +// The following fields specify film manufacturer, film type, film // roll and the frame's position within the roll: // // filmMfcCode film manufacturer code diff --git a/src/lib/OpenEXR/ImfMisc.cpp b/src/lib/OpenEXR/ImfMisc.cpp index 844890910f..ace12be61f 100644 --- a/src/lib/OpenEXR/ImfMisc.cpp +++ b/src/lib/OpenEXR/ImfMisc.cpp @@ -24,6 +24,9 @@ #include #include "ImfNamespace.h" +#include +#include + OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_ENTER using IMATH_NAMESPACE::Box2i; @@ -1893,5 +1896,11 @@ getChunkOffsetTableSize(const Header& header) } +std::wstring +WidenFilename (const char* filename) +{ + std::wstring_convert, wchar_t> converter; + return converter.from_bytes (filename); +} OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_EXIT diff --git a/src/lib/OpenEXR/ImfMisc.h b/src/lib/OpenEXR/ImfMisc.h index 58274a23cc..558785646b 100644 --- a/src/lib/OpenEXR/ImfMisc.h +++ b/src/lib/OpenEXR/ImfMisc.h @@ -444,6 +444,14 @@ IMF_EXPORT int getChunkOffsetTableSize(const Header& header); +// +// Convert a filename to a wide string. This is useful for working with +// filenames on Windows. +// + +IMF_EXPORT +std::wstring WidenFilename (const char* filename); + OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT diff --git a/src/lib/OpenEXR/ImfMultiPartInputFile.cpp b/src/lib/OpenEXR/ImfMultiPartInputFile.cpp index 513398a5de..daee4c16c8 100644 --- a/src/lib/OpenEXR/ImfMultiPartInputFile.cpp +++ b/src/lib/OpenEXR/ImfMultiPartInputFile.cpp @@ -194,7 +194,7 @@ MultiPartInputFile::getPart(int partNumber) const Header & MultiPartInputFile::header(int n) const { - if(n<0 || n >= _data->_headers.size()) + if (n < 0 || static_cast(n) >= _data->_headers.size ()) { THROW ( IEX_NAMESPACE::ArgExc , " MultiPartInputFile::header called with invalid part " << n << " on file with " << _data->_headers.size() << " parts"); } @@ -830,7 +830,7 @@ bool MultiPartInputFile::partComplete(int part) const { - if(part<0 || part >= _data->_headers.size()) + if (part < 0 || static_cast(part) >= _data->_headers.size ()) { THROW ( IEX_NAMESPACE::ArgExc , "MultiPartInputFile::partComplete called with invalid part " << part << " on file with " << _data->_headers.size() << " parts"); } diff --git a/src/lib/OpenEXR/ImfOptimizedPixelReading.h b/src/lib/OpenEXR/ImfOptimizedPixelReading.h index d433dc1186..9fc1c91722 100644 --- a/src/lib/OpenEXR/ImfOptimizedPixelReading.h +++ b/src/lib/OpenEXR/ImfOptimizedPixelReading.h @@ -35,7 +35,7 @@ class OptimizationMode //------------------------------------------------------------------------ -// Test for SSE pointer alignemnt +// Test for SSE pointer alignment //------------------------------------------------------------------------ EXR_FORCEINLINE bool diff --git a/src/lib/OpenEXR/ImfOutputFile.cpp b/src/lib/OpenEXR/ImfOutputFile.cpp index 33cccce1cf..e607a080f3 100644 --- a/src/lib/OpenEXR/ImfOutputFile.cpp +++ b/src/lib/OpenEXR/ImfOutputFile.cpp @@ -1176,7 +1176,7 @@ OutputFile::writePixels (int numScanLines) } // - // Exeption handling: + // Exception handling: // // LineBufferTask::execute() may have encountered exceptions, but // those exceptions occurred in another thread, not in the thread diff --git a/src/lib/OpenEXR/ImfPizCompressor.cpp b/src/lib/OpenEXR/ImfPizCompressor.cpp index 0a1288d857..645840658d 100644 --- a/src/lib/OpenEXR/ImfPizCompressor.cpp +++ b/src/lib/OpenEXR/ImfPizCompressor.cpp @@ -192,7 +192,7 @@ PizCompressor::PizCompressor // // We can support uncompressed data in the machine's native format // if all image channels are of type HALF, and if the Xdr and the - // native represenations of a half have the same size. + // native representations of a half have the same size. // if (onlyHalfChannels && (sizeof (half) == pixelTypeSize (HALF))) diff --git a/src/lib/OpenEXR/ImfPxr24Compressor.cpp b/src/lib/OpenEXR/ImfPxr24Compressor.cpp index 526af50e55..da9c35f05e 100644 --- a/src/lib/OpenEXR/ImfPxr24Compressor.cpp +++ b/src/lib/OpenEXR/ImfPxr24Compressor.cpp @@ -369,12 +369,14 @@ Pxr24Compressor::compress (const char *inPtr, } } - uLongf outSize = int (ceil ((tmpBufferEnd - _tmpBuffer) * 1.01)) + 100; - - if (Z_OK != ::compress ((Bytef *) _outBuffer, - &outSize, - (const Bytef *) _tmpBuffer, - tmpBufferEnd - _tmpBuffer)) + uLong inBufferSize = static_cast (tmpBufferEnd - _tmpBuffer); + uLong outSize = compressBound (inBufferSize); + + if (Z_OK != ::compress ( + reinterpret_cast (_outBuffer), + &outSize, + reinterpret_cast (_tmpBuffer), + inBufferSize)) { throw IEX_NAMESPACE::BaseExc ("Data compression (zlib) failed."); } @@ -396,12 +398,14 @@ Pxr24Compressor::uncompress (const char *inPtr, return 0; } - uLongf tmpSize = _maxScanLineSize * _numScanLines; + uLong tmpSize = static_cast (_maxScanLineSize * _numScanLines); - if (Z_OK != ::uncompress ((Bytef *)_tmpBuffer, - &tmpSize, - (const Bytef *) inPtr, - inSize)) + if (Z_OK != + ::uncompress ( + reinterpret_cast (_tmpBuffer), + &tmpSize, + reinterpret_cast (inPtr), + inSize)) { throw IEX_NAMESPACE::InputExc ("Data decompression (zlib) failed."); } @@ -440,8 +444,8 @@ Pxr24Compressor::uncompress (const char *inPtr, ptr[3] = ptr[2] + n; tmpBufferEnd = ptr[3] + n; - if ( (uLongf)(tmpBufferEnd - _tmpBuffer) > tmpSize) - notEnoughData(); + if (static_cast (tmpBufferEnd - _tmpBuffer) > tmpSize) + notEnoughData (); for (int j = 0; j < n; ++j) { @@ -466,8 +470,8 @@ Pxr24Compressor::uncompress (const char *inPtr, ptr[1] = ptr[0] + n; tmpBufferEnd = ptr[1] + n; - if ( (uLongf)(tmpBufferEnd - _tmpBuffer) > tmpSize) - notEnoughData(); + if (static_cast (tmpBufferEnd - _tmpBuffer) > tmpSize) + notEnoughData (); for (int j = 0; j < n; ++j) { @@ -490,8 +494,8 @@ Pxr24Compressor::uncompress (const char *inPtr, ptr[2] = ptr[1] + n; tmpBufferEnd = ptr[2] + n; - if ( (uLongf) (tmpBufferEnd - _tmpBuffer) > tmpSize) - notEnoughData(); + if (static_cast (tmpBufferEnd - _tmpBuffer) > tmpSize) + notEnoughData (); for (int j = 0; j < n; ++j) { @@ -515,8 +519,7 @@ Pxr24Compressor::uncompress (const char *inPtr, } } - if ((uLongf) (tmpBufferEnd - _tmpBuffer) < tmpSize) - tooMuchData(); + if (static_cast (tmpBufferEnd - _tmpBuffer) < tmpSize) tooMuchData (); outPtr = _outBuffer; return writePtr - _outBuffer; diff --git a/src/lib/OpenEXR/ImfRle.cpp b/src/lib/OpenEXR/ImfRle.cpp index 5232cd97fd..e2554d0e9f 100644 --- a/src/lib/OpenEXR/ImfRle.cpp +++ b/src/lib/OpenEXR/ImfRle.cpp @@ -38,21 +38,21 @@ rleCompress (int inLength, const char in[], signed char out[]) ++runEnd; } - if (runEnd - runStart >= MIN_RUN_LENGTH) - { - // - // Compressable run - // - - *outWrite++ = (runEnd - runStart) - 1; - *outWrite++ = *(signed char *) runStart; - runStart = runEnd; - } - else - { - // - // Uncompressable run - // + if (runEnd - runStart >= MIN_RUN_LENGTH) + { + // + // Compressible run + // + + *outWrite++ = (runEnd - runStart) - 1; + *outWrite++ = *(signed char*) runStart; + runStart = runEnd; + } + else + { + // + // Incompressible run + // while (runEnd < inEnd && ((runEnd + 1 >= inEnd || diff --git a/src/lib/OpenEXR/ImfScanLineInputFile.cpp b/src/lib/OpenEXR/ImfScanLineInputFile.cpp index 31600e977e..1369a63524 100644 --- a/src/lib/OpenEXR/ImfScanLineInputFile.cpp +++ b/src/lib/OpenEXR/ImfScanLineInputFile.cpp @@ -886,7 +886,7 @@ LineBufferTaskIIF::execute() // // Set the readPtr to read at the start of uncompressedData - // but with an offet based on calculated array. + // but with an offset based on calculated array. // _ifd->offsetInLineBuffer contains offsets based on which // line we are currently processing. // Stride will be taken into consideration later. @@ -1102,8 +1102,10 @@ void ScanLineInputFile::initialize(const Header& header) _data->linesInBuffer = numLinesInBuffer (comp); - int lineOffsetSize = (dataWindow.max.y - dataWindow.min.y + - _data->linesInBuffer) / _data->linesInBuffer; + uint64_t lineOffsetSize = + (static_cast(dataWindow.max.y) - static_cast(dataWindow.min.y) + static_cast(_data->linesInBuffer)) / + static_cast(_data->linesInBuffer); + // // avoid allocating excessive memory due to large lineOffsets and bytesPerLine table sizes. @@ -1309,9 +1311,8 @@ ScanLineInputFile::version () const namespace { - - -// returns the optimization state for the given arrangement of frame bufers + +// returns the optimization state for the given arrangement of frame buffers // this assumes: // both the file and framebuffer are half float data // both the file and framebuffer have xSampling and ySampling=1 @@ -1702,7 +1703,7 @@ ScanLineInputFile::readPixels (int scanLine1, int scanLine2) } // - // Exeption handling: + // Exception handling: // // LineBufferTask::execute() may have encountered exceptions, but // those exceptions occurred in another thread, not in the thread diff --git a/src/lib/OpenEXR/ImfSimd.h b/src/lib/OpenEXR/ImfSimd.h index 9bb4e11ae5..29c899c8b7 100644 --- a/src/lib/OpenEXR/ImfSimd.h +++ b/src/lib/OpenEXR/ImfSimd.h @@ -14,12 +14,12 @@ // GCC and Visual Studio SSE2 compiler flags -#if defined __SSE2__ || (_MSC_VER >= 1300 && (_M_IX86 || _M_X64)) - #define IMF_HAVE_SSE2 1 +#if defined __SSE2__ || (_MSC_VER && (_M_IX86 || _M_X64)) +# define IMF_HAVE_SSE2 1 #endif -#if defined __SSE4_1__ - #define IMF_HAVE_SSE4_1 1 +#if defined __SSE4_1__ || (_MSC_VER && (_M_IX86 || _M_X64)) +# define IMF_HAVE_SSE4_1 1 #endif // Compiler flags on e2k (MCST Elbrus 2000) architecture @@ -43,8 +43,11 @@ #define IMF_HAVE_F16C 1 #endif -extern "C" -{ +#if defined(__ARM_NEON) +# define IMF_HAVE_NEON +#endif + +extern "C" { #ifdef IMF_HAVE_SSE2 #include #include @@ -53,6 +56,11 @@ extern "C" #ifdef IMF_HAVE_SSE4_1 #include #endif + +#ifdef IMF_HAVE_NEON +# include +#endif + } #endif diff --git a/src/lib/OpenEXR/ImfStdIO.cpp b/src/lib/OpenEXR/ImfStdIO.cpp index 282a78990f..0c1784ebe0 100644 --- a/src/lib/OpenEXR/ImfStdIO.cpp +++ b/src/lib/OpenEXR/ImfStdIO.cpp @@ -10,6 +10,8 @@ // //----------------------------------------------------------------------------- +#include "Iex.h" +#include #include #include "Iex.h" #include @@ -34,22 +36,10 @@ OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_ENTER namespace { #ifdef _WIN32 -wstring WidenFilename (const char *filename) -{ - wstring ret; - int fnlen = static_cast( strlen(filename) ); - int len = MultiByteToWideChar(CP_UTF8, 0, filename, fnlen, NULL, 0 ); - if (len > 0) - { - ret.resize(len); - MultiByteToWideChar(CP_UTF8, 0, filename, fnlen, &ret[0], len); - } - return ret; -} - -# if defined(__GLIBCXX__) && !(defined(_GLIBCXX_HAVE_WFOPEN) && defined(_GLIBCXX_USE_WCHAR_T)) -# define USE_CUSTOM_WIDE_OPEN 1 -# endif +# if defined(__GLIBCXX__) && \ + !(defined(_GLIBCXX_HAVE_WFOPEN) && defined(_GLIBCXX_USE_WCHAR_T)) +# define USE_CUSTOM_WIDE_OPEN 1 +# endif # ifdef USE_CUSTOM_WIDE_OPEN template diff --git a/src/lib/OpenEXR/ImfSystemSpecific.cpp b/src/lib/OpenEXR/ImfSystemSpecific.cpp index 63a9e705b6..5d27326520 100644 --- a/src/lib/OpenEXR/ImfSystemSpecific.cpp +++ b/src/lib/OpenEXR/ImfSystemSpecific.cpp @@ -8,6 +8,9 @@ #include "ImfNamespace.h" #include "OpenEXRConfig.h" #include "OpenEXRConfigInternal.h" +#if defined(_MSC_VER) +#include +#endif OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_ENTER @@ -24,6 +27,20 @@ namespace { : /* Clobber */); } +#elif defined(_MSC_VER) && ( defined(_M_IX86) || ( defined(_M_AMD64) && !defined(_M_ARM64EC) ) ) + +// Helper functions for MSVC +void +cpuid (int n, int& eax, int& ebx, int& ecx, int& edx) +{ + int cpuInfo[4] = { -1 }; + __cpuid (cpuInfo, n); + eax = cpuInfo[0]; + ebx = cpuInfo[1]; + ecx = cpuInfo[2]; + edx = cpuInfo[3]; +} + #else // IMF_HAVE_SSE2 && __GNUC__ && !__e2k__ // Helper functions for generic compiler - all disabled diff --git a/src/lib/OpenEXR/ImfTileOffsets.cpp b/src/lib/OpenEXR/ImfTileOffsets.cpp index 52b2fde9f6..0120e3bc44 100644 --- a/src/lib/OpenEXR/ImfTileOffsets.cpp +++ b/src/lib/OpenEXR/ImfTileOffsets.cpp @@ -455,7 +455,7 @@ TileOffsets::operator () (int dx, int dy, int lx, int ly) // // Looks up the value of the tile with tile coordinate (dx, dy) // and level number (lx, ly) in the _offsets array, and returns - // the cooresponding offset. + // the corresponding offset. // switch (_mode) @@ -492,7 +492,7 @@ TileOffsets::operator () (int dx, int dy, int lx, int ly) const // // Looks up the value of the tile with tile coordinate (dx, dy) // and level number (lx, ly) in the _offsets array, and returns - // the cooresponding offset. + // the corresponding offset. // switch (_mode) diff --git a/src/lib/OpenEXR/ImfTileOffsets.h b/src/lib/OpenEXR/ImfTileOffsets.h index 9e5ccfab51..b0ae543e21 100644 --- a/src/lib/OpenEXR/ImfTileOffsets.h +++ b/src/lib/OpenEXR/ImfTileOffsets.h @@ -57,7 +57,7 @@ class IMF_EXPORT_TYPE TileOffsets //----------------------------------------------------------- // populate 'list' with tiles coordinates in the order they appear // in the offset table (assumes full table! - // each array myst be at leat totalTiles long + // each array myst be at least totalTiles long //----------------------------------------------------------- IMF_EXPORT void getTileOrder(int dx_table[], int dy_table[], int lx_table[], int ly_table[]) const; diff --git a/src/lib/OpenEXR/ImfTiledInputFile.cpp b/src/lib/OpenEXR/ImfTiledInputFile.cpp index 49ad69be68..3113319cbf 100644 --- a/src/lib/OpenEXR/ImfTiledInputFile.cpp +++ b/src/lib/OpenEXR/ImfTiledInputFile.cpp @@ -1330,20 +1330,20 @@ TiledInputFile::readTiles (int dx1, int dx2, int dy1, int dy2, int lx, int ly) // } - // - // Exeption handling: - // - // TileBufferTask::execute() may have encountered exceptions, but - // those exceptions occurred in another thread, not in the thread - // that is executing this call to TiledInputFile::readTiles(). - // TileBufferTask::execute() has caught all exceptions and stored - // the exceptions' what() strings in the tile buffers. - // Now we check if any tile buffer contains a stored exception; if - // this is the case then we re-throw the exception in this thread. - // (It is possible that multiple tile buffers contain stored - // exceptions. We re-throw the first exception we find and - // ignore all others.) - // + // + // Exception handling: + // + // TileBufferTask::execute() may have encountered exceptions, but + // those exceptions occurred in another thread, not in the thread + // that is executing this call to TiledInputFile::readTiles(). + // TileBufferTask::execute() has caught all exceptions and stored + // the exceptions' what() strings in the tile buffers. + // Now we check if any tile buffer contains a stored exception; if + // this is the case then we re-throw the exception in this thread. + // (It is possible that multiple tile buffers contain stored + // exceptions. We re-throw the first exception we find and + // ignore all others.) + // const string *exception = 0; diff --git a/src/lib/OpenEXR/ImfTiledInputFile.h b/src/lib/OpenEXR/ImfTiledInputFile.h index 146a179691..d930d5de6f 100644 --- a/src/lib/OpenEXR/ImfTiledInputFile.h +++ b/src/lib/OpenEXR/ImfTiledInputFile.h @@ -315,7 +315,7 @@ class IMF_EXPORT_TYPE TiledInputFile : public GenericInputFile // dy must lie in the interval [0, numYTiles(ly)-1] // // lx must lie in the interval [0, numXLevels()-1] - // ly must lie in the inverval [0, numYLevels()-1] + // ly must lie in the interval [0, numYLevels()-1] // // readTile(dx, dy, level) is a convenience function used // for ONE_LEVEL and MIPMAP_LEVELS files. It calls diff --git a/src/lib/OpenEXR/ImfTiledMisc.h b/src/lib/OpenEXR/ImfTiledMisc.h index 9059ae2c70..0dad1dd4cd 100644 --- a/src/lib/OpenEXR/ImfTiledMisc.h +++ b/src/lib/OpenEXR/ImfTiledMisc.h @@ -19,6 +19,7 @@ #include #include +#include OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER diff --git a/src/lib/OpenEXR/ImfTiledOutputFile.cpp b/src/lib/OpenEXR/ImfTiledOutputFile.cpp index b2a1971400..457e268224 100644 --- a/src/lib/OpenEXR/ImfTiledOutputFile.cpp +++ b/src/lib/OpenEXR/ImfTiledOutputFile.cpp @@ -1352,20 +1352,20 @@ TiledOutputFile::writeTiles (int dx1, int dx2, int dy1, int dy2, // } - // - // Exeption handling: - // - // TileBufferTask::execute() may have encountered exceptions, but - // those exceptions occurred in another thread, not in the thread - // that is executing this call to TiledOutputFile::writeTiles(). - // TileBufferTask::execute() has caught all exceptions and stored - // the exceptions' what() strings in the tile buffers. - // Now we check if any tile buffer contains a stored exception; if - // this is the case then we re-throw the exception in this thread. - // (It is possible that multiple tile buffers contain stored - // exceptions. We re-throw the first exception we find and - // ignore all others.) - // + // + // Exception handling: + // + // TileBufferTask::execute() may have encountered exceptions, but + // those exceptions occurred in another thread, not in the thread + // that is executing this call to TiledOutputFile::writeTiles(). + // TileBufferTask::execute() has caught all exceptions and stored + // the exceptions' what() strings in the tile buffers. + // Now we check if any tile buffer contains a stored exception; if + // this is the case then we re-throw the exception in this thread. + // (It is possible that multiple tile buffers contain stored + // exceptions. We re-throw the first exception we find and + // ignore all others.) + // const string *exception = 0; diff --git a/src/lib/OpenEXR/ImfTiledOutputFile.h b/src/lib/OpenEXR/ImfTiledOutputFile.h index 8ba1b9de1f..e1ece3b89c 100644 --- a/src/lib/OpenEXR/ImfTiledOutputFile.h +++ b/src/lib/OpenEXR/ImfTiledOutputFile.h @@ -311,7 +311,7 @@ class IMF_EXPORT_TYPE TiledOutputFile : public GenericOutputFile // dy must lie in the interval [0, numYTiles(ly) - 1] // // lx must lie in the interval [0, numXLevels() - 1] - // ly must lie in the inverval [0, numYLevels() - 1] + // ly must lie in the interval [0, numYLevels() - 1] // // writeTile(dx, dy, level) is a convenience function // used for ONE_LEVEL and MIPMAP_LEVEL files. It calls diff --git a/src/lib/OpenEXR/ImfTiledRgbaFile.h b/src/lib/OpenEXR/ImfTiledRgbaFile.h index 93880929ec..ca3f91392f 100644 --- a/src/lib/OpenEXR/ImfTiledRgbaFile.h +++ b/src/lib/OpenEXR/ImfTiledRgbaFile.h @@ -226,7 +226,7 @@ class IMF_EXPORT_TYPE TiledRgbaOutputFile // dy must lie in the interval [0, numYTiles(ly)-1] // // lx must lie in the interval [0, numXLevels()-1] - // ly must lie in the inverval [0, numYLevels()-1] + // ly must lie in the interval [0, numYLevels()-1] // // writeTile(dx, dy, level) is a convenience function // used for ONE_LEVEL and MIPMAP_LEVEL files. It calls @@ -476,7 +476,7 @@ class IMF_EXPORT_TYPE TiledRgbaInputFile // dy must lie in the interval [0, numYTiles(ly)-1] // // lx must lie in the interval [0, numXLevels()-1] - // ly must lie in the inverval [0, numYLevels()-1] + // ly must lie in the interval [0, numYLevels()-1] // // readTile(dx, dy, level) is a convenience function used // for ONE_LEVEL and MIPMAP_LEVELS files. It calls diff --git a/src/lib/OpenEXR/ImfWav.cpp b/src/lib/OpenEXR/ImfWav.cpp index 5e278602c9..019eff54a8 100644 --- a/src/lib/OpenEXR/ImfWav.cpp +++ b/src/lib/OpenEXR/ImfWav.cpp @@ -126,7 +126,7 @@ wav2Encode int p2 = 2; // == 1 << (level+1) // - // Hierachical loop on smaller dimension n + // Hierarchical loop on smaller dimension n // while (p2 <= n) diff --git a/src/lib/OpenEXR/ImfZip.cpp b/src/lib/OpenEXR/ImfZip.cpp index 7cffb7fc9f..98477ba594 100644 --- a/src/lib/OpenEXR/ImfZip.cpp +++ b/src/lib/OpenEXR/ImfZip.cpp @@ -7,6 +7,7 @@ #include "ImfCheckedArithmetic.h" #include "ImfNamespace.h" #include "ImfSimd.h" +#include "ImfSystemSpecific.h" #include "Iex.h" #include @@ -98,10 +99,15 @@ Zip::compress(const char *raw, int rawSize, char *compressed) // Compress the data using zlib // - uLongf outSize = int(ceil(rawSize * 1.01)) + 100; + uLong inSize = static_cast (rawSize); + uLong outSize = compressBound (inSize); - if (Z_OK != ::compress2 ((Bytef *)compressed, &outSize, - (const Bytef *) _tmpBuffer, rawSize, _zipLevel)) + if (Z_OK != ::compress2 ( + reinterpret_cast (compressed), + &outSize, + reinterpret_cast (_tmpBuffer), + inSize, + _zipLevel)) { throw IEX_NAMESPACE::BaseExc ("Data compression (zlib) failed."); } @@ -109,10 +115,13 @@ Zip::compress(const char *raw, int rawSize, char *compressed) return outSize; } +namespace +{ + #ifdef IMF_HAVE_SSE4_1 -static void -reconstruct_sse41(char *buf, size_t outSize) +void +reconstruct_sse41 (char* buf, size_t outSize) { static const size_t bytesPerChunk = sizeof(__m128i); const size_t vOutSize = outSize / bytesPerChunk; @@ -154,10 +163,60 @@ reconstruct_sse41(char *buf, size_t outSize) } } -#else +#endif -static void -reconstruct_scalar(char *buf, size_t outSize) +#ifdef IMF_HAVE_NEON + +void +reconstruct_neon (char* buf, size_t outSize) +{ + static const size_t bytesPerChunk = sizeof (uint8x16_t); + const size_t vOutSize = outSize / bytesPerChunk; + + const uint8x16_t c = vdupq_n_u8 (-128); + const uint8x16_t shuffleMask = vdupq_n_u8 (15); + + // The first element doesn't have its high bit flipped during compression, + // so it must not be flipped here. To make the SIMD loop nice and + // uniform, we pre-flip the bit so that the loop will unflip it again. + buf[0] += -128; + + unsigned char* vBuf = reinterpret_cast (buf); + uint8x16_t vZero = vdupq_n_u8 (0); + uint8x16_t vPrev = vdupq_n_u8 (0); + for (size_t i = 0; i < vOutSize; ++i) + { + uint8x16_t d = vaddq_u8 (vld1q_u8 (vBuf), c); + + // Compute the prefix sum of elements. + d = vaddq_u8 (d, vextq_u8 (vZero, d, 16 - 1)); + d = vaddq_u8 (d, vextq_u8 (vZero, d, 16 - 2)); + d = vaddq_u8 (d, vextq_u8 (vZero, d, 16 - 4)); + d = vaddq_u8 (d, vextq_u8 (vZero, d, 16 - 8)); + d = vaddq_u8 (d, vPrev); + + vst1q_u8 (vBuf, d); + vBuf += sizeof (uint8x16_t); + + // Broadcast the high byte in our result to all lanes of the prev + // value for the next iteration. + vPrev = vqtbl1q_u8 (d, shuffleMask); + } + + unsigned char prev = vgetq_lane_u8 (vPrev, 15); + for (size_t i = vOutSize * bytesPerChunk; i < outSize; ++i) + { + unsigned char d = prev + buf[i] - 128; + buf[i] = d; + prev = d; + } +} + +#endif + + +void +reconstruct_scalar (char* buf, size_t outSize) { unsigned char *t = (unsigned char *) buf + 1; unsigned char *stop = (unsigned char *) buf + outSize; @@ -170,13 +229,10 @@ reconstruct_scalar(char *buf, size_t outSize) } } -#endif - - #ifdef IMF_HAVE_SSE2 -static void -interleave_sse2(const char *source, size_t outSize, char *out) +void +interleave_sse2 (const char* source, size_t outSize, char* out) { static const size_t bytesPerChunk = 2*sizeof(__m128i); @@ -207,10 +263,48 @@ interleave_sse2(const char *source, size_t outSize, char *out) } } -#else +#endif + +#ifdef IMF_HAVE_NEON + +void +interleave_neon (const char* source, size_t outSize, char* out) +{ + static const size_t bytesPerChunk = 2 * sizeof (uint8x16_t); + + const size_t vOutSize = outSize / bytesPerChunk; + + const unsigned char* v1 = reinterpret_cast (source); + const unsigned char* v2 = + reinterpret_cast (source + (outSize + 1) / 2); + unsigned char* vOut = reinterpret_cast (out); + + for (size_t i = 0; i < vOutSize; ++i) + { + uint8x16_t a = vld1q_u8 (v1); v1 += sizeof (uint8x16_t); + uint8x16_t b = vld1q_u8 (v2); v2 += sizeof (uint8x16_t); + + uint8x16_t lo = vzip1q_u8 (a, b); + uint8x16_t hi = vzip2q_u8 (a, b); + + vst1q_u8 (vOut, lo); vOut += sizeof (uint8x16_t); + vst1q_u8 (vOut, hi); vOut += sizeof (uint8x16_t); + } + + const char* t1 = reinterpret_cast (v1); + const char* t2 = reinterpret_cast (v2); + char* sOut = reinterpret_cast (vOut); + + for (size_t i = vOutSize * bytesPerChunk; i < outSize; ++i) + { + *(sOut++) = (i % 2 == 0) ? *(t1++) : *(t2++); + } +} + +#endif -static void -interleave_scalar(const char *source, size_t outSize, char *out) +void +interleave_scalar (const char* source, size_t outSize, char* out) { const char *t1 = source; const char *t2 = source + (outSize + 1) / 2; @@ -231,7 +325,10 @@ interleave_scalar(const char *source, size_t outSize, char *out) } } -#endif +auto reconstruct = reconstruct_scalar; +auto interleave = interleave_scalar; + +} // namespace int Zip::uncompress(const char *compressed, int compressedSize, @@ -241,10 +338,14 @@ Zip::uncompress(const char *compressed, int compressedSize, // Decompress the data using zlib // - uLongf outSize = _maxRawSize; + uLong outSize = static_cast (_maxRawSize); + uLong inSize = static_cast (compressedSize); - if (Z_OK != ::uncompress ((Bytef *)_tmpBuffer, &outSize, - (const Bytef *) compressed, compressedSize)) + if (Z_OK != ::uncompress ( + reinterpret_cast (_tmpBuffer), + &outSize, + reinterpret_cast (compressed), + inSize)) { throw IEX_NAMESPACE::InputExc ("Data decompression (zlib) failed."); } @@ -257,22 +358,39 @@ Zip::uncompress(const char *compressed, int compressedSize, // // Predictor. // -#ifdef IMF_HAVE_SSE4_1 - reconstruct_sse41(_tmpBuffer, outSize); -#else - reconstruct_scalar(_tmpBuffer, outSize); -#endif + reconstruct (_tmpBuffer, outSize); // // Reorder the pixel data. // + interleave (_tmpBuffer, outSize, raw); + + return outSize; +} + +void +Zip::initializeFuncs () +{ + CpuId cpuId; + +#ifdef IMF_HAVE_SSE4_1 + if (cpuId.sse4_1) + { + reconstruct = reconstruct_sse41; + } +#endif + #ifdef IMF_HAVE_SSE2 - interleave_sse2(_tmpBuffer, outSize, raw); -#else - interleave_scalar(_tmpBuffer, outSize, raw); + if (cpuId.sse2) + { + interleave = interleave_sse2; + } #endif - return outSize; +#ifdef IMF_HAVE_NEON + reconstruct = reconstruct_neon; + interleave = interleave_neon; +#endif } OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_EXIT diff --git a/src/lib/OpenEXR/ImfZip.h b/src/lib/OpenEXR/ImfZip.h index 2970698e17..db5382c73d 100644 --- a/src/lib/OpenEXR/ImfZip.h +++ b/src/lib/OpenEXR/ImfZip.h @@ -41,10 +41,12 @@ class Zip int uncompress(const char *compressed, int compressedSize, char *raw); - private: - size_t _maxRawSize; - char *_tmpBuffer; - int _zipLevel; + static void initializeFuncs (); + +private: + size_t _maxRawSize; + char* _tmpBuffer; + int _zipLevel; }; OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT diff --git a/src/lib/OpenEXR/b44ExpLogTable.h b/src/lib/OpenEXR/b44ExpLogTable.h index c13d16cc9d..f2c0b208a5 100644 --- a/src/lib/OpenEXR/b44ExpLogTable.h +++ b/src/lib/OpenEXR/b44ExpLogTable.h @@ -1,3 +1,8 @@ +// +// SPDX-License-Identifier: BSD-3-Clause +// Copyright (c) DreamWorks Animation LLC and Contributors of the OpenEXR Project +// + // // This is an automatically generated file. // Do not edit. diff --git a/src/lib/OpenEXR/dwaLookups.cpp b/src/lib/OpenEXR/dwaLookups.cpp index bd8eb69c74..6a90afc3f1 100644 --- a/src/lib/OpenEXR/dwaLookups.cpp +++ b/src/lib/OpenEXR/dwaLookups.cpp @@ -451,7 +451,7 @@ cpuCount() // // This gives us num_bits(input)-1 values per input. If we alloc // space for everything, that's like a 2MB table. We can do better -// by compressing all the values to be contigious and using offset +// by compressing all the values to be contiguous and using offset // pointers. // // After we've found the candidates with fewer bits set, sort them diff --git a/src/lib/OpenEXR/dwaLookups.h b/src/lib/OpenEXR/dwaLookups.h index 98c8d68372..093246daa7 100644 --- a/src/lib/OpenEXR/dwaLookups.h +++ b/src/lib/OpenEXR/dwaLookups.h @@ -1,3 +1,7 @@ +// +// SPDX-License-Identifier: BSD-3-Clause +// Copyright (c) DreamWorks Animation LLC and Contributors of the OpenEXR Project +// const unsigned short dwaCompressorNoOp[] = { diff --git a/src/lib/OpenEXRCore/CMakeLists.txt b/src/lib/OpenEXRCore/CMakeLists.txt index a3ab8ac89c..a590c6b8fb 100644 --- a/src/lib/OpenEXRCore/CMakeLists.txt +++ b/src/lib/OpenEXRCore/CMakeLists.txt @@ -17,6 +17,7 @@ openexr_define_library(OpenEXRCore internal_decompress.h internal_file.h internal_float_vector.h + internal_huf.h internal_memory.h internal_opaque.h internal_posix_file_impl.h @@ -25,6 +26,7 @@ openexr_define_library(OpenEXRCore internal_string.h internal_string_vector.h internal_structs.h + internal_util.h internal_xdr.h internal_rle.c diff --git a/src/lib/OpenEXRCore/chunk.c b/src/lib/OpenEXRCore/chunk.c index 8014235c04..8c298af8a6 100644 --- a/src/lib/OpenEXRCore/chunk.c +++ b/src/lib/OpenEXRCore/chunk.c @@ -7,6 +7,7 @@ #include "internal_coding.h" #include "internal_structs.h" +#include "internal_util.h" #include "internal_xdr.h" #include @@ -347,7 +348,7 @@ extract_chunk_leader ( return ctxt->print_error ( ctxt, EXR_ERR_BAD_CHUNK_LEADER, - "Invalid chunk size reconstructing chunk table: found out of range %ld", + "Invalid chunk size reconstructing chunk table: found out of range %"PRId64, leaderdata->deep_data[1]); } leaderdata->packed_size = leaderdata->deep_packed_size; @@ -408,8 +409,21 @@ read_and_validate_chunk_leader ( if (part->storage_mode == EXR_STORAGE_SCANLINE || part->storage_mode == EXR_STORAGE_DEEP_SCANLINE) { - *indexio = (leader.scanline_y - part->data_window.min.y) / - part->lines_per_chunk; + int64_t chunk = (int64_t) leader.scanline_y; + chunk -= (int64_t) part->data_window.min.y; + chunk /= part->lines_per_chunk; + if (chunk < 0 || chunk > INT32_MAX) + return ctxt->print_error ( + ctxt, + EXR_ERR_BAD_CHUNK_LEADER, + "Invalid chunk index: %" PRId64 + " reading scanline %d (datawindow min %d) with lines per chunk %d", + chunk, + leader.scanline_y, + part->data_window.min.y, + part->lines_per_chunk); + + *indexio = (int) chunk; } else { @@ -527,10 +541,10 @@ extract_chunk_table ( EXR_CONST_CAST (atomic_uintptr_t*, &(part->chunk_table))); if (ctable == NULL) { - int64_t nread = 0; - uintptr_t eptr = 0, nptr = 0; - int complete = 1; - uint64_t maxoff = ((uint64_t) -1); + int64_t nread = 0; + uintptr_t eptr = 0, nptr = 0; + int complete = 1; + uint64_t maxoff = ((uint64_t) -1); exr_result_t rv; if (part->chunk_count <= 0) @@ -590,10 +604,7 @@ extract_chunk_table ( } } } - else - { - priv_to_native64 (ctable, part->chunk_count); - } + else { priv_to_native64 (ctable, part->chunk_count); } nptr = (uintptr_t) ctable; // see if we win or not @@ -670,21 +681,11 @@ compute_chunk_unpack_size ( { const exr_attr_chlist_entry_t* curc = (chanlist->entries + c); uint64_t chansz = ((curc->pixel_type == EXR_PIXEL_HALF) ? 2 : 4); - chansz *= ((uint64_t) width); + + chansz *= (uint64_t) width; if (curc->x_sampling > 1) chansz /= ((uint64_t) curc->x_sampling); - chansz *= ((uint64_t) height); - if (curc->y_sampling > 1) - { - if (height > 1) - { - if (curc->y_sampling > height) - chansz /= ((uint64_t) height); - else - chansz /= ((uint64_t) curc->y_sampling); - } - else if ((y % ((int) curc->y_sampling)) != 0) - chansz = 0; - } + chansz *= + (uint64_t) compute_sampled_lines (height, curc->y_sampling, y); unpacksize += chansz; } } @@ -761,10 +762,7 @@ exr_read_scanline_chunk_info ( cinfo->start_y = dw.min.y; cinfo->height -= (dw.min.y - miny); } - else if ((miny + lpc) > dw.max.y) - { - cinfo->height = (dw.max.y - miny + 1); - } + else if ((miny + lpc) > dw.max.y) { cinfo->height = (dw.max.y - miny + 1); } cinfo->level_x = 0; cinfo->level_y = 0; @@ -932,10 +930,11 @@ exr_read_scanline_chunk_info ( pctxt, EXR_ERR_BAD_CHUNK_LEADER, "Preparing to read scanline %d (chunk %d), found corrupt leader: packed size %" PRIu64 - ", file size %" PRId64, + ", file offset %" PRIu64 ", size %" PRId64, y, cidx, - (uint64_t) data[rdcnt], + cinfo->packed_size, + cinfo->data_offset, fsize); } } @@ -1332,12 +1331,12 @@ exr_read_chunk ( return pctxt->report_error ( pctxt, EXR_ERR_INVALID_ARGUMENT, - "mis-matched storage type for chunk block info"); + "mismatched storage type for chunk block info"); if (cinfo->compression != (uint8_t) part->comp_type) return pctxt->report_error ( pctxt, EXR_ERR_INVALID_ARGUMENT, - "mis-matched compression type for chunk block info"); + "mismatched compression type for chunk block info"); dataoffset = cinfo->data_offset; if (pctxt->file_size > 0 && dataoffset > (uint64_t) pctxt->file_size) @@ -1400,12 +1399,12 @@ exr_read_deep_chunk ( return pctxt->report_error ( pctxt, EXR_ERR_INVALID_ARGUMENT, - "mis-matched storage type for chunk block info"); + "mismatched storage type for chunk block info"); if (cinfo->compression != (uint8_t) part->comp_type) return pctxt->report_error ( pctxt, EXR_ERR_INVALID_ARGUMENT, - "mis-matched compression type for chunk block info"); + "mismatched compression type for chunk block info"); if (pctxt->file_size > 0 && cinfo->sample_count_data_offset > (uint64_t) pctxt->file_size) @@ -1641,10 +1640,7 @@ write_scan_chunk ( /* just in case we look at it again? */ priv_to_native64 (ctable, part->chunk_count); } - else - { - pctxt->last_output_chunk = cidx; - } + else { pctxt->last_output_chunk = cidx; } } return rv; @@ -1726,10 +1722,7 @@ exr_write_scanline_chunk_info ( cinfo->start_y = dw.min.y; cinfo->height -= (dw.min.y - miny); } - else if ((miny + lpc) > dw.max.y) - { - cinfo->height = (dw.max.y - miny + 1); - } + else if ((miny + lpc) > dw.max.y) { cinfo->height = (dw.max.y - miny + 1); } cinfo->level_x = 0; cinfo->level_y = 0; @@ -2064,10 +2057,7 @@ write_tile_chunk ( /* just in case we look at it again? */ priv_to_native64 (ctable, part->chunk_count); } - else - { - pctxt->last_output_chunk = cidx; - } + else { pctxt->last_output_chunk = cidx; } } return rv; diff --git a/src/lib/OpenEXRCore/coding.c b/src/lib/OpenEXRCore/coding.c index ef71d2aa92..2ce6ba1214 100644 --- a/src/lib/OpenEXRCore/coding.c +++ b/src/lib/OpenEXRCore/coding.c @@ -4,6 +4,7 @@ */ #include "internal_coding.h" +#include "internal_util.h" #include @@ -40,16 +41,8 @@ internal_coding_fill_channel_info ( decc->channel_name = curc->name.str; - if (curc->y_sampling > 1) - { - if (cinfo->height == 1) - decc->height = ((cinfo->start_y % curc->y_sampling) == 0) ? 1 - : 0; - else - decc->height = cinfo->height / curc->y_sampling; - } - else - decc->height = cinfo->height; + decc->height = compute_sampled_lines ( + cinfo->height, curc->y_sampling, cinfo->start_y); if (curc->x_sampling > 1) decc->width = cinfo->width / curc->x_sampling; @@ -106,16 +99,8 @@ internal_coding_update_channel_info ( ccic->channel_name = curc->name.str; - if (curc->y_sampling > 1) - { - if (cinfo->height == 1) - ccic->height = ((cinfo->start_y % curc->y_sampling) == 0) ? 1 - : 0; - else - ccic->height = cinfo->height / curc->y_sampling; - } - else - ccic->height = cinfo->height; + ccic->height = compute_sampled_lines ( + cinfo->height, curc->y_sampling, cinfo->start_y); if (curc->x_sampling > 1) ccic->width = cinfo->width / curc->x_sampling; diff --git a/src/lib/OpenEXRCore/decoding.c b/src/lib/OpenEXRCore/decoding.c index e984fce70f..0e9a355726 100644 --- a/src/lib/OpenEXRCore/decoding.c +++ b/src/lib/OpenEXRCore/decoding.c @@ -231,7 +231,7 @@ decompress_data ( return pctxt->report_error ( pctxt, EXR_ERR_INVALID_ARGUMENT, - "no compresssion set but still trying to decompress"); + "no compression set but still trying to decompress"); case EXR_COMPRESSION_RLE: rv = internal_exr_undo_rle ( diff --git a/src/lib/OpenEXRCore/encoding.c b/src/lib/OpenEXRCore/encoding.c index c14edeb4f1..9bd213cedb 100644 --- a/src/lib/OpenEXRCore/encoding.c +++ b/src/lib/OpenEXRCore/encoding.c @@ -34,7 +34,7 @@ default_compress_chunk (exr_encode_pipeline_t* encode) return pctxt->report_error ( pctxt, EXR_ERR_INVALID_ARGUMENT, - "no compresssion set but still trying to compress"); + "no compression set but still trying to compress"); case EXR_COMPRESSION_RLE: rv = internal_exr_apply_rle (encode); break; case EXR_COMPRESSION_ZIP: diff --git a/src/lib/OpenEXRCore/internal_b44.c b/src/lib/OpenEXRCore/internal_b44.c index 0a07b9c633..c340867bf2 100644 --- a/src/lib/OpenEXRCore/internal_b44.c +++ b/src/lib/OpenEXRCore/internal_b44.c @@ -126,7 +126,7 @@ pack (const uint16_t s[16], uint8_t b[14], int flatfields, int exactmax) // // Compute a set of running differences, r[0] ... r[14]: // Find a shift value such that after rounding off the - // rightmost bits and shifting all differenes are between + // rightmost bits and shifting all differences are between // -32 and +31. Then bias the differences so that they // end up between 0 and 63. // @@ -345,10 +345,7 @@ compress_b44_impl (exr_encode_pipeline_t* encode, int flat_field) } tmp += ((uint64_t) (y / curc->y_samples)) * bpl; } - else - { - tmp += ((uint64_t) y) * bpl; - } + else { tmp += ((uint64_t) y) * bpl; } memcpy (tmp, packed, bpl); if (curc->data_type == EXR_PIXEL_HALF) priv_to_native16 (tmp, nx); @@ -608,6 +605,36 @@ uncompress_b44_impl ( return EXR_ERR_SUCCESS; } +/**************************************/ + +static uint64_t +compute_scratch_buffer_size ( + exr_decode_pipeline_t* decode, uint64_t uncompressed_size) +{ + const exr_coding_channel_info_t* curc; + int nx, ny; + uint64_t ret = uncompressed_size; + uint64_t comp = 0; + + for (int c = 0; c < decode->channel_count; ++c) + { + curc = decode->channels + c; + + nx = curc->width; + ny = curc->height; + + if (nx % 4) nx += 4 - nx % 4; + if (ny % 4) ny += 4 - ny % 4; + + comp += (uint64_t) (ny) * (uint64_t) (nx) * + (uint64_t) (curc->bytes_per_element); + } + if (comp > ret) ret = comp; + return ret; +} + +/**************************************/ + exr_result_t internal_exr_undo_b44 ( exr_decode_pipeline_t* decode, @@ -622,7 +649,7 @@ internal_exr_undo_b44 ( EXR_TRANSCODE_BUFFER_SCRATCH1, &(decode->scratch_buffer_1), &(decode->scratch_alloc_size_1), - uncompressed_size); + compute_scratch_buffer_size (decode, uncompressed_size)); if (rv != EXR_ERR_SUCCESS) return rv; return uncompress_b44_impl ( @@ -647,7 +674,7 @@ internal_exr_undo_b44a ( EXR_TRANSCODE_BUFFER_SCRATCH1, &(decode->scratch_buffer_1), &(decode->scratch_alloc_size_1), - uncompressed_size); + compute_scratch_buffer_size (decode, uncompressed_size)); if (rv != EXR_ERR_SUCCESS) return rv; return uncompress_b44_impl ( diff --git a/src/lib/OpenEXRCore/internal_b44_table.c b/src/lib/OpenEXRCore/internal_b44_table.c index 2efcc2b89b..1fbdda5450 100644 --- a/src/lib/OpenEXRCore/internal_b44_table.c +++ b/src/lib/OpenEXRCore/internal_b44_table.c @@ -1,3 +1,8 @@ +// +// SPDX-License-Identifier: BSD-3-Clause +// Copyright (c) DreamWorks Animation LLC and Contributors of the OpenEXR Project +// + // // This is an automatically generated file. // Do not edit. diff --git a/src/lib/OpenEXRCore/internal_huf.c b/src/lib/OpenEXRCore/internal_huf.c index eda1dd49c7..91f0e9aeb1 100644 --- a/src/lib/OpenEXRCore/internal_huf.c +++ b/src/lib/OpenEXRCore/internal_huf.c @@ -6,9 +6,12 @@ #include "internal_huf.h" #include "internal_memory.h" +#include "internal_xdr.h" +#include "internal_structs.h" #include #include +#include #include #define HUF_ENCBITS 16 @@ -18,6 +21,11 @@ #define HUF_DECSIZE (1 << HUF_DECBITS) #define HUF_DECMASK (HUF_DECSIZE - 1) +#define SHORT_ZEROCODE_RUN 59 +#define LONG_ZEROCODE_RUN 63 +#define SHORTEST_LONG_RUN (2 + LONG_ZEROCODE_RUN - SHORT_ZEROCODE_RUN) +#define LONGEST_LONG_RUN (255 + SHORTEST_LONG_RUN) + typedef struct _HufDec { int32_t len; @@ -416,11 +424,6 @@ hufBuildEncTable ( // n zeroes (6 or more) 63 n-6 (6 + 8 bits) // -#define SHORT_ZEROCODE_RUN 59 -#define LONG_ZEROCODE_RUN 63 -#define SHORTEST_LONG_RUN (2 + LONG_ZEROCODE_RUN - SHORT_ZEROCODE_RUN) -#define LONGEST_LONG_RUN (255 + SHORTEST_LONG_RUN) - static void hufPackEncTable ( const uint64_t* hcode, // i : encoding table [HUF_ENCSIZE] @@ -614,10 +617,7 @@ hufBuildDecTable ( internal_exr_free (p); } - else - { - pl->p = (uint32_t*) internal_exr_alloc (sizeof (uint32_t)); - } + else { pl->p = (uint32_t*) internal_exr_alloc (sizeof (uint32_t)); } if (!pl->p) return EXR_ERR_OUT_OF_MEMORY; @@ -789,14 +789,8 @@ hufEncode ( while (cs-- > 0) \ *out++ = s; \ } \ - else if (out < oe) \ - { \ - *out++ = (uint16_t) po; \ - } \ - else \ - { \ - return EXR_ERR_CORRUPT_CHUNK; \ - } \ + else if (out < oe) { *out++ = (uint16_t) po; } \ + else { return EXR_ERR_CORRUPT_CHUNK; } \ } while (0) // @@ -942,6 +936,739 @@ readUInt (const uint8_t* b) /**************************************/ +// Longest compressed code length that ImfHuf supports (58 bits) +#define MAX_CODE_LEN 58 + +// Number of bits in our acceleration table. Should match all +// codes up to TABLE_LOOKUP_BITS in length. +#define TABLE_LOOKUP_BITS 14 + +#include + +#ifdef __APPLE__ +# include +# define READ64(c) OSSwapInt64 (*(const uint64_t*) (c)); +#elif defined(linux) +# include +# define READ64(c) bswap_64 (*(const uint64_t*) (c)); +#elif defined(_MSC_VER) +# include +# define READ64(c) _byteswap_uint64 (*(const uint64_t*) (c)) +#else +# define READ64(c) \ + ((uint64_t) (c)[0] << 56) | ((uint64_t) (c)[1] << 48) | \ + ((uint64_t) (c)[2] << 40) | ((uint64_t) (c)[3] << 32) | \ + ((uint64_t) (c)[4] << 24) | ((uint64_t) (c)[5] << 16) | \ + ((uint64_t) (c)[6] << 8) | ((uint64_t) (c)[7]) +#endif + +typedef struct FastHufDecoder +{ + int _rleSymbol; // RLE symbol written by the encoder. + // This could be 65536, so beware + // when you use shorts to hold things. + + int _numSymbols; // Number of symbols in the codebook. + + unsigned char _minCodeLength; // Minimum code length, in bits. + unsigned char _maxCodeLength; // Maximum code length, in bits. + + int _idToSymbol[65536 + 1]; // Maps Ids to symbols. Ids are a symbol + // ordering sorted first in terms of + // code length, and by code within + // the same length. Ids run from 0 + // to mNumSymbols-1. + + uint64_t _ljBase[MAX_CODE_LEN + 1 + 1]; // the 'left justified base' table. + // Takes base[i] (i = code length) + // and 'left justifies' it into an uint64_t + // Also includes a sentinel terminator + + uint64_t _ljOffset[MAX_CODE_LEN + 1]; // There are some other terms that can + // be folded into constants when taking + // the 'left justified' decode path. This + // holds those constants, indexed by + // code length + + // + // We can accelerate the 'left justified' processing by running the + // top TABLE_LOOKUP_BITS through a LUT, to find the symbol and code + // length. These are those acceleration tables. + // + // Even though our eventual 'symbols' are ushort's, the encoder adds + // a symbol to indicate RLE. So with a dense code book, we could + // have 2^16+1 codes, hence 'symbol' could be bigger than 16 bits. + // + int _lookupSymbol + [1 << TABLE_LOOKUP_BITS]; /* value = (codeLen << 24) | symbol */ + + uint64_t _tableMin; +} FastHufDecoder; + +static exr_result_t +FastHufDecoder_buildTables ( + const struct _internal_exr_context* pctxt, + FastHufDecoder* fhd, + uint64_t* base, + uint64_t* offset) +{ + // + // Build the 'left justified' base table, by shifting base left.. + // + + for (int i = 0; i <= MAX_CODE_LEN; ++i) + { + if (base[i] != 0xffffffffffffffffULL) + { + fhd->_ljBase[i] = base[i] << (64 - i); + } + else + { + // + // Unused code length - insert dummy values + // + + fhd->_ljBase[i] = 0xffffffffffffffffULL; + } + } + fhd->_ljBase[MAX_CODE_LEN + 1] = 0; /* sentinel for brute force lookup */ + + // + // Combine some terms into a big fat constant, which for + // lack of a better term we'll call the 'left justified' + // offset table (because it serves the same function + // as 'offset', when using the left justified base table. + // + + fhd->_ljOffset[0] = offset[0] - fhd->_ljBase[0]; + for (int i = 1; i <= MAX_CODE_LEN; ++i) + fhd->_ljOffset[i] = offset[i] - (fhd->_ljBase[i] >> (64 - i)); + + // + // Build the acceleration tables for the lookups of + // short codes ( <= TABLE_LOOKUP_BITS long) + // + + for (uint64_t i = 0; i < 1 << TABLE_LOOKUP_BITS; ++i) + { + uint64_t value = i << (64 - TABLE_LOOKUP_BITS); + + fhd->_lookupSymbol[i] = 0xffff; + + for (int codeLen = fhd->_minCodeLength; codeLen <= fhd->_maxCodeLength; + ++codeLen) + { + if (fhd->_ljBase[codeLen] <= value) + { + uint64_t id = + fhd->_ljOffset[codeLen] + (value >> (64 - codeLen)); + if (id < (uint64_t) (fhd->_numSymbols)) + { + fhd->_lookupSymbol[i] = + (fhd->_idToSymbol[id] | (codeLen << 24)); + } + else + { + if (pctxt) + pctxt->print_error ( + pctxt, + EXR_ERR_CORRUPT_CHUNK, + "Huffman decode error (Overrun)"); + return EXR_ERR_CORRUPT_CHUNK; + } + break; + } + } + } + + // + // Store the smallest value in the table that points to real data. + // This should be the entry for the largest length that has + // valid data (in our case, non-dummy _ljBase) + // + + int minIdx = TABLE_LOOKUP_BITS; + + while (minIdx > 0 && fhd->_ljBase[minIdx] == 0xffffffffffffffffULL) + minIdx--; + + if (minIdx < 0) + { + // + // Error, no codes with lengths 0-TABLE_LOOKUP_BITS used. + // Set the min value such that the table is never tested. + // + + fhd->_tableMin = 0xffffffffffffffffULL; + } + else { fhd->_tableMin = fhd->_ljBase[minIdx]; } + return EXR_ERR_SUCCESS; +} + +static inline void +FastHufDecoder_refill ( + uint64_t* buffer, + int numBits, // number of bits to refill + uint64_t* bufferBack, // the next 64-bits, to refill from + int* bufferBackNumBits, // number of bits left in bufferBack + const uint8_t** currByte, // current byte in the bitstream + int* currBitsLeft) +{ + // + // Refill bits into the bottom of buffer, from the top of bufferBack. + // Always top up buffer to be completely full. + // + + *buffer |= (*bufferBack) >> (64 - numBits); + + if (*bufferBackNumBits < numBits) + { + numBits -= *bufferBackNumBits; + + // + // Refill all of bufferBack from the bitstream. Either grab + // a full 64-bit chunk, or whatever bytes are left. If we + // don't have 64-bits left, pad with 0's. + // + + if (*currBitsLeft >= 64) + { + *bufferBack = READ64 (*currByte); + *bufferBackNumBits = 64; + *currByte += sizeof (uint64_t); + *currBitsLeft -= 8 * sizeof (uint64_t); + } + else + { + *bufferBack = 0; + *bufferBackNumBits = 64; + + uint64_t shift = 56; + + while (*currBitsLeft > 0) + { + *bufferBack |= ((uint64_t) (**currByte)) << shift; + + (*currByte)++; + shift -= 8; + *currBitsLeft -= 8; + } + + // + // At this point, currBitsLeft might be negative, just because + // we're subtracting whole bytes. To keep anyone from freaking + // out, zero the counter. + // + + if (*currBitsLeft < 0) *currBitsLeft = 0; + } + + *buffer |= (*bufferBack) >> (64 - numBits); + } + + // + // We can have cases where the previous shift of bufferBack is << 64 - + // this is an undefined operation but tends to create just zeroes. + // so if we won't have any bits left, zero out bufferBack instead of computing the shift + // + + if (*bufferBackNumBits <= numBits) { *bufferBack = 0; } + else { *bufferBack = (*bufferBack) << numBits; } + *bufferBackNumBits -= numBits; +} + +static inline uint64_t +fasthuf_read_bits ( + int numBits, uint64_t* buffer, int* bufferNumBits, const uint8_t** currByte) +{ + while (*bufferNumBits < numBits) + { + *buffer = ((*buffer) << 8) | *((*currByte)++); + *bufferNumBits += 8; + } + + *bufferNumBits -= numBits; + return ((*buffer) >> (*bufferNumBits)) & ((1 << numBits) - 1); +} + +static exr_result_t +fasthuf_initialize ( + const struct _internal_exr_context* pctxt, + FastHufDecoder* fhd, + const uint8_t** table, + int numBytes, + int minSymbol, + int maxSymbol, + int rleSymbol) +{ + fhd->_rleSymbol = rleSymbol; + fhd->_numSymbols = 0; + fhd->_minCodeLength = 255; + fhd->_maxCodeLength = 0; + + // + // The 'base' table is the minimum code at each code length. base[i] + // is the smallest code (numerically) of length i. + // + + uint64_t base[MAX_CODE_LEN + 1]; + + // + // The 'offset' table is the position (in sorted order) of the first id + // of a given code length. Array is indexed by code length, like base. + // + + uint64_t offset[MAX_CODE_LEN + 1]; + + // + // Count of how many codes at each length there are. Array is + // indexed by code length, like base and offset. + // + + size_t codeCount[MAX_CODE_LEN + 1]; + + for (int i = 0; i <= MAX_CODE_LEN; ++i) + { + codeCount[i] = 0; + base[i] = 0xffffffffffffffffULL; + offset[i] = 0; + } + + // + // Count the number of codes, the min/max code lengths, the number of + // codes with each length, and record symbols with non-zero code + // length as we find them. + // + + const uint8_t* currByte = *table; + uint64_t currBits = 0; + int currBitCount = 0; + + const uint8_t* topByte = *table + numBytes; + + for (uint64_t symbol = (uint64_t) minSymbol; symbol <= (uint64_t) maxSymbol; + symbol++) + { + if (currByte >= topByte) + { + if (pctxt) + pctxt->print_error ( + pctxt, + EXR_ERR_CORRUPT_CHUNK, + "Error decoding Huffman table (Truncated table data)."); + return EXR_ERR_CORRUPT_CHUNK; + } + + // + // Next code length - either: + // 0-58 (literal code length) + // 59-62 (various lengths runs of 0) + // 63 (run of n 0's, with n is the next 8 bits) + // + + uint64_t codeLen = + fasthuf_read_bits (6, &currBits, &currBitCount, &currByte); + + if (codeLen < (uint64_t) SHORT_ZEROCODE_RUN) + { + if (codeLen == 0) continue; + + if (codeLen < fhd->_minCodeLength) fhd->_minCodeLength = codeLen; + + if (codeLen > fhd->_maxCodeLength) fhd->_maxCodeLength = codeLen; + + codeCount[codeLen]++; + } + else if (codeLen == (uint64_t) LONG_ZEROCODE_RUN) + { + if (currByte >= topByte) + { + if (pctxt) + pctxt->print_error ( + pctxt, + EXR_ERR_CORRUPT_CHUNK, + "Error decoding Huffman table (Truncated table data)."); + return EXR_ERR_CORRUPT_CHUNK; + } + + symbol += + fasthuf_read_bits (8, &currBits, &currBitCount, &currByte) + + SHORTEST_LONG_RUN - 1; + } + else + symbol += codeLen - SHORT_ZEROCODE_RUN + 1; + + if (symbol > (uint64_t) maxSymbol) + { + if (pctxt) + pctxt->print_error ( + pctxt, + EXR_ERR_CORRUPT_CHUNK, + "Error decoding Huffman table (Run beyond end of table)."); + return EXR_ERR_CORRUPT_CHUNK; + } + } + + for (int i = 0; i < MAX_CODE_LEN; ++i) + fhd->_numSymbols += codeCount[i]; + + if ((size_t) fhd->_numSymbols > sizeof (fhd->_idToSymbol) / sizeof (int)) + { + if (pctxt) + pctxt->print_error ( + pctxt, + EXR_ERR_CORRUPT_CHUNK, + "Error decoding Huffman table (Too many symbols)."); + return EXR_ERR_CORRUPT_CHUNK; + } + + // + // Compute base - once we have the code length counts, there + // is a closed form solution for this + // + + { + double* countTmp = (double*) offset; /* temp space */ + + for (int l = fhd->_minCodeLength; l <= fhd->_maxCodeLength; ++l) + { + countTmp[l] = (double) codeCount[l] * + (double) (2ll << (fhd->_maxCodeLength - l)); + } + + for (int l = fhd->_minCodeLength; l <= fhd->_maxCodeLength; ++l) + { + double tmp = 0; + + for (int k = l + 1; k <= fhd->_maxCodeLength; ++k) + tmp += countTmp[k]; + + tmp /= (double) (2ll << (fhd->_maxCodeLength - l)); + + base[l] = (uint64_t) ceil (tmp); + } + } + + // + // Compute offset - these are the positions of the first + // id (not symbol) that has length [i] + // + + offset[fhd->_maxCodeLength] = 0; + + for (int i = fhd->_maxCodeLength - 1; i >= fhd->_minCodeLength; i--) + offset[i] = offset[i + 1] + codeCount[i + 1]; + + // + // Allocate and fill the symbol-to-id mapping. Smaller Ids should be + // mapped to less-frequent symbols (which have longer codes). Use + // the offset table to tell us where the id's for a given code + // length start off. + // + + uint64_t mapping[MAX_CODE_LEN + 1]; + for (int i = 0; i < MAX_CODE_LEN + 1; ++i) + mapping[i] = -1; + for (int i = fhd->_minCodeLength; i <= fhd->_maxCodeLength; ++i) + mapping[i] = offset[i]; + + currByte = *table; + currBits = 0; + currBitCount = 0; + + // + // Although we could have created an uncompressed list of symbols in our + // decoding loop above, it's faster to decode the compressed data again + // + for (uint64_t symbol = (uint64_t) minSymbol; symbol <= (uint64_t) maxSymbol; + symbol++) + { + uint64_t codeLen = + fasthuf_read_bits (6, &currBits, &currBitCount, &currByte); + + if (codeLen < (uint64_t) SHORT_ZEROCODE_RUN) + { + if (codeLen == 0) continue; + + if (mapping[codeLen] >= (uint64_t) fhd->_numSymbols) + { + if (pctxt) + pctxt->print_error ( + pctxt, + EXR_ERR_CORRUPT_CHUNK, + "Huffman decode error (Invalid symbol in header)"); + return EXR_ERR_CORRUPT_CHUNK; + } + fhd->_idToSymbol[mapping[codeLen]] = symbol; + mapping[codeLen]++; + } + else if (codeLen == (uint64_t) LONG_ZEROCODE_RUN) + symbol += + fasthuf_read_bits (8, &currBits, &currBitCount, &currByte) + + SHORTEST_LONG_RUN - 1; + else + symbol += codeLen - SHORT_ZEROCODE_RUN + 1; + } + + *table = currByte; + + return FastHufDecoder_buildTables (pctxt, fhd, base, offset); +} + +static inline int +fasthuf_decode_enabled () +{ +#if defined(__INTEL_COMPILER) || defined(__GNUC__) + + // + // Enabled for ICC, GCC: + // __i386__ -> x86 + // __x86_64__ -> 64-bit x86 + // __e2k__ -> e2k (MCST Elbrus 2000) + +# if defined(__i386__) || defined(__x86_64__) || defined(__e2k__) + return 1; +# else + return 0; +# endif + +#elif defined(_MSC_VER) + + // + // Enabled for Visual Studio: + // _M_IX86 -> x86 + // _M_X64 -> 64bit x86 + +# if defined(_M_IX86) || defined(_M_X64) + return 1; +# else + return 0; +# endif + +#else + + // + // Unknown compiler - Be safe and disable. + // + return 0; +#endif +} + +static exr_result_t +fasthuf_decode ( + const struct _internal_exr_context* pctxt, + FastHufDecoder* fhd, + const uint8_t* src, + int numSrcBits, + uint16_t* dst, + int numDstElems) +{ + // + // Current position (byte/bit) in the src data stream + // (after the first buffer fill) + // + + const unsigned char* currByte = src + 2 * sizeof (uint64_t); + + numSrcBits -= 8 * 2 * sizeof (uint64_t); + + // + // 64-bit buffer holding the current bits in the stream + // + + uint64_t buffer = READ64 (src); + int bufferNumBits = 64; + + // + // 64-bit buffer holding the next bits in the stream + // + + uint64_t bufferBack = READ64 ((src + sizeof (uint64_t))); + int bufferBackNumBits = 64; + + int dstIdx = 0; + + while (dstIdx < numDstElems) + { + int codeLen; + int symbol; + + // + // Test if we can be table accelerated. If so, directly + // lookup the output symbol. Otherwise, we need to fall + // back to searching for the code. + // + // If we're doing table lookups, we don't really need + // a re-filled buffer, so long as we have TABLE_LOOKUP_BITS + // left. But for a search, we do need a refilled table. + // + + if (fhd->_tableMin <= buffer) + { + int tableIdx = + fhd->_lookupSymbol[buffer >> (64 - TABLE_LOOKUP_BITS)]; + + // + // For invalid codes, _tableCodeLen[] should return 0. This + // will cause the decoder to get stuck in the current spot + // until we run out of elements, then barf that the codestream + // is bad. So we don't need to stick a condition like + // if (codeLen > _maxCodeLength) in this inner. + // + + codeLen = tableIdx >> 24; + symbol = tableIdx & 0xffffff; + } + else + { + // + // Brute force search: + // Find the smallest length where _ljBase[length] <= buffer + // + + codeLen = TABLE_LOOKUP_BITS + 1; + + /* sentinel zero can never be greater than buffer */ + while (fhd->_ljBase[codeLen] > + buffer /* && codeLen <= _maxCodeLength */) + codeLen++; + + if (codeLen > fhd->_maxCodeLength) + { + if (pctxt) + pctxt->print_error ( + pctxt, + EXR_ERR_CORRUPT_CHUNK, + "Huffman decode error (Decoded an invalid symbol)"); + return EXR_ERR_CORRUPT_CHUNK; + } + + uint64_t id = fhd->_ljOffset[codeLen] + (buffer >> (64 - codeLen)); + if (id < (uint64_t) fhd->_numSymbols) + { + symbol = fhd->_idToSymbol[id]; + } + else + { + if (pctxt) + pctxt->print_error ( + pctxt, + EXR_ERR_CORRUPT_CHUNK, + "Huffman decode error (Decoded an invalid symbol)"); + return EXR_ERR_CORRUPT_CHUNK; + } + } + + // + // Shift over bit stream, and update the bit count in the buffer + // + + buffer = buffer << codeLen; + bufferNumBits -= codeLen; + + // + // If we received a RLE symbol (_rleSymbol), then we need + // to read ahead 8 bits to know how many times to repeat + // the previous symbol. Need to ensure we at least have + // 8 bits of data in the buffer + // + + if (symbol == fhd->_rleSymbol) + { + if (bufferNumBits < 8) + { + FastHufDecoder_refill ( + &buffer, + 64 - bufferNumBits, + &bufferBack, + &bufferBackNumBits, + &currByte, + &numSrcBits); + + bufferNumBits = 64; + } + + int rleCount = buffer >> 56; + + if (dstIdx < 1) + { + if (pctxt) + pctxt->print_error ( + pctxt, + EXR_ERR_CORRUPT_CHUNK, + "Huffman decode error (RLE code with no previous symbol)"); + return EXR_ERR_CORRUPT_CHUNK; + } + + if (dstIdx + rleCount > numDstElems) + { + if (pctxt) + pctxt->print_error ( + pctxt, + EXR_ERR_CORRUPT_CHUNK, + "Huffman decode error (Symbol run beyond expected output buffer length)"); + return EXR_ERR_CORRUPT_CHUNK; + } + + if (rleCount <= 0) + { + if (pctxt) + pctxt->print_error ( + pctxt, + EXR_ERR_CORRUPT_CHUNK, + "Huffman decode error (Invalid RLE length)"); + return EXR_ERR_CORRUPT_CHUNK; + } + + for (int i = 0; i < rleCount; ++i) + dst[dstIdx + i] = dst[dstIdx - 1]; + + dstIdx += rleCount; + + buffer = buffer << 8; + bufferNumBits -= 8; + } + else + { + dst[dstIdx] = symbol; + dstIdx++; + } + + // + // refill bit stream buffer if we're below the number of + // bits needed for a table lookup + // + + if (bufferNumBits < 64) + { + FastHufDecoder_refill ( + &buffer, + 64 - bufferNumBits, + &bufferBack, + &bufferBackNumBits, + &currByte, + &numSrcBits); + + bufferNumBits = 64; + } + } + + if (numSrcBits != 0) + { + if (pctxt) + pctxt->print_error ( + pctxt, + EXR_ERR_CORRUPT_CHUNK, + "Huffman decode error (%d bits of compressed data remains after filling expected output buffer)", + numSrcBits); + return EXR_ERR_CORRUPT_CHUNK; + } + + return EXR_ERR_SUCCESS; +} + +/**************************************/ + uint64_t internal_exr_huf_compress_spare_bytes (void) { @@ -961,6 +1688,7 @@ internal_exr_huf_decompress_spare_bytes (void) ret += HUF_DECSIZE * sizeof (HufDec); // hdec // ret += HUF_ENCSIZE * sizeof (uint64_t*); // fheap // ret += HUF_ENCSIZE * sizeof (uint64_t); // scode + if (sizeof (FastHufDecoder) > ret) ret = sizeof (FastHufDecoder); return ret; } @@ -1028,18 +1756,22 @@ internal_huf_compress ( exr_result_t internal_huf_decompress ( - const uint8_t* compressed, - uint64_t nCompressed, - uint16_t* raw, - uint64_t nRaw, - void* spare, - uint64_t sparebytes) + exr_decode_pipeline_t* decode, + const uint8_t* compressed, + uint64_t nCompressed, + uint16_t* raw, + uint64_t nRaw, + void* spare, + uint64_t sparebytes) { - uint32_t im, iM, nBits; - uint64_t nBytes; - const uint8_t* ptr; - exr_result_t rv; - + uint32_t im, iM, nBits; + uint64_t nBytes; + const uint8_t* ptr; + exr_result_t rv; + const struct _internal_exr_context* pctxt = NULL; + const uint64_t hufInfoBlockSize = 5 * sizeof (uint32_t); + + if (decode) pctxt = EXR_CCTXT (decode->context); // // need at least 20 bytes for header // @@ -1060,37 +1792,35 @@ internal_huf_decompress ( if (im >= HUF_ENCSIZE || iM >= HUF_ENCSIZE) return EXR_ERR_CORRUPT_CHUNK; - ptr = compressed + 20; + ptr = compressed + hufInfoBlockSize; nBytes = (((uint64_t) (nBits) + 7)) / 8; - if (ptr + nBytes > compressed + nCompressed) return EXR_ERR_OUT_OF_MEMORY; + + // must be nBytes remaining in buffer + if (hufInfoBlockSize + nBytes > nCompressed) return EXR_ERR_OUT_OF_MEMORY; // // Fast decoder needs at least 2x64-bits of compressed data, and // needs to be run-able on this platform. Otherwise, fall back // to the original decoder // -#if 0 - if (FastHufDecoder::enabled () && nBits > 128) + if (fasthuf_decode_enabled () && nBits > 128) { - FastHufDecoder fhd (ptr, nCompressed - (ptr - compressed), im, iM, iM); + FastHufDecoder* fhd = (FastHufDecoder*) spare; - // must be nBytes remaining in buffer - if (ptr - compressed + nBytes > static_cast (nCompressed)) + rv = fasthuf_initialize (pctxt, fhd, &ptr, nCompressed - hufInfoBlockSize, im, iM, iM); + if (rv == EXR_ERR_SUCCESS) { - notEnoughData (); - return; + if ( (uint64_t)(ptr - compressed) + nBytes > nCompressed ) + return EXR_ERR_OUT_OF_MEMORY; + rv = fasthuf_decode (pctxt, fhd, ptr, nBits, raw, nRaw); } - - rv = fhd.decode (ptr, nBits, raw, nRaw); } else -#endif { uint64_t* freq = (uint64_t*) spare; HufDec* hdec = (HufDec*) (freq + HUF_ENCSIZE); uint64_t nLeft = nCompressed - 20; - uint64_t nTableSz = 0; hufClearDecTable (hdec); hufUnpackEncTable (&ptr, &nLeft, im, iM, freq); diff --git a/src/lib/OpenEXRCore/internal_huf.h b/src/lib/OpenEXRCore/internal_huf.h index 8eca85a5bb..0e37ee0c87 100644 --- a/src/lib/OpenEXRCore/internal_huf.h +++ b/src/lib/OpenEXRCore/internal_huf.h @@ -7,6 +7,7 @@ #define OPENEXR_CORE_HUF_CODING_H #include "openexr_errors.h" +#include "openexr_decode.h" uint64_t internal_exr_huf_compress_spare_bytes (void); uint64_t internal_exr_huf_decompress_spare_bytes (void); @@ -21,11 +22,12 @@ exr_result_t internal_huf_compress ( uint64_t sparebytes); exr_result_t internal_huf_decompress ( - const uint8_t* compressed, - uint64_t nCompressed, - uint16_t* raw, - uint64_t nRaw, - void* spare, - uint64_t sparebytes); + exr_decode_pipeline_t* decode, + const uint8_t* compressed, + uint64_t nCompressed, + uint16_t* raw, + uint64_t nRaw, + void* spare, + uint64_t sparebytes); #endif /* OPENEXR_CORE_HUF_CODING_H */ diff --git a/src/lib/OpenEXRCore/internal_piz.c b/src/lib/OpenEXRCore/internal_piz.c index d9c407db05..fd16498c6a 100644 --- a/src/lib/OpenEXRCore/internal_piz.c +++ b/src/lib/OpenEXRCore/internal_piz.c @@ -177,7 +177,7 @@ wav_2D_encode (uint16_t* in, int nx, int ox, int ny, int oy, uint16_t mx) int p2 = 2; // == 1 << (level+1) // - // Hierachical loop on smaller dimension n + // Hierarchical loop on smaller dimension n // while (p2 <= n) @@ -464,10 +464,7 @@ internal_exr_apply_piz (exr_encode_pipeline_t* encode) if ((cury % curc->y_samples) != 0) continue; tmp += ((uint64_t) (y / curc->y_samples)) * bpl; } - else - { - tmp += ((uint64_t) y) * bpl; - } + else { tmp += ((uint64_t) y) * bpl; } memcpy (tmp, packed, bpl); priv_to_native16 (tmp, nx * (curc->bytes_per_element / 2)); @@ -625,7 +622,13 @@ internal_exr_undo_piz ( wavbuf = decode->scratch_buffer_1; rv = internal_huf_decompress ( - packed + nBytes, hufbytes, wavbuf, outsz / 2, hufspare, hufSpareBytes); + decode, + packed + nBytes, + hufbytes, + wavbuf, + outsz / 2, + hufspare, + hufSpareBytes); if (rv != EXR_ERR_SUCCESS) return rv; // diff --git a/src/lib/OpenEXRCore/internal_pxr24.c b/src/lib/OpenEXRCore/internal_pxr24.c index 96f2f66e5f..f1928ad3b4 100644 --- a/src/lib/OpenEXRCore/internal_pxr24.c +++ b/src/lib/OpenEXRCore/internal_pxr24.c @@ -92,7 +92,7 @@ apply_pxr24_impl (exr_encode_pipeline_t* encode) uint8_t* out = encode->scratch_buffer_1; uint64_t nOut = 0; const uint8_t* lastIn = encode->packed_buffer; - uLongf compbufsz = encode->compressed_alloc_size; + uLong compbufsz = (uLong) encode->compressed_alloc_size; for (int y = 0; y < encode->chunk.height; ++y) { @@ -219,7 +219,7 @@ apply_pxr24_impl (exr_encode_pipeline_t* encode) (Bytef*) encode->compressed_buffer, &compbufsz, (const Bytef*) encode->scratch_buffer_1, - nOut)) + (uLong) nOut)) { return EXR_ERR_CORRUPT_CHUNK; } @@ -229,7 +229,7 @@ apply_pxr24_impl (exr_encode_pipeline_t* encode) encode->compressed_buffer, encode->packed_buffer, encode->packed_bytes); - compbufsz = encode->packed_bytes; + compbufsz = (uLong) encode->packed_bytes; } encode->compressed_bytes = compbufsz; return EXR_ERR_SUCCESS; @@ -262,7 +262,7 @@ undo_pxr24_impl ( void* scratch_data, uint64_t scratch_size) { - uLongf outSize = (uLongf) uncompressed_size; + uLong outSize = (uLong) uncompressed_size; int rstat; uint8_t* out = uncompressed_data; uint64_t nOut = 0; diff --git a/src/lib/OpenEXRCore/internal_rle.c b/src/lib/OpenEXRCore/internal_rle.c index 9d70a86abb..6e1362bf36 100644 --- a/src/lib/OpenEXRCore/internal_rle.c +++ b/src/lib/OpenEXRCore/internal_rle.c @@ -42,7 +42,7 @@ internal_rle_compress ( } else { - /* uncompressable */ + /* incompressible */ ++curcount; while (rune < end && ((rune + 1 >= end || *rune != *(rune + 1)) || diff --git a/src/lib/OpenEXRCore/internal_structs.c b/src/lib/OpenEXRCore/internal_structs.c index fdd1b43ed0..e4b8b523a8 100644 --- a/src/lib/OpenEXRCore/internal_structs.c +++ b/src/lib/OpenEXRCore/internal_structs.c @@ -7,7 +7,6 @@ #include "internal_attr.h" #include "internal_constants.h" #include "internal_memory.h" -#include "backward_compatibility.h" #include diff --git a/src/lib/OpenEXRCore/internal_util.h b/src/lib/OpenEXRCore/internal_util.h new file mode 100644 index 0000000000..0e76b52f01 --- /dev/null +++ b/src/lib/OpenEXRCore/internal_util.h @@ -0,0 +1,40 @@ +/* +** SPDX-License-Identifier: BSD-3-Clause +** Copyright Contributors to the OpenEXR Project. +*/ + +#include + +static inline int +compute_sampled_lines (int height, int y_sampling, int start_y) +{ + int nlines; + + if (y_sampling <= 1) return height; + + if (height == 1) + nlines = (start_y % y_sampling) == 0 ? 1 : 0; + else + { + int start, end; + + /* computed the number of times y % ysampling == 0, by + * computing interval based on first and last time that occurs + * on the given range + */ + start = start_y % y_sampling; + if (start != 0) + start = start_y + (y_sampling - start); + else + start = start_y; + end = start_y + height - 1; + end -= (end % y_sampling); + + if (start > end) + nlines = 0; + else + nlines = (end - start) / y_sampling + 1; + } + + return nlines; +} diff --git a/src/lib/OpenEXRCore/internal_zip.c b/src/lib/OpenEXRCore/internal_zip.c index 62e9ebe992..e829e6d7ce 100644 --- a/src/lib/OpenEXRCore/internal_zip.c +++ b/src/lib/OpenEXRCore/internal_zip.c @@ -24,6 +24,11 @@ # define IMF_HAVE_SSE4_1 1 # include #endif +#if defined(__ARM_NEON) +# define IMF_HAVE_NEON 1 +# include +#endif + /**************************************/ @@ -73,6 +78,54 @@ reconstruct (uint8_t* buf, uint64_t outSize) prev = d; } } +#elif defined(IMF_HAVE_NEON) +static void +reconstruct (uint8_t* buf, uint64_t outSize) +{ + static const uint64_t bytesPerChunk = sizeof (uint8x16_t); + const uint64_t vOutSize = outSize / bytesPerChunk; + const uint8x16_t c = vdupq_n_u8 (-128); + const uint8x16_t shuffleMask = vdupq_n_u8 (15); + const uint8x16_t zero = vdupq_n_u8 (0); + uint8_t * vBuf; + uint8x16_t vPrev; + uint8_t prev; + + /* + * The first element doesn't have its high bit flipped during compression, + * so it must not be flipped here. To make the SIMD loop nice and + * uniform, we pre-flip the bit so that the loop will unflip it again. + */ + buf[0] += -128; + vBuf = buf; + vPrev = vdupq_n_u8 (0); + + for (uint64_t i = 0; i < vOutSize; ++i) + { + uint8x16_t d = vaddq_u8 (vld1q_u8 (vBuf), c); + + /* Compute the prefix sum of elements. */ + d = vaddq_u8 (d, vextq_u8 (zero, d, 16 - 1)); + d = vaddq_u8 (d, vextq_u8 (zero, d, 16 - 2)); + d = vaddq_u8 (d, vextq_u8 (zero, d, 16 - 4)); + d = vaddq_u8 (d, vextq_u8 (zero, d, 16 - 8)); + d = vaddq_u8 (d, vPrev); + + vst1q_u8 (vBuf, d); vBuf += sizeof (uint8x16_t); + + // Broadcast the high byte in our result to all lanes of the prev + // value for the next iteration. + vPrev = vqtbl1q_u8 (d, shuffleMask); + } + + prev = vgetq_lane_u8 (vPrev, 15); + for (uint64_t i = vOutSize * bytesPerChunk; i < outSize; ++i) + { + uint8_t d = prev + buf[i] - 128; + buf[i] = d; + prev = d; + } +} #else static void reconstruct (uint8_t* buf, uint64_t sz) @@ -121,15 +174,39 @@ interleave (uint8_t* out, const uint8_t* source, uint64_t outSize) *(sOut++) = (i % 2 == 0) ? *(t1++) : *(t2++); } +#elif defined(IMF_HAVE_NEON) +static void +interleave (uint8_t* out, const uint8_t* source, uint64_t outSize) +{ + static const uint64_t bytesPerChunk = 2 * sizeof (uint8x16_t); + const uint64_t vOutSize = outSize / bytesPerChunk; + const uint8_t* v1 = source; + const uint8_t* v2 = source + (outSize + 1) / 2; + + for (uint64_t i = 0; i < vOutSize; ++i) + { + uint8x16_t a = vld1q_u8 (v1); v1 += sizeof (uint8x16_t); + uint8x16_t b = vld1q_u8 (v2); v2 += sizeof (uint8x16_t); + uint8x16_t lo = vzip1q_u8 (a, b); + uint8x16_t hi = vzip2q_u8 (a, b); + + vst1q_u8 (out, lo); out += sizeof (uint8x16_t); + vst1q_u8 (out, hi); out += sizeof (uint8x16_t); + } + + for (uint64_t i = vOutSize * bytesPerChunk; i < outSize; ++i) + *(out++) = (i % 2 == 0) ? *(v1++) : *(v2++); +} + #else static void interleave (uint8_t* out, const uint8_t* source, uint64_t outSize) { - const char* t1 = source; - const char* t2 = source + (outSize + 1) / 2; - char* s = out; - char* const stop = s + outSize; + const uint8_t* t1 = source; + const uint8_t* t2 = source + (outSize + 1) / 2; + uint8_t* s = out; + uint8_t* const stop = s + outSize; while (true) { @@ -158,7 +235,7 @@ undo_zip_impl ( void* scratch_data, uint64_t scratch_size) { - uLongf outSize = (uLongf) uncompressed_size; + uLong outSize = (uLong) scratch_size; int rstat; if (scratch_size < uncompressed_size) return EXR_ERR_INVALID_ARGUMENT; @@ -200,12 +277,16 @@ internal_exr_undo_zip ( uint64_t uncompressed_size) { exr_result_t rv; + uint64_t scratchbufsz = uncompressed_size; + if ( comp_buf_size > scratchbufsz ) + scratchbufsz = comp_buf_size; + rv = internal_decode_alloc_buffer ( decode, EXR_TRANSCODE_BUFFER_SCRATCH1, &(decode->scratch_buffer_1), &(decode->scratch_alloc_size_1), - uncompressed_size); + scratchbufsz); if (rv != EXR_ERR_SUCCESS) return rv; return undo_zip_impl ( compressed_data, @@ -226,7 +307,7 @@ apply_zip_impl (exr_encode_pipeline_t* encode) const uint8_t* raw = encode->packed_buffer; const uint8_t* stop = raw + encode->packed_bytes; int p, level; - uLongf compbufsz = encode->compressed_alloc_size; + uLong compbufsz = (uLong) encode->compressed_alloc_size; exr_result_t rv = EXR_ERR_SUCCESS; rv = exr_get_zip_compression_level ( @@ -257,7 +338,7 @@ apply_zip_impl (exr_encode_pipeline_t* encode) (Bytef*) encode->compressed_buffer, &compbufsz, (const Bytef*) encode->scratch_buffer_1, - encode->packed_bytes, + (uLong) encode->packed_bytes, level)) { return EXR_ERR_CORRUPT_CHUNK; diff --git a/src/lib/OpenEXRCore/opaque.c b/src/lib/OpenEXRCore/opaque.c index 9449470c7e..40ab3586ef 100644 --- a/src/lib/OpenEXRCore/opaque.c +++ b/src/lib/OpenEXRCore/opaque.c @@ -56,7 +56,7 @@ exr_attr_opaquedata_create ( exr_result_t rv = exr_attr_opaquedata_init (ctxt, u, b); if (rv == EXR_ERR_SUCCESS) { - if (d) memcpy ((void*) u->packed_data, d, b); + if (d && u->packed_data) memcpy ((void*) u->packed_data, d, b); } return rv; diff --git a/src/lib/OpenEXRCore/openexr_context.h b/src/lib/OpenEXRCore/openexr_context.h index 24aa98a7ca..26cbe56b36 100644 --- a/src/lib/OpenEXRCore/openexr_context.h +++ b/src/lib/OpenEXRCore/openexr_context.h @@ -82,6 +82,8 @@ typedef void (*exr_error_handler_cb_t) ( * * @param failed Indicates the write operation failed, the * implementor may wish to cleanup temporary files + * @param ctxt The context + * @param userdata The userdata */ typedef void (*exr_destroy_stream_func_ptr_t) ( exr_const_context_t ctxt, void* userdata, int failed); diff --git a/src/lib/OpenEXRCore/validation.c b/src/lib/OpenEXRCore/validation.c index 3388cd908f..f64a8f2670 100644 --- a/src/lib/OpenEXRCore/validation.c +++ b/src/lib/OpenEXRCore/validation.c @@ -420,7 +420,7 @@ validate_part_type ( if (f->is_singlepart_tiled && curpart->storage_mode != EXR_STORAGE_TILED) { - // mis-match between type attr and file flag. c++ believed the + // mismatch between type attr and file flag. c++ believed the // flag first and foremost curpart->storage_mode = EXR_STORAGE_TILED; diff --git a/src/lib/OpenEXRUtil/ImfCheckFile.cpp b/src/lib/OpenEXRUtil/ImfCheckFile.cpp index f4ab515b97..8c4fbe84f8 100644 --- a/src/lib/OpenEXRUtil/ImfCheckFile.cpp +++ b/src/lib/OpenEXRUtil/ImfCheckFile.cpp @@ -59,7 +59,7 @@ const int gMaxScanlinesToRead = 1<<20; // // compute row stride appropriate to process files quickly -// only used for the 'Rgba' interfaces, which read potentially non-existant channels +// only used for the 'Rgba' interfaces, which read potentially non-existent channels // // @@ -448,7 +448,7 @@ bool readDeepScanLine(T& in,bool reduceMemory, bool reduceTime) // size_t bufferSize = 0; size_t fileBufferSize = 0; - for (int j = 0; j < w; j++) + for (uint64_t j = 0; j < w; j++) { for (int k = 0; k < channelCount; k++) { @@ -475,7 +475,7 @@ bool readDeepScanLine(T& in,bool reduceMemory, bool reduceTime) pixelBuffer.resize(bufferSize); size_t bufferIndex = 0; - for (int j = 0; j < w ; j++) + for (uint64_t j = 0; j < w; j++) { for (int k = 0; k < channelCount; k++) { @@ -1185,9 +1185,8 @@ bool readCoreScanlinePart(exr_context_t f, int part, bool reduceMemory, bool red uint64_t width = (uint64_t) ((int64_t)datawin.max.x - (int64_t)datawin.min.x + 1); uint64_t height = (uint64_t) ((int64_t)datawin.max.y - (int64_t)datawin.min.y + 1); - std::vector imgdata; - bool doread = false; - exr_chunk_info_t cinfo; + std::vector imgdata; + bool doread = false; exr_decode_pipeline_t decoder = EXR_DECODE_PIPELINE_INITIALIZER; int32_t lines_per_chunk; @@ -1217,9 +1216,9 @@ bool readCoreScanlinePart(exr_context_t f, int part, bool reduceMemory, bool red uint64_t bytes = 0; for (int c = 0; c < decoder.channel_count; c++) { - exr_coding_channel_info_t & outc = decoder.channels[c]; - // fake addr for default rouines - outc.decode_to_ptr = (uint8_t*)0x1000; + exr_coding_channel_info_t& outc = decoder.channels[c]; + // fake addr for default routines + outc.decode_to_ptr = (uint8_t*) 0x1000; outc.user_pixel_stride = outc.user_bytes_per_element; outc.user_line_stride = outc.user_pixel_stride * width; bytes += width * (uint64_t)outc.user_bytes_per_element * (uint64_t)lines_per_chunk; diff --git a/src/lib/OpenEXRUtil/ImfSampleCountChannel.h b/src/lib/OpenEXRUtil/ImfSampleCountChannel.h index f0f1ca9165..a16775a182 100644 --- a/src/lib/OpenEXRUtil/ImfSampleCountChannel.h +++ b/src/lib/OpenEXRUtil/ImfSampleCountChannel.h @@ -165,7 +165,7 @@ class IMFUTIL_EXPORT_TYPE SampleCountChannel : public ImageChannel // // Application code must take make sure that each call to beginEdit() // is followed by a corresponding endEdit() call, even if an - // exception occurs while the sample counts are acessed. In order to + // exception occurs while the sample counts are accessed. In order to // do that, application code may want to create a temporary Edit // object instead of calling beginEdit() and endEdit() directly. // diff --git a/src/lib/OpenEXRUtil/README b/src/lib/OpenEXRUtil/README index f415aa431d..751e7c95b4 100644 --- a/src/lib/OpenEXRUtil/README +++ b/src/lib/OpenEXRUtil/README @@ -68,7 +68,7 @@ each level of a deep image has a sample count channel with a single value per pixel; this value determines how many values each of the other channels in the same level has at the same pixel location. -The Image, ImageLevel and ImageChannel classes are abstact base classes. +The Image, ImageLevel and ImageChannel classes are abstract base classes. Two sets of classes, one for flat images and one for deep images, are derived from the base classes. The FlatImageChannel and DeepImageChannel classes, derived from ImageChannel, are themselves base classes for the diff --git a/src/test/IexTest/CMakeLists.txt b/src/test/IexTest/CMakeLists.txt index f069c61341..58652178aa 100644 --- a/src/test/IexTest/CMakeLists.txt +++ b/src/test/IexTest/CMakeLists.txt @@ -4,6 +4,7 @@ add_executable(IexTest main.cpp testBaseExc.cpp + testBaseExc.h ) target_link_libraries(IexTest OpenEXR::Iex) diff --git a/src/test/OpenEXRCoreTest/CMakeLists.txt b/src/test/OpenEXRCoreTest/CMakeLists.txt index 13f4603309..4449de0b68 100644 --- a/src/test/OpenEXRCoreTest/CMakeLists.txt +++ b/src/test/OpenEXRCoreTest/CMakeLists.txt @@ -3,12 +3,19 @@ add_executable(OpenEXRCoreTest base_units.cpp + base_units.h compression.cpp + compression.h + deep.cpp + deep.h general_attr.cpp + general_attr.h main.cpp read.cpp + read.h + test_value.h write.cpp - deep.cpp + write.h ) target_compile_definitions(OpenEXRCoreTest PRIVATE ILM_IMF_TEST_IMAGEDIR="${CMAKE_CURRENT_SOURCE_DIR}/../OpenEXRTest/") # TODO: remove exr once we are happy everything is identical diff --git a/src/test/OpenEXRCoreTest/compression.cpp b/src/test/OpenEXRCoreTest/compression.cpp index c3d5b18207..e5cf292812 100644 --- a/src/test/OpenEXRCoreTest/compression.cpp +++ b/src/test/OpenEXRCoreTest/compression.cpp @@ -1,6 +1,14 @@ // SPDX-License-Identifier: BSD-3-Clause // Copyright Contributors to the OpenEXR Project. +// Windows specific addition to prevent the indirect import of the redefined min/max macros +#if defined _WIN32 || defined _WIN64 +# ifdef NOMINMAX +# undef NOMINMAX +# endif +# define NOMINMAX +#endif + #include "write.h" #include "test_value.h" @@ -11,6 +19,7 @@ #include #include +#include #include #include #include @@ -1355,9 +1364,13 @@ testHUF (const std::string& tempdir) { uint64_t esize = internal_exr_huf_compress_spare_bytes (); uint64_t dsize = internal_exr_huf_decompress_spare_bytes (); + // decsize 1 << 16 + 1 + // decsize 1 << 14 EXRCORE_TEST (esize == 65537 * (8 + 8 + sizeof (uint64_t*) + 4)); - EXRCORE_TEST ( - dsize == (65537 * 8 + (1 << 14) * (sizeof (uint32_t*) + 4 + 4))); + const uint64_t hufdecsize = (sizeof (uint32_t*) + sizeof(int32_t) + sizeof(uint32_t)); + // sizeof(FastHufDecoder) is bother to manually compute, just assume it's ok + // if it's returning at least enough for the slow path + EXRCORE_TEST (dsize >= (65537 * sizeof(uint64_t) + 16383 * hufdecsize)); std::vector hspare; @@ -1396,6 +1409,7 @@ testHUF (const std::string& tempdir) pixels decode = p; EXRCORE_TEST_RVAL (internal_huf_decompress ( + NULL, encoded.data (), ebytes, decode.h.data (), @@ -1430,6 +1444,7 @@ testHUF (const std::string& tempdir) } } EXRCORE_TEST_RVAL (internal_huf_decompress ( + NULL, encoded.data (), ebytes, decode.h.data (), @@ -1464,6 +1479,7 @@ testHUF (const std::string& tempdir) } } EXRCORE_TEST_RVAL (internal_huf_decompress ( + NULL, encoded.data (), ebytes, decode.h.data (), diff --git a/src/test/OpenEXRFuzzTest/CMakeLists.txt b/src/test/OpenEXRFuzzTest/CMakeLists.txt index a1b650b108..4a2c0b3594 100644 --- a/src/test/OpenEXRFuzzTest/CMakeLists.txt +++ b/src/test/OpenEXRFuzzTest/CMakeLists.txt @@ -5,12 +5,18 @@ option(OPENEXR_RUN_FUZZ_TESTS "Controls whether to include the fuzz tests (slow if(OPENEXR_RUN_FUZZ_TESTS) add_executable( OpenEXRFuzzTest fuzzFile.cpp + fuzzFile.h main.cpp - testFuzzDeepTiles.cpp testFuzzDeepScanLines.cpp + testFuzzDeepScanLines.h + testFuzzDeepTiles.cpp + testFuzzDeepTiles.h testFuzzScanLines.cpp + testFuzzScanLines.h testFuzzTiles.cpp + testFuzzTiles.h ) + target_include_directories(OpenEXRFuzzTest PRIVATE ../OpenEXRTest) target_link_libraries(OpenEXRFuzzTest OpenEXR::OpenEXR) set_target_properties(OpenEXRFuzzTest PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin" diff --git a/src/test/OpenEXRFuzzTest/tmpDir.h b/src/test/OpenEXRFuzzTest/tmpDir.h deleted file mode 100644 index e55f8776a0..0000000000 --- a/src/test/OpenEXRFuzzTest/tmpDir.h +++ /dev/null @@ -1,11 +0,0 @@ -// -// SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) Contributors to the OpenEXR Project. -// - - -#if defined(_WIN32) || defined(_WIN64) || defined(__ANDROID__) - #define IMF_TMP_DIR "" -#else - #define IMF_TMP_DIR "/var/tmp/" -#endif diff --git a/src/test/OpenEXRTest/CMakeLists.txt b/src/test/OpenEXRTest/CMakeLists.txt index 9dd74d1a7b..a843bdfacc 100644 --- a/src/test/OpenEXRTest/CMakeLists.txt +++ b/src/test/OpenEXRTest/CMakeLists.txt @@ -2,68 +2,134 @@ # Copyright (c) Contributors to the OpenEXR Project. add_executable(OpenEXRTest + TestUtilFStream.h + bswap_32.h compareB44.cpp + compareB44.h compareDwa.cpp + compareDwa.h compareFloat.cpp + compareFloat.h main.cpp random.cpp + random.h testAttributes.cpp + testAttributes.h testB44ExpLogTable.cpp + testB44ExpLogTable.h testBackwardCompatibility.cpp + testBackwardCompatibility.h testBadTypeAttributes.cpp + testBadTypeAttributes.h testChannels.cpp + testChannels.h testCompositeDeepScanLine.cpp + testCompositeDeepScanLine.h testCompression.cpp + testCompression.h testConversion.cpp + testConversion.h testCopyDeepScanLine.cpp + testCopyDeepScanLine.h testCopyDeepTiled.cpp + testCopyDeepTiled.h testCopyMultiPartFile.cpp + testCopyMultiPartFile.h testCopyPixels.cpp + testCopyPixels.h + testCpuId.cpp + testCpuId.h testCustomAttributes.cpp + testCustomAttributes.h testDeepScanLineBasic.cpp + testDeepScanLineBasic.h testDeepScanLineHuge.cpp + testDeepScanLineHuge.h testDeepScanLineMultipleRead.cpp + testDeepScanLineMultipleRead.h testDeepTiledBasic.cpp + testDeepTiledBasic.h testDwaCompressorSimd.cpp + testDwaCompressorSimd.h testDwaLookups.cpp + testDwaLookups.h testExistingStreams.cpp + testExistingStreams.h testFutureProofing.cpp + testFutureProofing.h testHuf.cpp + testHuf.h testIDManifest.cpp + testIDManifest.h testInputPart.cpp + testInputPart.h testIsComplete.cpp + testIsComplete.h testLargeDataWindowOffsets.cpp + testLargeDataWindowOffsets.h testLineOrder.cpp + testLineOrder.h testLut.cpp + testLut.h testMagic.cpp + testMagic.h testMalformedImages.cpp + testMalformedImages.h testMultiPartApi.cpp + testMultiPartApi.h testMultiPartFileMixingBasic.cpp + testMultiPartFileMixingBasic.h testMultiPartSharedAttributes.cpp + testMultiPartSharedAttributes.h testMultiPartThreading.cpp + testMultiPartThreading.h testMultiScanlinePartThreading.cpp + testMultiScanlinePartThreading.h testMultiTiledPartThreading.cpp + testMultiTiledPartThreading.h testMultiView.cpp + testMultiView.h testNativeFormat.cpp + testNativeFormat.h testOptimized.cpp + testOptimized.h testOptimizedInterleavePatterns.cpp + testOptimizedInterleavePatterns.h testPartHelper.cpp + testPartHelper.h testPreviewImage.cpp + testPreviewImage.h testRgba.cpp + testRgba.h testRgbaThreading.cpp + testRgbaThreading.h testRle.cpp + testRle.h testSampleImages.cpp + testSampleImages.h testScanLineApi.cpp + testScanLineApi.h testSharedFrameBuffer.cpp + testSharedFrameBuffer.h testStandardAttributes.cpp + testStandardAttributes.h testTiledCompression.cpp + testTiledCompression.h testTiledCopyPixels.cpp + testTiledCopyPixels.h testTiledLineOrder.cpp + testTiledLineOrder.h testTiledRgba.cpp + testTiledRgba.h testTiledYa.cpp + testTiledYa.h testWav.cpp + testWav.h testXdr.cpp + testXdr.h testYca.cpp + testYca.h + tmpDir.h ) target_compile_definitions(OpenEXRTest PRIVATE ILM_IMF_TEST_IMAGEDIR="${CMAKE_CURRENT_SOURCE_DIR}/") target_link_libraries(OpenEXRTest OpenEXR::OpenEXR) @@ -94,6 +160,7 @@ define_openexr_tests( testCopyDeepTiled testCopyMultiPartFile testCopyPixels + testCpuId testCustomAttributes testDeepScanLineBasic testDeepScanLineMultipleRead diff --git a/src/test/OpenEXRTest/TestUtilFStream.h b/src/test/OpenEXRTest/TestUtilFStream.h index 2cb7a1f077..430bc2e064 100644 --- a/src/test/OpenEXRTest/TestUtilFStream.h +++ b/src/test/OpenEXRTest/TestUtilFStream.h @@ -6,8 +6,10 @@ #ifndef INCLUDE_TestUtilFStream_h_ #define INCLUDE_TestUtilFStream_h_ 1 -#include -#include +# include + +# include +# include #ifdef _WIN32 # ifndef NOMINMAX @@ -25,21 +27,7 @@ namespace testutil { -#ifdef _WIN32 -inline std::wstring -WidenFilename (const char* filename) -{ - std::wstring ret; - int fnlen = static_cast (strlen (filename)); - int len = MultiByteToWideChar (CP_UTF8, 0, filename, fnlen, NULL, 0); - if (len > 0) - { - ret.resize (len); - MultiByteToWideChar (CP_UTF8, 0, filename, fnlen, &ret[0], len); - } - return ret; -} - +# ifdef _WIN32 // This is a big work around mechanism for compiling using mingw / gcc under windows // until mingw 9 where they add the wide filename version of open # if (defined(__GLIBCXX__) && !(defined(_GLIBCXX_HAVE_WFOPEN) && defined(_GLIBCXX_USE_WCHAR_T))) diff --git a/src/test/OpenEXRTest/main.cpp b/src/test/OpenEXRTest/main.cpp index 4eaecc9e5b..4b26639688 100644 --- a/src/test/OpenEXRTest/main.cpp +++ b/src/test/OpenEXRTest/main.cpp @@ -10,8 +10,28 @@ #include "ImfNamespace.h" #include "OpenEXRConfigInternal.h" -#include "testXdr.h" -#include "testMagic.h" +#include "testAttributes.h" +#include "testB44ExpLogTable.h" +#include "testBackwardCompatibility.h" +#include "testBadTypeAttributes.h" +#include "testChannels.h" +#include "testCompositeDeepScanLine.h" +#include "testCompression.h" +#include "testConversion.h" +#include "testCopyDeepScanLine.h" +#include "testCopyDeepTiled.h" +#include "testCopyMultiPartFile.h" +#include "testCopyPixels.h" +#include "testCpuId.h" +#include "testCustomAttributes.h" +#include "testDeepScanLineBasic.h" +#include "testDeepScanLineHuge.h" +#include "testDeepScanLineMultipleRead.h" +#include "testDeepTiledBasic.h" +#include "testDwaCompressorSimd.h" +#include "testDwaLookups.h" +#include "testExistingStreams.h" +#include "testFutureProofing.h" #include "testHuf.h" #include "testWav.h" #include "testChannels.h" @@ -23,6 +43,7 @@ #include "testRgba.h" #include "testRgbaThreading.h" #include "testLut.h" +#include "testMagic.h" #include "testSampleImages.h" #include "testPreviewImage.h" #include "testConversion.h" @@ -67,7 +88,7 @@ #include "testB44ExpLogTable.h" #include "testDwaLookups.h" #include "testIDManifest.h" - +#include "testXdr.h" #include "tmpDir.h" #include "ImathRandom.h" @@ -231,6 +252,7 @@ main (int argc, char *argv[]) TEST (testB44ExpLogTable, "core"); TEST (testDwaLookups, "core"); TEST (testIDManifest, "core"); + TEST (testCpuId, "core"); // NB: If you add a test here, make sure to enumerate it in the // CMakeLists.txt so it runs as part of the test suite diff --git a/src/test/OpenEXRTest/testAttributes.cpp b/src/test/OpenEXRTest/testAttributes.cpp index 695419e4d5..5e6cab4954 100644 --- a/src/test/OpenEXRTest/testAttributes.cpp +++ b/src/test/OpenEXRTest/testAttributes.cpp @@ -434,7 +434,7 @@ longNames (const Array2D &pf1, int height) { // - // Verify that long attibute or channel names in the header + // Verify that long attribute or channel names in the header // set the LONG_NAMES_FLAG in the file version number. // @@ -567,10 +567,7 @@ static int move_assignment_operator; struct TestType { - TestType() - { - default_constructor++; - } + TestType () : _f(0) { default_constructor++; } ~TestType() { diff --git a/src/test/OpenEXRTest/testCompositeDeepScanLine.cpp b/src/test/OpenEXRTest/testCompositeDeepScanLine.cpp index dde6bd3fc9..3af144e0b7 100644 --- a/src/test/OpenEXRTest/testCompositeDeepScanLine.cpp +++ b/src/test/OpenEXRTest/testCompositeDeepScanLine.cpp @@ -489,7 +489,7 @@ make_pattern(data & bob,int pattern_number) template void -write_file(const char * filename, const data & master, int number_of_parts) +write_file(const char * filename, const data & main, int number_of_parts) { vector
headers(number_of_parts); @@ -518,12 +518,12 @@ write_file(const char * filename, const data & master, int number_of_parts) if(number_of_parts>1) { - master.frak(sub_parts); + main.frak(sub_parts); } if(number_of_parts==1) { - master.setHeader(headers[0]); + main.setHeader(headers[0]); }else{ for(int i=0;i & master, int number_of_parts) DeepScanLineOutputPart p(f,i); if(number_of_parts==1) { - master.writeData(p); + main.writeData(p); }else{ sub_parts[i].writeData(p); } @@ -555,9 +555,9 @@ test_parts (int pattern_number, { std::string fn = tempDir + "imf_test_composite_deep_scanline_source.exr"; - data master; - make_pattern (master, pattern_number); - write_file (fn.c_str(), master,number_of_parts); + data main; + make_pattern (main, pattern_number); + write_file (fn.c_str(), main,number_of_parts); { @@ -576,7 +576,7 @@ test_parts (int pattern_number, } - master.setUpFrameBuffer(data,testbuf,comp.dataWindow(),load_depths); + main.setUpFrameBuffer(data,testbuf,comp.dataWindow(),load_depths); comp.setFrameBuffer(testbuf); @@ -598,7 +598,7 @@ test_parts (int pattern_number, } } - master.checkValues(data,comp.dataWindow(),load_depths); + main.checkValues(data,comp.dataWindow(),load_depths); for(int i=0;i data; FrameBuffer testbuf; const Box2i & dataWindow = file.header().dataWindow(); - master.setUpFrameBuffer(data,testbuf,dataWindow,load_depths); + main.setUpFrameBuffer(data,testbuf,dataWindow,load_depths); file.setFrameBuffer(testbuf); if(entire_buffer) { @@ -629,7 +629,7 @@ test_parts (int pattern_number, } } - master.checkValues (data, dataWindow, load_depths); + main.checkValues (data, dataWindow, load_depths); } remove (fn.c_str()); diff --git a/src/test/OpenEXRTest/testCopyDeepTiled.cpp b/src/test/OpenEXRTest/testCopyDeepTiled.cpp index b5627bedc0..9ab4f0e48c 100644 --- a/src/test/OpenEXRTest/testCopyDeepTiled.cpp +++ b/src/test/OpenEXRTest/testCopyDeepTiled.cpp @@ -430,8 +430,8 @@ copyFile (const std::string & srcFn, const std::string & cpyFn) DeepTiledOutputFile out_file (cpyFn.c_str(), in_file.header()); out_file.copyPixels (in_file); } - // prevent accidentally reading souce instead of copy - remove (srcFn.c_str()); + // prevent accidentally reading source instead of copy + remove (srcFn.c_str ()); } void diff --git a/src/test/OpenEXRTest/testCpuId.cpp b/src/test/OpenEXRTest/testCpuId.cpp new file mode 100644 index 0000000000..ec2522aad7 --- /dev/null +++ b/src/test/OpenEXRTest/testCpuId.cpp @@ -0,0 +1,39 @@ +// +// SPDX-License-Identifier: BSD-3-Clause +// Copyright (c) Contributors to the OpenEXR Project. +// + +#include +#include +#include + +using namespace std; + +void +testCpuId (const string&) +{ +#if defined(IMF_HAVE_SSE2) + std::cout << "IMF_HAVE_SSE2: " << true << "\n"; +#else + std::cout << "IMF_HAVE_SSE2: " << false << "\n"; +#endif +#if defined(IMF_HAVE_SSE4_1) + std::cout << "IMF_HAVE_SSE4_1: " << true << "\n"; +#else + std::cout << "IMF_HAVE_SSE4_1: " << false << "\n"; +#endif +#if defined(IMF_HAVE_AVX) + std::cout << "IMF_HAVE_AVX: " << true << "\n"; +#else + std::cout << "IMF_HAVE_AVX: " << false << "\n"; +#endif + + Imf::CpuId cpuId; + std::cout << "cpuId.sse2: " << cpuId.sse2 << "\n"; + std::cout << "cpuId.sse3: " << cpuId.sse3 << "\n"; + std::cout << "cpuId.ssse3: " << cpuId.ssse3 << "\n"; + std::cout << "cpuId.sse4_1: " << cpuId.sse4_1 << "\n"; + std::cout << "cpuId.sse4_2: " << cpuId.sse4_2 << "\n"; + std::cout << "cpuId.avx: " << cpuId.avx << "\n"; + std::cout << "cpuId.f16c: " << cpuId.f16c << std::endl; +} diff --git a/src/test/OpenEXRTest/testCpuId.h b/src/test/OpenEXRTest/testCpuId.h new file mode 100644 index 0000000000..e4b0cb69f5 --- /dev/null +++ b/src/test/OpenEXRTest/testCpuId.h @@ -0,0 +1,6 @@ +// +// SPDX-License-Identifier: BSD-3-Clause +// Copyright (c) Contributors to the OpenEXR Project. +// + +void testCpuId (const std::string&); diff --git a/src/test/OpenEXRTest/testDeepScanLineBasic.cpp b/src/test/OpenEXRTest/testDeepScanLineBasic.cpp index 1d256ecfc3..4f1534aa46 100644 --- a/src/test/OpenEXRTest/testDeepScanLineBasic.cpp +++ b/src/test/OpenEXRTest/testDeepScanLineBasic.cpp @@ -646,11 +646,11 @@ const int minY = 11; namespace large { -const int width = 10000; -const int height = 5000; -const int minX = -22; -const int minY = -12; -} + const int width = 5000; + const int height = 2500; + const int minX = -22; + const int minY = -12; +} // namespace large void testDeepScanLineBasic (const std::string &tempDir) diff --git a/src/test/OpenEXRTest/testDeepScanLineHuge.cpp b/src/test/OpenEXRTest/testDeepScanLineHuge.cpp index d5efdf0f19..b352831333 100644 --- a/src/test/OpenEXRTest/testDeepScanLineHuge.cpp +++ b/src/test/OpenEXRTest/testDeepScanLineHuge.cpp @@ -173,8 +173,8 @@ generateRandomFile (int channelCount, // // storage layout scheme: - // [Pixel1: [Channel1: [Sample1 Sample2 Sample...] ] [Channel2: [Sample1 Sample2...] ] [Channnel...] ] - // [Pixel2: [Channel1: [Sample1 Sample2 Sample...] ] [Channel2: [Sample1 Sample2...] ] [Channnel...] ] + // [Pixel1: [Channel1: [Sample1 Sample2 Sample...] ] [Channel2: [Sample1 Sample2...] ] [Channel...] ] + // [Pixel2: [Channel1: [Sample1 Sample2 Sample...] ] [Channel2: [Sample1 Sample2...] ] [Channel...] ] // [Pixel...] // storage.resize(total_number_of_samples*bytes_per_sample); diff --git a/src/test/OpenEXRTest/testDeepScanLineMultipleRead.cpp b/src/test/OpenEXRTest/testDeepScanLineMultipleRead.cpp index 15664af072..d9a75acadf 100644 --- a/src/test/OpenEXRTest/testDeepScanLineMultipleRead.cpp +++ b/src/test/OpenEXRTest/testDeepScanLineMultipleRead.cpp @@ -138,9 +138,9 @@ static void read_file(const char * filename) if( samplecounts[i]!= static_cast(row)) { - cout << i << ", " << row << " error, sample counts hould be " - << row << ", is " << samplecounts[i] - << endl << flush; + cout << i << ", " << row << " error, sample counts should be " + << row << ", is " << samplecounts[i] << endl + << flush; } assert (samplecounts[i]== static_cast(row)); diff --git a/src/test/OpenEXRTest/testDwaCompressorSimd.cpp b/src/test/OpenEXRTest/testDwaCompressorSimd.cpp index 6d831837ef..06f4f34b7e 100644 --- a/src/test/OpenEXRTest/testDwaCompressorSimd.cpp +++ b/src/test/OpenEXRTest/testDwaCompressorSimd.cpp @@ -400,6 +400,37 @@ testFloatToHalf() } } } + +#ifdef IMF_HAVE_NEON + { + cout << " convertFloatToHalf64_neon()" << endl; + for (int iter = 0; iter < numIter; ++iter) + { + for (int i = 0; i < 64; ++i) + { + if (i < 32) + { + src._buffer[i] = (float) 140000 * (rand48.nextf () - .5); + } + else { src._buffer[i] = (float) (rand48.nextf () - .5); } + dst._buffer[i] = 0; + } + + convertFloatToHalf64_neon (dst._buffer, src._buffer); + + for (int i = 0; i < 64; ++i) + { + half value = (half) src._buffer[i]; + if (value.bits () != dst._buffer[i]) + { + cout << src._buffer[i] << " -> " << dst._buffer[i] + << " expected " << value.bits () << endl; + assert (false); + } + } + } + } + #endif // IMF_HAVE_NEON } // @@ -483,7 +514,46 @@ testFromHalfZigZag() } } } // iter - } // f16c + } // f16c + +#ifdef IMF_HAVE_NEON + { + const int numIter = 1000000; + Rand48 rand48 (0); + half h; + SimdAlignedBuffer64f dstF16c; + + cout << " fromHalfZigZag_neon()" << endl; + + for (int iter = 0; iter < numIter; ++iter) + { + for (int i = 0; i < 64; ++i) + { + if (i < 32) { h = (half) (140000. * (rand48.nextf () - .5)); } + else + { + h = (half) (rand48.nextf () - .5); + } + src._buffer[i] = h.bits (); + } + + fromHalfZigZag_scalar (src._buffer, dst._buffer); + fromHalfZigZag_neon (src._buffer, dstF16c._buffer); + + for (int i = 0; i < 64; ++i) + { + if (fabsf (dst._buffer[i] - dstF16c._buffer[i]) > 1e-5) + { + cout << "At index " << i << ": "; + cout << "expecting " << dst._buffer[i] << "; got " + << dstF16c._buffer[i] << endl; + assert (false); + } + } + } // iter + } // neon + +#endif // IMF_HAVE_NEON } diff --git a/src/test/OpenEXRTest/testDwaLookups.cpp b/src/test/OpenEXRTest/testDwaLookups.cpp index 2613ac64df..2245235b09 100644 --- a/src/test/OpenEXRTest/testDwaLookups.cpp +++ b/src/test/OpenEXRTest/testDwaLookups.cpp @@ -413,7 +413,7 @@ cpuCount() // // This gives us num_bits(input)-1 values per input. If we alloc // space for everything, that's like a 2MB table. We can do better -// by compressing all the values to be contigious and using offset +// by compressing all the values to be contiguous and using offset // pointers. // // After we've found the candidates with fewer bits set, sort them diff --git a/src/test/OpenEXRTest/testExistingStreams.cpp b/src/test/OpenEXRTest/testExistingStreams.cpp index 808e508c44..8cc6b59069 100644 --- a/src/test/OpenEXRTest/testExistingStreams.cpp +++ b/src/test/OpenEXRTest/testExistingStreams.cpp @@ -7,8 +7,10 @@ # undef NDEBUG #endif -#include -#include +#include +#include +#include +#include #include #include #include @@ -16,12 +18,23 @@ #include #include #include +#include +#include #include #include #include "Iex.h" #include +#ifdef _WIN32 +#else +#include +#include +#include +#include +#endif + +#include #include #include @@ -71,7 +84,7 @@ fillPixels2 (Array2D &pixels, int w, int h) // // class MMIFStream -- a memory-mapped implementation of -// class IStream based on class std::ifstream +// class IStream // class MMIFStream: public OPENEXR_IMF_NAMESPACE::IStream @@ -80,8 +93,6 @@ class MMIFStream: public OPENEXR_IMF_NAMESPACE::IStream //------------------------------------------------------- // A constructor that opens the file with the given name. - // It reads the whole file into an internal buffer and - // then immediately closes the file. //------------------------------------------------------- MMIFStream (const char fileName[]); @@ -96,51 +107,129 @@ class MMIFStream: public OPENEXR_IMF_NAMESPACE::IStream virtual void seekg (uint64_t pos) {_pos = pos;} virtual void clear () {} - private: - - char* _buffer; - uint64_t _length; - uint64_t _pos; +private: +#ifdef _WIN32 + HANDLE _f = INVALID_HANDLE_VALUE; +#else + int _f; +#endif + void* _mmap; + const char* _mmapStart; + uint64_t _pos; + uint64_t _length; }; + MMIFStream::MMIFStream (const char fileName[]) + : OPENEXR_IMF_NAMESPACE::IStream (fileName) +#ifdef _WIN32 + , _f (INVALID_HANDLE_VALUE) +#else + , _f (-1) +#endif + , _mmap (reinterpret_cast(-1)) + , _mmapStart (nullptr) + , _pos (0) + , _length (0) +{ +#ifdef _WIN32 + const std::wstring fileNameWide = WidenFilename (fileName); + try + { + _f = CreateFileW ( + fileNameWide.c_str (), + GENERIC_READ, + FILE_SHARE_READ, + 0, + OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL, + 0); + } + catch (const std::exception&) + { + _f = INVALID_HANDLE_VALUE; + } + if (INVALID_HANDLE_VALUE == _f) + { + throw IEX_NAMESPACE::IoExc ("Cannot open file."); + } + struct _stati64 s; + memset (&s, 0, sizeof (struct _stati64)); + if (_wstati64 (fileNameWide.c_str (), &s) != 0) + { + throw IEX_NAMESPACE::IoExc ("Cannot stat file."); + } -MMIFStream::MMIFStream (const char fileName[]): - OPENEXR_IMF_NAMESPACE::IStream (fileName), - _buffer (0), - _length (0), - _pos (0) -{ - std::ifstream ifs; - testutil::OpenStreamWithUTF8Name ( - ifs, fileName, ios::in | ios_base::binary); + _length = s.st_size; - // - // Get length of file - // + _mmap = CreateFileMapping (_f, 0, PAGE_READONLY, 0, 0, 0); + if (!_mmap) + { + throw IEX_NAMESPACE::IoExc ("Cannot memory map file."); + } - ifs.seekg (0, ios::end); - _length = ifs.tellg(); - ifs.seekg (0, ios::beg); - - // - // Allocate memory - // + _mmapStart = reinterpret_cast ( + MapViewOfFile (_mmap, FILE_MAP_READ, 0, 0, 0)); + if (!_mmapStart) + { + throw IEX_NAMESPACE::IoExc ("Cannot map view of file."); + } - _buffer = new char [_length]; - - // - // Read the entire file - // +#else + + _f = open(fileName, O_RDONLY); + if (-1 == _f) + { + throw IEX_NAMESPACE::IoExc ("Cannot open file."); + } - ifs.read (_buffer, _length); - ifs.close(); + struct stat s; + memset(&s, 0, sizeof(struct stat)); + if (stat(fileName, &s) != 0) + { + throw IEX_NAMESPACE::IoExc ("Cannot stat file."); + } + + _length = s.st_size; + + _mmap = mmap(0, _length, PROT_READ, MAP_SHARED, _f, 0); + if (_mmap == (void*)-1) + { + throw IEX_NAMESPACE::IoExc ("Cannot memory map file."); + } + + _mmapStart = reinterpret_cast (_mmap); +#endif } MMIFStream::~MMIFStream () { - delete [] _buffer; +#ifdef _WIN32 + if (_mmapStart) + { + UnmapViewOfFile ((void*) _mmapStart); + } + if (_mmap) + { + CloseHandle (_mmap); + } + if (_f != INVALID_HANDLE_VALUE) + { + CloseHandle (_f); + } + +#else + + if (_mmap != (void*)-1) + { + munmap(_mmap, _length); + } + if (_f != -1) + { + close(_f); + } +#endif } @@ -159,7 +248,7 @@ MMIFStream::read (char c[/*n*/], int n) retVal = false; } - memcpy (c, &(_buffer[_pos]), n2); + memcpy (c, _mmapStart + _pos, n2); _pos += n2; return retVal; } @@ -174,17 +263,19 @@ MMIFStream::readMemoryMapped (int n) if (_pos + n > _length) throw IEX_NAMESPACE::InputExc ("Reading past end of file."); - char* retVal = &(_buffer[_pos]); + char* retVal = const_cast(_mmapStart) + _pos; _pos += n; return retVal; } void -writeReadScanLines (const char fileName[], - int width, - int height, - const Array2D &p1) +writeReadScanLines ( + const char fileName[], + int width, + int height, + Compression compression, + const Array2D& p1) { // // Save a scanline-based RGBA image, but instead of @@ -206,7 +297,14 @@ writeReadScanLines (const char fileName[], testutil::OpenStreamWithUTF8Name ( os, fileName, ios::out | ios_base::binary); StdOFStream ofs (os, fileName); - Header header (width, height); + Header header ( + width, + height, + 1, + IMATH_NAMESPACE::V2f (0, 0), + 1, + INCREASING_Y, + compression); RgbaOutputFile out (ofs, header, WRITE_RGBA); out.setFrameBuffer (&p1[0][0], 1, width); out.writePixels (height); @@ -230,17 +328,20 @@ writeReadScanLines (const char fileName[], in.setFrameBuffer (&p2[-dy][-dx], 1, w); in.readPixels (dw.min.y, dw.max.y); - cout << ", comparing"; - for (int y = 0; y < h; ++y) - { - for (int x = 0; x < w; ++x) - { - assert (p2[y][x].r == p1[y][x].r); - assert (p2[y][x].g == p1[y][x].g); - assert (p2[y][x].b == p1[y][x].b); - assert (p2[y][x].a == p1[y][x].a); - } - } + if (!isLossyCompression (compression)) + { + cout << ", comparing"; + for (int y = 0; y < h; ++y) + { + for (int x = 0; x < w; ++x) + { + assert (p2[y][x].r == p1[y][x].r); + assert (p2[y][x].g == p1[y][x].g); + assert (p2[y][x].b == p1[y][x].b); + assert (p2[y][x].a == p1[y][x].a); + } + } + } } { @@ -258,28 +359,34 @@ writeReadScanLines (const char fileName[], in.setFrameBuffer (&p2[-dy][-dx], 1, w); in.readPixels (dw.min.y, dw.max.y); - cout << ", comparing"; - for (int y = 0; y < h; ++y) - { - for (int x = 0; x < w; ++x) - { - assert (p2[y][x].r == p1[y][x].r); - assert (p2[y][x].g == p1[y][x].g); - assert (p2[y][x].b == p1[y][x].b); - assert (p2[y][x].a == p1[y][x].a); - } - } + if (!isLossyCompression(compression)) + { + cout << ", comparing"; + for (int y = 0; y < h; ++y) + { + for (int x = 0; x < w; ++x) + { + assert (p2[y][x].r == p1[y][x].r); + assert (p2[y][x].g == p1[y][x].g); + assert (p2[y][x].b == p1[y][x].b); + assert (p2[y][x].a == p1[y][x].a); + } + } + } } cout << endl; remove (fileName); } + void -writeReadMultiPart (const char fileName[], - int width, - int height, - const Array2D &p1) +writeReadMultiPart ( + const char fileName[], + int width, + int height, + Compression compression, + const Array2D& p1) { // // Save a two scanline parts in an image, but instead of @@ -291,9 +398,9 @@ writeReadMultiPart (const char fileName[], // back a second time using a memory-mapped // MMIFStream (see above). // - - cout << "scan-line based mulitpart file:" << endl; - + + cout << "scan-line based multipart file:" << endl; + { cout << "writing"; remove (fileName); @@ -302,14 +409,21 @@ writeReadMultiPart (const char fileName[], os, fileName, ios::out | ios_base::binary); StdOFStream ofs (os, fileName); - vector
headers(2); - headers[0] = Header(width, height); - headers[0].setName("part1"); - headers[0].channels().insert("R",Channel()); - headers[0].channels().insert("G",Channel()); - headers[0].channels().insert("B",Channel()); - headers[0].channels().insert("A",Channel()); - headers[0].setType(SCANLINEIMAGE); + vector
headers (2); + headers[0] = Header ( + width, + height, + 1, + IMATH_NAMESPACE::V2f (0, 0), + 1, + INCREASING_Y, + compression); + headers[0].setName ("part1"); + headers[0].channels ().insert ("R", Channel ()); + headers[0].channels ().insert ("G", Channel ()); + headers[0].channels ().insert ("B", Channel ()); + headers[0].channels ().insert ("A", Channel ()); + headers[0].setType (SCANLINEIMAGE); headers[1]=headers[0]; headers[1].setName("part2"); @@ -359,16 +473,19 @@ writeReadMultiPart (const char fileName[], InputPart p(in,part); p.setFrameBuffer(f); p.readPixels (dw.min.y, dw.max.y); - - cout << ", comparing pt " << part; - for (int y = 0; y < h; ++y) + + if (!isLossyCompression (compression)) { - for (int x = 0; x < w; ++x) + cout << ", comparing pt " << part; + for (int y = 0; y < h; ++y) { - assert (p2[y][x].r == p1[y][x].r); - assert (p2[y][x].g == p1[y][x].g); - assert (p2[y][x].b == p1[y][x].b); - assert (p2[y][x].a == p1[y][x].a); + for (int x = 0; x < w; ++x) + { + assert (p2[y][x].r == p1[y][x].r); + assert (p2[y][x].g == p1[y][x].g); + assert (p2[y][x].b == p1[y][x].b); + assert (p2[y][x].a == p1[y][x].a); + } } } } @@ -402,16 +519,19 @@ writeReadMultiPart (const char fileName[], InputPart p(in,part); p.setFrameBuffer(f); p.readPixels (dw.min.y, dw.max.y); - - cout << ", comparing pt " << part; - for (int y = 0; y < h; ++y) + + if (!isLossyCompression (compression)) { - for (int x = 0; x < w; ++x) + cout << ", comparing pt " << part; + for (int y = 0; y < h; ++y) { - assert (p2[y][x].r == p1[y][x].r); - assert (p2[y][x].g == p1[y][x].g); - assert (p2[y][x].b == p1[y][x].b); - assert (p2[y][x].a == p1[y][x].a); + for (int x = 0; x < w; ++x) + { + assert (p2[y][x].r == p1[y][x].r); + assert (p2[y][x].g == p1[y][x].g); + assert (p2[y][x].b == p1[y][x].b); + assert (p2[y][x].a == p1[y][x].a); + } } } } @@ -425,10 +545,12 @@ writeReadMultiPart (const char fileName[], void -writeReadTiles (const char fileName[], - int width, - int height, - const Array2D &p1) +writeReadTiles ( + const char fileName[], + int width, + int height, + Compression compression, + const Array2D& p1) { // // Save a tiled RGBA image, but instead of letting @@ -448,7 +570,14 @@ writeReadTiles (const char fileName[], testutil::OpenStreamWithUTF8Name ( os, fileName, ios_base::out | ios_base::binary); StdOFStream ofs (os, fileName); - Header header (width, height); + Header header ( + width, + height, + 1, + IMATH_NAMESPACE::V2f (0, 0), + 1, + INCREASING_Y, + compression); TiledRgbaOutputFile out (ofs, header, WRITE_RGBA, 20, 20, ONE_LEVEL); out.setFrameBuffer (&p1[0][0], 1, width); out.writeTiles (0, out.numXTiles() - 1, 0, out.numYTiles() - 1); @@ -472,17 +601,20 @@ writeReadTiles (const char fileName[], in.setFrameBuffer (&p2[-dy][-dx], 1, w); in.readTiles (0, in.numXTiles() - 1, 0, in.numYTiles() - 1); - cout << ", comparing"; - for (int y = 0; y < h; ++y) - { - for (int x = 0; x < w; ++x) - { - assert (p2[y][x].r == p1[y][x].r); - assert (p2[y][x].g == p1[y][x].g); - assert (p2[y][x].b == p1[y][x].b); - assert (p2[y][x].a == p1[y][x].a); - } - } + if (!isLossyCompression (compression)) + { + cout << ", comparing"; + for (int y = 0; y < h; ++y) + { + for (int x = 0; x < w; ++x) + { + assert (p2[y][x].r == p1[y][x].r); + assert (p2[y][x].g == p1[y][x].g); + assert (p2[y][x].b == p1[y][x].b); + assert (p2[y][x].a == p1[y][x].a); + } + } + } } { @@ -500,17 +632,20 @@ writeReadTiles (const char fileName[], in.setFrameBuffer (&p2[-dy][-dx], 1, w); in.readTiles (0, in.numXTiles() - 1, 0, in.numYTiles() - 1); - cout << ", comparing"; - for (int y = 0; y < h; ++y) - { - for (int x = 0; x < w; ++x) - { - assert (p2[y][x].r == p1[y][x].r); - assert (p2[y][x].g == p1[y][x].g); - assert (p2[y][x].b == p1[y][x].b); - assert (p2[y][x].a == p1[y][x].a); - } - } + if (!isLossyCompression (compression)) + { + cout << ", comparing"; + for (int y = 0; y < h; ++y) + { + for (int x = 0; x < w; ++x) + { + assert (p2[y][x].r == p1[y][x].r); + assert (p2[y][x].g == p1[y][x].g); + assert (p2[y][x].b == p1[y][x].b); + assert (p2[y][x].a == p1[y][x].a); + } + } + } } cout << endl; @@ -600,9 +735,9 @@ writeReadMultiPart (int width, // existing StdISStream, and compare the pixels // with the original data. // - - cout << "scan-line based mulitpart stringstream:" << endl; - + + cout << "scan-line based multipart stringstream:" << endl; + std::string strEXRFile; { @@ -762,19 +897,40 @@ testExistingStreams (const std::string &tempDir) const int W = 119; const int H = 237; - Array2D p1 (H, W); - - fillPixels1 (p1, W, H); - writeReadScanLines ((tempDir + "imf_test_streams.exr").c_str(), W, H, p1); - writeReadScanLines (W, H, p1); - - fillPixels2 (p1, W, H); - writeReadTiles ((tempDir + "imf_test_streams2.exr").c_str(), W, H, p1); - writeReadTiles (W, H, p1); - - fillPixels1 (p1, W, H); - writeReadMultiPart ((tempDir + "imf_test_streams3.exr").c_str(), W, H, p1); - writeReadMultiPart (W, H, p1); + for (int compression = 0; compression < NUM_COMPRESSION_METHODS; + ++compression) + { + cout << "compression: " << compression << endl; + + Array2D p1 (H, W); + + fillPixels1 (p1, W, H); + writeReadScanLines ( + (tempDir + "imf_test_streams.exr").c_str (), + W, + H, + static_cast(compression), + p1); + writeReadScanLines (W, H, p1); + + fillPixels2 (p1, W, H); + writeReadTiles ( + (tempDir + "imf_test_streams2.exr").c_str (), + W, + H, + static_cast (compression), + p1); + writeReadTiles (W, H, p1); + + fillPixels1 (p1, W, H); + writeReadMultiPart ( + (tempDir + "imf_test_streams3.exr").c_str (), + W, + H, + static_cast (compression), + p1); + writeReadMultiPart (W, H, p1); + } cout << "ok\n" << endl; } diff --git a/src/test/OpenEXRTest/testFutureProofing.cpp b/src/test/OpenEXRTest/testFutureProofing.cpp index e3bbeeb5ea..14984a9e4b 100644 --- a/src/test/OpenEXRTest/testFutureProofing.cpp +++ b/src/test/OpenEXRTest/testFutureProofing.cpp @@ -365,7 +365,7 @@ generateRandomHeaders (int partCount, vector
& headers) << " tile order =" << header.lineOrder() << " levelMode = " << levelModes[i] << endl << flush; } - // future types MUST have a chunkCount attribute - ommitting causes the library + // future types MUST have a chunkCount attribute - omitting causes the library // to raise an exception (can't compute chunkOffsetTable) and prevents us from reading // the rest of the image header.setChunkCount(getChunkOffsetTableSize(header)); @@ -1314,7 +1314,8 @@ testWriteRead (int partNumber) } catch(std::exception & e) { - cout << "recieved exception (" << e.what() << ") as expected\n"; + cout << "received exception (" << e.what () + << ") as expected\n"; caught = true; // that's what we thought would happen } @@ -1333,7 +1334,7 @@ testWriteRead (int partNumber) } catch(std::exception & e) { - cout << "recieved exception (" << e.what() << ") as expected\n"; + cout << "received exception (" << e.what () << ") as expected\n"; caught = true; // that's what we thought would happen } diff --git a/src/test/OpenEXRTest/testIDManifest.cpp b/src/test/OpenEXRTest/testIDManifest.cpp index 9fe2fa25da..e2ae39d49f 100644 --- a/src/test/OpenEXRTest/testIDManifest.cpp +++ b/src/test/OpenEXRTest/testIDManifest.cpp @@ -131,15 +131,20 @@ namespace #define COMPARE_WITH_SIMPLE_ZIP #ifdef COMPARE_WITH_SIMPLE_ZIP - // - // allocate a buffer which is guaranteed to be big enough for compression - // - uLongf compressedDataSize = compressBound(str.str().size()); - vector compressed(compressedDataSize); + // + // allocate a buffer which is guaranteed to be big enough for compression + // + uLong sourceDataSize = static_cast (str.str ().size ()); + uLong compressedDataSize = compressBound (sourceDataSize); + vector compressed(compressedDataSize); - ::compress((Bytef*) &compressed[0],&compressedDataSize,(const Bytef*) str.str().c_str(),str.str().size()); + ::compress( + reinterpret_cast(compressed.data ()), + &compressedDataSize, + reinterpret_cast (str.str ().c_str ()), + sourceDataSize); - cerr << "simple zip size: " << compressedDataSize << ' '; + cerr << "simple zip size: " << compressedDataSize << ' '; #endif cerr.flush(); diff --git a/src/test/OpenEXRTest/testMultiPartSharedAttributes.cpp b/src/test/OpenEXRTest/testMultiPartSharedAttributes.cpp index 25a07d941f..2f344b4e88 100644 --- a/src/test/OpenEXRTest/testMultiPartSharedAttributes.cpp +++ b/src/test/OpenEXRTest/testMultiPartSharedAttributes.cpp @@ -287,7 +287,7 @@ testSharedAttributes (const std::string & fn) MultiPartOutputFile file(fn.c_str(), &headers[0],headers.size()); } - // Adding a header a that has non-complient standard attributes will throw + // Adding a header a that has non-compliant standard attributes will throw // an exception. // Run the tests diff --git a/src/test/OpenEXRTest/testMultiView.cpp b/src/test/OpenEXRTest/testMultiView.cpp index 088a62bded..17190d596d 100644 --- a/src/test/OpenEXRTest/testMultiView.cpp +++ b/src/test/OpenEXRTest/testMultiView.cpp @@ -223,7 +223,7 @@ testMultiViewFunctions () "wensleydale.left.fell", multiView) == false); - // four sectons + // four sections assert (areCounterparts ("lincoln.longwool.right.A", "lincoln.longwool.left.A", diff --git a/src/test/OpenEXRTest/testNativeFormat.cpp b/src/test/OpenEXRTest/testNativeFormat.cpp index f7a4867ea8..255546d420 100644 --- a/src/test/OpenEXRTest/testNativeFormat.cpp +++ b/src/test/OpenEXRTest/testNativeFormat.cpp @@ -249,8 +249,9 @@ testNativeFormat (const std::string &tempDir) { try { - cout << "Testing if uncompressible pixel data are written " - "in Xdr, not native format" << endl; + cout << "Testing if incompressible pixel data are written " + "in Xdr, not native format" + << endl; cout << "image 1:" << endl; readCopyRead(tempDir, ILM_IMF_TEST_IMAGEDIR "test_native1.exr", 54435); diff --git a/src/test/OpenEXRTest/testPreviewImage.cpp b/src/test/OpenEXRTest/testPreviewImage.cpp index e741b85652..334ba8e054 100644 --- a/src/test/OpenEXRTest/testPreviewImage.cpp +++ b/src/test/OpenEXRTest/testPreviewImage.cpp @@ -121,13 +121,13 @@ readWriteFiles (const char fileName1[], file2.setFrameBuffer (pixels2 - dx - dy * w, 1, w); file2.readPixels (dw.min.y, dw.max.y); - for (size_t i = 0; i < w * h; ++i) - { - assert (pixels1[i].r == pixels2[i].r); - assert (pixels1[i].g == pixels2[i].g); - assert (pixels1[i].b == pixels2[i].b); - assert (pixels1[i].a == pixels2[i].a); - } + for (int i = 0; i < w * h; ++i) + { + assert (pixels1[i].r == pixels2[i].r); + assert (pixels1[i].g == pixels2[i].g); + assert (pixels1[i].b == pixels2[i].b); + assert (pixels1[i].a == pixels2[i].a); + } } cout << "writing file " << fileName3 << endl; diff --git a/src/test/OpenEXRTest/testRgba.cpp b/src/test/OpenEXRTest/testRgba.cpp index 6e77133728..f6e0e977db 100644 --- a/src/test/OpenEXRTest/testRgba.cpp +++ b/src/test/OpenEXRTest/testRgba.cpp @@ -87,7 +87,7 @@ writeReadRGBA (const char fileName[], // // Save the selected channels of RGBA image p1; save the // scan lines in the specified order. Read the image back - // from the file, and compare the data with the orignal. + // from the file, and compare the data with the original. // cout << "channels " << diff --git a/src/test/OpenEXRTest/testRgbaThreading.cpp b/src/test/OpenEXRTest/testRgbaThreading.cpp index fa7d1ef2c6..f61dbb17a4 100644 --- a/src/test/OpenEXRTest/testRgbaThreading.cpp +++ b/src/test/OpenEXRTest/testRgbaThreading.cpp @@ -59,7 +59,7 @@ writeReadRGBA (const char fileName[], // // Save the selected channels of RGBA image p1; save the // scan lines in the specified order. Read the image back - // from the file, and compare the data with the orignal. + // from the file, and compare the data with the original. // cout << "channels " << diff --git a/src/test/OpenEXRTest/testSharedFrameBuffer.cpp b/src/test/OpenEXRTest/testSharedFrameBuffer.cpp index 82e74d7a09..59517245bd 100644 --- a/src/test/OpenEXRTest/testSharedFrameBuffer.cpp +++ b/src/test/OpenEXRTest/testSharedFrameBuffer.cpp @@ -167,7 +167,7 @@ writeReadRGBA (const char fileName[], // // Save the selected channels of RGBA image p1; save the // scan lines in the specified order. Read the image back - // from the file, and compare the data with the orignal. + // from the file, and compare the data with the original. // cout << "channels " << diff --git a/src/test/OpenEXRUtilTest/CMakeLists.txt b/src/test/OpenEXRUtilTest/CMakeLists.txt index 2f4cafc18a..cbbb08d046 100644 --- a/src/test/OpenEXRUtilTest/CMakeLists.txt +++ b/src/test/OpenEXRUtilTest/CMakeLists.txt @@ -4,9 +4,13 @@ add_executable(OpenEXRUtilTest main.cpp testFlatImage.cpp + testFlatImage.h testDeepImage.cpp + testDeepImage.h testIO.cpp + testIO.h ) +target_include_directories(OpenEXRUtilTest PRIVATE ../OpenEXRTest) target_link_libraries(OpenEXRUtilTest OpenEXR::OpenEXRUtil) set_target_properties(OpenEXRUtilTest PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin" diff --git a/src/test/OpenEXRUtilTest/tmpDir.h b/src/test/OpenEXRUtilTest/tmpDir.h deleted file mode 100644 index e965a82da4..0000000000 --- a/src/test/OpenEXRUtilTest/tmpDir.h +++ /dev/null @@ -1,20 +0,0 @@ -// -// SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) Contributors to the OpenEXR Project. -// - - -#if defined(ANDROID) || defined(__ANDROID_API__) - #define IMF_TMP_DIR "/sdcard/" - #define IMF_PATH_SEPARATOR "/" -#elif defined(_WIN32) || defined(_WIN64) - #define IMF_TMP_DIR "" // TODO: get this from GetTempPath() or env var $TEMP or $TMP - #define IMF_PATH_SEPARATOR "\\" - #include // for _mkdir, _rmdir - #define mkdir(name,mode) _mkdir(name) - #define rmdir _rmdir -#else - #include // for mkdir - #define IMF_TMP_DIR "/var/tmp/" - #define IMF_PATH_SEPARATOR "/" -#endif