mandrake icon indicating copy to clipboard operation
mandrake copied to clipboard

Parallelise animation frame drawing

Open johnlees opened this issue 4 years ago • 0 comments

This is a bit of a pain because to do this in python we need to use process_map, but this requires all arguments to the mapped function can be pickled. Pickling is possible in pybind11 (see https://pybind11.readthedocs.io/en/stable/advanced/classes.html#pickling-support) but seems to be designed for binary streams, which would result in many large copies. Using shared_ptr didn't work out in my attempts.

An alternative is to load everything into numpy and use python shared memory. This doubles memory use, and is a big faff.

Perhaps a practical alternative is just to wrap a raw pointer in a class, and be careful how you use it. It's a fairly marginal gain as the ffmpeg encoding takes ages (single threaded) anyway.

johnlees avatar Oct 18 '21 16:10 johnlees