diff options
author | Jean-Francois Moine <moinejf@free.fr> | 2008-07-26 07:02:47 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-07-27 10:06:42 -0400 |
commit | 1250ac6d4ab716dafe0ac245fd31cd3a7cbc0a98 (patch) | |
tree | 7fa259d8d414566ddc80bc5cba6627d7e946cd28 /drivers/media/video/gspca/spca508.c | |
parent | 496cd7e977c73df2c287eaf6d612fc49d6f83dd7 (diff) |
V4L/DVB (8518): gspca: Remove the remaining frame decoding functions from the subdrivers.
SPCA505 and SPCA508 added in the pixel formats.
Decode functions and associated resources removed in spca505, 506 and 508.
The decode routines are now found in the V4L library.
Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/gspca/spca508.c')
-rw-r--r-- | drivers/media/video/gspca/spca508.c | 91 |
1 files changed, 20 insertions, 71 deletions
diff --git a/drivers/media/video/gspca/spca508.c b/drivers/media/video/gspca/spca508.c index af531d62856..4378e966edc 100644 --- a/drivers/media/video/gspca/spca508.c +++ b/drivers/media/video/gspca/spca508.c | |||
@@ -30,10 +30,6 @@ MODULE_LICENSE("GPL"); | |||
30 | struct sd { | 30 | struct sd { |
31 | struct gspca_dev gspca_dev; /* !! must be the first item */ | 31 | struct gspca_dev gspca_dev; /* !! must be the first item */ |
32 | 32 | ||
33 | int buflen; | ||
34 | unsigned char tmpbuf[352 * 288 * 3 / 2]; /* YUVY per line */ | ||
35 | unsigned char tmpbuf2[352 * 288 * 2]; /* YUYV */ | ||
36 | |||
37 | unsigned char brightness; | 33 | unsigned char brightness; |
38 | 34 | ||
39 | char subtype; | 35 | char subtype; |
@@ -68,23 +64,23 @@ static struct ctrl sd_ctrls[] = { | |||
68 | 64 | ||
69 | static struct v4l2_pix_format sif_mode[] = { | 65 | static struct v4l2_pix_format sif_mode[] = { |
70 | {160, 120, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE, | 66 | {160, 120, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE, |
71 | .bytesperline = 160 * 2, | 67 | .bytesperline = 160 * 3, |
72 | .sizeimage = 160 * 120 * 2, | 68 | .sizeimage = 160 * 120 * 3 / 2, |
73 | .colorspace = V4L2_COLORSPACE_SRGB, | 69 | .colorspace = V4L2_COLORSPACE_SRGB, |
74 | .priv = 3}, | 70 | .priv = 3}, |
75 | {176, 144, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE, | 71 | {176, 144, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE, |
76 | .bytesperline = 176 * 2, | 72 | .bytesperline = 176 * 3, |
77 | .sizeimage = 176 * 144 * 2, | 73 | .sizeimage = 176 * 144 * 3 / 2, |
78 | .colorspace = V4L2_COLORSPACE_SRGB, | 74 | .colorspace = V4L2_COLORSPACE_SRGB, |
79 | .priv = 2}, | 75 | .priv = 2}, |
80 | {320, 240, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE, | 76 | {320, 240, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE, |
81 | .bytesperline = 320 * 2, | 77 | .bytesperline = 320 * 3, |
82 | .sizeimage = 320 * 240 * 2, | 78 | .sizeimage = 320 * 240 * 3 / 2, |
83 | .colorspace = V4L2_COLORSPACE_SRGB, | 79 | .colorspace = V4L2_COLORSPACE_SRGB, |
84 | .priv = 1}, | 80 | .priv = 1}, |
85 | {352, 288, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE, | 81 | {352, 288, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE, |
86 | .bytesperline = 352 * 2, | 82 | .bytesperline = 352 * 3, |
87 | .sizeimage = 352 * 288 * 2, | 83 | .sizeimage = 352 * 288 * 3 / 2, |
88 | .colorspace = V4L2_COLORSPACE_SRGB, | 84 | .colorspace = V4L2_COLORSPACE_SRGB, |
89 | .priv = 0}, | 85 | .priv = 0}, |
90 | }; | 86 | }; |
@@ -1567,77 +1563,30 @@ static void sd_close(struct gspca_dev *gspca_dev) | |||
1567 | { | 1563 | { |
1568 | } | 1564 | } |
1569 | 1565 | ||
1570 | /* convert YUVY per line to YUYV (YUV 4:2:2) */ | ||
1571 | static void yuvy_decode(unsigned char *out, | ||
1572 | unsigned char *in, | ||
1573 | int width, | ||
1574 | int height) | ||
1575 | { | ||
1576 | unsigned char *Ui, *Vi, *yi, *yi1; | ||
1577 | unsigned char *out1; | ||
1578 | int i, j; | ||
1579 | |||
1580 | yi = in; | ||
1581 | for (i = height / 2; --i >= 0; ) { | ||
1582 | out1 = out + width * 2; /* next line */ | ||
1583 | Ui = yi + width; | ||
1584 | Vi = Ui + width / 2; | ||
1585 | yi1 = Vi + width / 2; | ||
1586 | for (j = width / 2; --j >= 0; ) { | ||
1587 | *out++ = 128 + *yi++; | ||
1588 | *out++ = 128 + *Ui; | ||
1589 | *out++ = 128 + *yi++; | ||
1590 | *out++ = 128 + *Vi; | ||
1591 | |||
1592 | *out1++ = 128 + *yi1++; | ||
1593 | *out1++ = 128 + *Ui++; | ||
1594 | *out1++ = 128 + *yi1++; | ||
1595 | *out1++ = 128 + *Vi++; | ||
1596 | } | ||
1597 | yi += width * 2; | ||
1598 | out = out1; | ||
1599 | } | ||
1600 | } | ||
1601 | |||
1602 | static void sd_pkt_scan(struct gspca_dev *gspca_dev, | 1566 | static void sd_pkt_scan(struct gspca_dev *gspca_dev, |
1603 | struct gspca_frame *frame, /* target */ | 1567 | struct gspca_frame *frame, /* target */ |
1604 | __u8 *data, /* isoc packet */ | 1568 | __u8 *data, /* isoc packet */ |
1605 | int len) /* iso packet length */ | 1569 | int len) /* iso packet length */ |
1606 | { | 1570 | { |
1607 | struct sd *sd = (struct sd *) gspca_dev; | ||
1608 | |||
1609 | switch (data[0]) { | 1571 | switch (data[0]) { |
1610 | case 0: /* start of frame */ | 1572 | case 0: /* start of frame */ |
1611 | if (gspca_dev->last_packet_type == FIRST_PACKET) { | 1573 | frame = gspca_frame_add(gspca_dev, LAST_PACKET, frame, |
1612 | yuvy_decode(sd->tmpbuf2, sd->tmpbuf, | 1574 | data, 0); |
1613 | gspca_dev->width, | ||
1614 | gspca_dev->height); | ||
1615 | frame = gspca_frame_add(gspca_dev, | ||
1616 | LAST_PACKET, | ||
1617 | frame, | ||
1618 | sd->tmpbuf2, | ||
1619 | gspca_dev->width | ||
1620 | * gspca_dev->height | ||
1621 | * 2); | ||
1622 | } | ||
1623 | gspca_frame_add(gspca_dev, FIRST_PACKET, frame, | ||
1624 | data, 0); | ||
1625 | data += SPCA508_OFFSET_DATA; | 1575 | data += SPCA508_OFFSET_DATA; |
1626 | len -= SPCA508_OFFSET_DATA; | 1576 | len -= SPCA508_OFFSET_DATA; |
1627 | if (len > 0) | 1577 | gspca_frame_add(gspca_dev, FIRST_PACKET, frame, |
1628 | memcpy(sd->tmpbuf, data, len); | 1578 | data, len); |
1629 | else | 1579 | break; |
1630 | len = 0; | ||
1631 | sd->buflen = len; | ||
1632 | return; | ||
1633 | case 0xff: /* drop */ | 1580 | case 0xff: /* drop */ |
1634 | /* gspca_dev->last_packet_type = DISCARD_PACKET; */ | 1581 | /* gspca_dev->last_packet_type = DISCARD_PACKET; */ |
1635 | return; | 1582 | break; |
1583 | default: | ||
1584 | data += 1; | ||
1585 | len -= 1; | ||
1586 | gspca_frame_add(gspca_dev, FIRST_PACKET, frame, | ||
1587 | data, len); | ||
1588 | break; | ||
1636 | } | 1589 | } |
1637 | data += 1; | ||
1638 | len -= 1; | ||
1639 | memcpy(&sd->tmpbuf[sd->buflen], data, len); | ||
1640 | sd->buflen += len; | ||
1641 | } | 1590 | } |
1642 | 1591 | ||
1643 | static void setbrightness(struct gspca_dev *gspca_dev) | 1592 | static void setbrightness(struct gspca_dev *gspca_dev) |