Eruption - What is LavaRnd?
Obsidian - FAQ
Lava - Demos
Lavaologists - About us
Strata - New and old stuff
Magma - Download
Bedrock - Developers

LavaRnd Logitech QuickCam 4000 Pro webcam settings

To maximize the noise to signal ratio of the chaotic source, LavaRnd cranks up the webcam settings to maximize the chaotic noise that the CCD records. The following sections describe these settings.

Linux module setting

The /etc/hotplug/usb/pwc performs the following modprobe:
/sbin/modprobe pwc size=vga fps=15 leds=250,750 fbufs=2 mbufs=1 compression=0

Open camera state

The camset tool:
camset pwc740 /dev/video0 -L -v 1
reports that the default LavaRnd open state of the camera is as follows:
Camera name: Logitech QuickCam Pro 4000
Philips camera type: 740
Picture brightness: 65024
Picture colour: 65468
Picture contrast: 64512
Picture gamma: 63488
Picture depth: 24
Min width: 160
Min height: 120
Max width: 640
Max height: 480
Width: 160
Height: 120
Framerate (fps): 30
Compression preference: 0
White balance (2): fluorescent
LED on time: 25500
LED off time: 19100
Electronic sharpness: 64512
Backlight compression (0): OFF
Flicker suppression (0): OFF
Dynamic noise reduction (0): OFF
Manual gain control (AGC): 0
Video mbuf size: 460800
Video mbuf count: 1
Palette: YUV 4:2:0 Planar (15)

Camera sanity check parameters

To help ensure that the camera is operating in a proper fashion, the LavaRnd camop layer performs the following sanity checks as reported by the camset tool:
17 most frequent octet values are considered common
max fraction of frame containing common octet values: 0.557056
20 most common values must be < 1/2 of frame octets
max fraction of bits same in next frame: 0.300359 (min is 1-max = 0.699641)
NOTE: In the above, the frame refers to only the chaos potion of the frame. See the camera frame size below.

Camera frame size

When using the -L default LavaRnd settings, the following frame information is reported by the camset tool:
read size: 460800
read LavaRnd offset: 0
read LavaRnd length: 19200

mmap size: 460800
mmap frame size: 460800
mmap frames: 1
mmap LavaRnd offset: 0
mmap LavaRnd length: 19200

will use mmap I/O
mmap image: 460800
chaos size: 19200
chaos offset: 0

LavaRnd output rate

We use the lavadump tool to measure the amount of time it takes for LavaRnd to output 1 Megabyte (1048576 octets) for a given camera. When using lavadump, we set the default LavaRnd parameters (see above), and we disable the normal warm-up wait period. These tests were perform on a Linux system with a detected 1529.526 MHz Athlon processor (3053.97 BogoMIPS) using the following command:
time lavadump pwc740 /dev/video0 1048576 alpha_rate -L -T 0 >/dev/null
lavadump of 1 Megabyte
alpha rate bits/second real seconds user seconds system seconds

You should remember that the lavadump tool, while it performs the LavaRnd Digital Blendertm Algorithm using the server libraries, is intended for use as a test tool only. One should use the LavaRnd application interface (API) and allow the lavapool daemon to access the webcam and buffer the random numbers.

An application using the LavaRnd API can receive random data at a high rate as long as the lavapool daemon's buffer contains random data. One may configure the size of the lavapool buffer by adjusting the poolsize value in the cfg.lavapool file. So unless your application requires a great deal of random data over an extended period of time, the actual output rate of the webcam may not be that important.

An alpha rate of 8.0 is used when the lavapool buffer is below the fastpool configure value. As the buffer level increases to the slowpool, the alpha rate drops to 1.0. Above the slowpool an alpha rate of 1.0 is used.

The above timings suggest that the random data output rate is not limited by the CPU, but rather by the webcam's ability to output chaos. The limiting factor in webcam chaos output may be a combination of the webcam frame rate & size, perhaps the webcam signal to noise ratio, and the webcam data transfer rate.

Entropy measurements

We use the imgtally tool to process 131072 frames:
imgtally pwc740 /dev/video0 131072 /var/tmp/tally_file -L -v 2

to produce the following entropy measurement on the luminance data found in a webcam frame:

Shannon entropy bit measure:    XXX - TBD
Shannon total image entropy:    XXX - TBD
Shannon estimate entropy/pixel:      XXX - TBD

NOTE: The above is not a measurement of LavaRnd's output, it is a measurement of the luminance that would have been feed to the LavaRnd Digital Blendertm Algorithm to produce random data.

Luminance octet value distribution

Using the gnuplot on the /var/tmp/tally_file file (produced by the previous imgtally command), we can observe the distribution of octet values within the raw luminance data:


Additional resources

See the webcam page for information about other webcams that LavaRnd supports.

For more information using the Linux pwc driver, see Landon Curt Noll's Philips / Logitech USB camera setup for RedHat Linux page.

Credit: Many thanks goes to Martin Kretschmar (mail at Martin dash Kretschmar dot de) for his help in establishing the operational parameters for the pwc740.

SourceForge.net Logo
Home  |   LavaRnd?  |   FAQ  |   Demos  |   About us  |   New & Old  |   Download  |   Developers  |   Tour