[Prev][Next][Index][Thread]

Re: qcam on NetBSD



Russ writes:
> a fair bit of time is spent in the unpacking from a guess or from
> profiling?
> 

Educated Guessing, and here's why:

The four possible modes

1.  4bpp, unidirectional
2.  6bpp, unidirectional
3.  4bpp, bi-directional
4.  6bpp, bi-directional.

The simplest is mode 1, which is 4bpp, uni-directional.  4 bits at a
time, simply shift over by 4 to the right (ie, encoded in the high order
4 bits of the byte)  The qcam-0.3 packs them into a byte, and then
unpacks them.  No need to do that..

Next simplest is mode 4, which is 2 6 bit words encoded into 14 bits.  Bits
1 thru 6 of the low byte are the low word.  Bit 0 is flag/handshake.  Bit 8,
bits 3 thru 7 of the high order byte are the second 6 bit byte.

(simple, just shifting.  Don't do mul/div in a driver..  Do shifting, 
subtracting, adding.)

Next one, is mode 2.  Yech.  Look in my protocol.txt for that mess..
I believe though you can decode that one on the fly using just
shifts.. (again, check out my uni-directional.c in released code)

Mode 3, I'm not sure yet.  Looks to me like 4 bit bytes encoded into
12 bits, but I'm still working on it..

So, see the logic?  Greatest speed comes from least amount of work..

-- 
Thomas Davis			| Internet:	Thomas.Davis@mnscorp.com
Systems Consultant		| Snail Mail:	Suite 528
Midwest Network Solutions Corp.	| 		1941 South 42nd Street
(402) 346-7687			|		Omaha, NE 68105-2939

References: