lundi 6 mars 2017

Slow BitmapData.draw() with matrix from camera video

Im building an iOS AIR app using AS3/Flash builder.

The app grabs the camera stream into a video object and then draws that to a BitmapData. The camera stream is 1280x720px and the container is 2208x1242px (iPhone 7+) so I need to scale the footage. I also need to rotate it around the center point:


I have timed the drawing operation with matrix:

videoBitmapData.draw(video,mat); //9-11ms

And without matrix:

videoBitmapData.draw(video); //2-3ms

Clearly the transformation is slowing me down. Is there a faster way to do this? Maybe drawing first, then applying the matrix somehow? Pre-rotating something? Leveraging native scaling/rotation? Can I skip using the video object somehow? Accessing the camera data in a more raw form?

I see no difference using render mode GPU vs CPU.


Aucun commentaire:

Enregistrer un commentaire