[squeak-dev] Get raw 24 Bit image data into a Form

tim Rowledge tim at rowledge.org
Sun Aug 30 18:04:01 UTC 2015


On 30-08-2015, at 8:19 AM, Herbert König <herbertkoenig at gmx.net> wrote:
> this works with image size of 320 @ 208. On my A+ with a size of 1280*832 Tim's version takes 10-12 seconds without displaying the Form. Levente's version takes about 1.5 to 3 seconds. This is already too slow for me.
>  

You’re not going to get hugely faster with any code that involves a cycle of writing a file from raspiyuv and then reading that file. The FS interface on the Pi simply isn’t all that quick.

What you might be able to do is cut out the middle… err, fileman, and get access to the camera buffer directly. I have no idea exactly how the hardware works but for the Scratch camera UI we go via v4linux2 and mmap stuff. Maybe it’s possible to even side-step v4l2 ?

As an example on my Pi2 -
sudo modprobe bcm2835-v4l2
- to get the video4linux2 driver loaded
|frameForm|
(CameraPlugin cameraName: 1) ifNotNil: [|n frameExtent t|
	(CameraPlugin openCamera: 1 width: 1296 height: 832) ifNotNil: [
				frameForm  :=  Form extent: (CameraPlugin frameExtent: 1) depth: 32.
				frameExtent  :=  frameForm extent.
				Delay waitMSecs: 400].
	t := Time millisecondsToRun: [n  :=  CameraPlugin getFrameForCamera: 1 into: frameForm bits].
	CameraPlugin closeCamera: 1.
	n = 0 ifTrue: [^ false].  
	frameForm display.
	t] 
= 18mSec
So, much faster it seems. The CameraPlugin code is available from the squeakvm.org svn tree easily enough and the Smalltalk code is easily sendable. The plugin itself is included in any recent Pi VM.
Even if the A+ takes 3x longer it seems potentially useful to me.

tim
--
tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
Never write software that anthropomorphizes the machine. They hate that.




More information about the Squeak-dev mailing list