Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 174049
b: refs/heads/master
c: cc409c0
h: refs/heads/master
i:
  174047: da4c662
v: v3
  • Loading branch information
Marton Nemeth authored and Mauro Carvalho Chehab committed Dec 5, 2009
1 parent 6ef4d2b commit 9d1d691
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 17 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a6b69e409a41144c24dcbecdc174a5c847631de2
refs/heads/master: cc409c0efb40a4c99cf023ec12ba7d67c67f666b
42 changes: 26 additions & 16 deletions trunk/drivers/media/video/gspca/pac7311.c
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,7 @@ static void do_autogain(struct gspca_dev *gspca_dev)
}

/* JPEG header, part 1 */
static const unsigned char pac7311_jpeg_header1[] = {
static const unsigned char pac_jpeg_header1[] = {
0xff, 0xd8, /* SOI: Start of Image */

0xff, 0xc0, /* SOF0: Start of Frame (Baseline DCT) */
Expand All @@ -813,7 +813,7 @@ static const unsigned char pac7311_jpeg_header1[] = {
};

/* JPEG header, continued */
static const unsigned char pac7311_jpeg_header2[] = {
static const unsigned char pac_jpeg_header2[] = {
0x03, /* Number of image components: 3 */
0x01, 0x21, 0x00, /* ID=1, Subsampling 1x1, Quantization table: 0 */
0x02, 0x11, 0x01, /* ID=2, Subsampling 2x1, Quantization table: 1 */
Expand All @@ -829,6 +829,26 @@ static const unsigned char pac7311_jpeg_header2[] = {
0x00 /* Successive approximation: 0 */
};

static void pac_start_frame(struct gspca_dev *gspca_dev,
struct gspca_frame *frame,
__u16 lines, __u16 samples_per_line)
{
unsigned char tmpbuf[4];

gspca_frame_add(gspca_dev, FIRST_PACKET, frame,
pac_jpeg_header1, sizeof(pac_jpeg_header1));

tmpbuf[0] = lines >> 8;
tmpbuf[1] = lines & 0xff;
tmpbuf[2] = samples_per_line >> 8;
tmpbuf[3] = samples_per_line & 0xff;

gspca_frame_add(gspca_dev, INTER_PACKET, frame,
tmpbuf, sizeof(tmpbuf));
gspca_frame_add(gspca_dev, INTER_PACKET, frame,
pac_jpeg_header2, sizeof(pac_jpeg_header2));
}

/* this function is run at interrupt level */
static void sd_pkt_scan(struct gspca_dev *gspca_dev,
struct gspca_frame *frame, /* target */
Expand All @@ -840,7 +860,6 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,

sof = pac_find_sof(&sd->sof_read, data, len);
if (sof) {
unsigned char tmpbuf[4];
int n, lum_offset, footer_length;

if (sd->sensor == SENSOR_PAC7302) {
Expand Down Expand Up @@ -882,23 +901,14 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
atomic_set(&sd->avg_lum, -1);

/* Start the new frame with the jpeg header */
gspca_frame_add(gspca_dev, FIRST_PACKET, frame,
pac7311_jpeg_header1, sizeof(pac7311_jpeg_header1));
if (sd->sensor == SENSOR_PAC7302) {
/* The PAC7302 has the image rotated 90 degrees */
tmpbuf[0] = gspca_dev->width >> 8;
tmpbuf[1] = gspca_dev->width & 0xff;
tmpbuf[2] = gspca_dev->height >> 8;
tmpbuf[3] = gspca_dev->height & 0xff;
pac_start_frame(gspca_dev, frame,
gspca_dev->width, gspca_dev->height);
} else {
tmpbuf[0] = gspca_dev->height >> 8;
tmpbuf[1] = gspca_dev->height & 0xff;
tmpbuf[2] = gspca_dev->width >> 8;
tmpbuf[3] = gspca_dev->width & 0xff;
pac_start_frame(gspca_dev, frame,
gspca_dev->height, gspca_dev->width);
}
gspca_frame_add(gspca_dev, INTER_PACKET, frame, tmpbuf, 4);
gspca_frame_add(gspca_dev, INTER_PACKET, frame,
pac7311_jpeg_header2, sizeof(pac7311_jpeg_header2));
}
gspca_frame_add(gspca_dev, INTER_PACKET, frame, data, len);
}
Expand Down

0 comments on commit 9d1d691

Please sign in to comment.