Divide error in fetch_frame when enabling compression (0.4.3)

Nick Holloway Nick.Holloway@alfie.demon.co.uk
28 Nov 1999 09:55:19 -0000


To calculate the transfer rate, the following is used within fetch_frame:

    rate = image_size * HZ / 1024 / (jiffies-oldjif);

When compression is enabled, it would appear that you can still be on
the same jiffy, and so you get a divide error (which leads to a SEGV
being sent to the application, and a reboot before further use of the
device is allowed).

As I didn't care about the accuracy, I just added a "+1" to the jiffy
difference.  This confirmed that this was the problem.

Alternatively, treat a zero difference observed as 1/2 jiffy:

    oldjif = jiffies-oldjif;
    rate = image_size * HZ / 512 / (oldjif ? 2*oldjif : 1 );

-- 
 `O O'  | Nick.Holloway@alfie.demon.co.uk
// ^ \\ | http://www.alfie.demon.co.uk/
-----------------------------------------------------------------------------
To unsubscribe from this mailinglist, send the line "unsubscribe vision-webcam" in the
body of a message to "majordomo@errors.no".