1 /* Linux driver for Philips webcam
2 Various miscellaneous functions and tables.
3 (C) 1999-2003 Nemosoft Unv. (webcam@smcc.demon.nl)
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 #include <linux/slab.h>
24 struct pwc_coord pwc_image_sizes[PSZ_MAX] =
35 int pwc_decode_size(struct pwc_device *pdev, int width, int height)
39 /* Make sure we don't go beyond our max size */
40 if (width > pdev->view_max.x || height > pdev->view_max.y)
42 /* Find the largest size supported by the camera that fits into the
46 for (i = 0; i < PSZ_MAX; i++) {
47 if (pdev->image_mask & (1 << i)) {
48 if (pwc_image_sizes[i].x <= width && pwc_image_sizes[i].y <= height)
54 /* initialize variables depending on type */
55 void pwc_construct(struct pwc_device *pdev)
60 pdev->view_min.x = 128;
61 pdev->view_min.y = 96;
62 pdev->view_max.x = 352;
63 pdev->view_max.y = 288;
64 pdev->image_mask = 1 << PSZ_SQCIF | 1 << PSZ_QCIF | 1 << PSZ_CIF;
65 pdev->vcinterface = 2;
67 pdev->frame_header_size = 0;
68 pdev->frame_trailer_size = 0;
73 pdev->view_min.x = 128;
74 pdev->view_min.y = 96;
75 pdev->view_max.x = 640;
76 pdev->view_max.y = 480;
77 pdev->image_mask = 1 << PSZ_SQCIF | 1 << PSZ_QSIF | 1 << PSZ_QCIF | 1 << PSZ_SIF | 1 << PSZ_CIF | 1 << PSZ_VGA;
78 pdev->vcinterface = 3;
80 pdev->frame_header_size = 0;
81 pdev->frame_trailer_size = 0;
87 pdev->view_min.x = 160;
88 pdev->view_min.y = 120;
89 pdev->view_max.x = 640;
90 pdev->view_max.y = 480;
91 pdev->image_mask = 1 << PSZ_QSIF | 1 << PSZ_SIF | 1 << PSZ_VGA;
92 pdev->vcinterface = 3;
94 pdev->frame_header_size = TOUCAM_HEADER_SIZE;
95 pdev->frame_trailer_size = TOUCAM_TRAILER_SIZE;
98 pdev->view_min.size = pdev->view_min.x * pdev->view_min.y;
99 pdev->view_max.size = pdev->view_max.x * pdev->view_max.y;
100 /* length of image, in YUV format */
101 pdev->len_per_image = (pdev->view_max.size * 3) / 2;