# CZOA HEIC decoder source and relinking kit This kit corresponds to the separately loaded library module `/vendor/heic/libheif-d1a93baf2da8.mjs`, SHA-256 `d1a93baf2da80de406a5355c8620037358aaf8465e3b1f54185eaa05f6d37797`. It contains unmodified libheif 1.22.2 and libde265 1.0.16 source archives, the actual linked library object archives, the original libheif post.js, exported ABI, explicit build options, and original license/copyright files. Only the libde265 HEVC decoder is enabled. Examples, other codec plugins, plugin loading and multithreaded decoding are disabled. The LGPL-covered library portions may be modified, replaced and reverse engineered for debugging those modifications under the included licenses. Nothing in this documentation or the site's terms limits those rights. CZOA does not claim ownership of the included libraries. The adapter sources in `adapter/` document the application/library interface; they are separate from the library module and contain no user photographs or credentials. ## Reproduce the original link Use Emscripten 4.0.15 (recorded compiler revision in build-plan.json), with its environment configured as documented by the Emscripten project. The original build used CMake 3.31.8 and a single compilation job. Toolchain archive URLs, checksums and the embedded WASM memory limit are recorded in source.json alongside this downloadable kit. No package installation is performed by these scripts. Run: ```sh python3 relink.py --emcc /path/to/emscripten/emcc --output replacement-libheif.mjs ``` The command uses the supplied objects and exact original link options. `--libheif`, `--libde265` and `--post-js` accept replacement object archives or modified libheif post.js. The module has a default factory export and uses embedded WASM; no separate WASM download is required. ## Rebuild library source ```sh python3 rebuild.py --emscripten /path/to/emscripten --cmake /path/to/cmake --work ./rebuilt ``` This extracts the included source archives to `rebuilt/sources/`, compiles one job at a time, and relinks `rebuilt/libheif.mjs`. To modify a library, edit the extracted source and rerun: existing source directories are kept. Emscripten's system-library cache is placed in the work directory unless `EM_CACHE` is already set. Original source archive hashes are listed in SHA256SUMS.json; modified source naturally changes those hashes. ## Use a replacement module The application loads this library as a separate same-origin ES module. In a local copy or installation you control, replace the module at the above URL, or change `decoderUrl` in the supplied `heic.worker.ts` adapter to the replacement module's URL. The filename's hash text is a cache key; the application does not enforce it as an integrity restriction. Retain the default factory and HeifDecoder/HeifImage API expected by the adapter. The included adapters show the size checks and worker message protocol. Run a local HTTP server supporting ES modules; a file:// URL is not an appropriate browser module environment. This does not grant access to modify another person's server or any production account. The library module's maximum WASM linear memory is 512 MiB. The CZOA adapter independently limits each source to 75 MiB and 48,000,000 pixels before RGBA allocation; the browser worker is terminated after each job. The bound applies to WASM linear memory, not the browser's entire memory. Photograph pixel correctness, browser support and site release acceptance are separate from the source/relinking evidence. Full source and original notices for the Emscripten runtime are supplied in `emscripten-runtime-source.tar.gz` alongside this kit, with the exact compiler/toolchain references in source.json. Applicable licenses are in `licenses/` and NOTICE.txt alongside the kit. The source archives preserve original per-file copyright and license headers.