-
Notifications
You must be signed in to change notification settings - Fork 7
feat: add extended animation encoding options #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
heidi-alps
wants to merge
11
commits into
nieyuyao:main
Choose a base branch
from
heidi-alps:feat/extended-animation-options
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 9 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
b34a256
feat: add extended animation encoding options
kakao-heidi-alps c87dbb1
WIP
kakao-heidi-alps d218148
chore: vendor libwebp v1.3.2, remove submodules for closed network
kakao-heidi-alps 515706f
chore: remove GitHub Actions workflows for internal repo
kakao-heidi-alps 7e5988b
chore: use libwebp as git submodule
kakao-heidi-alps 26442cc
chore: add emsdk as git submodule
kakao-heidi-alps 469fdbc
chore: ensure build.sh is executable
kakao-heidi-alps f3151af
chore: gitignore dev build artifacts
kakao-heidi-alps 359a637
chore: simplify .gitignore
kakao-heidi-alps 411c23f
Revert "chore: remove GitHub Actions workflows for internal repo"
heidi-alps c4f14f7
docs: add extended animation options API example
heidi-alps File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,6 @@ | ||
| [submodule "libwebp"] | ||
| path = libwebp | ||
| branch = "v1.3.2" | ||
| url = https://github.com/webmproject/libwebp.git | ||
| ignore = all | ||
| url = https://chromium.googlesource.com/webm/libwebp | ||
| [submodule "emsdk"] | ||
| path = emsdk | ||
| branch = "3.1.56" | ||
| url = https://github.com/juj/emsdk.git | ||
| ignore = all | ||
| url = https://github.com/emscripten-core/emsdk.git | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| # CLAUDE.md | ||
|
|
||
| This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. | ||
|
|
||
| ## Project Overview | ||
|
|
||
| webp-wasm is a pure WebAssembly/JavaScript port of libwebp that enables WebP encoding/decoding (including animated WebP) in browsers and Node.js without native dependencies. | ||
|
|
||
| ## Build Commands | ||
|
|
||
| ```bash | ||
| # Full build (ESM with TypeScript) | ||
| npm run build | ||
|
|
||
| # Development build (outputs to src/ for hot reload) | ||
| npm run build-wasm:dev | ||
|
|
||
| # Build variants | ||
| npm run build:esm # ESM module build | ||
| npm run build:cjs # CommonJS build | ||
|
|
||
| # Run tests | ||
| npm test | ||
|
|
||
| # Development server (Vite) | ||
| npm run dev | ||
| ``` | ||
|
|
||
| ## Architecture | ||
|
|
||
| ### Build Pipeline | ||
|
|
||
| ``` | ||
| libwebp (C) → Emscripten → webp-wasm.wasm + webp-wasm.js → TypeScript wrapper → dist/ | ||
| ``` | ||
|
|
||
| 1. **libwebp/** - Vendored libwebp v1.3.2 source (git submodule) | ||
| 2. **webp/** - C++ wrapper using Emscripten bindings (`emscripten/bind.h`) | ||
| 3. **src/index.ts** - TypeScript API that loads and wraps the WASM module | ||
| 4. **Makefile** - Orchestrates WASM compilation using emcc/em++ | ||
|
|
||
| ### Key Files | ||
|
|
||
| | File | Purpose | | ||
| |------|---------| | ||
| | `webp/webp.cpp` | Emscripten bindings (EMSCRIPTEN_BINDINGS macro) | | ||
| | `webp/encode.cpp` | WebP encoding including animation | | ||
| | `webp/decode.cpp` | WebP decoding including animation | | ||
| | `src/index.ts` | Public TypeScript API | | ||
| | `src/types.d.ts` | TypeScript type definitions | | ||
| | `build.sh` | Build script with emsdk auto-setup | | ||
|
|
||
| ### Dependencies (Git Submodules) | ||
|
|
||
| | Submodule | Version | Source | | ||
| |-----------|---------|--------| | ||
| | libwebp | v1.3.2 | chromium.googlesource.com/webm/libwebp | | ||
| | emsdk | 3.1.74 | github.com/emscripten-core/emsdk | | ||
|
|
||
| The build script automatically installs emsdk if `EMSDK` environment variable is not set. | ||
|
|
||
| ## API Structure | ||
|
|
||
| The library exports async functions that load the WASM module on first call: | ||
|
|
||
| - **Encoding**: `encodeRGB`, `encodeRGBA`, `encode`, `encodeAnimation` | ||
| - **Decoding**: `decodeRGB`, `decodeRGBA`, `decodeAnimation` | ||
| - **Utilities**: `encoderVersion`, `decoderVersion` | ||
|
|
||
| Animation encoding supports per-frame quality settings via `WebPAnimationFrame.config`. | ||
|
|
||
| ## Testing | ||
|
|
||
| Tests use Jest with experimental WASM module support: | ||
| ```bash | ||
| npm test # Run all tests | ||
| npm test -- tests/encode.test.js # Run single test file | ||
| ``` | ||
|
|
||
| Test fixtures are PNG images in `tests/fixtures/`. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule emsdk
updated
90 files
Submodule libwebp
updated
from 6c484c to ca3322
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it would be better to specify a branch or tag here. @heidi-alps