How academysoftwarefoundation/openexr works
Project type and purpose
• OpenEXR is an open-source, multi-language, multi-platform reference implementation of the high-dynamic-range EXR image file format. It consists of:
• Core C library (“OpenEXRCore”) providing low-level file I/O, compression, header parsing.
• C++ libraries (Imf, Iex, IlmThread, OpenEXRUtil) building atop the core to expose rich image, multi-part, deep-compositing APIs.
• Command-line tools (“exr*” binaries) demonstrating and bundling common workflows.
• Python bindings wrapping the C++ API for scripting.
• Extensive test suites (unit, fuzz, integration).
• Documentation and website generator sources.
• Cross-platform build support via CMake and Bazel.
File structure
• Top-level build files: WORKSPACE.bazel, BUILD.bazel, CMakeLists.txt → dual build systems.
• “src/lib/OpenEXRCore”: Pure C code, lowest layer.
• “src/lib/OpenEXR”: C++ API implementation (Imf).
• “src/lib/Iex”: exception and base utilities.
• “src/lib/IlmThread”: threading primitives.
• “src/lib/OpenEXRUtil”: helper classes for common tasks.
• “src/bin”: multiple executables (exrinfo, exr2aces, exrmultipart, etc.) all linking against the C++ libraries.
• “src/wrappers/python”: Python extension module and tests.
• “src/test”: C++ unit and fuzz tests.
• “website”: documentation sources (Sphinx, Doxygen, example apps).
README
• Confirms the layering: Imf::RgbaFile writer example uses the OpenEXR::OpenEXR CMake target.
• Emphasizes core objectives: performance, robustness, backwards compatibility.
• References technical docs and examples under the “website” directory.
a. Main components:
• Build System (CMake & Bazel)
• Core C Library (“OpenEXRCore”)
• Exception & Math Library (“Iex” & “Imath”)
• Threading Library (“IlmThread”)
• C++ API Library (“OpenEXR/Imf”)
• Utility Library (“OpenEXRUtil”)
• Command-Line Tools (exrinfo, exr2aces, etc.)
• Python Wrapper Module (“PyOpenEXR”)
• Test Suites (Unit, Fuzz, Integration)
• Documentation Generator & Website
• External Dependencies (zlib/libdeflate, Python, Sphinx, Doxygen)
b. Relationships and interactions:
• The Build System resolves external dependencies, compiles and links all components.
• OpenEXRCore is the lowest dependency; Iex/Imath and IlmThread depend on core only.
• OpenEXR/Imf (C++ API) depends on OpenEXRCore, Iex/Imath, IlmThread.
• OpenEXRUtil depends on Imf and core.
• Command-Line Tools and Examples link against Imf and Util.
• Python Wrapper uses C-API or directly binds Imf symbols.
• Test Suites exercise all layers: core, C++, utilities, CLI, Python.
• Documentation generator parses headers and sources to produce API docs.
c. Architectural patterns & principles:
• Layered modular architecture: Core → Utilities → API → Clients.
• Separation of concerns: compression, threading, math, I/O are separate modules.
• Plugin-style extensibility for compressors (PIZ, ZIP, DWAA, etc.) loaded via dynamic code paths.
• Dual build backends for Bazel and CMake.
• Multi-language support via language bindings.
d. Key technologies/frameworks:
• C++17 standard libraries
• Bazel and CMake build systems
• Python (CPython extension building)
• zlib/libdeflate for compression
• Sphinx & Doxygen for documentation
• GoogleTest (or custom harness) and libFuzzer for tests
Essential elements to capture
• Clearly separate OpenEXRCore, Imf API, Python bindings, CLI tools, tests, and docs.
• External dependencies and CI as part of the ecosystem.
• Both build-time (CMake/Bazel) and runtime relationships.