26
26
/* We calculate the autogain at the end of the transfer of a frame, at this
27
moment a frame with the old settings is being transmitted, and a frame is
28
being captured with the old settings. So if we adjust the autogain we must
29
ignore atleast the 2 next frames for the new settings to come into effect
30
before doing any other adjustments */
31
#define PAC_AUTOGAIN_IGNORE_FRAMES 3
27
moment a frame with the old settings is being captured and transmitted. So
28
if we adjust the gain or exposure we must ignore atleast the next frame for
29
the new settings to come into effect before doing any other adjustments. */
30
#define PAC_AUTOGAIN_IGNORE_FRAMES 2
33
32
static const unsigned char pac_sof_marker[5] =
34
33
{ 0xff, 0xff, 0x00, 0xff, 0x96 };
36
static unsigned char *pac_find_sof(struct gspca_dev *gspca_dev,
36
The following state machine finds the SOF marker sequence
37
0xff, 0xff, 0x00, 0xff, 0x96 in a byte stream.
40
| 0: START |<---------------\
44
+----------+ otherwise |
45
| 1 |--------------->*
52
| | 2 |--------------->*
59
| | |--------------->*
60
| +----------+ otherwise ^
66
+----------+ otherwise
74
static unsigned char *pac_find_sof(u8 *sof_read,
37
75
unsigned char *m, int len)
39
struct sd *sd = (struct sd *) gspca_dev;
42
79
/* Search for the SOF marker (fixed part) in the header */
43
80
for (i = 0; i < len; i++) {
44
if (m[i] == pac_sof_marker[sd->sof_read]) {
46
if (sd->sof_read == sizeof(pac_sof_marker)) {
98
/* stay in this state */
48
115
"SOF found, bytes to analyze: %u."
49
116
" Frame starts at byte #%u",