martedì 25 maggio 2010

Android Camera performance: new Options for preview callbacks in froyo

I managed to install the new Android Froyo release on my nexus one yesterday (a bit late I know... ;) ). I was really excited by the new features introduced by the google team (WiFi and BlueTooth hotspot device transformation capability, increased JIT performance, and so on...). Among the other features the release note reported some improvement on the camera preview side. The problem with the camera was that using the preview callback didn't allow to directly access the buffered preview calls running into poor performance frame preview that involved too many gc() calls for camera applications (Further informations are reported both in google group discussions and in details at http://nhenze.net/?p=349 - see comment #6 of that post to find a reflection trick to avoid using native code). Anyway it seems that the new Android platform version fixed this problem on the SDK!!! I haven't already tested the new implementation in order to understand the real performances, but if you dive into the android.hardware.Camera documentation both on 2.1 and 2.2 version, you can find the possible reason of that: new methods that were @hidden into the 2.1 version are now available (in particular: addCallbackBuffer(PreviewCallback pc) and setPreviewCallBackWithBuffer(byte[] buffer)). They will not only help to avoid gc() but their usage will also help performances when manipulating image frames to realize real time camera applications... I'm gonna test the implementation in my spare time...

Stay connected...

Nessun commento: