aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/gspca/spca505.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/spca505.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/spca505.c')
-rw-r--r--drivers/media/video/gspca/spca505.c105
1 files changed, 27 insertions, 78 deletions
diff --git a/drivers/media/video/gspca/spca505.c b/drivers/media/video/gspca/spca505.c
index 284d549e4d3e..32ffe5556061 100644
--- a/drivers/media/video/gspca/spca505.c
+++ b/drivers/media/video/gspca/spca505.c
@@ -31,10 +31,6 @@ MODULE_LICENSE("GPL");
31struct sd { 31struct sd {
32 struct gspca_dev gspca_dev; /* !! must be the first item */ 32 struct gspca_dev gspca_dev; /* !! must be the first item */
33 33
34 int buflen;
35 unsigned char tmpbuf[640 * 480 * 3 / 2]; /* YYUV per line */
36 unsigned char tmpbuf2[640 * 480 * 2]; /* YUYV */
37
38 unsigned char brightness; 34 unsigned char brightness;
39 35
40 char subtype; 36 char subtype;
@@ -64,29 +60,29 @@ static struct ctrl sd_ctrls[] = {
64}; 60};
65 61
66static struct v4l2_pix_format vga_mode[] = { 62static struct v4l2_pix_format vga_mode[] = {
67 {160, 120, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE, 63 {160, 120, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE,
68 .bytesperline = 160 * 2, 64 .bytesperline = 160 * 3,
69 .sizeimage = 160 * 120 * 2, 65 .sizeimage = 160 * 120 * 3 / 2,
70 .colorspace = V4L2_COLORSPACE_SRGB, 66 .colorspace = V4L2_COLORSPACE_SRGB,
71 .priv = 5}, 67 .priv = 5},
72 {176, 144, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE, 68 {176, 144, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE,
73 .bytesperline = 176 * 2, 69 .bytesperline = 176 * 3,
74 .sizeimage = 176 * 144 * 2, 70 .sizeimage = 176 * 144 * 3 / 2,
75 .colorspace = V4L2_COLORSPACE_SRGB, 71 .colorspace = V4L2_COLORSPACE_SRGB,
76 .priv = 4}, 72 .priv = 4},
77 {320, 240, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE, 73 {320, 240, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE,
78 .bytesperline = 320 * 2, 74 .bytesperline = 320 * 3,
79 .sizeimage = 320 * 240 * 2, 75 .sizeimage = 320 * 240 * 3 / 2,
80 .colorspace = V4L2_COLORSPACE_SRGB, 76 .colorspace = V4L2_COLORSPACE_SRGB,
81 .priv = 2}, 77 .priv = 2},
82 {352, 288, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE, 78 {352, 288, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE,
83 .bytesperline = 352 * 2, 79 .bytesperline = 352 * 3,
84 .sizeimage = 352 * 288 * 2, 80 .sizeimage = 352 * 288 * 3 / 2,
85 .colorspace = V4L2_COLORSPACE_SRGB, 81 .colorspace = V4L2_COLORSPACE_SRGB,
86 .priv = 1}, 82 .priv = 1},
87 {640, 480, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE, 83 {640, 480, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE,
88 .bytesperline = 640 * 2, 84 .bytesperline = 640 * 3,
89 .sizeimage = 640 * 480 * 2, 85 .sizeimage = 640 * 480 * 3 / 2,
90 .colorspace = V4L2_COLORSPACE_SRGB, 86 .colorspace = V4L2_COLORSPACE_SRGB,
91 .priv = 0}, 87 .priv = 0},
92}; 88};
@@ -760,77 +756,30 @@ static void sd_close(struct gspca_dev *gspca_dev)
760 reg_write(gspca_dev->dev, 0x05, 0x11, 0xf); 756 reg_write(gspca_dev->dev, 0x05, 0x11, 0xf);
761} 757}
762 758
763/* convert YYUV per line to YUYV (YUV 4:2:2) */
764static void yyuv_decode(unsigned char *out,
765 unsigned char *in,
766 int width,
767 int height)
768{
769 unsigned char *Ui, *Vi, *yi, *yi1;
770 unsigned char *out1;
771 int i, j;
772
773 yi = in;
774 for (i = height / 2; --i >= 0; ) {
775 out1 = out + width * 2; /* next line */
776 yi1 = yi + width;
777 Ui = yi1 + width;
778 Vi = Ui + width / 2;
779 for (j = width / 2; --j >= 0; ) {
780 *out++ = 128 + *yi++;
781 *out++ = 128 + *Ui;
782 *out++ = 128 + *yi++;
783 *out++ = 128 + *Vi;
784
785 *out1++ = 128 + *yi1++;
786 *out1++ = 128 + *Ui++;
787 *out1++ = 128 + *yi1++;
788 *out1++ = 128 + *Vi++;
789 }
790 yi += width * 2;
791 out = out1;
792 }
793}
794
795static void sd_pkt_scan(struct gspca_dev *gspca_dev, 759static void sd_pkt_scan(struct gspca_dev *gspca_dev,
796 struct gspca_frame *frame, /* target */ 760 struct gspca_frame *frame, /* target */
797 __u8 *data, /* isoc packet */ 761 __u8 *data, /* isoc packet */
798 int len) /* iso packet length */ 762 int len) /* iso packet length */
799{ 763{
800 struct sd *sd = (struct sd *) gspca_dev;
801
802 switch (data[0]) { 764 switch (data[0]) {
803 case 0: /* start of frame */ 765 case 0: /* start of frame */
804 if (gspca_dev->last_packet_type == FIRST_PACKET) { 766 frame = gspca_frame_add(gspca_dev, LAST_PACKET, frame,
805 yyuv_decode(sd->tmpbuf2, sd->tmpbuf, 767 data, 0);
806 gspca_dev->width,
807 gspca_dev->height);
808 frame = gspca_frame_add(gspca_dev,
809 LAST_PACKET,
810 frame,
811 sd->tmpbuf2,
812 gspca_dev->width
813 * gspca_dev->height
814 * 2);
815 }
816 gspca_frame_add(gspca_dev, FIRST_PACKET, frame,
817 data, 0);
818 data += SPCA50X_OFFSET_DATA; 768 data += SPCA50X_OFFSET_DATA;
819 len -= SPCA50X_OFFSET_DATA; 769 len -= SPCA50X_OFFSET_DATA;
820 if (len > 0) 770 gspca_frame_add(gspca_dev, FIRST_PACKET, frame,
821 memcpy(sd->tmpbuf, data, len); 771 data, len);
822 else 772 break;
823 len = 0;
824 sd->buflen = len;
825 return;
826 case 0xff: /* drop */ 773 case 0xff: /* drop */
827/* gspca_dev->last_packet_type = DISCARD_PACKET; */ 774/* gspca_dev->last_packet_type = DISCARD_PACKET; */
828 return; 775 break;
776 default:
777 data += 1;
778 len -= 1;
779 gspca_frame_add(gspca_dev, FIRST_PACKET, frame,
780 data, len);
781 break;
829 } 782 }
830 data += 1;
831 len -= 1;
832 memcpy(&sd->tmpbuf[sd->buflen], data, len);
833 sd->buflen += len;
834} 783}
835 784
836static void setbrightness(struct gspca_dev *gspca_dev) 785static void setbrightness(struct gspca_dev *gspca_dev)