Skip to content

Commit

Permalink
wip: Update jpeg decoder.
Browse files Browse the repository at this point in the history
I was trying to see an xray that I got recently (happy to email it
privately if it helps), which fails to decode on the demo with:

```
JPX Error: Unsupported COD options (selectiveArithmeticCodingBypass) jpx.js:339:23
```

So this tries to update to openjpeg via
mozilla/pdf.js#17946, which should support it.
However:

 * It's very WIP (the image decodes correctly on the worker, but I only
   see black on the canvas, however I see correct metadata).
 * I haven't updated all the references to the other decoders.
 * It loads the non-jpeg decoders as a module which I can't test, but
   probably breaks them. I also need to update the sync decoders, which
   likely doesn't work.

I don't think I'll have time to finish this, but posting it here in case
it saves someone time or someone has the time to finish it up.

Thanks.
  • Loading branch information
emilio committed Apr 21, 2024
1 parent deff835 commit 3f2b2d1
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 2,414 deletions.
185 changes: 0 additions & 185 deletions decoders/pdfjs/arithmetic_decoder.js

This file was deleted.

9 changes: 2 additions & 7 deletions decoders/pdfjs/decode-jpeg2000.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,10 @@
// Do not warn if these variables were not defined before.
/* global importScripts, JpxImage */

importScripts('jpx.js', 'util.js', 'arithmetic_decoder.js');
import { JpxImage } from "./jpx.js";

self.addEventListener('message', function (event) {

// decode DICOM buffer
var decoder = new JpxImage();
decoder.parse(event.data.buffer);
let res = JpxImage.decode(event.data.buffer, /* ignoreColorSpace = */ false);
// post decoded data
var res = decoder.tiles[0].items;
self.postMessage([res]);

}, false);
Loading

0 comments on commit 3f2b2d1

Please sign in to comment.