guardianproject/InformaCore — pull request #58 by n8fr8 (2014-09-26 05:37:20+00:00)
Title: Work on improving detect+import process

Based on comments from Martin today in the scrum, I spent some time looking at the media import process in the InformaCam app to see how we might make it more efficient.

First, I discovered that at some point, we try to load the entire full bitmap of each captured image into memory (in order to generate thumbnail) which uses up a ton of memory, and cause out of memory errors. Now, we don't do this, and it reduces memory usage and improves import speed a great deal.

Second, I changed the detection+import process to work in the background while photos or videos are being captured. This means that as soon as you take a photo, it is imported and analyzed and associated with whatever sensor caches exist at the current time. The sensor cache then resets (mostly) for the next media capture event, so that you don't have the huge massive sensor log caches if you are shooting many photos or videos over an extended period of time.

This also means that, for the most part, when you return to the gallery view, the captured media has already been processed, and is displayed there - yay!

Third, I improved the speed of the main file hash logic a bit, processing the file in 64kb chunks instead of 8kb, and there is a definite improvement there. We should probably implemented our SHA-1 hashing in C at some point, which would really speed up that step of code (which takes a few seconds per file now).