aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/gspca/spca506.c
diff options
context:
space:
mode:
authorJean-Francois Moine <moinejf@free.fr>2008-07-26 07:02:47 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-07-27 10:06:42 -0400
commit1250ac6d4ab716dafe0ac245fd31cd3a7cbc0a98 (patch)
tree7fa259d8d414566ddc80bc5cba6627d7e946cd28 /drivers/media/video/gspca/spca506.c
parent496cd7e977c73df2c287eaf6d612fc49d6f83dd7 (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/spca506.c')
-rw-r--r--drivers/media/video/gspca/spca506.c105
1 files changed, 27 insertions, 78 deletions
diff --git a/drivers/media/video/gspca/spca506.c b/drivers/media/video/gspca/spca506.c
index 2c281a0563e5..6fe715c80ad2 100644
--- a/drivers/media/video/gspca/spca506.c
+++ b/drivers/media/video/gspca/spca506.c
@@ -33,10 +33,6 @@ MODULE_LICENSE("GPL");
33struct sd { 33struct sd {
34 struct gspca_dev gspca_dev; /* !! must be the first item */ 34 struct gspca_dev gspca_dev; /* !! must be the first item */
35 35
36 int buflen;
37 __u8 tmpbuf[640 * 480 * 3]; /* YYUV per line */
38 __u8 tmpbuf2[640 * 480 * 2]; /* YUYV */
39
40 unsigned char brightness; 36 unsigned char brightness;
41 unsigned char contrast; 37 unsigned char contrast;
42 unsigned char colors; 38 unsigned char colors;
@@ -115,29 +111,29 @@ static struct ctrl sd_ctrls[] = {
115}; 111};
116 112
117static struct v4l2_pix_format vga_mode[] = { 113static struct v4l2_pix_format vga_mode[] = {
118 {160, 120, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE, 114 {160, 120, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE,
119 .bytesperline = 160 * 2, 115 .bytesperline = 160 * 3,
120 .sizeimage = 160 * 120 * 2, 116 .sizeimage = 160 * 120 * 3 / 2,
121 .colorspace = V4L2_COLORSPACE_SRGB, 117 .colorspace = V4L2_COLORSPACE_SRGB,
122 .priv = 5}, 118 .priv = 5},
123 {176, 144, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE, 119 {176, 144, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE,
124 .bytesperline = 176 * 2, 120 .bytesperline = 176 * 3,
125 .sizeimage = 176 * 144 * 2, 121 .sizeimage = 176 * 144 * 3 / 2,
126 .colorspace = V4L2_COLORSPACE_SRGB, 122 .colorspace = V4L2_COLORSPACE_SRGB,
127 .priv = 4}, 123 .priv = 4},
128 {320, 240, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE, 124 {320, 240, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE,
129 .bytesperline = 320 * 2, 125 .bytesperline = 320 * 3,
130 .sizeimage = 320 * 240 * 2, 126 .sizeimage = 320 * 240 * 3 / 2,
131 .colorspace = V4L2_COLORSPACE_SRGB, 127 .colorspace = V4L2_COLORSPACE_SRGB,
132 .priv = 2}, 128 .priv = 2},
133 {352, 288, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE, 129 {352, 288, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE,
134 .bytesperline = 352 * 2, 130 .bytesperline = 352 * 3,
135 .sizeimage = 352 * 288 * 2, 131 .sizeimage = 352 * 288 * 3 / 2,
136 .colorspace = V4L2_COLORSPACE_SRGB, 132 .colorspace = V4L2_COLORSPACE_SRGB,
137 .priv = 1}, 133 .priv = 1},
138 {640, 480, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE, 134 {640, 480, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE,
139 .bytesperline = 640 * 2, 135 .bytesperline = 640 * 3,
140 .sizeimage = 640 * 480 * 2, 136 .sizeimage = 640 * 480 * 3 / 2,
141 .colorspace = V4L2_COLORSPACE_SRGB, 137 .colorspace = V4L2_COLORSPACE_SRGB,
142 .priv = 0}, 138 .priv = 0},
143}; 139};
@@ -572,77 +568,30 @@ static void sd_close(struct gspca_dev *gspca_dev)
572{ 568{
573} 569}
574 570
575/* convert YYUV per line to YUYV (YUV 4:2:2) */
576static void yyuv_decode(unsigned char *out,
577 unsigned char *in,
578 int width,
579 int height)
580{
581 unsigned char *Ui, *Vi, *yi, *yi1;
582 unsigned char *out1;
583 int i, j;
584
585 yi = in;
586 for (i = height / 2; --i >= 0; ) {
587 out1 = out + width * 2; /* next line */
588 yi1 = yi + width;
589 Ui = yi1 + width;
590 Vi = Ui + width / 2;
591 for (j = width / 2; --j >= 0; ) {
592 *out++ = 128 + *yi++;
593 *out++ = 128 + *Ui;
594 *out++ = 128 + *yi++;
595 *out++ = 128 + *Vi;
596
597 *out1++ = 128 + *yi1++;
598 *out1++ = 128 + *Ui++;
599 *out1++ = 128 + *yi1++;
600 *out1++ = 128 + *Vi++;
601 }
602 yi += width * 2;
603 out = out1;
604 }
605}
606
607static void sd_pkt_scan(struct gspca_dev *gspca_dev, 571static void sd_pkt_scan(struct gspca_dev *gspca_dev,
608 struct gspca_frame *frame, /* target */ 572 struct gspca_frame *frame, /* target */
609 __u8 *data, /* isoc packet */ 573 __u8 *data, /* isoc packet */
610 int len) /* iso packet length */ 574 int len) /* iso packet length */
611{ 575{
612 struct sd *sd = (struct sd *) gspca_dev;
613
614 switch (data[0]) { 576 switch (data[0]) {
615 case 0: /* start of frame */ 577 case 0: /* start of frame */
616 if (gspca_dev->last_packet_type == FIRST_PACKET) { 578 frame = gspca_frame_add(gspca_dev, LAST_PACKET, frame,
617 yyuv_decode(sd->tmpbuf2, sd->tmpbuf, 579 data, 0);
618 gspca_dev->width,
619 gspca_dev->height);
620 frame = gspca_frame_add(gspca_dev,
621 LAST_PACKET,
622 frame,
623 sd->tmpbuf2,
624 gspca_dev->width
625 * gspca_dev->height
626 * 2);
627 }
628 gspca_frame_add(gspca_dev, FIRST_PACKET, frame,
629 data, 0);
630 data += SPCA50X_OFFSET_DATA; 580 data += SPCA50X_OFFSET_DATA;
631 len -= SPCA50X_OFFSET_DATA; 581 len -= SPCA50X_OFFSET_DATA;
632 if (len > 0) 582 gspca_frame_add(gspca_dev, FIRST_PACKET, frame,
633 memcpy(sd->tmpbuf, data, len); 583 data, len);
634 else 584 break;
635 len = 0;
636 sd->buflen = len;
637 return;
638 case 0xff: /* drop */ 585 case 0xff: /* drop */
639/* gspca_dev->last_packet_type = DISCARD_PACKET; */ 586/* gspca_dev->last_packet_type = DISCARD_PACKET; */
640 return; 587 break;
588 default:
589 data += 1;
590 len -= 1;
591 gspca_frame_add(gspca_dev, FIRST_PACKET, frame,
592 data, len);
593 break;
641 } 594 }
642 data += 1;
643 len -= 1;
644 memcpy(&sd->tmpbuf[sd->buflen], data, len);
645 sd->buflen += len;
646} 595}
647 596
648static void setbrightness(struct gspca_dev *gspca_dev) 597static void setbrightness(struct gspca_dev *gspca_dev)