Code update 4 – improving buffering

Over the last couple of weeks a lot of spare time went into improving the code that controls the image capturing. The main bug to address was that the image capturing would ‘hang’ after a certain amount of time when capturing say round 10 seconds or more of 720p 12 bit images.

We revisited the code and the multi-threaded buffering algorithm. Putting the buffer and the code that empties the buffer on a separate thread, away from the main user interfacing window thread dramatically improved the performance. The ‘hanging’ capturing was solved except for the fact that at some times the output of Ximea API messages can still interfere with the code, which is at the capturing stage pushing all boundaries of the raspberry pi 3. When run with an open terminal window the problem is solved but we will ‘silence’ the API output further in order to completely solve the issue.

The only other point to note is that when capturing 720p resolution (the highest option) and at 12 bit, the image capture buffer fills up quite rapidly as the large RAW images take time to be written to microSD card. When ~300 images are in the buffer the raspberry pi sort of gives up and starts ‘sputtering’. Waiting long enough for the buffer to empty solves the situation but you will lose images.

Best options in this ‘best mode’ are to capture shorter shots. Also scaling back to 8 bit RAW dramatically slows down filling up of the buffer. Another option is to move to 540p at 12 bit.

A final ‘disturbing’ issue is that the Ximea camera every now and then ‘disconnects’ and throws an error. The ConnectCam button needs to be pressed to reset the connection and filming can resume. Whether this is a bad USB cable issue or something else will be investigated.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.