acdha / jp2-polyfill

Experimenting with JavaScript decoding for browsers without native JPEG-2000 support
http://acdha.github.io/jp2-polyfill/demo.html
Other
8 stars 0 forks source link

OpenJPEG 2 upgrade #1

Open acdha opened 9 years ago

acdha commented 9 years ago

See https://github.com/kripken/j2k.js/issues/8

Current build process:

emconfigure cmake -DCMAKE_TOOLCHAIN_FILE=/usr/local/Cellar/emscripten/1.24.0/libexec/cmake/Modules/Platform/Emscripten.cmake -DEMSCRIPTEN=1 -DOPJ_BIG_ENDIAN=0 -DCFLAGS=-O1 .
emmake make
acdha commented 9 years ago

Current status: opj_decompress builds but needs some packaging work to actually fake file I/O so run() will work

acdha commented 9 years ago

The most immediate step would be porting this hack:

https://github.com/kripken/j2k.js/blob/eae124dae2cab3ae91c44e2838bb82cf5b3b11b0/codec/j2k_to_image.c#L799-L801

A more complete solution might be to fork opj_decompress and add support for accepting the desired output image dimensions so we could selectively decode only the resolution level needed for that level of detail and simplify things so e.g. output will always be the 8-bit RGBA format which our canvas supports.