Skip to content

[api-major] Add openjpeg.wasm to pdf.js (bug 1935076) #19329

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

Merged
merged 1 commit into from
Jan 16, 2025

Conversation

calixteman
Copy link
Contributor

In order to fix bug 1935076, we'll have to add a pure js fallback in case wasm is disabled or simd isn't supported. Unfortunately, this fallback will take some space.

So, the main goal of this patch is to reduce the overall size (by ~93k). As a side effect, it should make easier to use an other wasm file (which must export _jp2_decode, _malloc and _free).

@calixteman
Copy link
Contributor Author

/botio test

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Received

Command cmd_test from @calixteman received. Current queue size: 0

Live output at: http://54.241.84.105:8877/d55fe890be8225c/output.txt

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Windows)


Received

Command cmd_test from @calixteman received. Current queue size: 0

Live output at: http://54.193.163.58:8877/1c20eabb2c7f37f/output.txt

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Failed

Full output at http://54.241.84.105:8877/d55fe890be8225c/output.txt

Total script time: 28.01 mins

  • Unit tests: Passed
  • Integration Tests: FAILED
  • Regression tests: FAILED
  errors: 64
  different ref/snapshot: 2

Image differences available at: http://54.241.84.105:8877/d55fe890be8225c/reftest-analyzer.html#web=eq.log

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Windows)


Failed

Full output at http://54.193.163.58:8877/1c20eabb2c7f37f/output.txt

Total script time: 57.14 mins

  • Unit tests: FAILED
  • Integration Tests: FAILED
  • Regression tests: FAILED
  errors: 64
  different ref/snapshot: 2

Image differences available at: http://54.193.163.58:8877/1c20eabb2c7f37f/reftest-analyzer.html#web=eq.log

@calixteman
Copy link
Contributor Author

/botio test

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Received

Command cmd_test from @calixteman received. Current queue size: 0

Live output at: http://54.241.84.105:8877/896ca7c56152839/output.txt

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Windows)


Received

Command cmd_test from @calixteman received. Current queue size: 0

Live output at: http://54.193.163.58:8877/4474db775db14e7/output.txt

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Failed

Full output at http://54.241.84.105:8877/896ca7c56152839/output.txt

Total script time: 28.65 mins

  • Unit tests: Passed
  • Integration Tests: FAILED
  • Regression tests: FAILED
  different ref/snapshot: 2

Image differences available at: http://54.241.84.105:8877/896ca7c56152839/reftest-analyzer.html#web=eq.log

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Windows)


Failed

Full output at http://54.193.163.58:8877/4474db775db14e7/output.txt

Total script time: 58.79 mins

  • Unit tests: Passed
  • Integration Tests: FAILED
  • Regression tests: FAILED
  different ref/snapshot: 2

Image differences available at: http://54.193.163.58:8877/4474db775db14e7/reftest-analyzer.html#web=eq.log

@calixteman
Copy link
Contributor Author

/botio test

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Windows)


Received

Command cmd_test from @calixteman received. Current queue size: 0

Live output at: http://54.193.163.58:8877/b258dc512563ad8/output.txt

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Received

Command cmd_test from @calixteman received. Current queue size: 0

Live output at: http://54.241.84.105:8877/4bc93f37da6f530/output.txt

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Failed

Full output at http://54.241.84.105:8877/4bc93f37da6f530/output.txt

Total script time: 29.66 mins

  • Unit tests: Passed
  • Integration Tests: FAILED
  • Regression tests: Passed

@calixteman calixteman marked this pull request as ready for review January 16, 2025 09:58
@Snuffleupagus Snuffleupagus changed the title Add openjpeg.wasm to pdf.js (bug 1935076) [api-major] Add openjpeg.wasm to pdf.js (bug 1935076) Jan 16, 2025
@calixteman calixteman force-pushed the bug1935076_1 branch 2 times, most recently from b07771d to a5d0574 Compare January 16, 2025 10:04
@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Windows)


Failed

Full output at http://54.193.163.58:8877/b258dc512563ad8/output.txt

Total script time: 59.00 mins

  • Unit tests: Passed
  • Integration Tests: FAILED
  • Regression tests: Passed

@Snuffleupagus
Copy link
Collaborator

Snuffleupagus commented Jan 16, 2025

A little while back you mentioned potentially replacing the JBIG2 decoder with a wasm-based one, is this still something that we might at one point want to do? (Or if we want to introduce any other wasm-code, e.g. for ICC profile support.)

If so, it'd probably make sense to replace the openjpegWasmUrl/OpenjpegWasmFactory API-parameters (and the class/file names) with more general wasmUrl/WasmFactory ones instead to make that easier without having to then duplicate a lot of code.

@calixteman
Copy link
Contributor Author

A little while back you mentioned potentially replacing the JBIG2 decoder with a wasm-based one, is this still something that we might at one point want to do? (Or if we want to introduce any other wasm-code, e.g. for ICC profile support.)

Yep replacing the JBIG2 decoder with the pdfium one (afaik it's the only one with a license compatible with ours) is still something we'd like to do.
I already have more than wip for using qcms for the ICC stuff.

If so, it'd probably make sense to replace the openjpegWasmUrl/OpenjpegWasmFactory API-parameters (and the class/file names) with more general wasmUrl/WasmFactory ones instead to make that easier without having to then duplicate a lot of code.

Yes I thought about that too but then I thought it could be done later when an other wasm file will be added.
Do you prefer we do it now ?

@Snuffleupagus
Copy link
Collaborator

Yes I thought about that too but then I thought it could be done later when an other wasm file will be added.
Do you prefer we do it now ?

By doing this now we avoid breaking backwards compatibility at a later date, which definitely seems worthwhile to me!

@Snuffleupagus
Copy link
Collaborator

/botio browsertest

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Received

Command cmd_browsertest from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.241.84.105:8877/11ae6d45fb7379d/output.txt

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Windows)


Received

Command cmd_browsertest from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.193.163.58:8877/b946219caa1eb1b/output.txt

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Success

Full output at http://54.241.84.105:8877/11ae6d45fb7379d/output.txt

Total script time: 16.73 mins

  • Regression tests: Passed

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Windows)


Success

Full output at http://54.193.163.58:8877/b946219caa1eb1b/output.txt

Total script time: 30.45 mins

  • Regression tests: Passed

Copy link
Collaborator

@Snuffleupagus Snuffleupagus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r=me, with the final comments addressed; thank you!

In order to fix bug 1935076, we'll have to add a pure js fallback in case wasm is disabled
or simd isn't supported. Unfortunately, this fallback will take some space.

So, the main goal of this patch is to reduce the overall size (by ~93k).
As a side effect, it should make easier to use an other wasm file (which must export
_jp2_decode, _malloc and _free).
@calixteman
Copy link
Contributor Author

/botio test

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Windows)


Received

Command cmd_test from @calixteman received. Current queue size: 0

Live output at: http://54.193.163.58:8877/4e03ad187f48314/output.txt

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Received

Command cmd_test from @calixteman received. Current queue size: 0

Live output at: http://54.241.84.105:8877/57ada2c899049e4/output.txt

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Failed

Full output at http://54.241.84.105:8877/57ada2c899049e4/output.txt

Total script time: 28.66 mins

  • Unit tests: Passed
  • Integration Tests: FAILED
  • Regression tests: Passed

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Windows)


Failed

Full output at http://54.193.163.58:8877/4e03ad187f48314/output.txt

Total script time: 59.72 mins

  • Unit tests: FAILED
  • Integration Tests: FAILED
  • Regression tests: Passed

@calixteman calixteman merged commit 7a57af1 into mozilla:master Jan 16, 2025
9 checks passed
@calixteman
Copy link
Contributor Author

/botio makeref

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Received

Command cmd_makeref from @calixteman received. Current queue size: 0

Live output at: http://54.241.84.105:8877/4ed2d15ffd73e15/output.txt

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Windows)


Received

Command cmd_makeref from @calixteman received. Current queue size: 0

Live output at: http://54.193.163.58:8877/834b381194d2cca/output.txt

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Success

Full output at http://54.241.84.105:8877/4ed2d15ffd73e15/output.txt

Total script time: 16.66 mins

  • Make references: Passed
  • Check references: Passed

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Windows)


Success

Full output at http://54.193.163.58:8877/834b381194d2cca/output.txt

Total script time: 30.35 mins

  • Make references: Passed
  • Check references: Passed

@Snuffleupagus Snuffleupagus mentioned this pull request Mar 7, 2025
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Embed a .wasm file for the jpeg2000 decoder in order to reduce the bundle size
3 participants