One costly part of our app is image decoding. We use a custom codec not supported by browser - and which has a C++ implementation. We want a high frame rate, so I'm investigating options to improve performance. I thought we could pass the encoded image to a C++ function, decode and return the decoded result to the JS. Can I pass TypedArrays into the C++? (One as input, one to hold the output.) The wiki page "Interacting with Compiled Code<https://github.com/kripken/emscripten/wiki/Interacting-with-code>" only says that JS native types Number and String can be used. I could pass the encoded input as a String I suppose. But what about the output? In order to avoid copying, I would like to decode directly into the TypedArray from a Canvas 2d context ImageData object. As for using the C++ heap, I can't see how to do that without copying back and forth - as per the "Accessing Memory" example in the wiki page. (Well, maybe I could wrap a TypedArray around a part of Emscripten's heap ArrayBuffer that I reserved with malloc, but that would only useful with JS APIs that only consume TypedArrays - and it doesn't allow me to efficiently get the data from a TypedArray into the C++.) Maybe I've tried an awkward split between the C++ and the JS. Any comments welcome, thanks ben
-- You received this message because you are subscribed to the Google Groups "emscripten-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
