-
Notifications
You must be signed in to change notification settings - Fork 18
feat: JPEG XL encoder/decoder #50
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
wayfarer3130
wants to merge
13
commits into
main
Choose a base branch
from
feat/jpeg-xl-emsdk-3174
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 10 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
528649c
feat: JPEG XL encoder/decoder
wayfarer3130 9cd7bf6
Add libjxl transfer syntaxes
wayfarer3130 4f4bc1e
fix: setQuality needs to have per-codec configuration
wayfarer3130 6d97404
fix: Add various fixes to try to get jpegxl decoding working
wayfarer3130 b52b4cd
fix: Build inside emscripten environment of codecs
wayfarer3130 441ece4
Merge branch 'feat/jpeg-xl-emsdk-3174' of https://github.com/cornerst…
wayfarer3130 2cc7b43
Add logging to start debugging JPEG XL failures
wayfarer3130 1b1c3ca
fix: libjxl JPEG XL encoder build
wayfarer3130 61854ba
fix: Build instructions
wayfarer3130 c546875
fix: Add build files
wayfarer3130 fc6099c
Remove old git file
wayfarer3130 384d74c
Add resolution for critical security issue
wayfarer3130 b1049fc
fix: Allow encoder to use provided set encoding options
wayfarer3130 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 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
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
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 |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| const codecModule = require("@cornerstonejs/codec-libjxl"); | ||
| const codecFactory = require("./codecFactory"); | ||
|
|
||
| /** | ||
| * @type {CodecWrapper} | ||
| */ | ||
| const codecWrapper = { | ||
| codec: undefined, | ||
| Decoder: undefined, | ||
| Encoder: undefined, | ||
| encoderName: "JpegXLEncoder", | ||
| decoderName: "JpegXLDecoder", | ||
| }; | ||
|
|
||
| /** | ||
| * Decode imageFrame using jpegls decoder. | ||
| * | ||
| * @param {TypedArray} imageFrame to decode. | ||
| * @param {ExtendedImageInfo} imageInfo image info options. | ||
| * @returns Object containing decoded image frame and imageInfo (current) data. | ||
| */ | ||
| async function decode(imageFrame, imageInfo) { | ||
| return codecFactory.runProcess( | ||
| codecWrapper, | ||
| codecModule, | ||
| // Base module loads it's own codecModule | ||
| undefined, | ||
| codecWrapper.decoderName, | ||
| (context) => { | ||
| return codecFactory.decode(context, codecWrapper, imageFrame, imageInfo); | ||
| } | ||
| ); | ||
| } | ||
|
|
||
| /** | ||
| * Encode imageFrame to jpegls format. | ||
| * | ||
| * @param {TypedArray} imageFrame to encode. | ||
| * @param {ExtendedImageInfo} imageInfo image info options. | ||
| * @param {Object} options encode option. | ||
| * @returns Object containing encoded image frame and imageInfo (current) data | ||
| */ | ||
| async function encode(imageFrame, imageInfo, options = {}) { | ||
| return codecFactory.runProcess( | ||
| codecWrapper, | ||
| codecModule, | ||
| undefined, | ||
| codecWrapper.encoderName, | ||
| (context) => { | ||
| function beforeEncode(encoderInstance) { | ||
| encoderInstance.setNearLossless(0); | ||
| } | ||
|
|
||
| return codecFactory.encode( | ||
| context, | ||
| codecWrapper, | ||
| imageFrame, | ||
| imageInfo, | ||
| Object.assign({}, options, { beforeEncode }) | ||
| ); | ||
| } | ||
| ); | ||
| } | ||
|
|
||
| function getPixelData(imageFrame, imageInfo) { | ||
| return codecFactory.getPixelData(imageFrame, imageInfo); | ||
| } | ||
|
|
||
| exports.decode = decode; | ||
| exports.encode = encode; | ||
| exports.getPixelData = getPixelData; |
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 |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| FROM debian:stable | ||
|
|
||
| RUN apt update | ||
| RUN apt install -y cmake clang doxygen g++ extra-cmake-modules \ | ||
| libgif-dev libjpeg-dev ninja-build libgoogle-perftools-dev \ | ||
| graphviz | ||
| RUN apt install -y qt6-base-dev libwebp-dev libgimp2.0-dev libopenexr-dev \ | ||
| libgtest-dev libgmock-dev libbenchmark-dev libbenchmark-tools | ||
| RUN apt install -y git | ||
|
|
||
| WORKDIR $OPT | ||
|
|
||
| # Get the emsdk repo. | ||
| RUN git clone https://github.com/emscripten-core/emsdk.git | ||
|
|
||
| # Enter that directory. | ||
| WORKDIR $OPT/emsdk | ||
|
|
||
| # Download and install the latest SDK tools. | ||
| RUN ./emsdk install latest | ||
|
|
||
| # Make the "latest" SDK "active" for the current user. (writes ~/.emscripten file) | ||
| RUN ./emsdk activate latest | ||
|
|
||
| # Install node | ||
| RUN apt install -y nodejs | ||
|
|
||
| RUN echo "NODE_JS='/usr/bin/node'" >> $OPT/emsdk/.emscripten | ||
|
|
||
| WORKDIR /workspaces/libjxl | ||
|
|
||
| CMD /bin/bash |
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,27 @@ | ||
| // For format details, see https://aka.ms/vscode-remote/devcontainer.json or this file's README at: | ||
| // https://github.com/microsoft/vscode-dev-containers/tree/v0.112.0/containers/cpp | ||
| { | ||
| "name": "C++", | ||
| "dockerFile": "Dockerfile", | ||
|
|
||
| // Set *default* container specific settings.json values on container create. | ||
| "settings": { | ||
| "terminal.integrated.shell.linux": "/bin/bash" | ||
| }, | ||
|
|
||
| // Add the IDs of extensions you want installed when the container is created. | ||
| "extensions": [ | ||
| "ms-vscode.cpptools", | ||
| "twxs.cmake", | ||
| "flixs.vs-code-http-server-and-html-preview" | ||
| ] | ||
|
|
||
| // Use 'forwardPorts' to make a list of ports inside the container available locally. | ||
| // "forwardPorts": [], | ||
|
|
||
| // Use 'postCreateCommand' to run commands after the container is created. | ||
| // "postCreateCommand": "gcc -v", | ||
|
|
||
| // Uncomment to connect as a non-root user. See https://aka.ms/vscode-remote/containers/non-root. | ||
| // "remoteUser": "emscripten" | ||
| } |
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,109 @@ | ||
| build/ | ||
| build-native/ | ||
| test/node/*.jxl | ||
|
|
||
| .DS_Store | ||
|
|
||
| # Logs | ||
| logs | ||
| *.log | ||
| npm-debug.log* | ||
| yarn-debug.log* | ||
| yarn-error.log* | ||
| lerna-debug.log* | ||
|
|
||
| # Diagnostic reports (https://nodejs.org/api/report.html) | ||
| report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json | ||
|
|
||
| # Runtime data | ||
| pids | ||
| *.pid | ||
| *.seed | ||
| *.pid.lock | ||
|
|
||
| # Directory for instrumented libs generated by jscoverage/JSCover | ||
| lib-cov | ||
|
|
||
| # Coverage directory used by tools like istanbul | ||
| coverage | ||
| *.lcov | ||
|
|
||
| # nyc test coverage | ||
| .nyc_output | ||
|
|
||
| # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) | ||
| .grunt | ||
|
|
||
| # Bower dependency directory (https://bower.io/) | ||
| bower_components | ||
|
|
||
| # node-waf configuration | ||
| .lock-wscript | ||
|
|
||
| # Compiled binary addons (https://nodejs.org/api/addons.html) | ||
| build/Release | ||
|
|
||
| # Dependency directories | ||
| node_modules/ | ||
| jspm_packages/ | ||
|
|
||
| # TypeScript v1 declaration files | ||
| typings/ | ||
|
|
||
| # TypeScript cache | ||
| *.tsbuildinfo | ||
|
|
||
| # Optional npm cache directory | ||
| .npm | ||
|
|
||
| # Optional eslint cache | ||
| .eslintcache | ||
|
|
||
| # Microbundle cache | ||
| .rpt2_cache/ | ||
| .rts2_cache_cjs/ | ||
| .rts2_cache_es/ | ||
| .rts2_cache_umd/ | ||
|
|
||
| # Optional REPL history | ||
| .node_repl_history | ||
|
|
||
| # Output of 'npm pack' | ||
| *.tgz | ||
|
|
||
| # Yarn Integrity file | ||
| .yarn-integrity | ||
|
|
||
| # dotenv environment variables file | ||
| .env | ||
| .env.test | ||
|
|
||
| # parcel-bundler cache (https://parceljs.org/) | ||
| .cache | ||
|
|
||
| # Next.js build output | ||
| .next | ||
|
|
||
| # Nuxt.js build / generate output | ||
| .nuxt | ||
|
|
||
| # Gatsby files | ||
| .cache/ | ||
| # Comment in the public line in if your project uses Gatsby and *not* Next.js | ||
| # https://nextjs.org/blog/next-9-1#public-directory-support | ||
| # public | ||
|
|
||
| # vuepress build output | ||
| .vuepress/dist | ||
|
|
||
| # Serverless directories | ||
| .serverless/ | ||
|
|
||
| # FuseBox cache | ||
| .fusebox/ | ||
|
|
||
| # DynamoDB Local files | ||
| .dynamodb/ | ||
|
|
||
| # TernJS port file | ||
| .tern-port |
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,3 @@ | ||
| [submodule "extern/libjxl"] | ||
| path = extern/libjxl | ||
| url = https://github.com/libjxl/libjxl.git |
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.
Uses the v0.11.x release tag so I don't think we need a custom version tag here.