Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 2 additions & 46 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,47 +26,6 @@ jobs:
with:
submodules: recursive

- name: 'Setup Emscripten'
uses: mymindstorm/setup-emsdk@v11
with:
version: 3.1.47

- name: 'Setup Python'
uses: actions/setup-python@v4
with:
python-version: '3.10'

- name: 'Install Meson & Ninja'
uses: BSFishy/pip-action@v1
with:
packages: |
meson
ninja

- name: Write em.txt
uses: "DamianReeves/write-file-action@master"
with:
path: libultrahdr-wasm/em.txt
write-mode: overwrite
contents: |
[binaries]
c = 'emcc'
cpp = 'em++'
ar = 'emar'
nm = 'emnm'

[host_machine]
system = 'emscripten'
cpu_family = 'wasm32'
cpu = 'wasm32'
endian = 'little'

- name: 'Build libultrahdr WASM'
run: |
cd libultrahdr-wasm
meson setup build --cross-file=em.txt
meson compile -C build

- name: 'Setup Nodejs'
uses: actions/setup-node@v3
with:
Expand All @@ -85,10 +44,6 @@ jobs:
name: build-artifact
if-no-files-found: error
path: |
libultrahdr-wasm/build/*.ts
libultrahdr-wasm/build/*.js
libultrahdr-wasm/build/*.map
libultrahdr-wasm/build/*.wasm
dist/

################################
Expand All @@ -110,6 +65,7 @@ jobs:
uses: actions/download-artifact@v4
with:
name: build-artifact
path: dist

- name: 'Setup Nodejs'
uses: actions/setup-node@v3
Expand Down Expand Up @@ -154,11 +110,11 @@ jobs:
uses: actions/checkout@v4
with:
submodules: recursive

- name: 'Download build artifacts'
uses: actions/download-artifact@v4
with:
name: build-artifact
path: dist

- name: 'Setup Nodejs'
uses: actions/setup-node@v3
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/publish-wiki.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ jobs:
uses: dawidd6/action-download-artifact@v6
with:
name: build-artifact
path: dist
run_id: ${{ github.event.workflow_run.id }}
workflow_conclusion: success

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ jobs:
uses: dawidd6/action-download-artifact@v6 # download artifacts
with:
name: build-artifact
path: dist
run_id: ${{ github.event.workflow_run.id }}
workflow_conclusion: success

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ jobs:
uses: dawidd6/action-download-artifact@v6 # download artifacts
with:
name: build-artifact
path: dist
run_id: ${{ github.event.workflow_run.id }}

- name: 'Download check artifacts'
Expand Down
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

4 changes: 0 additions & 4 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,3 @@ src
reports
examples
wiki
libultrahdr-wasm/**/*
!libultrahdr-wasm/build/*.ts
!libultrahdr-wasm/build/*.js
!libultrahdr-wasm/build/*.wasm
21 changes: 21 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"runtimeExecutable": "/home/daniele/.nvm/versions/node/v22.21.0/bin/node",
"skipFiles": [
"<node_internals>/**"
],
"program": "${workspaceFolder}/tests/encode/encode.test.ts",
"outFiles": [
"${workspaceFolder}/**/*.js"
]
}
]
}
56 changes: 4 additions & 52 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ const metadata = encodingResult.getMetadata()

// embed the compressed images + metadata into a single
// JPEG file
const jpeg = await encodeJPEGMetadata({
const jpeg = encodeJPEGMetadata({
...encodingResult,
...metadata,
sdr,
Expand Down Expand Up @@ -350,62 +350,14 @@ module.exports = defineConfig({
```


## Building with full encoding support (libultrahdr-wasm)
## Building

Clone the repository with git submodules recursively:
```bash
$ git clone --recurse-submodules git@github.com:MONOGRID/gainmap-js.git
```

Proceed to build the libultrahdr-wasm module following the [documentation found here](https://github.com/MONOGRID/libultrahdr-wasm#building), here's a quick summary

```bash
$ cd gainmap-js/libultrahdr-wasm/
```
Create a meson "cross compile config" named em.txt and place the following content inside:
```ini
[binaries]
c = 'emcc'
cpp = 'em++'
ar = 'emar'
nm = 'emnm'

[host_machine]
system = 'emscripten'
cpu_family = 'wasm32'
cpu = 'wasm32'
endian = 'little'
```
Then execute

```bash
$ meson setup build --cross-file=em.txt
$ meson compile -C build
```

After compiling the WASM, head back to the main repository

```bash
$ cd ..
$ npm i
$ npm run build
```

## Building with no encoding support (requires no wasm)

> :warning: Building the library with decode only capabilities will not allow to run playwright e2e tests with `npm run test`
> this method should only be used by people who would like to customize the "decoding" part of the library but are unable to build the WASM module for some reason (emscripten can be tricky sometimes, I've been there)

Clone the repository normally:
Clone the repository:
```bash
$ git clone git@github.com:MONOGRID/gainmap-js.git
$ cd gainmap-js
$ npm i
```

build with
```bash
$ npm run build --config rollup.config.decodeonly.mjs
$ npm run build
```


Expand Down
3 changes: 1 addition & 2 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ const config = defineConfig([
ignores: [
'node_modules/**/*',
'dist/**/*',
'.vscode/**/*',
'libultrahdr-wasm/build/**/*'
'.vscode/**/*'
]
}
])
Expand Down
2 changes: 1 addition & 1 deletion examples/encode-and-compress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const encodingResult = await encodeAndCompress({

// embed the compressed images + metadata into a single
// JPEG file
const jpeg = await encodeJPEGMetadata({
const jpeg = encodeJPEGMetadata({
...encodingResult,
sdr: encodingResult.sdr,
gainMap: encodingResult.gainMap
Expand Down
2 changes: 1 addition & 1 deletion examples/encode-jpeg-metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const metadata = encodingResult.getMetadata()

// embed the compressed images + metadata into a single
// JPEG file
const jpeg = await encodeJPEGMetadata({
const jpeg = encodeJPEGMetadata({
...encodingResult,
...metadata,
sdr,
Expand Down
2 changes: 1 addition & 1 deletion examples/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const encodingResult = await encodeAndCompress({

// embed the compressed images + metadata into a single
// JPEG file
const jpeg = await encodeJPEGMetadata({
const jpeg = encodeJPEGMetadata({
...encodingResult,
sdr: encodingResult.sdr,
gainMap: encodingResult.gainMap
Expand Down
1 change: 0 additions & 1 deletion libultrahdr-wasm
Submodule libultrahdr-wasm deleted from b077d0
146 changes: 0 additions & 146 deletions rollup.config.decodeonly.mjs

This file was deleted.

Loading
Loading