diff options
Diffstat (limited to 'drivers/media/video/pwc')
| -rw-r--r-- | drivers/media/video/pwc/Kconfig | 47 | ||||
| -rw-r--r-- | drivers/media/video/pwc/Makefile | 4 | ||||
| -rw-r--r-- | drivers/media/video/pwc/philips.txt | 236 | ||||
| -rw-r--r-- | drivers/media/video/pwc/pwc-ctrl.c | 1760 | ||||
| -rw-r--r-- | drivers/media/video/pwc/pwc-dec1.c | 50 | ||||
| -rw-r--r-- | drivers/media/video/pwc/pwc-dec1.h | 43 | ||||
| -rw-r--r-- | drivers/media/video/pwc/pwc-dec23.c | 942 | ||||
| -rw-r--r-- | drivers/media/video/pwc/pwc-dec23.h | 67 | ||||
| -rw-r--r-- | drivers/media/video/pwc/pwc-if.c | 2115 | ||||
| -rw-r--r-- | drivers/media/video/pwc/pwc-ioctl.h | 323 | ||||
| -rw-r--r-- | drivers/media/video/pwc/pwc-kiara.c | 893 | ||||
| -rw-r--r-- | drivers/media/video/pwc/pwc-kiara.h | 48 | ||||
| -rw-r--r-- | drivers/media/video/pwc/pwc-misc.c | 133 | ||||
| -rw-r--r-- | drivers/media/video/pwc/pwc-nala.h | 66 | ||||
| -rw-r--r-- | drivers/media/video/pwc/pwc-timon.c | 1448 | ||||
| -rw-r--r-- | drivers/media/video/pwc/pwc-timon.h | 63 | ||||
| -rw-r--r-- | drivers/media/video/pwc/pwc-uncompress.c | 138 | ||||
| -rw-r--r-- | drivers/media/video/pwc/pwc-uncompress.h | 40 | ||||
| -rw-r--r-- | drivers/media/video/pwc/pwc-v4l.c | 960 | ||||
| -rw-r--r-- | drivers/media/video/pwc/pwc.h | 356 | 
20 files changed, 0 insertions, 9732 deletions
diff --git a/drivers/media/video/pwc/Kconfig b/drivers/media/video/pwc/Kconfig deleted file mode 100644 index 8da42e4f1ba..00000000000 --- a/drivers/media/video/pwc/Kconfig +++ /dev/null @@ -1,47 +0,0 @@ -config USB_PWC -	tristate "USB Philips Cameras" -	depends on VIDEO_V4L2 -	---help--- -	  Say Y or M here if you want to use one of these Philips & OEM -	  webcams: -	   * Philips PCA645, PCA646 -	   * Philips PCVC675, PCVC680, PCVC690 -	   * Philips PCVC720/40, PCVC730, PCVC740, PCVC750 -	   * Philips SPC900NC -	   * Askey VC010 -	   * Logitech QuickCam Pro 3000, 4000, 'Zoom', 'Notebook Pro' -	     and 'Orbit'/'Sphere' -	   * Samsung MPC-C10, MPC-C30 -	   * Creative Webcam 5, Pro Ex -	   * SOTEC Afina Eye -	   * Visionite VCS-UC300, VCS-UM100 - -	  The PCA635, PCVC665 and PCVC720/20 are not supported by this driver -	  and never will be, but the 665 and 720/20 are supported by other -	  drivers. - -	  Some newer logitech webcams are not handled by this driver but by the -	  Usb Video Class driver (linux-uvc). - -	  The built-in microphone is enabled by selecting USB Audio support. - -	  To compile this driver as a module, choose M here: the -	  module will be called pwc. - -config USB_PWC_DEBUG -	bool "USB Philips Cameras verbose debug" -	depends on USB_PWC -	help -	  Say Y here in order to have the pwc driver generate verbose debugging -	  messages. -	  A special module options 'trace' is used to control the verbosity. - -config USB_PWC_INPUT_EVDEV -	bool "USB Philips Cameras input events device support" -	default y -	depends on USB_PWC && (USB_PWC=INPUT || INPUT=y) -	---help--- -	  This option makes USB Philips cameras register the snapshot button as -	  an input device to report button events. - -	  If you are in doubt, say Y. diff --git a/drivers/media/video/pwc/Makefile b/drivers/media/video/pwc/Makefile deleted file mode 100644 index f5c8ec261e8..00000000000 --- a/drivers/media/video/pwc/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -pwc-objs	:= pwc-if.o pwc-misc.o pwc-ctrl.o pwc-v4l.o pwc-uncompress.o -pwc-objs	+= pwc-dec1.o pwc-dec23.o pwc-kiara.o pwc-timon.o - -obj-$(CONFIG_USB_PWC) += pwc.o diff --git a/drivers/media/video/pwc/philips.txt b/drivers/media/video/pwc/philips.txt deleted file mode 100644 index d38dd791511..00000000000 --- a/drivers/media/video/pwc/philips.txt +++ /dev/null @@ -1,236 +0,0 @@ -This file contains some additional information for the Philips and OEM webcams. -E-mail: webcam@smcc.demon.nl                        Last updated: 2004-01-19 -Site: http://www.smcc.demon.nl/webcam/ - -As of this moment, the following cameras are supported: - * Philips PCA645 - * Philips PCA646 - * Philips PCVC675 - * Philips PCVC680 - * Philips PCVC690 - * Philips PCVC720/40 - * Philips PCVC730 - * Philips PCVC740 - * Philips PCVC750 - * Askey VC010 - * Creative Labs Webcam 5 - * Creative Labs Webcam Pro Ex - * Logitech QuickCam 3000 Pro - * Logitech QuickCam 4000 Pro - * Logitech QuickCam Notebook Pro - * Logitech QuickCam Zoom - * Logitech QuickCam Orbit - * Logitech QuickCam Sphere - * Samsung MPC-C10 - * Samsung MPC-C30 - * Sotec Afina Eye - * AME CU-001 - * Visionite VCS-UM100 - * Visionite VCS-UC300 - -The main webpage for the Philips driver is at the address above. It contains -a lot of extra information, a FAQ, and the binary plugin 'PWCX'. This plugin -contains decompression routines that allow you to use higher image sizes and -framerates; in addition the webcam uses less bandwidth on the USB bus (handy -if you want to run more than 1 camera simultaneously). These routines fall -under a NDA, and may therefore not be distributed as source; however, its use -is completely optional. - -You can build this code either into your kernel, or as a module. I recommend -the latter, since it makes troubleshooting a lot easier. The built-in -microphone is supported through the USB Audio class. - -When you load the module you can set some default settings for the -camera; some programs depend on a particular image-size or -format and -don't know how to set it properly in the driver. The options are: - -size -   Can be one of 'sqcif', 'qsif', 'qcif', 'sif', 'cif' or -   'vga', for an image size of resp. 128x96, 160x120, 176x144, -   320x240, 352x288 and 640x480 (of course, only for those cameras that -   support these resolutions). - -fps -   Specifies the desired framerate. Is an integer in the range of 4-30. - -fbufs -   This parameter specifies the number of internal buffers to use for storing -   frames from the cam. This will help if the process that reads images from -   the cam is a bit slow or momentarily busy. However, on slow machines it -   only introduces lag, so choose carefully. The default is 3, which is -   reasonable. You can set it between 2 and 5. - -mbufs -   This is an integer between 1 and 10. It will tell the module the number of -   buffers to reserve for mmap(), VIDIOCCGMBUF, VIDIOCMCAPTURE and friends. -   The default is 2, which is adequate for most applications (double -   buffering). - -   Should you experience a lot of 'Dumping frame...' messages during -   grabbing with a tool that uses mmap(), you might want to increase if. -   However, it doesn't really buffer images, it just gives you a bit more -   slack when your program is behind. But you need a multi-threaded or -   forked program to really take advantage of these buffers. - -   The absolute maximum is 10, but don't set it too high!  Every buffer takes -   up 460 KB of RAM, so unless you have a lot of memory setting this to -   something more than 4 is an absolute waste.  This memory is only -   allocated during open(), so nothing is wasted when the camera is not in -   use. - -power_save -   When power_save is enabled (set to 1), the module will try to shut down -   the cam on close() and re-activate on open(). This will save power and -   turn off the LED. Not all cameras support this though (the 645 and 646 -   don't have power saving at all), and some models don't work either (they -   will shut down, but never wake up). Consider this experimental. By -   default this option is disabled. - -compression (only useful with the plugin) -   With this option you can control the compression factor that the camera -   uses to squeeze the image through the USB bus. You can set the -   parameter between 0 and 3: -     0 = prefer uncompressed images; if the requested mode is not available -	 in an uncompressed format, the driver will silently switch to low -	 compression. -     1 = low compression. -     2 = medium compression. -     3 = high compression. - -   High compression takes less bandwidth of course, but it could also -   introduce some unwanted artefacts. The default is 2, medium compression. -   See the FAQ on the website for an overview of which modes require -   compression. - -   The compression parameter does not apply to the 645 and 646 cameras -   and OEM models derived from those (only a few). Most cams honour this -   parameter. - -leds -   This settings takes 2 integers, that define the on/off time for the LED -   (in milliseconds). One of the interesting things that you can do with -   this is let the LED blink while the camera is in use. This: - -     leds=500,500 - -   will blink the LED once every second. But with: - -     leds=0,0 - -   the LED never goes on, making it suitable for silent surveillance. - -   By default the camera's LED is on solid while in use, and turned off -   when the camera is not used anymore. - -   This parameter works only with the ToUCam range of cameras (720, 730, 740, -   750) and OEMs. For other cameras this command is silently ignored, and -   the LED cannot be controlled. - -   Finally: this parameters does not take effect UNTIL the first time you -   open the camera device. Until then, the LED remains on. - -dev_hint -   A long standing problem with USB devices is their dynamic nature: you -   never know what device a camera gets assigned; it depends on module load -   order, the hub configuration, the order in which devices are plugged in, -   and the phase of the moon (i.e. it can be random). With this option you -   can give the driver a hint as to what video device node (/dev/videoX) it -   should use with a specific camera. This is also handy if you have two -   cameras of the same model. - -   A camera is specified by its type (the number from the camera model, -   like PCA645, PCVC750VC, etc) and optionally the serial number (visible -   in /proc/bus/usb/devices). A hint consists of a string with the following -   format: - -      [type[.serialnumber]:]node - -   The square brackets mean that both the type and the serialnumber are -   optional, but a serialnumber cannot be specified without a type (which -   would be rather pointless). The serialnumber is separated from the type -   by a '.'; the node number by a ':'. - -   This somewhat cryptic syntax is best explained by a few examples: - -     dev_hint=3,5              The first detected cam gets assigned -			       /dev/video3, the second /dev/video5. Any -			       other cameras will get the first free -			       available slot (see below). - -     dev_hint=645:1,680:2      The PCA645 camera will get /dev/video1, -			       and a PCVC680 /dev/video2. - -     dev_hint=645.0123:3,645.4567:0	The PCA645 camera with serialnumber -					0123 goes to /dev/video3, the same -					camera model with the 4567 serial -					gets /dev/video0. - -     dev_hint=750:1,4,5,6       The PCVC750 camera will get /dev/video1, the -				next 3 Philips cams will use /dev/video4 -				through /dev/video6. - -   Some points worth knowing: -   - Serialnumbers are case sensitive and must be written full, including -     leading zeroes (it's treated as a string). -   - If a device node is already occupied, registration will fail and -     the webcam is not available. -   - You can have up to 64 video devices; be sure to make enough device -     nodes in /dev if you want to spread the numbers. -     After /dev/video9 comes /dev/video10 (not /dev/videoA). -   - If a camera does not match any dev_hint, it will simply get assigned -     the first available device node, just as it used to be. - -trace -   In order to better detect problems, it is now possible to turn on a -   'trace' of some of the calls the module makes; it logs all items in your -   kernel log at debug level. - -   The trace variable is a bitmask; each bit represents a certain feature. -   If you want to trace something, look up the bit value(s) in the table -   below, add the values together and supply that to the trace variable. - -   Value  Value   Description					   Default -   (dec)  (hex) -       1    0x1   Module initialization; this will log messages       On -		  while loading and unloading the module - -       2    0x2   probe() and disconnect() traces                     On - -       4    0x4   Trace open() and close() calls                      Off - -       8    0x8   read(), mmap() and associated ioctl() calls         Off - -      16   0x10   Memory allocation of buffers, etc.                  Off - -      32   0x20   Showing underflow, overflow and Dumping frame       On -		  messages - -      64   0x40   Show viewport and image sizes                       Off - -     128   0x80   PWCX debugging                                      Off - -   For example, to trace the open() & read() functions, sum 8 + 4 = 12, -   so you would supply trace=12 during insmod or modprobe. If -   you want to turn the initialization and probing tracing off, set trace=0. -   The default value for trace is 35 (0x23). - - - -Example: - -     # modprobe pwc size=cif fps=15 power_save=1 - -The fbufs, mbufs and trace parameters are global and apply to all connected -cameras. Each camera has its own set of buffers. - -size and fps only specify defaults when you open() the device; this is to -accommodate some tools that don't set the size. You can change these -settings after open() with the Video4Linux ioctl() calls. The default of -defaults is QCIF size at 10 fps. - -The compression parameter is semiglobal; it sets the initial compression -preference for all camera's, but this parameter can be set per camera with -the VIDIOCPWCSCQUAL ioctl() call. - -All parameters are optional. - diff --git a/drivers/media/video/pwc/pwc-ctrl.c b/drivers/media/video/pwc/pwc-ctrl.c deleted file mode 100644 index 6b8fbddc074..00000000000 --- a/drivers/media/video/pwc/pwc-ctrl.c +++ /dev/null @@ -1,1760 +0,0 @@ -/* Driver for Philips webcam -   Functions that send various control messages to the webcam, including -   video modes. -   (C) 1999-2003 Nemosoft Unv. -   (C) 2004-2006 Luc Saillard (luc@saillard.org) - -   NOTE: this version of pwc is an unofficial (modified) release of pwc & pcwx -   driver and thus may have bugs that are not present in the original version. -   Please send bug reports and support requests to <luc@saillard.org>. - -   NOTE: this version of pwc is an unofficial (modified) release of pwc & pcwx -   driver and thus may have bugs that are not present in the original version. -   Please send bug reports and support requests to <luc@saillard.org>. -   The decompression routines have been implemented by reverse-engineering the -   Nemosoft binary pwcx module. Caveat emptor. - -   This program is free software; you can redistribute it and/or modify -   it under the terms of the GNU General Public License as published by -   the Free Software Foundation; either version 2 of the License, or -   (at your option) any later version. - -   This program is distributed in the hope that it will be useful, -   but WITHOUT ANY WARRANTY; without even the implied warranty of -   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the -   GNU General Public License for more details. - -   You should have received a copy of the GNU General Public License -   along with this program; if not, write to the Free Software -   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA -*/ - -/* -   Changes -   2001/08/03  Alvarado   Added methods for changing white balance and -			  red/green gains - */ - -/* Control functions for the cam; brightness, contrast, video mode, etc. */ - -#ifdef __KERNEL__ -#include <asm/uaccess.h> -#endif -#include <asm/errno.h> - -#include "pwc.h" -#include "pwc-uncompress.h" -#include "pwc-kiara.h" -#include "pwc-timon.h" -#include "pwc-dec1.h" -#include "pwc-dec23.h" - -/* Request types: video */ -#define SET_LUM_CTL			0x01 -#define GET_LUM_CTL			0x02 -#define SET_CHROM_CTL			0x03 -#define GET_CHROM_CTL			0x04 -#define SET_STATUS_CTL			0x05 -#define GET_STATUS_CTL			0x06 -#define SET_EP_STREAM_CTL		0x07 -#define GET_EP_STREAM_CTL		0x08 -#define GET_XX_CTL			0x09 -#define SET_XX_CTL			0x0A -#define GET_XY_CTL			0x0B -#define SET_XY_CTL			0x0C -#define SET_MPT_CTL			0x0D -#define GET_MPT_CTL			0x0E - -/* Selectors for the Luminance controls [GS]ET_LUM_CTL */ -#define AGC_MODE_FORMATTER			0x2000 -#define PRESET_AGC_FORMATTER			0x2100 -#define SHUTTER_MODE_FORMATTER			0x2200 -#define PRESET_SHUTTER_FORMATTER		0x2300 -#define PRESET_CONTOUR_FORMATTER		0x2400 -#define AUTO_CONTOUR_FORMATTER			0x2500 -#define BACK_LIGHT_COMPENSATION_FORMATTER	0x2600 -#define CONTRAST_FORMATTER			0x2700 -#define DYNAMIC_NOISE_CONTROL_FORMATTER		0x2800 -#define FLICKERLESS_MODE_FORMATTER		0x2900 -#define AE_CONTROL_SPEED			0x2A00 -#define BRIGHTNESS_FORMATTER			0x2B00 -#define GAMMA_FORMATTER				0x2C00 - -/* Selectors for the Chrominance controls [GS]ET_CHROM_CTL */ -#define WB_MODE_FORMATTER			0x1000 -#define AWB_CONTROL_SPEED_FORMATTER		0x1100 -#define AWB_CONTROL_DELAY_FORMATTER		0x1200 -#define PRESET_MANUAL_RED_GAIN_FORMATTER	0x1300 -#define PRESET_MANUAL_BLUE_GAIN_FORMATTER	0x1400 -#define COLOUR_MODE_FORMATTER			0x1500 -#define SATURATION_MODE_FORMATTER1		0x1600 -#define SATURATION_MODE_FORMATTER2		0x1700 - -/* Selectors for the Status controls [GS]ET_STATUS_CTL */ -#define SAVE_USER_DEFAULTS_FORMATTER		0x0200 -#define RESTORE_USER_DEFAULTS_FORMATTER		0x0300 -#define RESTORE_FACTORY_DEFAULTS_FORMATTER	0x0400 -#define READ_AGC_FORMATTER			0x0500 -#define READ_SHUTTER_FORMATTER			0x0600 -#define READ_RED_GAIN_FORMATTER			0x0700 -#define READ_BLUE_GAIN_FORMATTER		0x0800 -#define GET_STATUS_B00				0x0B00 -#define SENSOR_TYPE_FORMATTER1			0x0C00 -#define GET_STATUS_3000				0x3000 -#define READ_RAW_Y_MEAN_FORMATTER		0x3100 -#define SET_POWER_SAVE_MODE_FORMATTER		0x3200 -#define MIRROR_IMAGE_FORMATTER			0x3300 -#define LED_FORMATTER				0x3400 -#define LOWLIGHT				0x3500 -#define GET_STATUS_3600				0x3600 -#define SENSOR_TYPE_FORMATTER2			0x3700 -#define GET_STATUS_3800				0x3800 -#define GET_STATUS_4000				0x4000 -#define GET_STATUS_4100				0x4100	/* Get */ -#define CTL_STATUS_4200				0x4200	/* [GS] 1 */ - -/* Formatters for the Video Endpoint controls [GS]ET_EP_STREAM_CTL */ -#define VIDEO_OUTPUT_CONTROL_FORMATTER		0x0100 - -/* Formatters for the motorized pan & tilt [GS]ET_MPT_CTL */ -#define PT_RELATIVE_CONTROL_FORMATTER		0x01 -#define PT_RESET_CONTROL_FORMATTER		0x02 -#define PT_STATUS_FORMATTER			0x03 - -static const char *size2name[PSZ_MAX] = -{ -	"subQCIF", -	"QSIF", -	"QCIF", -	"SIF", -	"CIF", -	"VGA", -}; - -/********/ - -/* Entries for the Nala (645/646) camera; the Nala doesn't have compression -   preferences, so you either get compressed or non-compressed streams. - -   An alternate value of 0 means this mode is not available at all. - */ - -#define PWC_FPS_MAX_NALA 8 - -struct Nala_table_entry { -	char alternate;			/* USB alternate setting */ -	int compressed;			/* Compressed yes/no */ - -	unsigned char mode[3];		/* precomputed mode table */ -}; - -static unsigned int Nala_fps_vector[PWC_FPS_MAX_NALA] = { 4, 5, 7, 10, 12, 15, 20, 24 }; - -static struct Nala_table_entry Nala_table[PSZ_MAX][PWC_FPS_MAX_NALA] = -{ -#include "pwc-nala.h" -}; - -static void pwc_set_image_buffer_size(struct pwc_device *pdev); - -/****************************************************************************/ - -static int _send_control_msg(struct pwc_device *pdev, -	u8 request, u16 value, int index, void *buf, int buflen, int timeout) -{ -	int rc; -	void *kbuf = NULL; - -	if (buflen) { -		kbuf = kmalloc(buflen, GFP_KERNEL); /* not allowed on stack */ -		if (kbuf == NULL) -			return -ENOMEM; -		memcpy(kbuf, buf, buflen); -	} - -	rc = usb_control_msg(pdev->udev, usb_sndctrlpipe(pdev->udev, 0), -		request, -		USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, -		value, -		index, -		kbuf, buflen, timeout); - -	kfree(kbuf); -	return rc; -} - -static int recv_control_msg(struct pwc_device *pdev, -	u8 request, u16 value, void *buf, int buflen) -{ -	int rc; -	void *kbuf = kmalloc(buflen, GFP_KERNEL); /* not allowed on stack */ - -	if (kbuf == NULL) -		return -ENOMEM; - -	rc = usb_control_msg(pdev->udev, usb_rcvctrlpipe(pdev->udev, 0), -		request, -		USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, -		value, -		pdev->vcinterface, -		kbuf, buflen, 500); -	memcpy(buf, kbuf, buflen); -	kfree(kbuf); -	return rc; -} - -static inline int send_video_command(struct pwc_device *pdev, -	int index, void *buf, int buflen) -{ -	return _send_control_msg(pdev, -		SET_EP_STREAM_CTL, -		VIDEO_OUTPUT_CONTROL_FORMATTER, -		index, -		buf, buflen, 1000); -} - -static inline int send_control_msg(struct pwc_device *pdev, -	u8 request, u16 value, void *buf, int buflen) -{ -	return _send_control_msg(pdev, -		request, value, pdev->vcinterface, buf, buflen, 500); -} - - - -static int set_video_mode_Nala(struct pwc_device *pdev, int size, int frames) -{ -	unsigned char buf[3]; -	int ret, fps; -	struct Nala_table_entry *pEntry; -	int frames2frames[31] = -	{ /* closest match of framerate */ -	   0,  0,  0,  0,  4,  /*  0-4  */ -	   5,  5,  7,  7, 10,  /*  5-9  */ -	  10, 10, 12, 12, 15,  /* 10-14 */ -	  15, 15, 15, 20, 20,  /* 15-19 */ -	  20, 20, 20, 24, 24,  /* 20-24 */ -	  24, 24, 24, 24, 24,  /* 25-29 */ -	  24                   /* 30    */ -	}; -	int frames2table[31] = -	{ 0, 0, 0, 0, 0, /*  0-4  */ -	  1, 1, 1, 2, 2, /*  5-9  */ -	  3, 3, 4, 4, 4, /* 10-14 */ -	  5, 5, 5, 5, 5, /* 15-19 */ -	  6, 6, 6, 6, 7, /* 20-24 */ -	  7, 7, 7, 7, 7, /* 25-29 */ -	  7              /* 30    */ -	}; - -	if (size < 0 || size > PSZ_CIF || frames < 4 || frames > 25) -		return -EINVAL; -	frames = frames2frames[frames]; -	fps = frames2table[frames]; -	pEntry = &Nala_table[size][fps]; -	if (pEntry->alternate == 0) -		return -EINVAL; - -	memcpy(buf, pEntry->mode, 3); -	ret = send_video_command(pdev, pdev->vendpoint, buf, 3); -	if (ret < 0) { -		PWC_DEBUG_MODULE("Failed to send video command... %d\n", ret); -		return ret; -	} -	if (pEntry->compressed && pdev->pixfmt == V4L2_PIX_FMT_YUV420) -		pwc_dec1_init(pdev->type, pdev->release, buf, pdev->decompress_data); - -	pdev->cmd_len = 3; -	memcpy(pdev->cmd_buf, buf, 3); - -	/* Set various parameters */ -	pdev->vframes = frames; -	pdev->vsize = size; -	pdev->valternate = pEntry->alternate; -	pdev->image = pwc_image_sizes[size]; -	pdev->frame_size = (pdev->image.x * pdev->image.y * 3) / 2; -	if (pEntry->compressed) { -		if (pdev->release < 5) { /* 4 fold compression */ -			pdev->vbandlength = 528; -			pdev->frame_size /= 4; -		} -		else { -			pdev->vbandlength = 704; -			pdev->frame_size /= 3; -		} -	} -	else -		pdev->vbandlength = 0; -	return 0; -} - - -static int set_video_mode_Timon(struct pwc_device *pdev, int size, int frames, int compression, int snapshot) -{ -	unsigned char buf[13]; -	const struct Timon_table_entry *pChoose; -	int ret, fps; - -	if (size >= PSZ_MAX || frames < 5 || frames > 30 || compression < 0 || compression > 3) -		return -EINVAL; -	if (size == PSZ_VGA && frames > 15) -		return -EINVAL; -	fps = (frames / 5) - 1; - -	/* Find a supported framerate with progressively higher compression ratios -	   if the preferred ratio is not available. -	*/ -	pChoose = NULL; -	while (compression <= 3) { -	   pChoose = &Timon_table[size][fps][compression]; -	   if (pChoose->alternate != 0) -	     break; -	   compression++; -	} -	if (pChoose == NULL || pChoose->alternate == 0) -		return -ENOENT; /* Not supported. */ - -	memcpy(buf, pChoose->mode, 13); -	if (snapshot) -		buf[0] |= 0x80; -	ret = send_video_command(pdev, pdev->vendpoint, buf, 13); -	if (ret < 0) -		return ret; - -	if (pChoose->bandlength > 0 && pdev->pixfmt == V4L2_PIX_FMT_YUV420) -		pwc_dec23_init(pdev, pdev->type, buf); - -	pdev->cmd_len = 13; -	memcpy(pdev->cmd_buf, buf, 13); - -	/* Set various parameters */ -	pdev->vframes = frames; -	pdev->vsize = size; -	pdev->vsnapshot = snapshot; -	pdev->valternate = pChoose->alternate; -	pdev->image = pwc_image_sizes[size]; -	pdev->vbandlength = pChoose->bandlength; -	if (pChoose->bandlength > 0) -		pdev->frame_size = (pChoose->bandlength * pdev->image.y) / 4; -	else -		pdev->frame_size = (pdev->image.x * pdev->image.y * 12) / 8; -	return 0; -} - - -static int set_video_mode_Kiara(struct pwc_device *pdev, int size, int frames, int compression, int snapshot) -{ -	const struct Kiara_table_entry *pChoose = NULL; -	int fps, ret; -	unsigned char buf[12]; -	struct Kiara_table_entry RawEntry = {6, 773, 1272, {0xAD, 0xF4, 0x10, 0x27, 0xB6, 0x24, 0x96, 0x02, 0x30, 0x05, 0x03, 0x80}}; - -	if (size >= PSZ_MAX || frames < 5 || frames > 30 || compression < 0 || compression > 3) -		return -EINVAL; -	if (size == PSZ_VGA && frames > 15) -		return -EINVAL; -	fps = (frames / 5) - 1; - -	/* special case: VGA @ 5 fps and snapshot is raw bayer mode */ -	if (size == PSZ_VGA && frames == 5 && snapshot && pdev->pixfmt != V4L2_PIX_FMT_YUV420) -	{ -		/* Only available in case the raw palette is selected or -		   we have the decompressor available. This mode is -		   only available in compressed form -		*/ -		PWC_DEBUG_SIZE("Choosing VGA/5 BAYER mode.\n"); -		pChoose = &RawEntry; -	} -	else -	{ -		/* Find a supported framerate with progressively higher compression ratios -		   if the preferred ratio is not available. -		   Skip this step when using RAW modes. -		*/ -		snapshot = 0; -		while (compression <= 3) { -			pChoose = &Kiara_table[size][fps][compression]; -			if (pChoose->alternate != 0) -				break; -			compression++; -		} -	} -	if (pChoose == NULL || pChoose->alternate == 0) -		return -ENOENT; /* Not supported. */ - -	PWC_TRACE("Using alternate setting %d.\n", pChoose->alternate); - -	/* usb_control_msg won't take staticly allocated arrays as argument?? */ -	memcpy(buf, pChoose->mode, 12); -	if (snapshot) -		buf[0] |= 0x80; - -	/* Firmware bug: video endpoint is 5, but commands are sent to endpoint 4 */ -	ret = send_video_command(pdev, 4 /* pdev->vendpoint */, buf, 12); -	if (ret < 0) -		return ret; - -	if (pChoose->bandlength > 0 && pdev->pixfmt == V4L2_PIX_FMT_YUV420) -		pwc_dec23_init(pdev, pdev->type, buf); - -	pdev->cmd_len = 12; -	memcpy(pdev->cmd_buf, buf, 12); -	/* All set and go */ -	pdev->vframes = frames; -	pdev->vsize = size; -	pdev->vsnapshot = snapshot; -	pdev->valternate = pChoose->alternate; -	pdev->image = pwc_image_sizes[size]; -	pdev->vbandlength = pChoose->bandlength; -	if (pdev->vbandlength > 0) -		pdev->frame_size = (pdev->vbandlength * pdev->image.y) / 4; -	else -		pdev->frame_size = (pdev->image.x * pdev->image.y * 12) / 8; -	PWC_TRACE("frame_size=%d, vframes=%d, vsize=%d, vsnapshot=%d, vbandlength=%d\n", -	    pdev->frame_size,pdev->vframes,pdev->vsize,pdev->vsnapshot,pdev->vbandlength); -	return 0; -} - - - -/** -   @pdev: device structure -   @width: viewport width -   @height: viewport height -   @frame: framerate, in fps -   @compression: preferred compression ratio -   @snapshot: snapshot mode or streaming - */ -int pwc_set_video_mode(struct pwc_device *pdev, int width, int height, int frames, int compression, int snapshot) -{ -	int ret, size; - -	PWC_DEBUG_FLOW("set_video_mode(%dx%d @ %d, pixfmt %08x).\n", width, height, frames, pdev->pixfmt); -	size = pwc_decode_size(pdev, width, height); -	if (size < 0) { -		PWC_DEBUG_MODULE("Could not find suitable size.\n"); -		return -ERANGE; -	} -	PWC_TRACE("decode_size = %d.\n", size); - -	if (DEVICE_USE_CODEC1(pdev->type)) { -		ret = set_video_mode_Nala(pdev, size, frames); - -	} else if (DEVICE_USE_CODEC3(pdev->type)) { -		ret = set_video_mode_Kiara(pdev, size, frames, compression, snapshot); - -	} else { -		ret = set_video_mode_Timon(pdev, size, frames, compression, snapshot); -	} -	if (ret < 0) { -		PWC_ERROR("Failed to set video mode %s@%d fps; return code = %d\n", size2name[size], frames, ret); -		return ret; -	} -	pdev->view.x = width; -	pdev->view.y = height; -	pdev->frame_total_size = pdev->frame_size + pdev->frame_header_size + pdev->frame_trailer_size; -	pwc_set_image_buffer_size(pdev); -	PWC_DEBUG_SIZE("Set viewport to %dx%d, image size is %dx%d.\n", width, height, pwc_image_sizes[size].x, pwc_image_sizes[size].y); -	return 0; -} - -static unsigned int pwc_get_fps_Nala(struct pwc_device *pdev, unsigned int index, unsigned int size) -{ -	unsigned int i; - -	for (i = 0; i < PWC_FPS_MAX_NALA; i++) { -		if (Nala_table[size][i].alternate) { -			if (index--==0) return Nala_fps_vector[i]; -		} -	} -	return 0; -} - -static unsigned int pwc_get_fps_Kiara(struct pwc_device *pdev, unsigned int index, unsigned int size) -{ -	unsigned int i; - -	for (i = 0; i < PWC_FPS_MAX_KIARA; i++) { -		if (Kiara_table[size][i][3].alternate) { -			if (index--==0) return Kiara_fps_vector[i]; -		} -	} -	return 0; -} - -static unsigned int pwc_get_fps_Timon(struct pwc_device *pdev, unsigned int index, unsigned int size) -{ -	unsigned int i; - -	for (i=0; i < PWC_FPS_MAX_TIMON; i++) { -		if (Timon_table[size][i][3].alternate) { -			if (index--==0) return Timon_fps_vector[i]; -		} -	} -	return 0; -} - -unsigned int pwc_get_fps(struct pwc_device *pdev, unsigned int index, unsigned int size) -{ -	unsigned int ret; - -	if (DEVICE_USE_CODEC1(pdev->type)) { -		ret = pwc_get_fps_Nala(pdev, index, size); - -	} else if (DEVICE_USE_CODEC3(pdev->type)) { -		ret = pwc_get_fps_Kiara(pdev, index, size); - -	} else { -		ret = pwc_get_fps_Timon(pdev, index, size); -	} - -	return ret; -} - -#define BLACK_Y 0 -#define BLACK_U 128 -#define BLACK_V 128 - -static void pwc_set_image_buffer_size(struct pwc_device *pdev) -{ -	int i, factor = 0; - -	/* for V4L2_PIX_FMT_YUV420 */ -	switch (pdev->pixfmt) { -	case V4L2_PIX_FMT_YUV420: -		factor = 6; -		break; -	case V4L2_PIX_FMT_PWC1: -	case V4L2_PIX_FMT_PWC2: -		factor = 6; /* can be uncompressed YUV420P */ -		break; -	} - -	/* Set sizes in bytes */ -	pdev->image.size = pdev->image.x * pdev->image.y * factor / 4; -	pdev->view.size  = pdev->view.x  * pdev->view.y  * factor / 4; - -	/* Align offset, or you'll get some very weird results in -	   YUV420 mode... x must be multiple of 4 (to get the Y's in -	   place), and y even (or you'll mixup U & V). This is less of a -	   problem for YUV420P. -	 */ -	pdev->offset.x = ((pdev->view.x - pdev->image.x) / 2) & 0xFFFC; -	pdev->offset.y = ((pdev->view.y - pdev->image.y) / 2) & 0xFFFE; - -	/* Fill buffers with black colors */ -	for (i = 0; i < pwc_mbufs; i++) { -		unsigned char *p = pdev->image_data + pdev->images[i].offset; -		memset(p, BLACK_Y, pdev->view.x * pdev->view.y); -		p += pdev->view.x * pdev->view.y; -		memset(p, BLACK_U, pdev->view.x * pdev->view.y/4); -		p += pdev->view.x * pdev->view.y/4; -		memset(p, BLACK_V, pdev->view.x * pdev->view.y/4); -	} -} - - - -/* BRIGHTNESS */ - -int pwc_get_brightness(struct pwc_device *pdev) -{ -	char buf; -	int ret; - -	ret = recv_control_msg(pdev, -		GET_LUM_CTL, BRIGHTNESS_FORMATTER, &buf, sizeof(buf)); -	if (ret < 0) -		return ret; -	return buf; -} - -int pwc_set_brightness(struct pwc_device *pdev, int value) -{ -	char buf; - -	if (value < 0) -		value = 0; -	if (value > 0xffff) -		value = 0xffff; -	buf = (value >> 9) & 0x7f; -	return send_control_msg(pdev, -		SET_LUM_CTL, BRIGHTNESS_FORMATTER, &buf, sizeof(buf)); -} - -/* CONTRAST */ - -int pwc_get_contrast(struct pwc_device *pdev) -{ -	char buf; -	int ret; - -	ret = recv_control_msg(pdev, -		GET_LUM_CTL, CONTRAST_FORMATTER, &buf, sizeof(buf)); -	if (ret < 0) -		return ret; -	return buf; -} - -int pwc_set_contrast(struct pwc_device *pdev, int value) -{ -	char buf; - -	if (value < 0) -		value = 0; -	if (value > 0xffff) -		value = 0xffff; -	buf = (value >> 10) & 0x3f; -	return send_control_msg(pdev, -		SET_LUM_CTL, CONTRAST_FORMATTER, &buf, sizeof(buf)); -} - -/* GAMMA */ - -int pwc_get_gamma(struct pwc_device *pdev) -{ -	char buf; -	int ret; - -	ret = recv_control_msg(pdev, -		GET_LUM_CTL, GAMMA_FORMATTER, &buf, sizeof(buf)); -	if (ret < 0) -		return ret; -	return buf; -} - -int pwc_set_gamma(struct pwc_device *pdev, int value) -{ -	char buf; - -	if (value < 0) -		value = 0; -	if (value > 0xffff) -		value = 0xffff; -	buf = (value >> 11) & 0x1f; -	return send_control_msg(pdev, -		SET_LUM_CTL, GAMMA_FORMATTER, &buf, sizeof(buf)); -} - - -/* SATURATION */ - -/* return a value between [-100 , 100] */ -int pwc_get_saturation(struct pwc_device *pdev, int *value) -{ -	char buf; -	int ret, saturation_register; - -	if (pdev->type < 675) -		return -EINVAL; -	if (pdev->type < 730) -		saturation_register = SATURATION_MODE_FORMATTER2; -	else -		saturation_register = SATURATION_MODE_FORMATTER1; -	ret = recv_control_msg(pdev, -		GET_CHROM_CTL, saturation_register, &buf, sizeof(buf)); -	if (ret < 0) -		return ret; -	*value = (signed)buf; -	return 0; -} - -/* @param value saturation color between [-100 , 100] */ -int pwc_set_saturation(struct pwc_device *pdev, int value) -{ -	char buf; -	int saturation_register; - -	if (pdev->type < 675) -		return -EINVAL; -	if (value < -100) -		value = -100; -	if (value > 100) -		value = 100; -	if (pdev->type < 730) -		saturation_register = SATURATION_MODE_FORMATTER2; -	else -		saturation_register = SATURATION_MODE_FORMATTER1; -	return send_control_msg(pdev, -		SET_CHROM_CTL, saturation_register, &buf, sizeof(buf)); -} - -/* AGC */ - -int pwc_set_agc(struct pwc_device *pdev, int mode, int value) -{ -	char buf; -	int ret; - -	if (mode) -		buf = 0x0; /* auto */ -	else -		buf = 0xff; /* fixed */ - -	ret = send_control_msg(pdev, -		SET_LUM_CTL, AGC_MODE_FORMATTER, &buf, sizeof(buf)); - -	if (!mode && ret >= 0) { -		if (value < 0) -			value = 0; -		if (value > 0xffff) -			value = 0xffff; -		buf = (value >> 10) & 0x3F; -		ret = send_control_msg(pdev, -			SET_LUM_CTL, PRESET_AGC_FORMATTER, &buf, sizeof(buf)); -	} -	if (ret < 0) -		return ret; -	return 0; -} - -int pwc_get_agc(struct pwc_device *pdev, int *value) -{ -	unsigned char buf; -	int ret; - -	ret = recv_control_msg(pdev, -		GET_LUM_CTL, AGC_MODE_FORMATTER, &buf, sizeof(buf)); -	if (ret < 0) -		return ret; - -	if (buf != 0) { /* fixed */ -		ret = recv_control_msg(pdev, -			GET_LUM_CTL, PRESET_AGC_FORMATTER, &buf, sizeof(buf)); -		if (ret < 0) -			return ret; -		if (buf > 0x3F) -			buf = 0x3F; -		*value = (buf << 10); -	} -	else { /* auto */ -		ret = recv_control_msg(pdev, -			GET_STATUS_CTL, READ_AGC_FORMATTER, &buf, sizeof(buf)); -		if (ret < 0) -			return ret; -		/* Gah... this value ranges from 0x00 ... 0x9F */ -		if (buf > 0x9F) -			buf = 0x9F; -		*value = -(48 + buf * 409); -	} - -	return 0; -} - -int pwc_set_shutter_speed(struct pwc_device *pdev, int mode, int value) -{ -	char buf[2]; -	int speed, ret; - - -	if (mode) -		buf[0] = 0x0;	/* auto */ -	else -		buf[0] = 0xff; /* fixed */ - -	ret = send_control_msg(pdev, -		SET_LUM_CTL, SHUTTER_MODE_FORMATTER, &buf, 1); - -	if (!mode && ret >= 0) { -		if (value < 0) -			value = 0; -		if (value > 0xffff) -			value = 0xffff; - -		if (DEVICE_USE_CODEC2(pdev->type)) { -			/* speed ranges from 0x0 to 0x290 (656) */ -			speed = (value / 100); -			buf[1] = speed >> 8; -			buf[0] = speed & 0xff; -		} else if (DEVICE_USE_CODEC3(pdev->type)) { -			/* speed seems to range from 0x0 to 0xff */ -			buf[1] = 0; -			buf[0] = value >> 8; -		} - -		ret = send_control_msg(pdev, -			SET_LUM_CTL, PRESET_SHUTTER_FORMATTER, -			&buf, sizeof(buf)); -	} -	return ret; -} - -/* This function is not exported to v4l1, so output values between 0 -> 256 */ -int pwc_get_shutter_speed(struct pwc_device *pdev, int *value) -{ -	unsigned char buf[2]; -	int ret; - -	ret = recv_control_msg(pdev, -		GET_STATUS_CTL, READ_SHUTTER_FORMATTER, &buf, sizeof(buf)); -	if (ret < 0) -		return ret; -	*value = buf[0] + (buf[1] << 8); -	if (DEVICE_USE_CODEC2(pdev->type)) { -		/* speed ranges from 0x0 to 0x290 (656) */ -		*value *= 256/656; -	} else if (DEVICE_USE_CODEC3(pdev->type)) { -		/* speed seems to range from 0x0 to 0xff */ -	} -	return 0; -} - - -/* POWER */ - -int pwc_camera_power(struct pwc_device *pdev, int power) -{ -	char buf; - -	if (pdev->type < 675 || (pdev->type < 730 && pdev->release < 6)) -		return 0;	/* Not supported by Nala or Timon < release 6 */ - -	if (power) -		buf = 0x00; /* active */ -	else -		buf = 0xFF; /* power save */ -	return send_control_msg(pdev, -		SET_STATUS_CTL, SET_POWER_SAVE_MODE_FORMATTER, -		&buf, sizeof(buf)); -} - - - -/* private calls */ - -int pwc_restore_user(struct pwc_device *pdev) -{ -	return send_control_msg(pdev, -		SET_STATUS_CTL, RESTORE_USER_DEFAULTS_FORMATTER, NULL, 0); -} - -int pwc_save_user(struct pwc_device *pdev) -{ -	return send_control_msg(pdev, -		SET_STATUS_CTL, SAVE_USER_DEFAULTS_FORMATTER, NULL, 0); -} - -int pwc_restore_factory(struct pwc_device *pdev) -{ -	return send_control_msg(pdev, -		SET_STATUS_CTL, RESTORE_FACTORY_DEFAULTS_FORMATTER, NULL, 0); -} - - /* ************************************************* */ - /* Patch by Alvarado: (not in the original version   */ - - /* -  * the camera recognizes modes from 0 to 4: -  * -  * 00: indoor (incandescant lighting) -  * 01: outdoor (sunlight) -  * 02: fluorescent lighting -  * 03: manual -  * 04: auto -  */ -int pwc_set_awb(struct pwc_device *pdev, int mode) -{ -	char buf; -	int ret; - -	if (mode < 0) -	    mode = 0; - -	if (mode > 4) -	    mode = 4; - -	buf = mode & 0x07; /* just the lowest three bits */ - -	ret = send_control_msg(pdev, -		SET_CHROM_CTL, WB_MODE_FORMATTER, &buf, sizeof(buf)); - -	if (ret < 0) -		return ret; -	return 0; -} - -int pwc_get_awb(struct pwc_device *pdev) -{ -	unsigned char buf; -	int ret; - -	ret = recv_control_msg(pdev, -		GET_CHROM_CTL, WB_MODE_FORMATTER, &buf, sizeof(buf)); - -	if (ret < 0) -		return ret; -	return buf; -} - -int pwc_set_red_gain(struct pwc_device *pdev, int value) -{ -	unsigned char buf; - -	if (value < 0) -		value = 0; -	if (value > 0xffff) -		value = 0xffff; -	/* only the msb is considered */ -	buf = value >> 8; -	return send_control_msg(pdev, -		SET_CHROM_CTL, PRESET_MANUAL_RED_GAIN_FORMATTER, -		&buf, sizeof(buf)); -} - -int pwc_get_red_gain(struct pwc_device *pdev, int *value) -{ -	unsigned char buf; -	int ret; - -	ret = recv_control_msg(pdev, -		GET_CHROM_CTL, PRESET_MANUAL_RED_GAIN_FORMATTER, -		&buf, sizeof(buf)); -	if (ret < 0) -	    return ret; -	*value = buf << 8; -	return 0; -} - - -int pwc_set_blue_gain(struct pwc_device *pdev, int value) -{ -	unsigned char buf; - -	if (value < 0) -		value = 0; -	if (value > 0xffff) -		value = 0xffff; -	/* only the msb is considered */ -	buf = value >> 8; -	return send_control_msg(pdev, -		SET_CHROM_CTL, PRESET_MANUAL_BLUE_GAIN_FORMATTER, -		&buf, sizeof(buf)); -} - -int pwc_get_blue_gain(struct pwc_device *pdev, int *value) -{ -	unsigned char buf; -	int ret; - -	ret = recv_control_msg(pdev, -		GET_CHROM_CTL, PRESET_MANUAL_BLUE_GAIN_FORMATTER, -		&buf, sizeof(buf)); -	if (ret < 0) -	    return ret; -	*value = buf << 8; -	return 0; -} - - -/* The following two functions are different, since they only read the -   internal red/blue gains, which may be different from the manual -   gains set or read above. - */ -static int pwc_read_red_gain(struct pwc_device *pdev, int *value) -{ -	unsigned char buf; -	int ret; - -	ret = recv_control_msg(pdev, -		GET_STATUS_CTL, READ_RED_GAIN_FORMATTER, &buf, sizeof(buf)); -	if (ret < 0) -		return ret; -	*value = buf << 8; -	return 0; -} - -static int pwc_read_blue_gain(struct pwc_device *pdev, int *value) -{ -	unsigned char buf; -	int ret; - -	ret = recv_control_msg(pdev, -		GET_STATUS_CTL, READ_BLUE_GAIN_FORMATTER, &buf, sizeof(buf)); -	if (ret < 0) -		return ret; -	*value = buf << 8; -	return 0; -} - - -static int pwc_set_wb_speed(struct pwc_device *pdev, int speed) -{ -	unsigned char buf; - -	/* useful range is 0x01..0x20 */ -	buf = speed / 0x7f0; -	return send_control_msg(pdev, -		SET_CHROM_CTL, AWB_CONTROL_SPEED_FORMATTER, &buf, sizeof(buf)); -} - -static int pwc_get_wb_speed(struct pwc_device *pdev, int *value) -{ -	unsigned char buf; -	int ret; - -	ret = recv_control_msg(pdev, -		GET_CHROM_CTL, AWB_CONTROL_SPEED_FORMATTER, &buf, sizeof(buf)); -	if (ret < 0) -		return ret; -	*value = buf * 0x7f0; -	return 0; -} - - -static int pwc_set_wb_delay(struct pwc_device *pdev, int delay) -{ -	unsigned char buf; - -	/* useful range is 0x01..0x3F */ -	buf = (delay >> 10); -	return send_control_msg(pdev, -		SET_CHROM_CTL, AWB_CONTROL_DELAY_FORMATTER, &buf, sizeof(buf)); -} - -static int pwc_get_wb_delay(struct pwc_device *pdev, int *value) -{ -	unsigned char buf; -	int ret; - -	ret = recv_control_msg(pdev, -		GET_CHROM_CTL, AWB_CONTROL_DELAY_FORMATTER, &buf, sizeof(buf)); -	if (ret < 0) -		return ret; -	*value = buf << 10; -	return 0; -} - - -int pwc_set_leds(struct pwc_device *pdev, int on_value, int off_value) -{ -	unsigned char buf[2]; - -	if (pdev->type < 730) -		return 0; -	on_value /= 100; -	off_value /= 100; -	if (on_value < 0) -		on_value = 0; -	if (on_value > 0xff) -		on_value = 0xff; -	if (off_value < 0) -		off_value = 0; -	if (off_value > 0xff) -		off_value = 0xff; - -	buf[0] = on_value; -	buf[1] = off_value; - -	return send_control_msg(pdev, -		SET_STATUS_CTL, LED_FORMATTER, &buf, sizeof(buf)); -} - -static int pwc_get_leds(struct pwc_device *pdev, int *on_value, int *off_value) -{ -	unsigned char buf[2]; -	int ret; - -	if (pdev->type < 730) { -		*on_value = -1; -		*off_value = -1; -		return 0; -	} - -	ret = recv_control_msg(pdev, -		GET_STATUS_CTL, LED_FORMATTER, &buf, sizeof(buf)); -	if (ret < 0) -		return ret; -	*on_value = buf[0] * 100; -	*off_value = buf[1] * 100; -	return 0; -} - -int pwc_set_contour(struct pwc_device *pdev, int contour) -{ -	unsigned char buf; -	int ret; - -	if (contour < 0) -		buf = 0xff; /* auto contour on */ -	else -		buf = 0x0; /* auto contour off */ -	ret = send_control_msg(pdev, -		SET_LUM_CTL, AUTO_CONTOUR_FORMATTER, &buf, sizeof(buf)); -	if (ret < 0) -		return ret; - -	if (contour < 0) -		return 0; -	if (contour > 0xffff) -		contour = 0xffff; - -	buf = (contour >> 10); /* contour preset is [0..3f] */ -	ret = send_control_msg(pdev, -		SET_LUM_CTL, PRESET_CONTOUR_FORMATTER, &buf, sizeof(buf)); -	if (ret < 0) -		return ret; -	return 0; -} - -int pwc_get_contour(struct pwc_device *pdev, int *contour) -{ -	unsigned char buf; -	int ret; - -	ret = recv_control_msg(pdev, -		GET_LUM_CTL, AUTO_CONTOUR_FORMATTER, &buf, sizeof(buf)); -	if (ret < 0) -		return ret; - -	if (buf == 0) { -		/* auto mode off, query current preset value */ -		ret = recv_control_msg(pdev, -			GET_LUM_CTL, PRESET_CONTOUR_FORMATTER, -			&buf, sizeof(buf)); -		if (ret < 0) -			return ret; -		*contour = buf << 10; -	} -	else -		*contour = -1; -	return 0; -} - - -int pwc_set_backlight(struct pwc_device *pdev, int backlight) -{ -	unsigned char buf; - -	if (backlight) -		buf = 0xff; -	else -		buf = 0x0; -	return send_control_msg(pdev, -		SET_LUM_CTL, BACK_LIGHT_COMPENSATION_FORMATTER, -		&buf, sizeof(buf)); -} - -int pwc_get_backlight(struct pwc_device *pdev, int *backlight) -{ -	int ret; -	unsigned char buf; - -	ret = recv_control_msg(pdev, -		GET_LUM_CTL, BACK_LIGHT_COMPENSATION_FORMATTER, -		&buf, sizeof(buf)); -	if (ret < 0) -		return ret; -	*backlight = !!buf; -	return 0; -} - -int pwc_set_colour_mode(struct pwc_device *pdev, int colour) -{ -	unsigned char buf; - -	if (colour) -		buf = 0xff; -	else -		buf = 0x0; -	return send_control_msg(pdev, -		SET_CHROM_CTL, COLOUR_MODE_FORMATTER, &buf, sizeof(buf)); -} - -int pwc_get_colour_mode(struct pwc_device *pdev, int *colour) -{ -	int ret; -	unsigned char buf; - -	ret = recv_control_msg(pdev, -		GET_CHROM_CTL, COLOUR_MODE_FORMATTER, &buf, sizeof(buf)); -	if (ret < 0) -		return ret; -	*colour = !!buf; -	return 0; -} - - -int pwc_set_flicker(struct pwc_device *pdev, int flicker) -{ -	unsigned char buf; - -	if (flicker) -		buf = 0xff; -	else -		buf = 0x0; -	return send_control_msg(pdev, -		SET_LUM_CTL, FLICKERLESS_MODE_FORMATTER, &buf, sizeof(buf)); -} - -int pwc_get_flicker(struct pwc_device *pdev, int *flicker) -{ -	int ret; -	unsigned char buf; - -	ret = recv_control_msg(pdev, -		GET_LUM_CTL, FLICKERLESS_MODE_FORMATTER, &buf, sizeof(buf)); -	if (ret < 0) -		return ret; -	*flicker = !!buf; -	return 0; -} - -int pwc_set_dynamic_noise(struct pwc_device *pdev, int noise) -{ -	unsigned char buf; - -	if (noise < 0) -		noise = 0; -	if (noise > 3) -		noise = 3; -	buf = noise; -	return send_control_msg(pdev, -		SET_LUM_CTL, DYNAMIC_NOISE_CONTROL_FORMATTER, -		&buf, sizeof(buf)); -} - -int pwc_get_dynamic_noise(struct pwc_device *pdev, int *noise) -{ -	int ret; -	unsigned char buf; - -	ret = recv_control_msg(pdev, -		GET_LUM_CTL, DYNAMIC_NOISE_CONTROL_FORMATTER, -		&buf, sizeof(buf)); -	if (ret < 0) -		return ret; -	*noise = buf; -	return 0; -} - -static int _pwc_mpt_reset(struct pwc_device *pdev, int flags) -{ -	unsigned char buf; - -	buf = flags & 0x03; // only lower two bits are currently used -	return send_control_msg(pdev, -		SET_MPT_CTL, PT_RESET_CONTROL_FORMATTER, &buf, sizeof(buf)); -} - -int pwc_mpt_reset(struct pwc_device *pdev, int flags) -{ -	int ret; -	ret = _pwc_mpt_reset(pdev, flags); -	if (ret >= 0) { -		pdev->pan_angle = 0; -		pdev->tilt_angle = 0; -	} -	return ret; -} - -static int _pwc_mpt_set_angle(struct pwc_device *pdev, int pan, int tilt) -{ -	unsigned char buf[4]; - -	/* set new relative angle; angles are expressed in degrees * 100, -	   but cam as .5 degree resolution, hence divide by 200. Also -	   the angle must be multiplied by 64 before it's send to -	   the cam (??) -	 */ -	pan  =  64 * pan  / 100; -	tilt = -64 * tilt / 100; /* positive tilt is down, which is not what the user would expect */ -	buf[0] = pan & 0xFF; -	buf[1] = (pan >> 8) & 0xFF; -	buf[2] = tilt & 0xFF; -	buf[3] = (tilt >> 8) & 0xFF; -	return send_control_msg(pdev, -		SET_MPT_CTL, PT_RELATIVE_CONTROL_FORMATTER, &buf, sizeof(buf)); -} - -int pwc_mpt_set_angle(struct pwc_device *pdev, int pan, int tilt) -{ -	int ret; - -	/* check absolute ranges */ -	if (pan  < pdev->angle_range.pan_min  || -	    pan  > pdev->angle_range.pan_max  || -	    tilt < pdev->angle_range.tilt_min || -	    tilt > pdev->angle_range.tilt_max) -		return -ERANGE; - -	/* go to relative range, check again */ -	pan  -= pdev->pan_angle; -	tilt -= pdev->tilt_angle; -	/* angles are specified in degrees * 100, thus the limit = 36000 */ -	if (pan < -36000 || pan > 36000 || tilt < -36000 || tilt > 36000) -		return -ERANGE; - -	ret = _pwc_mpt_set_angle(pdev, pan, tilt); -	if (ret >= 0) { -		pdev->pan_angle  += pan; -		pdev->tilt_angle += tilt; -	} -	if (ret == -EPIPE) /* stall -> out of range */ -		ret = -ERANGE; -	return ret; -} - -static int pwc_mpt_get_status(struct pwc_device *pdev, struct pwc_mpt_status *status) -{ -	int ret; -	unsigned char buf[5]; - -	ret = recv_control_msg(pdev, -		GET_MPT_CTL, PT_STATUS_FORMATTER, &buf, sizeof(buf)); -	if (ret < 0) -		return ret; -	status->status = buf[0] & 0x7; // 3 bits are used for reporting -	status->time_pan = (buf[1] << 8) + buf[2]; -	status->time_tilt = (buf[3] << 8) + buf[4]; -	return 0; -} - - -int pwc_get_cmos_sensor(struct pwc_device *pdev, int *sensor) -{ -	unsigned char buf; -	int ret = -1, request; - -	if (pdev->type < 675) -		request = SENSOR_TYPE_FORMATTER1; -	else if (pdev->type < 730) -		return -1; /* The Vesta series doesn't have this call */ -	else -		request = SENSOR_TYPE_FORMATTER2; - -	ret = recv_control_msg(pdev, -		GET_STATUS_CTL, request, &buf, sizeof(buf)); -	if (ret < 0) -		return ret; -	if (pdev->type < 675) -		*sensor = buf | 0x100; -	else -		*sensor = buf; -	return 0; -} - - - /* End of Add-Ons                                    */ - /* ************************************************* */ - -/* Linux 2.5.something and 2.6 pass direct pointers to arguments of -   ioctl() calls. With 2.4, you have to do tedious copy_from_user() -   and copy_to_user() calls. With these macros we circumvent this, -   and let me maintain only one source file. The functionality is -   exactly the same otherwise. - */ - -/* define local variable for arg */ -#define ARG_DEF(ARG_type, ARG_name)\ -	ARG_type *ARG_name = arg; -/* copy arg to local variable */ -#define ARG_IN(ARG_name) /* nothing */ -/* argument itself (referenced) */ -#define ARGR(ARG_name) (*ARG_name) -/* argument address */ -#define ARGA(ARG_name) ARG_name -/* copy local variable to arg */ -#define ARG_OUT(ARG_name) /* nothing */ - -long pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg) -{ -	long ret = 0; - -	switch(cmd) { -	case VIDIOCPWCRUSER: -	{ -		if (pwc_restore_user(pdev)) -			ret = -EINVAL; -		break; -	} - -	case VIDIOCPWCSUSER: -	{ -		if (pwc_save_user(pdev)) -			ret = -EINVAL; -		break; -	} - -	case VIDIOCPWCFACTORY: -	{ -		if (pwc_restore_factory(pdev)) -			ret = -EINVAL; -		break; -	} - -	case VIDIOCPWCSCQUAL: -	{ -		ARG_DEF(int, qual) - -		ARG_IN(qual) -		if (ARGR(qual) < 0 || ARGR(qual) > 3) -			ret = -EINVAL; -		else -			ret = pwc_try_video_mode(pdev, pdev->view.x, pdev->view.y, pdev->vframes, ARGR(qual), pdev->vsnapshot); -		if (ret >= 0) -			pdev->vcompression = ARGR(qual); -		break; -	} - -	case VIDIOCPWCGCQUAL: -	{ -		ARG_DEF(int, qual) - -		ARGR(qual) = pdev->vcompression; -		ARG_OUT(qual) -		break; -	} - -	case VIDIOCPWCPROBE: -	{ -		ARG_DEF(struct pwc_probe, probe) - -		strcpy(ARGR(probe).name, pdev->vdev->name); -		ARGR(probe).type = pdev->type; -		ARG_OUT(probe) -		break; -	} - -	case VIDIOCPWCGSERIAL: -	{ -		ARG_DEF(struct pwc_serial, serial) - -		strcpy(ARGR(serial).serial, pdev->serial); -		ARG_OUT(serial) -		break; -	} - -	case VIDIOCPWCSAGC: -	{ -		ARG_DEF(int, agc) - -		ARG_IN(agc) -		if (pwc_set_agc(pdev, ARGR(agc) < 0 ? 1 : 0, ARGR(agc))) -			ret = -EINVAL; -		break; -	} - -	case VIDIOCPWCGAGC: -	{ -		ARG_DEF(int, agc) - -		if (pwc_get_agc(pdev, ARGA(agc))) -			ret = -EINVAL; -		ARG_OUT(agc) -		break; -	} - -	case VIDIOCPWCSSHUTTER: -	{ -		ARG_DEF(int, shutter_speed) - -		ARG_IN(shutter_speed) -		ret = pwc_set_shutter_speed(pdev, ARGR(shutter_speed) < 0 ? 1 : 0, ARGR(shutter_speed)); -		break; -	} - -	case VIDIOCPWCSAWB: -	{ -		ARG_DEF(struct pwc_whitebalance, wb) - -		ARG_IN(wb) -		ret = pwc_set_awb(pdev, ARGR(wb).mode); -		if (ret >= 0 && ARGR(wb).mode == PWC_WB_MANUAL) { -			pwc_set_red_gain(pdev, ARGR(wb).manual_red); -			pwc_set_blue_gain(pdev, ARGR(wb).manual_blue); -		} -		break; -	} - -	case VIDIOCPWCGAWB: -	{ -		ARG_DEF(struct pwc_whitebalance, wb) - -		memset(ARGA(wb), 0, sizeof(struct pwc_whitebalance)); -		ARGR(wb).mode = pwc_get_awb(pdev); -		if (ARGR(wb).mode < 0) -			ret = -EINVAL; -		else { -			if (ARGR(wb).mode == PWC_WB_MANUAL) { -				ret = pwc_get_red_gain(pdev, &ARGR(wb).manual_red); -				if (ret < 0) -					break; -				ret = pwc_get_blue_gain(pdev, &ARGR(wb).manual_blue); -				if (ret < 0) -					break; -			} -			if (ARGR(wb).mode == PWC_WB_AUTO) { -				ret = pwc_read_red_gain(pdev, &ARGR(wb).read_red); -				if (ret < 0) -					break; -				ret = pwc_read_blue_gain(pdev, &ARGR(wb).read_blue); -				if (ret < 0) -					break; -			} -		} -		ARG_OUT(wb) -		break; -	} - -	case VIDIOCPWCSAWBSPEED: -	{ -		ARG_DEF(struct pwc_wb_speed, wbs) - -		if (ARGR(wbs).control_speed > 0) { -			ret = pwc_set_wb_speed(pdev, ARGR(wbs).control_speed); -		} -		if (ARGR(wbs).control_delay > 0) { -			ret = pwc_set_wb_delay(pdev, ARGR(wbs).control_delay); -		} -		break; -	} - -	case VIDIOCPWCGAWBSPEED: -	{ -		ARG_DEF(struct pwc_wb_speed, wbs) - -		ret = pwc_get_wb_speed(pdev, &ARGR(wbs).control_speed); -		if (ret < 0) -			break; -		ret = pwc_get_wb_delay(pdev, &ARGR(wbs).control_delay); -		if (ret < 0) -			break; -		ARG_OUT(wbs) -		break; -	} - -	case VIDIOCPWCSLED: -	{ -		ARG_DEF(struct pwc_leds, leds) - -		ARG_IN(leds) -		ret = pwc_set_leds(pdev, ARGR(leds).led_on, ARGR(leds).led_off); -		break; -	} - - -	case VIDIOCPWCGLED: -	{ -		ARG_DEF(struct pwc_leds, leds) - -		ret = pwc_get_leds(pdev, &ARGR(leds).led_on, &ARGR(leds).led_off); -		ARG_OUT(leds) -		break; -	} - -	case VIDIOCPWCSCONTOUR: -	{ -		ARG_DEF(int, contour) - -		ARG_IN(contour) -		ret = pwc_set_contour(pdev, ARGR(contour)); -		break; -	} - -	case VIDIOCPWCGCONTOUR: -	{ -		ARG_DEF(int, contour) - -		ret = pwc_get_contour(pdev, ARGA(contour)); -		ARG_OUT(contour) -		break; -	} - -	case VIDIOCPWCSBACKLIGHT: -	{ -		ARG_DEF(int, backlight) - -		ARG_IN(backlight) -		ret = pwc_set_backlight(pdev, ARGR(backlight)); -		break; -	} - -	case VIDIOCPWCGBACKLIGHT: -	{ -		ARG_DEF(int, backlight) - -		ret = pwc_get_backlight(pdev, ARGA(backlight)); -		ARG_OUT(backlight) -		break; -	} - -	case VIDIOCPWCSFLICKER: -	{ -		ARG_DEF(int, flicker) - -		ARG_IN(flicker) -		ret = pwc_set_flicker(pdev, ARGR(flicker)); -		break; -	} - -	case VIDIOCPWCGFLICKER: -	{ -		ARG_DEF(int, flicker) - -		ret = pwc_get_flicker(pdev, ARGA(flicker)); -		ARG_OUT(flicker) -		break; -	} - -	case VIDIOCPWCSDYNNOISE: -	{ -		ARG_DEF(int, dynnoise) - -		ARG_IN(dynnoise) -		ret = pwc_set_dynamic_noise(pdev, ARGR(dynnoise)); -		break; -	} - -	case VIDIOCPWCGDYNNOISE: -	{ -		ARG_DEF(int, dynnoise) - -		ret = pwc_get_dynamic_noise(pdev, ARGA(dynnoise)); -		ARG_OUT(dynnoise); -		break; -	} - -	case VIDIOCPWCGREALSIZE: -	{ -		ARG_DEF(struct pwc_imagesize, size) - -		ARGR(size).width = pdev->image.x; -		ARGR(size).height = pdev->image.y; -		ARG_OUT(size) -		break; -	} - -	case VIDIOCPWCMPTRESET: -	{ -		if (pdev->features & FEATURE_MOTOR_PANTILT) -		{ -			ARG_DEF(int, flags) - -			ARG_IN(flags) -			ret = pwc_mpt_reset(pdev, ARGR(flags)); -		} -		else -		{ -			ret = -ENXIO; -		} -		break; -	} - -	case VIDIOCPWCMPTGRANGE: -	{ -		if (pdev->features & FEATURE_MOTOR_PANTILT) -		{ -			ARG_DEF(struct pwc_mpt_range, range) - -			ARGR(range) = pdev->angle_range; -			ARG_OUT(range) -		} -		else -		{ -			ret = -ENXIO; -		} -		break; -	} - -	case VIDIOCPWCMPTSANGLE: -	{ -		int new_pan, new_tilt; - -		if (pdev->features & FEATURE_MOTOR_PANTILT) -		{ -			ARG_DEF(struct pwc_mpt_angles, angles) - -			ARG_IN(angles) -			/* The camera can only set relative angles, so -			   do some calculations when getting an absolute angle . -			 */ -			if (ARGR(angles).absolute) -			{ -				new_pan  = ARGR(angles).pan; -				new_tilt = ARGR(angles).tilt; -			} -			else -			{ -				new_pan  = pdev->pan_angle  + ARGR(angles).pan; -				new_tilt = pdev->tilt_angle + ARGR(angles).tilt; -			} -			ret = pwc_mpt_set_angle(pdev, new_pan, new_tilt); -		} -		else -		{ -			ret = -ENXIO; -		} -		break; -	} - -	case VIDIOCPWCMPTGANGLE: -	{ - -		if (pdev->features & FEATURE_MOTOR_PANTILT) -		{ -			ARG_DEF(struct pwc_mpt_angles, angles) - -			ARGR(angles).absolute = 1; -			ARGR(angles).pan  = pdev->pan_angle; -			ARGR(angles).tilt = pdev->tilt_angle; -			ARG_OUT(angles) -		} -		else -		{ -			ret = -ENXIO; -		} -		break; -	} - -	case VIDIOCPWCMPTSTATUS: -	{ -		if (pdev->features & FEATURE_MOTOR_PANTILT) -		{ -			ARG_DEF(struct pwc_mpt_status, status) - -			ret = pwc_mpt_get_status(pdev, ARGA(status)); -			ARG_OUT(status) -		} -		else -		{ -			ret = -ENXIO; -		} -		break; -	} - -	case VIDIOCPWCGVIDCMD: -	{ -		ARG_DEF(struct pwc_video_command, vcmd); - -		ARGR(vcmd).type = pdev->type; -		ARGR(vcmd).release = pdev->release; -		ARGR(vcmd).command_len = pdev->cmd_len; -		memcpy(&ARGR(vcmd).command_buf, pdev->cmd_buf, pdev->cmd_len); -		ARGR(vcmd).bandlength = pdev->vbandlength; -		ARGR(vcmd).frame_size = pdev->frame_size; -		ARG_OUT(vcmd) -		break; -	} -	/* -	case VIDIOCPWCGVIDTABLE: -	{ -		ARG_DEF(struct pwc_table_init_buffer, table); -		ARGR(table).len = pdev->cmd_len; -		memcpy(&ARGR(table).buffer, pdev->decompress_data, pdev->decompressor->table_size); -		ARG_OUT(table) -		break; -	} -	*/ - -	default: -		ret = -ENOIOCTLCMD; -		break; -	} - -	if (ret > 0) -		return 0; -	return ret; -} - - -/* vim: set cinoptions= formatoptions=croql cindent shiftwidth=8 tabstop=8: */ diff --git a/drivers/media/video/pwc/pwc-dec1.c b/drivers/media/video/pwc/pwc-dec1.c deleted file mode 100644 index c29593f589e..00000000000 --- a/drivers/media/video/pwc/pwc-dec1.c +++ /dev/null @@ -1,50 +0,0 @@ -/* Linux driver for Philips webcam -   Decompression for chipset version 1 -   (C) 2004-2006 Luc Saillard (luc@saillard.org) - -   NOTE: this version of pwc is an unofficial (modified) release of pwc & pcwx -   driver and thus may have bugs that are not present in the original version. -   Please send bug reports and support requests to <luc@saillard.org>. -   The decompression routines have been implemented by reverse-engineering the -   Nemosoft binary pwcx module. Caveat emptor. - -   This program is free software; you can redistribute it and/or modify -   it under the terms of the GNU General Public License as published by -   the Free Software Foundation; either version 2 of the License, or -   (at your option) any later version. - -   This program is distributed in the hope that it will be useful, -   but WITHOUT ANY WARRANTY; without even the implied warranty of -   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the -   GNU General Public License for more details. - -   You should have received a copy of the GNU General Public License -   along with this program; if not, write to the Free Software -   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA -*/ - - - -#include "pwc-dec1.h" - - -void pwc_dec1_init(int type, int release, void *buffer, void *table) -{ - -} - -void pwc_dec1_exit(void) -{ - - - -} - -int pwc_dec1_alloc(struct pwc_device *pwc) -{ -	pwc->decompress_data = kmalloc(sizeof(struct pwc_dec1_private), GFP_KERNEL); -	if (pwc->decompress_data == NULL) -		return -ENOMEM; -	return 0; -} - diff --git a/drivers/media/video/pwc/pwc-dec1.h b/drivers/media/video/pwc/pwc-dec1.h deleted file mode 100644 index 8b62ddcc5c7..00000000000 --- a/drivers/media/video/pwc/pwc-dec1.h +++ /dev/null @@ -1,43 +0,0 @@ -/* Linux driver for Philips webcam -   (C) 2004-2006 Luc Saillard (luc@saillard.org) - -   NOTE: this version of pwc is an unofficial (modified) release of pwc & pcwx -   driver and thus may have bugs that are not present in the original version. -   Please send bug reports and support requests to <luc@saillard.org>. -   The decompression routines have been implemented by reverse-engineering the -   Nemosoft binary pwcx module. Caveat emptor. - -   This program is free software; you can redistribute it and/or modify -   it under the terms of the GNU General Public License as published by -   the Free Software Foundation; either version 2 of the License, or -   (at your option) any later version. - -   This program is distributed in the hope that it will be useful, -   but WITHOUT ANY WARRANTY; without even the implied warranty of -   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the -   GNU General Public License for more details. - -   You should have received a copy of the GNU General Public License -   along with this program; if not, write to the Free Software -   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA -*/ - - - -#ifndef PWC_DEC1_H -#define PWC_DEC1_H - -#include "pwc.h" - -struct pwc_dec1_private -{ -	int version; - -}; - -int  pwc_dec1_alloc(struct pwc_device *pwc); -void pwc_dec1_init(int type, int release, void *buffer, void *private_data); -void pwc_dec1_exit(void); - -#endif - diff --git a/drivers/media/video/pwc/pwc-dec23.c b/drivers/media/video/pwc/pwc-dec23.c deleted file mode 100644 index 0c801b8f3ec..00000000000 --- a/drivers/media/video/pwc/pwc-dec23.c +++ /dev/null @@ -1,942 +0,0 @@ -/* Linux driver for Philips webcam -   Decompression for chipset version 2 et 3 -   (C) 2004-2006  Luc Saillard (luc@saillard.org) - -   NOTE: this version of pwc is an unofficial (modified) release of pwc & pcwx -   driver and thus may have bugs that are not present in the original version. -   Please send bug reports and support requests to <luc@saillard.org>. -   The decompression routines have been implemented by reverse-engineering the -   Nemosoft binary pwcx module. Caveat emptor. - -   This program is free software; you can redistribute it and/or modify -   it under the terms of the GNU General Public License as published by -   the Free Software Foundation; either version 2 of the License, or -   (at your option) any later version. - -   This program is distributed in the hope that it will be useful, -   but WITHOUT ANY WARRANTY; without even the implied warranty of -   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the -   GNU General Public License for more details. - -   You should have received a copy of the GNU General Public License -   along with this program; if not, write to the Free Software -   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA - -*/ - -#include "pwc-timon.h" -#include "pwc-kiara.h" -#include "pwc-dec23.h" -#include <media/pwc-ioctl.h> - -#include <linux/string.h> -#include <linux/slab.h> - -/* - * USE_LOOKUP_TABLE_TO_CLAMP - *   0: use a C version of this tests:  {  a<0?0:(a>255?255:a) } - *   1: use a faster lookup table for cpu with a big cache (intel) - */ -#define USE_LOOKUP_TABLE_TO_CLAMP	1 -/* - * UNROLL_LOOP_FOR_COPYING_BLOCK - *   0: use a loop for a smaller code (but little slower) - *   1: when unrolling the loop, gcc produces some faster code (perhaps only - *   valid for intel processor class). Activating this option, automaticaly - *   activate USE_LOOKUP_TABLE_TO_CLAMP - */ -#define UNROLL_LOOP_FOR_COPY		1 -#if UNROLL_LOOP_FOR_COPY -# undef USE_LOOKUP_TABLE_TO_CLAMP -# define USE_LOOKUP_TABLE_TO_CLAMP 1 -#endif - -/* - * ENABLE_BAYER_DECODER - *   0: bayer decoder is not build (save some space) - *   1: bayer decoder is build and can be used - */ -#define ENABLE_BAYER_DECODER 0 - -static void build_subblock_pattern(struct pwc_dec23_private *pdec) -{ -	static const unsigned int initial_values[12] = { -		-0x526500, -0x221200, 0x221200, 0x526500, -			   -0x3de200, 0x3de200, -		-0x6db480, -0x2d5d00, 0x2d5d00, 0x6db480, -			   -0x12c200, 0x12c200 - -	}; -	static const unsigned int values_derivated[12] = { -		0xa4ca, 0x4424, -0x4424, -0xa4ca, -			0x7bc4, -0x7bc4, -		0xdb69, 0x5aba, -0x5aba, -0xdb69, -			0x2584, -0x2584 -	}; -	unsigned int temp_values[12]; -	int i, j; - -	memcpy(temp_values, initial_values, sizeof(initial_values)); -	for (i = 0; i < 256; i++) { -		for (j = 0; j < 12; j++) { -			pdec->table_subblock[i][j] = temp_values[j]; -			temp_values[j] += values_derivated[j]; -		} -	} -} - -static void build_bit_powermask_table(struct pwc_dec23_private *pdec) -{ -	unsigned char *p; -	unsigned int bit, byte, mask, val; -	unsigned int bitpower = 1; - -	for (bit = 0; bit < 8; bit++) { -		mask = bitpower - 1; -		p = pdec->table_bitpowermask[bit]; -		for (byte = 0; byte < 256; byte++) { -			val = (byte & mask); -			if (byte & bitpower) -				val = -val; -			*p++ = val; -		} -		bitpower<<=1; -	} -} - - -static void build_table_color(const unsigned int romtable[16][8], -			      unsigned char p0004[16][1024], -			      unsigned char p8004[16][256]) -{ -	int compression_mode, j, k, bit, pw; -	unsigned char *p0, *p8; -	const unsigned int *r; - -	/* We have 16 compressions tables */ -	for (compression_mode = 0; compression_mode < 16; compression_mode++) { -		p0 = p0004[compression_mode]; -		p8 = p8004[compression_mode]; -		r  = romtable[compression_mode]; - -		for (j = 0; j < 8; j++, r++, p0 += 128) { - -			for (k = 0; k < 16; k++) { -				if (k == 0) -					bit = 1; -				else if (k >= 1 && k < 3) -					bit = (r[0] >> 15) & 7; -				else if (k >= 3 && k < 6) -					bit = (r[0] >> 12) & 7; -				else if (k >= 6 && k < 10) -					bit = (r[0] >> 9) & 7; -				else if (k >= 10 && k < 13) -					bit = (r[0] >> 6) & 7; -				else if (k >= 13 && k < 15) -					bit = (r[0] >> 3) & 7; -				else -					bit = (r[0]) & 7; -				if (k == 0) -					*p8++ = 8; -				else -					*p8++ = j - bit; -				*p8++ = bit; - -				pw = 1 << bit; -				p0[k + 0x00] = (1 * pw) + 0x80; -				p0[k + 0x10] = (2 * pw) + 0x80; -				p0[k + 0x20] = (3 * pw) + 0x80; -				p0[k + 0x30] = (4 * pw) + 0x80; -				p0[k + 0x40] = (-1 * pw) + 0x80; -				p0[k + 0x50] = (-2 * pw) + 0x80; -				p0[k + 0x60] = (-3 * pw) + 0x80; -				p0[k + 0x70] = (-4 * pw) + 0x80; -			}	/* end of for (k=0; k<16; k++, p8++) */ -		}	/* end of for (j=0; j<8; j++ , table++) */ -	} /* end of foreach compression_mode */ -} - -/* - * - */ -static void fill_table_dc00_d800(struct pwc_dec23_private *pdec) -{ -#define SCALEBITS 15 -#define ONE_HALF  (1UL << (SCALEBITS - 1)) -	int i; -	unsigned int offset1 = ONE_HALF; -	unsigned int offset2 = 0x0000; - -	for (i=0; i<256; i++) { -		pdec->table_dc00[i] = offset1 & ~(ONE_HALF); -		pdec->table_d800[i] = offset2; - -		offset1 += 0x7bc4; -		offset2 += 0x7bc4; -	} -} - -/* - * To decode the stream: - *   if look_bits(2) == 0:	# op == 2 in the lookup table - *      skip_bits(2) - *      end of the stream - *   elif look_bits(3) == 7:	# op == 1 in the lookup table - *      skip_bits(3) - *      yyyy = get_bits(4) - *      xxxx = get_bits(8) - *   else:			# op == 0 in the lookup table - *      skip_bits(x) - * - * For speedup processing, we build a lookup table and we takes the first 6 bits. - * - * struct { - *   unsigned char op;	    // operation to execute - *   unsigned char bits;    // bits use to perform operation - *   unsigned char offset1; // offset to add to access in the table_0004 % 16 - *   unsigned char offset2; // offset to add to access in the table_0004 - * } - * - * How to build this table ? - *   op == 2 when (i%4)==0 - *   op == 1 when (i%8)==7 - *   op == 0 otherwise - * - */ -static const unsigned char hash_table_ops[64*4] = { -	0x02, 0x00, 0x00, 0x00, -	0x00, 0x03, 0x01, 0x00, -	0x00, 0x04, 0x01, 0x10, -	0x00, 0x06, 0x01, 0x30, -	0x02, 0x00, 0x00, 0x00, -	0x00, 0x03, 0x01, 0x40, -	0x00, 0x05, 0x01, 0x20, -	0x01, 0x00, 0x00, 0x00, -	0x02, 0x00, 0x00, 0x00, -	0x00, 0x03, 0x01, 0x00, -	0x00, 0x04, 0x01, 0x50, -	0x00, 0x05, 0x02, 0x00, -	0x02, 0x00, 0x00, 0x00, -	0x00, 0x03, 0x01, 0x40, -	0x00, 0x05, 0x03, 0x00, -	0x01, 0x00, 0x00, 0x00, -	0x02, 0x00, 0x00, 0x00, -	0x00, 0x03, 0x01, 0x00, -	0x00, 0x04, 0x01, 0x10, -	0x00, 0x06, 0x02, 0x10, -	0x02, 0x00, 0x00, 0x00, -	0x00, 0x03, 0x01, 0x40, -	0x00, 0x05, 0x01, 0x60, -	0x01, 0x00, 0x00, 0x00, -	0x02, 0x00, 0x00, 0x00, -	0x00, 0x03, 0x01, 0x00, -	0x00, 0x04, 0x01, 0x50, -	0x00, 0x05, 0x02, 0x40, -	0x02, 0x00, 0x00, 0x00, -	0x00, 0x03, 0x01, 0x40, -	0x00, 0x05, 0x03, 0x40, -	0x01, 0x00, 0x00, 0x00, -	0x02, 0x00, 0x00, 0x00, -	0x00, 0x03, 0x01, 0x00, -	0x00, 0x04, 0x01, 0x10, -	0x00, 0x06, 0x01, 0x70, -	0x02, 0x00, 0x00, 0x00, -	0x00, 0x03, 0x01, 0x40, -	0x00, 0x05, 0x01, 0x20, -	0x01, 0x00, 0x00, 0x00, -	0x02, 0x00, 0x00, 0x00, -	0x00, 0x03, 0x01, 0x00, -	0x00, 0x04, 0x01, 0x50, -	0x00, 0x05, 0x02, 0x00, -	0x02, 0x00, 0x00, 0x00, -	0x00, 0x03, 0x01, 0x40, -	0x00, 0x05, 0x03, 0x00, -	0x01, 0x00, 0x00, 0x00, -	0x02, 0x00, 0x00, 0x00, -	0x00, 0x03, 0x01, 0x00, -	0x00, 0x04, 0x01, 0x10, -	0x00, 0x06, 0x02, 0x50, -	0x02, 0x00, 0x00, 0x00, -	0x00, 0x03, 0x01, 0x40, -	0x00, 0x05, 0x01, 0x60, -	0x01, 0x00, 0x00, 0x00, -	0x02, 0x00, 0x00, 0x00, -	0x00, 0x03, 0x01, 0x00, -	0x00, 0x04, 0x01, 0x50, -	0x00, 0x05, 0x02, 0x40, -	0x02, 0x00, 0x00, 0x00, -	0x00, 0x03, 0x01, 0x40, -	0x00, 0x05, 0x03, 0x40, -	0x01, 0x00, 0x00, 0x00 -}; - -/* - * - */ -static const unsigned int MulIdx[16][16] = { -	{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,}, -	{0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3,}, -	{0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3,}, -	{4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 4, 4, 4, 4,}, -	{6, 7, 8, 9, 7, 10, 11, 8, 8, 11, 10, 7, 9, 8, 7, 6,}, -	{4, 5, 5, 4, 4, 5, 5, 4, 4, 5, 5, 4, 4, 5, 5, 4,}, -	{1, 3, 0, 2, 1, 3, 0, 2, 1, 3, 0, 2, 1, 3, 0, 2,}, -	{0, 3, 3, 0, 1, 2, 2, 1, 2, 1, 1, 2, 3, 0, 0, 3,}, -	{0, 1, 2, 3, 3, 2, 1, 0, 3, 2, 1, 0, 0, 1, 2, 3,}, -	{1, 1, 1, 1, 3, 3, 3, 3, 0, 0, 0, 0, 2, 2, 2, 2,}, -	{7, 10, 11, 8, 9, 8, 7, 6, 6, 7, 8, 9, 8, 11, 10, 7,}, -	{4, 5, 5, 4, 5, 4, 4, 5, 5, 4, 4, 5, 4, 5, 5, 4,}, -	{7, 9, 6, 8, 10, 8, 7, 11, 11, 7, 8, 10, 8, 6, 9, 7,}, -	{1, 3, 0, 2, 2, 0, 3, 1, 2, 0, 3, 1, 1, 3, 0, 2,}, -	{1, 2, 2, 1, 3, 0, 0, 3, 0, 3, 3, 0, 2, 1, 1, 2,}, -	{10, 8, 7, 11, 8, 6, 9, 7, 7, 9, 6, 8, 11, 7, 8, 10} -}; - -#if USE_LOOKUP_TABLE_TO_CLAMP -#define MAX_OUTER_CROP_VALUE	(512) -static unsigned char pwc_crop_table[256 + 2*MAX_OUTER_CROP_VALUE]; -#define CLAMP(x) (pwc_crop_table[MAX_OUTER_CROP_VALUE+(x)]) -#else -#define CLAMP(x) ((x)>255?255:((x)<0?0:x)) -#endif - - -/* If the type or the command change, we rebuild the lookup table */ -int pwc_dec23_init(struct pwc_device *pwc, int type, unsigned char *cmd) -{ -	int flags, version, shift, i; -	struct pwc_dec23_private *pdec; - -	if (pwc->decompress_data == NULL) { -		pdec = kmalloc(sizeof(struct pwc_dec23_private), GFP_KERNEL); -		if (pdec == NULL) -			return -ENOMEM; -		pwc->decompress_data = pdec; -	} -	pdec = pwc->decompress_data; - -	if (DEVICE_USE_CODEC3(type)) { -		flags = cmd[2] & 0x18; -		if (flags == 8) -			pdec->nbits = 7;	/* More bits, mean more bits to encode the stream, but better quality */ -		else if (flags == 0x10) -			pdec->nbits = 8; -		else -			pdec->nbits = 6; - -		version = cmd[2] >> 5; -		build_table_color(KiaraRomTable[version][0], pdec->table_0004_pass1, pdec->table_8004_pass1); -		build_table_color(KiaraRomTable[version][1], pdec->table_0004_pass2, pdec->table_8004_pass2); - -	} else { - -		flags = cmd[2] & 6; -		if (flags == 2) -			pdec->nbits = 7; -		else if (flags == 4) -			pdec->nbits = 8; -		else -			pdec->nbits = 6; - -		version = cmd[2] >> 3; -		build_table_color(TimonRomTable[version][0], pdec->table_0004_pass1, pdec->table_8004_pass1); -		build_table_color(TimonRomTable[version][1], pdec->table_0004_pass2, pdec->table_8004_pass2); -	} - -	/* Informations can be coded on a variable number of bits but never less than 8 */ -	shift = 8 - pdec->nbits; -	pdec->scalebits = SCALEBITS - shift; -	pdec->nbitsmask = 0xFF >> shift; - -	fill_table_dc00_d800(pdec); -	build_subblock_pattern(pdec); -	build_bit_powermask_table(pdec); - -#if USE_LOOKUP_TABLE_TO_CLAMP -	/* Build the static table to clamp value [0-255] */ -	for (i=0;i<MAX_OUTER_CROP_VALUE;i++) -		pwc_crop_table[i] = 0; -	for (i=0; i<256; i++) -		pwc_crop_table[MAX_OUTER_CROP_VALUE+i] = i; -	for (i=0; i<MAX_OUTER_CROP_VALUE; i++) -		pwc_crop_table[MAX_OUTER_CROP_VALUE+256+i] = 255; -#endif - -	return 0; -} - -/* - * Copy the 4x4 image block to Y plane buffer - */ -static void copy_image_block_Y(const int *src, unsigned char *dst, unsigned int bytes_per_line, unsigned int scalebits) -{ -#if UNROLL_LOOP_FOR_COPY -	const unsigned char *cm = pwc_crop_table+MAX_OUTER_CROP_VALUE; -	const int *c = src; -	unsigned char *d = dst; - -	*d++ = cm[c[0] >> scalebits]; -	*d++ = cm[c[1] >> scalebits]; -	*d++ = cm[c[2] >> scalebits]; -	*d++ = cm[c[3] >> scalebits]; - -	d = dst + bytes_per_line; -	*d++ = cm[c[4] >> scalebits]; -	*d++ = cm[c[5] >> scalebits]; -	*d++ = cm[c[6] >> scalebits]; -	*d++ = cm[c[7] >> scalebits]; - -	d = dst + bytes_per_line*2; -	*d++ = cm[c[8] >> scalebits]; -	*d++ = cm[c[9] >> scalebits]; -	*d++ = cm[c[10] >> scalebits]; -	*d++ = cm[c[11] >> scalebits]; - -	d = dst + bytes_per_line*3; -	*d++ = cm[c[12] >> scalebits]; -	*d++ = cm[c[13] >> scalebits]; -	*d++ = cm[c[14] >> scalebits]; -	*d++ = cm[c[15] >> scalebits]; -#else -	int i; -	const int *c = src; -	unsigned char *d = dst; -	for (i = 0; i < 4; i++, c++) -		*d++ = CLAMP((*c) >> scalebits); - -	d = dst + bytes_per_line; -	for (i = 0; i < 4; i++, c++) -		*d++ = CLAMP((*c) >> scalebits); - -	d = dst + bytes_per_line*2; -	for (i = 0; i < 4; i++, c++) -		*d++ = CLAMP((*c) >> scalebits); - -	d = dst + bytes_per_line*3; -	for (i = 0; i < 4; i++, c++) -		*d++ = CLAMP((*c) >> scalebits); -#endif -} - -/* - * Copy the 4x4 image block to a CrCb plane buffer - * - */ -static void copy_image_block_CrCb(const int *src, unsigned char *dst, unsigned int bytes_per_line, unsigned int scalebits) -{ -#if UNROLL_LOOP_FOR_COPY -	/* Unroll all loops */ -	const unsigned char *cm = pwc_crop_table+MAX_OUTER_CROP_VALUE; -	const int *c = src; -	unsigned char *d = dst; - -	*d++ = cm[c[0] >> scalebits]; -	*d++ = cm[c[4] >> scalebits]; -	*d++ = cm[c[1] >> scalebits]; -	*d++ = cm[c[5] >> scalebits]; -	*d++ = cm[c[2] >> scalebits]; -	*d++ = cm[c[6] >> scalebits]; -	*d++ = cm[c[3] >> scalebits]; -	*d++ = cm[c[7] >> scalebits]; - -	d = dst + bytes_per_line; -	*d++ = cm[c[12] >> scalebits]; -	*d++ = cm[c[8] >> scalebits]; -	*d++ = cm[c[13] >> scalebits]; -	*d++ = cm[c[9] >> scalebits]; -	*d++ = cm[c[14] >> scalebits]; -	*d++ = cm[c[10] >> scalebits]; -	*d++ = cm[c[15] >> scalebits]; -	*d++ = cm[c[11] >> scalebits]; -#else -	int i; -	const int *c1 = src; -	const int *c2 = src + 4; -	unsigned char *d = dst; - -	for (i = 0; i < 4; i++, c1++, c2++) { -		*d++ = CLAMP((*c1) >> scalebits); -		*d++ = CLAMP((*c2) >> scalebits); -	} -	c1 = src + 12; -	d = dst + bytes_per_line; -	for (i = 0; i < 4; i++, c1++, c2++) { -		*d++ = CLAMP((*c1) >> scalebits); -		*d++ = CLAMP((*c2) >> scalebits); -	} -#endif -} - -#if ENABLE_BAYER_DECODER -/* - * Format: 8x2 pixels - *   . G . G . G . G . G . G . G - *   . . . . . . . . . . . . . . - *   . G . G . G . G . G . G . G - *   . . . . . . . . . . . . . . - *   or - *   . . . . . . . . . . . . . . - *   G . G . G . G . G . G . G . - *   . . . . . . . . . . . . . . - *   G . G . G . G . G . G . G . -*/ -static void copy_image_block_Green(const int *src, unsigned char *dst, unsigned int bytes_per_line, unsigned int scalebits) -{ -#if UNROLL_LOOP_FOR_COPY -	/* Unroll all loops */ -	const unsigned char *cm = pwc_crop_table+MAX_OUTER_CROP_VALUE; -	unsigned char *d = dst; -	const int *c = src; - -	d[0] = cm[c[0] >> scalebits]; -	d[2] = cm[c[1] >> scalebits]; -	d[4] = cm[c[2] >> scalebits]; -	d[6] = cm[c[3] >> scalebits]; -	d[8] = cm[c[4] >> scalebits]; -	d[10] = cm[c[5] >> scalebits]; -	d[12] = cm[c[6] >> scalebits]; -	d[14] = cm[c[7] >> scalebits]; - -	d = dst + bytes_per_line; -	d[0] = cm[c[8] >> scalebits]; -	d[2] = cm[c[9] >> scalebits]; -	d[4] = cm[c[10] >> scalebits]; -	d[6] = cm[c[11] >> scalebits]; -	d[8] = cm[c[12] >> scalebits]; -	d[10] = cm[c[13] >> scalebits]; -	d[12] = cm[c[14] >> scalebits]; -	d[14] = cm[c[15] >> scalebits]; -#else -	int i; -	unsigned char *d; -	const int *c = src; - -	d = dst; -	for (i = 0; i < 8; i++, c++) -		d[i*2] = CLAMP((*c) >> scalebits); - -	d = dst + bytes_per_line; -	for (i = 0; i < 8; i++, c++) -		d[i*2] = CLAMP((*c) >> scalebits); -#endif -} -#endif - -#if ENABLE_BAYER_DECODER -/* - * Format: 4x4 pixels - *   R . R . R . R - *   . B . B . B . - *   R . R . R . R - *   . B . B . B . - */ -static void copy_image_block_RedBlue(const int *src, unsigned char *dst, unsigned int bytes_per_line, unsigned int scalebits) -{ -#if UNROLL_LOOP_FOR_COPY -	/* Unroll all loops */ -	const unsigned char *cm = pwc_crop_table+MAX_OUTER_CROP_VALUE; -	unsigned char *d = dst; -	const int *c = src; - -	d[0] = cm[c[0] >> scalebits]; -	d[2] = cm[c[1] >> scalebits]; -	d[4] = cm[c[2] >> scalebits]; -	d[6] = cm[c[3] >> scalebits]; - -	d = dst + bytes_per_line; -	d[1] = cm[c[4] >> scalebits]; -	d[3] = cm[c[5] >> scalebits]; -	d[5] = cm[c[6] >> scalebits]; -	d[7] = cm[c[7] >> scalebits]; - -	d = dst + bytes_per_line*2; -	d[0] = cm[c[8] >> scalebits]; -	d[2] = cm[c[9] >> scalebits]; -	d[4] = cm[c[10] >> scalebits]; -	d[6] = cm[c[11] >> scalebits]; - -	d = dst + bytes_per_line*3; -	d[1] = cm[c[12] >> scalebits]; -	d[3] = cm[c[13] >> scalebits]; -	d[5] = cm[c[14] >> scalebits]; -	d[7] = cm[c[15] >> scalebits]; -#else -	int i; -	unsigned char *d; -	const int *c = src; - -	d = dst; -	for (i = 0; i < 4; i++, c++) -		d[i*2] = CLAMP((*c) >> scalebits); - -	d = dst + bytes_per_line; -	for (i = 0; i < 4; i++, c++) -		d[i*2+1] = CLAMP((*c) >> scalebits); - -	d = dst + bytes_per_line*2; -	for (i = 0; i < 4; i++, c++) -		d[i*2] = CLAMP((*c) >> scalebits); - -	d = dst + bytes_per_line*3; -	for (i = 0; i < 4; i++, c++) -		d[i*2+1] = CLAMP((*c) >> scalebits); -#endif -} -#endif - -/* - * To manage the stream, we keep bits in a 32 bits register. - * fill_nbits(n): fill the reservoir with at least n bits - * skip_bits(n): discard n bits from the reservoir - * get_bits(n): fill the reservoir, returns the first n bits and discard the - *              bits from the reservoir. - * __get_nbits(n): faster version of get_bits(n), but asumes that the reservoir - *                 contains at least n bits. bits returned is discarded. - */ -#define fill_nbits(pdec, nbits_wanted) do { \ -   while (pdec->nbits_in_reservoir<(nbits_wanted)) \ -    { \ -      pdec->reservoir |= (*(pdec->stream)++) << (pdec->nbits_in_reservoir); \ -      pdec->nbits_in_reservoir += 8; \ -    } \ -}  while(0); - -#define skip_nbits(pdec, nbits_to_skip) do { \ -   pdec->reservoir >>= (nbits_to_skip); \ -   pdec->nbits_in_reservoir -= (nbits_to_skip); \ -}  while(0); - -#define get_nbits(pdec, nbits_wanted, result) do { \ -   fill_nbits(pdec, nbits_wanted); \ -   result = (pdec->reservoir) & ((1U<<(nbits_wanted))-1); \ -   skip_nbits(pdec, nbits_wanted); \ -}  while(0); - -#define __get_nbits(pdec, nbits_wanted, result) do { \ -   result = (pdec->reservoir) & ((1U<<(nbits_wanted))-1); \ -   skip_nbits(pdec, nbits_wanted); \ -}  while(0); - -#define look_nbits(pdec, nbits_wanted) \ -   ((pdec->reservoir) & ((1U<<(nbits_wanted))-1)) - -/* - * Decode a 4x4 pixel block - */ -static void decode_block(struct pwc_dec23_private *pdec, -			 const unsigned char *ptable0004, -			 const unsigned char *ptable8004) -{ -	unsigned int primary_color; -	unsigned int channel_v, offset1, op; -	int i; - -	fill_nbits(pdec, 16); -	__get_nbits(pdec, pdec->nbits, primary_color); - -	if (look_nbits(pdec,2) == 0) { -		skip_nbits(pdec, 2); -		/* Very simple, the color is the same for all pixels of the square */ -		for (i = 0; i < 16; i++) -			pdec->temp_colors[i] = pdec->table_dc00[primary_color]; - -		return; -	} - -	/* This block is encoded with small pattern */ -	for (i = 0; i < 16; i++) -		pdec->temp_colors[i] = pdec->table_d800[primary_color]; - -	__get_nbits(pdec, 3, channel_v); -	channel_v = ((channel_v & 1) << 2) | (channel_v & 2) | ((channel_v & 4) >> 2); - -	ptable0004 += (channel_v * 128); -	ptable8004 += (channel_v * 32); - -	offset1 = 0; -	do -	{ -		unsigned int htable_idx, rows = 0; -		const unsigned int *block; - -		/* [  zzzz y x x ] -		 *     xx == 00 :=> end of the block def, remove the two bits from the stream -		 *    yxx == 111 -		 *    yxx == any other value -		 * -		 */ -		fill_nbits(pdec, 16); -		htable_idx = look_nbits(pdec, 6); -		op = hash_table_ops[htable_idx * 4]; - -		if (op == 2) { -			skip_nbits(pdec, 2); - -		} else if (op == 1) { -			/* 15bits [ xxxx xxxx yyyy 111 ] -			 * yyy => offset in the table8004 -			 * xxx => offset in the tabled004 (tree) -			 */ -			unsigned int mask, shift; -			unsigned int nbits, col1; -			unsigned int yyyy; - -			skip_nbits(pdec, 3); -			/* offset1 += yyyy */ -			__get_nbits(pdec, 4, yyyy); -			offset1 += 1 + yyyy; -			offset1 &= 0x0F; -			nbits = ptable8004[offset1 * 2]; - -			/* col1 = xxxx xxxx */ -			__get_nbits(pdec, nbits+1, col1); - -			/* Bit mask table */ -			mask = pdec->table_bitpowermask[nbits][col1]; -			shift = ptable8004[offset1 * 2 + 1]; -			rows = ((mask << shift) + 0x80) & 0xFF; - -			block = pdec->table_subblock[rows]; -			for (i = 0; i < 16; i++) -				pdec->temp_colors[i] += block[MulIdx[offset1][i]]; - -		} else { -			/* op == 0 -			 * offset1 is coded on 3 bits -			 */ -			unsigned int shift; - -			offset1 += hash_table_ops [htable_idx * 4 + 2]; -			offset1 &= 0x0F; - -			rows = ptable0004[offset1 + hash_table_ops [htable_idx * 4 + 3]]; -			block = pdec->table_subblock[rows]; -			for (i = 0; i < 16; i++) -				pdec->temp_colors[i] += block[MulIdx[offset1][i]]; - -			shift = hash_table_ops[htable_idx * 4 + 1]; -			skip_nbits(pdec, shift); -		} - -	} while (op != 2); - -} - -static void DecompressBand23(struct pwc_dec23_private *pdec, -			     const unsigned char *rawyuv, -			     unsigned char *planar_y, -			     unsigned char *planar_u, -			     unsigned char *planar_v, -			     unsigned int   compressed_image_width, -			     unsigned int   real_image_width) -{ -	int compression_index, nblocks; -	const unsigned char *ptable0004; -	const unsigned char *ptable8004; - -	pdec->reservoir = 0; -	pdec->nbits_in_reservoir = 0; -	pdec->stream = rawyuv + 1;	/* The first byte of the stream is skipped */ - -	get_nbits(pdec, 4, compression_index); - -	/* pass 1: uncompress Y component */ -	nblocks = compressed_image_width / 4; - -	ptable0004 = pdec->table_0004_pass1[compression_index]; -	ptable8004 = pdec->table_8004_pass1[compression_index]; - -	/* Each block decode a square of 4x4 */ -	while (nblocks) { -		decode_block(pdec, ptable0004, ptable8004); -		copy_image_block_Y(pdec->temp_colors, planar_y, real_image_width, pdec->scalebits); -		planar_y += 4; -		nblocks--; -	} - -	/* pass 2: uncompress UV component */ -	nblocks = compressed_image_width / 8; - -	ptable0004 = pdec->table_0004_pass2[compression_index]; -	ptable8004 = pdec->table_8004_pass2[compression_index]; - -	/* Each block decode a square of 4x4 */ -	while (nblocks) { -		decode_block(pdec, ptable0004, ptable8004); -		copy_image_block_CrCb(pdec->temp_colors, planar_u, real_image_width/2, pdec->scalebits); - -		decode_block(pdec, ptable0004, ptable8004); -		copy_image_block_CrCb(pdec->temp_colors, planar_v, real_image_width/2, pdec->scalebits); - -		planar_v += 8; -		planar_u += 8; -		nblocks -= 2; -	} - -} - -#if ENABLE_BAYER_DECODER -/* - * Size need to be a multiple of 8 in width - * - * Return a block of four line encoded like this: - * - *   G R G R G R G R G R G R G R G R - *   B G B G B G B G B G B G B G B G - *   G R G R G R G R G R G R G R G R - *   B G B G B G B G B G B G B G B G - * - */ -static void DecompressBandBayer(struct pwc_dec23_private *pdec, -				const unsigned char *rawyuv, -				unsigned char *rgbbayer, -				unsigned int   compressed_image_width, -				unsigned int   real_image_width) -{ -	int compression_index, nblocks; -	const unsigned char *ptable0004; -	const unsigned char *ptable8004; -	unsigned char *dest; - -	pdec->reservoir = 0; -	pdec->nbits_in_reservoir = 0; -	pdec->stream = rawyuv + 1;	/* The first byte of the stream is skipped */ - -	get_nbits(pdec, 4, compression_index); - -	/* pass 1: uncompress RB component */ -	nblocks = compressed_image_width / 4; - -	ptable0004 = pdec->table_0004_pass1[compression_index]; -	ptable8004 = pdec->table_8004_pass1[compression_index]; -	dest = rgbbayer; - -	/* Each block decode a square of 4x4 */ -	while (nblocks) { -		decode_block(pdec, ptable0004, ptable8004); -		copy_image_block_RedBlue(pdec->temp_colors, rgbbayer, real_image_width, pdec->scalebits); -		dest += 8; -		nblocks--; -	} - -	/* pass 2: uncompress G component */ -	nblocks = compressed_image_width / 8; - -	ptable0004 = pdec->table_0004_pass2[compression_index]; -	ptable8004 = pdec->table_8004_pass2[compression_index]; - -	/* Each block decode a square of 4x4 */ -	while (nblocks) { -		decode_block(pdec, ptable0004, ptable8004); -		copy_image_block_Green(pdec->temp_colors, rgbbayer+1, real_image_width, pdec->scalebits); - -		decode_block(pdec, ptable0004, ptable8004); -		copy_image_block_Green(pdec->temp_colors, rgbbayer+real_image_width, real_image_width, pdec->scalebits); - -		rgbbayer += 16; -		nblocks -= 2; -	} -} -#endif - - -/** - * - * Uncompress a pwc23 buffer. - * - * pwc.view: size of the image wanted - * pwc.image: size of the image returned by the camera - * pwc.offset: (x,y) to displayer image in the view - * - * src: raw data - * dst: image output - * flags: PWCX_FLAG_PLANAR or PWCX_FLAG_BAYER - */ -void pwc_dec23_decompress(const struct pwc_device *pwc, -			  const void *src, -			  void *dst, -			  int flags) -{ -	int bandlines_left, stride, bytes_per_block; - -	bandlines_left = pwc->image.y / 4; -	bytes_per_block = pwc->view.x * 4; - -	if (flags & PWCX_FLAG_BAYER) { -#if ENABLE_BAYER_DECODER -		/* RGB Bayer format */ -		unsigned char *rgbout; - -		stride = pwc->view.x * pwc->offset.y; -		rgbout = dst + stride + pwc->offset.x; - - -		while (bandlines_left--) { - -			DecompressBandBayer(pwc->decompress_data, -					    src, -					    rgbout, -					    pwc->image.x, pwc->view.x); - -			src += pwc->vbandlength; -			rgbout += bytes_per_block; - -		} -#else -		memset(dst, 0, pwc->view.x * pwc->view.y); -#endif - -	} else { -		/* YUV420P image format */ -		unsigned char *pout_planar_y; -		unsigned char *pout_planar_u; -		unsigned char *pout_planar_v; -		unsigned int   plane_size; - -		plane_size = pwc->view.x * pwc->view.y; - -		/* offset in Y plane */ -		stride = pwc->view.x * pwc->offset.y; -		pout_planar_y = dst + stride + pwc->offset.x; - -		/* offsets in U/V planes */ -		stride = (pwc->view.x * pwc->offset.y) / 4 + pwc->offset.x / 2; -		pout_planar_u = dst + plane_size + stride; -		pout_planar_v = dst + plane_size + plane_size / 4 + stride; - -		while (bandlines_left--) { - -			DecompressBand23(pwc->decompress_data, -					 src, -					 pout_planar_y, pout_planar_u, pout_planar_v, -					 pwc->image.x, pwc->view.x); -			src += pwc->vbandlength; -			pout_planar_y += bytes_per_block; -			pout_planar_u += pwc->view.x; -			pout_planar_v += pwc->view.x; - -		} - -	} - -} - -void pwc_dec23_exit(void) -{ -	/* Do nothing */ - -} - -/** - * Allocate a private structure used by lookup table. - * You must call kfree() to free the memory allocated. - */ -int pwc_dec23_alloc(struct pwc_device *pwc) -{ -	pwc->decompress_data = kmalloc(sizeof(struct pwc_dec23_private), GFP_KERNEL); -	if (pwc->decompress_data == NULL) -		return -ENOMEM; -	return 0; -} - -/* vim: set cino= formatoptions=croql cindent shiftwidth=8 tabstop=8: */ diff --git a/drivers/media/video/pwc/pwc-dec23.h b/drivers/media/video/pwc/pwc-dec23.h deleted file mode 100644 index 1c55298ad15..00000000000 --- a/drivers/media/video/pwc/pwc-dec23.h +++ /dev/null @@ -1,67 +0,0 @@ -/* Linux driver for Philips webcam -   (C) 2004-2006 Luc Saillard (luc@saillard.org) - -   NOTE: this version of pwc is an unofficial (modified) release of pwc & pcwx -   driver and thus may have bugs that are not present in the original version. -   Please send bug reports and support requests to <luc@saillard.org>. -   The decompression routines have been implemented by reverse-engineering the -   Nemosoft binary pwcx module. Caveat emptor. - -   This program is free software; you can redistribute it and/or modify -   it under the terms of the GNU General Public License as published by -   the Free Software Foundation; either version 2 of the License, or -   (at your option) any later version. - -   This program is distributed in the hope that it will be useful, -   but WITHOUT ANY WARRANTY; without even the implied warranty of -   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the -   GNU General Public License for more details. - -   You should have received a copy of the GNU General Public License -   along with this program; if not, write to the Free Software -   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA -*/ - -#ifndef PWC_DEC23_H -#define PWC_DEC23_H - -#include "pwc.h" - -struct pwc_dec23_private -{ -  unsigned int scalebits; -  unsigned int nbitsmask, nbits; /* Number of bits of a color in the compressed stream */ - -  unsigned int reservoir; -  unsigned int nbits_in_reservoir; -  const unsigned char *stream; -  int temp_colors[16]; - -  unsigned char table_0004_pass1[16][1024]; -  unsigned char table_0004_pass2[16][1024]; -  unsigned char table_8004_pass1[16][256]; -  unsigned char table_8004_pass2[16][256]; -  unsigned int  table_subblock[256][12]; - -  unsigned char table_bitpowermask[8][256]; -  unsigned int  table_d800[256]; -  unsigned int  table_dc00[256]; - -}; - - -int pwc_dec23_alloc(struct pwc_device *pwc); -int pwc_dec23_init(struct pwc_device *pwc, int type, unsigned char *cmd); -void pwc_dec23_exit(void); -void pwc_dec23_decompress(const struct pwc_device *pwc, -			  const void *src, -			  void *dst, -			  int flags); - - - -#endif - - -/* vim: set cino= formatoptions=croql cindent shiftwidth=8 tabstop=8: */ - diff --git a/drivers/media/video/pwc/pwc-if.c b/drivers/media/video/pwc/pwc-if.c deleted file mode 100644 index e62beb4efdb..00000000000 --- a/drivers/media/video/pwc/pwc-if.c +++ /dev/null @@ -1,2115 +0,0 @@ -/* Linux driver for Philips webcam -   USB and Video4Linux interface part. -   (C) 1999-2004 Nemosoft Unv. -   (C) 2004-2006 Luc Saillard (luc@saillard.org) - -   NOTE: this version of pwc is an unofficial (modified) release of pwc & pcwx -   driver and thus may have bugs that are not present in the original version. -   Please send bug reports and support requests to <luc@saillard.org>. -   The decompression routines have been implemented by reverse-engineering the -   Nemosoft binary pwcx module. Caveat emptor. - -   This program is free software; you can redistribute it and/or modify -   it under the terms of the GNU General Public License as published by -   the Free Software Foundation; either version 2 of the License, or -   (at your option) any later version. - -   This program is distributed in the hope that it will be useful, -   but WITHOUT ANY WARRANTY; without even the implied warranty of -   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the -   GNU General Public License for more details. - -   You should have received a copy of the GNU General Public License -   along with this program; if not, write to the Free Software -   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA - -*/ - -/* -   This code forms the interface between the USB layers and the Philips -   specific stuff. Some adanved stuff of the driver falls under an -   NDA, signed between me and Philips B.V., Eindhoven, the Netherlands, and -   is thus not distributed in source form. The binary pwcx.o module -   contains the code that falls under the NDA. - -   In case you're wondering: 'pwc' stands for "Philips WebCam", but -   I really didn't want to type 'philips_web_cam' every time (I'm lazy as -   any Linux kernel hacker, but I don't like uncomprehensible abbreviations -   without explanation). - -   Oh yes, convention: to disctinguish between all the various pointers to -   device-structures, I use these names for the pointer variables: -   udev: struct usb_device * -   vdev: struct video_device * -   pdev: struct pwc_devive * -*/ - -/* Contributors: -   - Alvarado: adding whitebalance code -   - Alistar Moire: QuickCam 3000 Pro device/product ID -   - Tony Hoyle: Creative Labs Webcam 5 device/product ID -   - Mark Burazin: solving hang in VIDIOCSYNC when camera gets unplugged -   - Jk Fang: Sotec Afina Eye ID -   - Xavier Roche: QuickCam Pro 4000 ID -   - Jens Knudsen: QuickCam Zoom ID -   - J. Debert: QuickCam for Notebooks ID -   - Pham Thanh Nam: webcam snapshot button as an event input device -*/ - -#include <linux/errno.h> -#include <linux/init.h> -#include <linux/mm.h> -#include <linux/module.h> -#include <linux/poll.h> -#include <linux/slab.h> -#include <linux/smp_lock.h> -#ifdef CONFIG_USB_PWC_INPUT_EVDEV -#include <linux/usb/input.h> -#endif -#include <linux/vmalloc.h> -#include <asm/io.h> -#include <linux/kernel.h>		/* simple_strtol() */ - -#include "pwc.h" -#include "pwc-kiara.h" -#include "pwc-timon.h" -#include "pwc-dec23.h" -#include "pwc-dec1.h" -#include "pwc-uncompress.h" - -/* Function prototypes and driver templates */ - -/* hotplug device table support */ -static const struct usb_device_id pwc_device_table [] = { -	{ USB_DEVICE(0x0471, 0x0302) }, /* Philips models */ -	{ USB_DEVICE(0x0471, 0x0303) }, -	{ USB_DEVICE(0x0471, 0x0304) }, -	{ USB_DEVICE(0x0471, 0x0307) }, -	{ USB_DEVICE(0x0471, 0x0308) }, -	{ USB_DEVICE(0x0471, 0x030C) }, -	{ USB_DEVICE(0x0471, 0x0310) }, -	{ USB_DEVICE(0x0471, 0x0311) }, /* Philips ToUcam PRO II */ -	{ USB_DEVICE(0x0471, 0x0312) }, -	{ USB_DEVICE(0x0471, 0x0313) }, /* the 'new' 720K */ -	{ USB_DEVICE(0x0471, 0x0329) }, /* Philips SPC 900NC PC Camera */ -	{ USB_DEVICE(0x069A, 0x0001) }, /* Askey */ -	{ USB_DEVICE(0x046D, 0x08B0) }, /* Logitech QuickCam Pro 3000 */ -	{ USB_DEVICE(0x046D, 0x08B1) }, /* Logitech QuickCam Notebook Pro */ -	{ USB_DEVICE(0x046D, 0x08B2) }, /* Logitech QuickCam Pro 4000 */ -	{ USB_DEVICE(0x046D, 0x08B3) }, /* Logitech QuickCam Zoom (old model) */ -	{ USB_DEVICE(0x046D, 0x08B4) }, /* Logitech QuickCam Zoom (new model) */ -	{ USB_DEVICE(0x046D, 0x08B5) }, /* Logitech QuickCam Orbit/Sphere */ -	{ USB_DEVICE(0x046D, 0x08B6) }, /* Cisco VT Camera */ -	{ USB_DEVICE(0x046D, 0x08B7) }, /* Logitech ViewPort AV 100 */ -	{ USB_DEVICE(0x046D, 0x08B8) }, /* Logitech (reserved) */ -	{ USB_DEVICE(0x055D, 0x9000) }, /* Samsung MPC-C10 */ -	{ USB_DEVICE(0x055D, 0x9001) }, /* Samsung MPC-C30 */ -	{ USB_DEVICE(0x055D, 0x9002) },	/* Samsung SNC-35E (Ver3.0) */ -	{ USB_DEVICE(0x041E, 0x400C) }, /* Creative Webcam 5 */ -	{ USB_DEVICE(0x041E, 0x4011) }, /* Creative Webcam Pro Ex */ -	{ USB_DEVICE(0x04CC, 0x8116) }, /* Afina Eye */ -	{ USB_DEVICE(0x06BE, 0x8116) }, /* new Afina Eye */ -	{ USB_DEVICE(0x0d81, 0x1910) }, /* Visionite */ -	{ USB_DEVICE(0x0d81, 0x1900) }, -	{ } -}; -MODULE_DEVICE_TABLE(usb, pwc_device_table); - -static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id *id); -static void usb_pwc_disconnect(struct usb_interface *intf); - -static struct usb_driver pwc_driver = { -	.name =			"Philips webcam",	/* name */ -	.id_table =		pwc_device_table, -	.probe =		usb_pwc_probe,		/* probe() */ -	.disconnect =		usb_pwc_disconnect,	/* disconnect() */ -}; - -#define MAX_DEV_HINTS	20 -#define MAX_ISOC_ERRORS	20 - -static int default_size = PSZ_QCIF; -static int default_fps = 10; -static int default_fbufs = 3;   /* Default number of frame buffers */ -	int pwc_mbufs = 2;	/* Default number of mmap() buffers */ -#ifdef CONFIG_USB_PWC_DEBUG -	int pwc_trace = PWC_DEBUG_LEVEL; -#endif -static int power_save; -static int led_on = 100, led_off; /* defaults to LED that is on while in use */ -static int pwc_preferred_compression = 1; /* 0..3 = uncompressed..high */ -static struct { -	int type; -	char serial_number[30]; -	int device_node; -	struct pwc_device *pdev; -} device_hint[MAX_DEV_HINTS]; - -/***/ - -static int pwc_video_open(struct file *file); -static int pwc_video_close(struct file *file); -static ssize_t pwc_video_read(struct file *file, char __user *buf, -			  size_t count, loff_t *ppos); -static unsigned int pwc_video_poll(struct file *file, poll_table *wait); -static long  pwc_video_ioctl(struct file *file, -			    unsigned int ioctlnr, unsigned long arg); -static int  pwc_video_mmap(struct file *file, struct vm_area_struct *vma); - -static const struct v4l2_file_operations pwc_fops = { -	.owner =	THIS_MODULE, -	.open =		pwc_video_open, -	.release =     	pwc_video_close, -	.read =		pwc_video_read, -	.poll =		pwc_video_poll, -	.mmap =		pwc_video_mmap, -	.unlocked_ioctl = pwc_video_ioctl, -}; -static struct video_device pwc_template = { -	.name =		"Philips Webcam",	/* Filled in later */ -	.release =	video_device_release, -	.fops =         &pwc_fops, -}; - -/***************************************************************************/ - -/* Okay, this is some magic that I worked out and the reasoning behind it... - -   The biggest problem with any USB device is of course: "what to do -   when the user unplugs the device while it is in use by an application?" -   We have several options: -   1) Curse them with the 7 plagues when they do (requires divine intervention) -   2) Tell them not to (won't work: they'll do it anyway) -   3) Oops the kernel (this will have a negative effect on a user's uptime) -   4) Do something sensible. - -   Of course, we go for option 4. - -   It happens that this device will be linked to two times, once from -   usb_device and once from the video_device in their respective 'private' -   pointers. This is done when the device is probed() and all initialization -   succeeded. The pwc_device struct links back to both structures. - -   When a device is unplugged while in use it will be removed from the -   list of known USB devices; I also de-register it as a V4L device, but -   unfortunately I can't free the memory since the struct is still in use -   by the file descriptor. This free-ing is then deferend until the first -   opportunity. Crude, but it works. - -   A small 'advantage' is that if a user unplugs the cam and plugs it back -   in, it should get assigned the same video device minor, but unfortunately -   it's non-trivial to re-link the cam back to the video device... (that -   would surely be magic! :)) -*/ - -/***************************************************************************/ -/* Private functions */ - -/* Here we want the physical address of the memory. - * This is used when initializing the contents of the area. - */ - - - -static void *pwc_rvmalloc(unsigned long size) -{ -	void * mem; -	unsigned long adr; - -	mem=vmalloc_32(size); -	if (!mem) -		return NULL; - -	memset(mem, 0, size); /* Clear the ram out, no junk to the user */ -	adr=(unsigned long) mem; -	while (size > 0) -	 { -	   SetPageReserved(vmalloc_to_page((void *)adr)); -	   adr  += PAGE_SIZE; -	   size -= PAGE_SIZE; -	 } -	return mem; -} - -static void pwc_rvfree(void * mem, unsigned long size) -{ -	unsigned long adr; - -	if (!mem) -		return; - -	adr=(unsigned long) mem; -	while ((long) size > 0) -	 { -	   ClearPageReserved(vmalloc_to_page((void *)adr)); -	   adr  += PAGE_SIZE; -	   size -= PAGE_SIZE; -	 } -	vfree(mem); -} - - - - -static int pwc_allocate_buffers(struct pwc_device *pdev) -{ -	int i, err; -	void *kbuf; - -	PWC_DEBUG_MEMORY(">> pwc_allocate_buffers(pdev = 0x%p)\n", pdev); - -	if (pdev == NULL) -		return -ENXIO; - -	/* Allocate Isochronuous pipe buffers */ -	for (i = 0; i < MAX_ISO_BUFS; i++) { -		if (pdev->sbuf[i].data == NULL) { -			kbuf = kzalloc(ISO_BUFFER_SIZE, GFP_KERNEL); -			if (kbuf == NULL) { -				PWC_ERROR("Failed to allocate iso buffer %d.\n", i); -				return -ENOMEM; -			} -			PWC_DEBUG_MEMORY("Allocated iso buffer at %p.\n", kbuf); -			pdev->sbuf[i].data = kbuf; -		} -	} - -	/* Allocate frame buffer structure */ -	if (pdev->fbuf == NULL) { -		kbuf = kzalloc(default_fbufs * sizeof(struct pwc_frame_buf), GFP_KERNEL); -		if (kbuf == NULL) { -			PWC_ERROR("Failed to allocate frame buffer structure.\n"); -			return -ENOMEM; -		} -		PWC_DEBUG_MEMORY("Allocated frame buffer structure at %p.\n", kbuf); -		pdev->fbuf = kbuf; -	} - -	/* create frame buffers, and make circular ring */ -	for (i = 0; i < default_fbufs; i++) { -		if (pdev->fbuf[i].data == NULL) { -			kbuf = vmalloc(PWC_FRAME_SIZE); /* need vmalloc since frame buffer > 128K */ -			if (kbuf == NULL) { -				PWC_ERROR("Failed to allocate frame buffer %d.\n", i); -				return -ENOMEM; -			} -			PWC_DEBUG_MEMORY("Allocated frame buffer %d at %p.\n", i, kbuf); -			pdev->fbuf[i].data = kbuf; -			memset(kbuf, 0, PWC_FRAME_SIZE); -		} -	} - -	/* Allocate decompressor table space */ -	if (DEVICE_USE_CODEC1(pdev->type)) -		err = pwc_dec1_alloc(pdev); -	else -		err = pwc_dec23_alloc(pdev); - -	if (err) { -		PWC_ERROR("Failed to allocate decompress table.\n"); -		return err; -	} - -	/* Allocate image buffer; double buffer for mmap() */ -	kbuf = pwc_rvmalloc(pwc_mbufs * pdev->len_per_image); -	if (kbuf == NULL) { -		PWC_ERROR("Failed to allocate image buffer(s). needed (%d)\n", -				pwc_mbufs * pdev->len_per_image); -		return -ENOMEM; -	} -	PWC_DEBUG_MEMORY("Allocated image buffer at %p.\n", kbuf); -	pdev->image_data = kbuf; -	for (i = 0; i < pwc_mbufs; i++) { -		pdev->images[i].offset = i * pdev->len_per_image; -		pdev->images[i].vma_use_count = 0; -	} -	for (; i < MAX_IMAGES; i++) { -		pdev->images[i].offset = 0; -	} - -	kbuf = NULL; - -	PWC_DEBUG_MEMORY("<< pwc_allocate_buffers()\n"); -	return 0; -} - -static void pwc_free_buffers(struct pwc_device *pdev) -{ -	int i; - -	PWC_DEBUG_MEMORY("Entering free_buffers(%p).\n", pdev); - -	if (pdev == NULL) -		return; -	/* Release Iso-pipe buffers */ -	for (i = 0; i < MAX_ISO_BUFS; i++) -		if (pdev->sbuf[i].data != NULL) { -			PWC_DEBUG_MEMORY("Freeing ISO buffer at %p.\n", pdev->sbuf[i].data); -			kfree(pdev->sbuf[i].data); -			pdev->sbuf[i].data = NULL; -		} - -	/* The same for frame buffers */ -	if (pdev->fbuf != NULL) { -		for (i = 0; i < default_fbufs; i++) { -			if (pdev->fbuf[i].data != NULL) { -				PWC_DEBUG_MEMORY("Freeing frame buffer %d at %p.\n", i, pdev->fbuf[i].data); -				vfree(pdev->fbuf[i].data); -				pdev->fbuf[i].data = NULL; -			} -		} -		kfree(pdev->fbuf); -		pdev->fbuf = NULL; -	} - -	/* Intermediate decompression buffer & tables */ -	if (pdev->decompress_data != NULL) { -		PWC_DEBUG_MEMORY("Freeing decompression buffer at %p.\n", pdev->decompress_data); -		kfree(pdev->decompress_data); -		pdev->decompress_data = NULL; -	} - -	/* Release image buffers */ -	if (pdev->image_data != NULL) { -		PWC_DEBUG_MEMORY("Freeing image buffer at %p.\n", pdev->image_data); -		pwc_rvfree(pdev->image_data, pwc_mbufs * pdev->len_per_image); -	} -	pdev->image_data = NULL; - -	PWC_DEBUG_MEMORY("Leaving free_buffers().\n"); -} - -/* The frame & image buffer mess. - -   Yes, this is a mess. Well, it used to be simple, but alas...  In this -   module, 3 buffers schemes are used to get the data from the USB bus to -   the user program. The first scheme involves the ISO buffers (called thus -   since they transport ISO data from the USB controller), and not really -   interesting. Suffices to say the data from this buffer is quickly -   gathered in an interrupt handler (pwc_isoc_handler) and placed into the -   frame buffer. - -   The frame buffer is the second scheme, and is the central element here. -   It collects the data from a single frame from the camera (hence, the -   name). Frames are delimited by the USB camera with a short USB packet, -   so that's easy to detect. The frame buffers form a list that is filled -   by the camera+USB controller and drained by the user process through -   either read() or mmap(). - -   The image buffer is the third scheme, in which frames are decompressed -   and converted into planar format. For mmap() there is more than -   one image buffer available. - -   The frame buffers provide the image buffering. In case the user process -   is a bit slow, this introduces lag and some undesired side-effects. -   The problem arises when the frame buffer is full. I used to drop the last -   frame, which makes the data in the queue stale very quickly. But dropping -   the frame at the head of the queue proved to be a litte bit more difficult. -   I tried a circular linked scheme, but this introduced more problems than -   it solved. - -   Because filling and draining are completely asynchronous processes, this -   requires some fiddling with pointers and mutexes. - -   Eventually, I came up with a system with 2 lists: an 'empty' frame list -   and a 'full' frame list: -     * Initially, all frame buffers but one are on the 'empty' list; the one -       remaining buffer is our initial fill frame. -     * If a frame is needed for filling, we try to take it from the 'empty' -       list, unless that list is empty, in which case we take the buffer at -       the head of the 'full' list. -     * When our fill buffer has been filled, it is appended to the 'full' -       list. -     * If a frame is needed by read() or mmap(), it is taken from the head of -       the 'full' list, handled, and then appended to the 'empty' list. If no -       buffer is present on the 'full' list, we wait. -   The advantage is that the buffer that is currently being decompressed/ -   converted, is on neither list, and thus not in our way (any other scheme -   I tried had the problem of old data lingering in the queue). - -   Whatever strategy you choose, it always remains a tradeoff: with more -   frame buffers the chances of a missed frame are reduced. On the other -   hand, on slower machines it introduces lag because the queue will -   always be full. - */ - -/** -  \brief Find next frame buffer to fill. Take from empty or full list, whichever comes first. - */ -static int pwc_next_fill_frame(struct pwc_device *pdev) -{ -	int ret; -	unsigned long flags; - -	ret = 0; -	spin_lock_irqsave(&pdev->ptrlock, flags); -	if (pdev->fill_frame != NULL) { -		/* append to 'full' list */ -		if (pdev->full_frames == NULL) { -			pdev->full_frames = pdev->fill_frame; -			pdev->full_frames_tail = pdev->full_frames; -		} -		else { -			pdev->full_frames_tail->next = pdev->fill_frame; -			pdev->full_frames_tail = pdev->fill_frame; -		} -	} -	if (pdev->empty_frames != NULL) { -		/* We have empty frames available. That's easy */ -		pdev->fill_frame = pdev->empty_frames; -		pdev->empty_frames = pdev->empty_frames->next; -	} -	else { -		/* Hmm. Take it from the full list */ -		/* sanity check */ -		if (pdev->full_frames == NULL) { -			PWC_ERROR("Neither empty or full frames available!\n"); -			spin_unlock_irqrestore(&pdev->ptrlock, flags); -			return -EINVAL; -		} -		pdev->fill_frame = pdev->full_frames; -		pdev->full_frames = pdev->full_frames->next; -		ret = 1; -	} -	pdev->fill_frame->next = NULL; -	spin_unlock_irqrestore(&pdev->ptrlock, flags); -	return ret; -} - - -/** -  \brief Reset all buffers, pointers and lists, except for the image_used[] buffer. - -  If the image_used[] buffer is cleared too, mmap()/VIDIOCSYNC will run into trouble. - */ -static void pwc_reset_buffers(struct pwc_device *pdev) -{ -	int i; -	unsigned long flags; - -	PWC_DEBUG_MEMORY(">> %s __enter__\n", __func__); - -	spin_lock_irqsave(&pdev->ptrlock, flags); -	pdev->full_frames = NULL; -	pdev->full_frames_tail = NULL; -	for (i = 0; i < default_fbufs; i++) { -		pdev->fbuf[i].filled = 0; -		if (i > 0) -			pdev->fbuf[i].next = &pdev->fbuf[i - 1]; -		else -			pdev->fbuf->next = NULL; -	} -	pdev->empty_frames = &pdev->fbuf[default_fbufs - 1]; -	pdev->empty_frames_tail = pdev->fbuf; -	pdev->read_frame = NULL; -	pdev->fill_frame = pdev->empty_frames; -	pdev->empty_frames = pdev->empty_frames->next; - -	pdev->image_read_pos = 0; -	pdev->fill_image = 0; -	spin_unlock_irqrestore(&pdev->ptrlock, flags); - -	PWC_DEBUG_MEMORY("<< %s __leaving__\n", __func__); -} - - -/** -  \brief Do all the handling for getting one frame: get pointer, decompress, advance pointers. - */ -int pwc_handle_frame(struct pwc_device *pdev) -{ -	int ret = 0; -	unsigned long flags; - -	spin_lock_irqsave(&pdev->ptrlock, flags); -	/* First grab our read_frame; this is removed from all lists, so -	   we can release the lock after this without problems */ -	if (pdev->read_frame != NULL) { -		/* This can't theoretically happen */ -		PWC_ERROR("Huh? Read frame still in use?\n"); -		spin_unlock_irqrestore(&pdev->ptrlock, flags); -		return ret; -	} - - -	if (pdev->full_frames == NULL) { -		PWC_ERROR("Woops. No frames ready.\n"); -	} -	else { -		pdev->read_frame = pdev->full_frames; -		pdev->full_frames = pdev->full_frames->next; -		pdev->read_frame->next = NULL; -	} - -	if (pdev->read_frame != NULL) { -		/* Decompression is a lengthy process, so it's outside of the lock. -		   This gives the isoc_handler the opportunity to fill more frames -		   in the mean time. -		*/ -		spin_unlock_irqrestore(&pdev->ptrlock, flags); -		ret = pwc_decompress(pdev); -		spin_lock_irqsave(&pdev->ptrlock, flags); - -		/* We're done with read_buffer, tack it to the end of the empty buffer list */ -		if (pdev->empty_frames == NULL) { -			pdev->empty_frames = pdev->read_frame; -			pdev->empty_frames_tail = pdev->empty_frames; -		} -		else { -			pdev->empty_frames_tail->next = pdev->read_frame; -			pdev->empty_frames_tail = pdev->read_frame; -		} -		pdev->read_frame = NULL; -	} -	spin_unlock_irqrestore(&pdev->ptrlock, flags); -	return ret; -} - -/** -  \brief Advance pointers of image buffer (after each user request) -*/ -void pwc_next_image(struct pwc_device *pdev) -{ -	pdev->image_used[pdev->fill_image] = 0; -	pdev->fill_image = (pdev->fill_image + 1) % pwc_mbufs; -} - -/** - * Print debug information when a frame is discarded because all of our buffer - * is full - */ -static void pwc_frame_dumped(struct pwc_device *pdev) -{ -	pdev->vframes_dumped++; -	if (pdev->vframe_count < FRAME_LOWMARK) -		return; - -	if (pdev->vframes_dumped < 20) -		PWC_DEBUG_FLOW("Dumping frame %d\n", pdev->vframe_count); -	else if (pdev->vframes_dumped == 20) -		PWC_DEBUG_FLOW("Dumping frame %d (last message)\n", -				pdev->vframe_count); -} - -static void pwc_snapshot_button(struct pwc_device *pdev, int down) -{ -	if (down) { -		PWC_TRACE("Snapshot button pressed.\n"); -		pdev->snapshot_button_status = 1; -	} else { -		PWC_TRACE("Snapshot button released.\n"); -	} - -#ifdef CONFIG_USB_PWC_INPUT_EVDEV -	if (pdev->button_dev) { -		input_report_key(pdev->button_dev, KEY_CAMERA, down); -		input_sync(pdev->button_dev); -	} -#endif -} - -static int pwc_rcv_short_packet(struct pwc_device *pdev, const struct pwc_frame_buf *fbuf) -{ -	int awake = 0; - -	/* The ToUCam Fun CMOS sensor causes the firmware to send 2 or 3 bogus -	   frames on the USB wire after an exposure change. This conditition is -	   however detected  in the cam and a bit is set in the header. -	   */ -	if (pdev->type == 730) { -		unsigned char *ptr = (unsigned char *)fbuf->data; - -		if (ptr[1] == 1 && ptr[0] & 0x10) { -			PWC_TRACE("Hyundai CMOS sensor bug. Dropping frame.\n"); -			pdev->drop_frames += 2; -			pdev->vframes_error++; -		} -		if ((ptr[0] ^ pdev->vmirror) & 0x01) { -			pwc_snapshot_button(pdev, ptr[0] & 0x01); -		} -		if ((ptr[0] ^ pdev->vmirror) & 0x02) { -			if (ptr[0] & 0x02) -				PWC_TRACE("Image is mirrored.\n"); -			else -				PWC_TRACE("Image is normal.\n"); -		} -		pdev->vmirror = ptr[0] & 0x03; -		/* Sometimes the trailer of the 730 is still sent as a 4 byte packet -		   after a short frame; this condition is filtered out specifically. A 4 byte -		   frame doesn't make sense anyway. -		   So we get either this sequence: -		   drop_bit set -> 4 byte frame -> short frame -> good frame -		   Or this one: -		   drop_bit set -> short frame -> good frame -		   So we drop either 3 or 2 frames in all! -		   */ -		if (fbuf->filled == 4) -			pdev->drop_frames++; -	} -	else if (pdev->type == 740 || pdev->type == 720) { -		unsigned char *ptr = (unsigned char *)fbuf->data; -		if ((ptr[0] ^ pdev->vmirror) & 0x01) { -			pwc_snapshot_button(pdev, ptr[0] & 0x01); -		} -		pdev->vmirror = ptr[0] & 0x03; -	} - -	/* In case we were instructed to drop the frame, do so silently. -	   The buffer pointers are not updated either (but the counters are reset below). -	   */ -	if (pdev->drop_frames > 0) -		pdev->drop_frames--; -	else { -		/* Check for underflow first */ -		if (fbuf->filled < pdev->frame_total_size) { -			PWC_DEBUG_FLOW("Frame buffer underflow (%d bytes);" -				       " discarded.\n", fbuf->filled); -			pdev->vframes_error++; -		} -		else { -			/* Send only once per EOF */ -			awake = 1; /* delay wake_ups */ - -			/* Find our next frame to fill. This will always succeed, since we -			 * nick a frame from either empty or full list, but if we had to -			 * take it from the full list, it means a frame got dropped. -			 */ -			if (pwc_next_fill_frame(pdev)) -				pwc_frame_dumped(pdev); - -		} -	} /* !drop_frames */ -	pdev->vframe_count++; -	return awake; -} - -/* This gets called for the Isochronous pipe (video). This is done in - * interrupt time, so it has to be fast, not crash, and not stall. Neat. - */ -static void pwc_isoc_handler(struct urb *urb) -{ -	struct pwc_device *pdev; -	int i, fst, flen; -	int awake; -	struct pwc_frame_buf *fbuf; -	unsigned char *fillptr = NULL, *iso_buf = NULL; - -	awake = 0; -	pdev = (struct pwc_device *)urb->context; -	if (pdev == NULL) { -		PWC_ERROR("isoc_handler() called with NULL device?!\n"); -		return; -	} - -	if (urb->status == -ENOENT || urb->status == -ECONNRESET) { -		PWC_DEBUG_OPEN("URB (%p) unlinked %ssynchronuously.\n", urb, urb->status == -ENOENT ? "" : "a"); -		return; -	} -	if (urb->status != -EINPROGRESS && urb->status != 0) { -		const char *errmsg; - -		errmsg = "Unknown"; -		switch(urb->status) { -			case -ENOSR:		errmsg = "Buffer error (overrun)"; break; -			case -EPIPE:		errmsg = "Stalled (device not responding)"; break; -			case -EOVERFLOW:	errmsg = "Babble (bad cable?)"; break; -			case -EPROTO:		errmsg = "Bit-stuff error (bad cable?)"; break; -			case -EILSEQ:		errmsg = "CRC/Timeout (could be anything)"; break; -			case -ETIME:		errmsg = "Device does not respond"; break; -		} -		PWC_DEBUG_FLOW("pwc_isoc_handler() called with status %d [%s].\n", urb->status, errmsg); -		/* Give up after a number of contiguous errors on the USB bus. -		   Appearantly something is wrong so we simulate an unplug event. -		 */ -		if (++pdev->visoc_errors > MAX_ISOC_ERRORS) -		{ -			PWC_INFO("Too many ISOC errors, bailing out.\n"); -			pdev->error_status = EIO; -			awake = 1; -			wake_up_interruptible(&pdev->frameq); -		} -		goto handler_end; // ugly, but practical -	} - -	fbuf = pdev->fill_frame; -	if (fbuf == NULL) { -		PWC_ERROR("pwc_isoc_handler without valid fill frame.\n"); -		awake = 1; -		goto handler_end; -	} -	else { -		fillptr = fbuf->data + fbuf->filled; -	} - -	/* Reset ISOC error counter. We did get here, after all. */ -	pdev->visoc_errors = 0; - -	/* vsync: 0 = don't copy data -		  1 = sync-hunt -		  2 = synched -	 */ -	/* Compact data */ -	for (i = 0; i < urb->number_of_packets; i++) { -		fst  = urb->iso_frame_desc[i].status; -		flen = urb->iso_frame_desc[i].actual_length; -		iso_buf = urb->transfer_buffer + urb->iso_frame_desc[i].offset; -		if (fst == 0) { -			if (flen > 0) { /* if valid data... */ -				if (pdev->vsync > 0) { /* ...and we are not sync-hunting... */ -					pdev->vsync = 2; - -					/* ...copy data to frame buffer, if possible */ -					if (flen + fbuf->filled > pdev->frame_total_size) { -						PWC_DEBUG_FLOW("Frame buffer overflow (flen = %d, frame_total_size = %d).\n", flen, pdev->frame_total_size); -						pdev->vsync = 0; /* Hmm, let's wait for an EOF (end-of-frame) */ -						pdev->vframes_error++; -					} -					else { -						memmove(fillptr, iso_buf, flen); -						fillptr += flen; -					} -				} -				fbuf->filled += flen; -			} /* ..flen > 0 */ - -			if (flen < pdev->vlast_packet_size) { -				/* Shorter packet... We probably have the end of an image-frame; -				   wake up read() process and let select()/poll() do something. -				   Decompression is done in user time over there. -				   */ -				if (pdev->vsync == 2) { -					if (pwc_rcv_short_packet(pdev, fbuf)) { -						awake = 1; -						fbuf = pdev->fill_frame; -					} -				} -				fbuf->filled = 0; -				fillptr = fbuf->data; -				pdev->vsync = 1; -			} - -			pdev->vlast_packet_size = flen; -		} /* ..status == 0 */ -		else { -			/* This is normally not interesting to the user, unless -			 * you are really debugging something, default = 0 */ -			static int iso_error; -			iso_error++; -			if (iso_error < 20) -				PWC_DEBUG_FLOW("Iso frame %d of USB has error %d\n", i, fst); -		} -	} - -handler_end: -	if (awake) -		wake_up_interruptible(&pdev->frameq); - -	urb->dev = pdev->udev; -	i = usb_submit_urb(urb, GFP_ATOMIC); -	if (i != 0) -		PWC_ERROR("Error (%d) re-submitting urb in pwc_isoc_handler.\n", i); -} - - -int pwc_isoc_init(struct pwc_device *pdev) -{ -	struct usb_device *udev; -	struct urb *urb; -	int i, j, ret; - -	struct usb_interface *intf; -	struct usb_host_interface *idesc = NULL; - -	if (pdev == NULL) -		return -EFAULT; -	if (pdev->iso_init) -		return 0; -	pdev->vsync = 0; -	udev = pdev->udev; - -	/* Get the current alternate interface, adjust packet size */ -	if (!udev->actconfig) -		return -EFAULT; -	intf = usb_ifnum_to_if(udev, 0); -	if (intf) -		idesc = usb_altnum_to_altsetting(intf, pdev->valternate); - -	if (!idesc) -		return -EFAULT; - -	/* Search video endpoint */ -	pdev->vmax_packet_size = -1; -	for (i = 0; i < idesc->desc.bNumEndpoints; i++) { -		if ((idesc->endpoint[i].desc.bEndpointAddress & 0xF) == pdev->vendpoint) { -			pdev->vmax_packet_size = le16_to_cpu(idesc->endpoint[i].desc.wMaxPacketSize); -			break; -		} -	} - -	if (pdev->vmax_packet_size < 0 || pdev->vmax_packet_size > ISO_MAX_FRAME_SIZE) { -		PWC_ERROR("Failed to find packet size for video endpoint in current alternate setting.\n"); -		return -ENFILE; /* Odd error, that should be noticeable */ -	} - -	/* Set alternate interface */ -	ret = 0; -	PWC_DEBUG_OPEN("Setting alternate interface %d\n", pdev->valternate); -	ret = usb_set_interface(pdev->udev, 0, pdev->valternate); -	if (ret < 0) -		return ret; - -	for (i = 0; i < MAX_ISO_BUFS; i++) { -		urb = usb_alloc_urb(ISO_FRAMES_PER_DESC, GFP_KERNEL); -		if (urb == NULL) { -			PWC_ERROR("Failed to allocate urb %d\n", i); -			ret = -ENOMEM; -			break; -		} -		pdev->sbuf[i].urb = urb; -		PWC_DEBUG_MEMORY("Allocated URB at 0x%p\n", urb); -	} -	if (ret) { -		/* De-allocate in reverse order */ -		while (i--) { -			usb_free_urb(pdev->sbuf[i].urb); -			pdev->sbuf[i].urb = NULL; -		} -		return ret; -	} - -	/* init URB structure */ -	for (i = 0; i < MAX_ISO_BUFS; i++) { -		urb = pdev->sbuf[i].urb; - -		urb->interval = 1; // devik -		urb->dev = udev; -		urb->pipe = usb_rcvisocpipe(udev, pdev->vendpoint); -		urb->transfer_flags = URB_ISO_ASAP; -		urb->transfer_buffer = pdev->sbuf[i].data; -		urb->transfer_buffer_length = ISO_BUFFER_SIZE; -		urb->complete = pwc_isoc_handler; -		urb->context = pdev; -		urb->start_frame = 0; -		urb->number_of_packets = ISO_FRAMES_PER_DESC; -		for (j = 0; j < ISO_FRAMES_PER_DESC; j++) { -			urb->iso_frame_desc[j].offset = j * ISO_MAX_FRAME_SIZE; -			urb->iso_frame_desc[j].length = pdev->vmax_packet_size; -		} -	} - -	/* link */ -	for (i = 0; i < MAX_ISO_BUFS; i++) { -		ret = usb_submit_urb(pdev->sbuf[i].urb, GFP_KERNEL); -		if (ret) -			PWC_ERROR("isoc_init() submit_urb %d failed with error %d\n", i, ret); -		else -			PWC_DEBUG_MEMORY("URB 0x%p submitted.\n", pdev->sbuf[i].urb); -	} - -	/* All is done... */ -	pdev->iso_init = 1; -	PWC_DEBUG_OPEN("<< pwc_isoc_init()\n"); -	return 0; -} - -static void pwc_iso_stop(struct pwc_device *pdev) -{ -	int i; - -	/* Unlinking ISOC buffers one by one */ -	for (i = 0; i < MAX_ISO_BUFS; i++) { -		struct urb *urb; - -		urb = pdev->sbuf[i].urb; -		if (urb) { -			PWC_DEBUG_MEMORY("Unlinking URB %p\n", urb); -			usb_kill_urb(urb); -		} -	} -} - -static void pwc_iso_free(struct pwc_device *pdev) -{ -	int i; - -	/* Freeing ISOC buffers one by one */ -	for (i = 0; i < MAX_ISO_BUFS; i++) { -		struct urb *urb; - -		urb = pdev->sbuf[i].urb; -		if (urb) { -			PWC_DEBUG_MEMORY("Freeing URB\n"); -			usb_free_urb(urb); -			pdev->sbuf[i].urb = NULL; -		} -	} -} - -void pwc_isoc_cleanup(struct pwc_device *pdev) -{ -	PWC_DEBUG_OPEN(">> pwc_isoc_cleanup()\n"); -	if (pdev == NULL) -		return; -	if (pdev->iso_init == 0) -		return; - -	pwc_iso_stop(pdev); -	pwc_iso_free(pdev); - -	/* Stop camera, but only if we are sure the camera is still there (unplug -	   is signalled by EPIPE) -	 */ -	if (pdev->error_status && pdev->error_status != EPIPE) { -		PWC_DEBUG_OPEN("Setting alternate interface 0.\n"); -		usb_set_interface(pdev->udev, 0, 0); -	} - -	pdev->iso_init = 0; -	PWC_DEBUG_OPEN("<< pwc_isoc_cleanup()\n"); -} - -int pwc_try_video_mode(struct pwc_device *pdev, int width, int height, int new_fps, int new_compression, int new_snapshot) -{ -	int ret, start; - -	/* Stop isoc stuff */ -	pwc_isoc_cleanup(pdev); -	/* Reset parameters */ -	pwc_reset_buffers(pdev); -	/* Try to set video mode... */ -	start = ret = pwc_set_video_mode(pdev, width, height, new_fps, new_compression, new_snapshot); -	if (ret) { -		PWC_DEBUG_FLOW("pwc_set_video_mode attempt 1 failed.\n"); -		/* That failed... restore old mode (we know that worked) */ -		start = pwc_set_video_mode(pdev, pdev->view.x, pdev->view.y, pdev->vframes, pdev->vcompression, pdev->vsnapshot); -		if (start) { -			PWC_DEBUG_FLOW("pwc_set_video_mode attempt 2 failed.\n"); -		} -	} -	if (start == 0) -	{ -		if (pwc_isoc_init(pdev) < 0) -		{ -			PWC_WARNING("Failed to restart ISOC transfers in pwc_try_video_mode.\n"); -			ret = -EAGAIN; /* let's try again, who knows if it works a second time */ -		} -	} -	pdev->drop_frames++; /* try to avoid garbage during switch */ -	return ret; /* Return original error code */ -} - -/********* - * sysfs - *********/ -static struct pwc_device *cd_to_pwc(struct device *cd) -{ -	struct video_device *vdev = to_video_device(cd); -	return video_get_drvdata(vdev); -} - -static ssize_t show_pan_tilt(struct device *class_dev, -			     struct device_attribute *attr, char *buf) -{ -	struct pwc_device *pdev = cd_to_pwc(class_dev); -	return sprintf(buf, "%d %d\n", pdev->pan_angle, pdev->tilt_angle); -} - -static ssize_t store_pan_tilt(struct device *class_dev, -			      struct device_attribute *attr, -			      const char *buf, size_t count) -{ -	struct pwc_device *pdev = cd_to_pwc(class_dev); -	int pan, tilt; -	int ret = -EINVAL; - -	if (strncmp(buf, "reset", 5) == 0) -		ret = pwc_mpt_reset(pdev, 0x3); - -	else if (sscanf(buf, "%d %d", &pan, &tilt) > 0) -		ret = pwc_mpt_set_angle(pdev, pan, tilt); - -	if (ret < 0) -		return ret; -	return strlen(buf); -} -static DEVICE_ATTR(pan_tilt, S_IRUGO | S_IWUSR, show_pan_tilt, -		   store_pan_tilt); - -static ssize_t show_snapshot_button_status(struct device *class_dev, -					   struct device_attribute *attr, char *buf) -{ -	struct pwc_device *pdev = cd_to_pwc(class_dev); -	int status = pdev->snapshot_button_status; -	pdev->snapshot_button_status = 0; -	return sprintf(buf, "%d\n", status); -} - -static DEVICE_ATTR(button, S_IRUGO | S_IWUSR, show_snapshot_button_status, -		   NULL); - -static int pwc_create_sysfs_files(struct video_device *vdev) -{ -	struct pwc_device *pdev = video_get_drvdata(vdev); -	int rc; - -	rc = device_create_file(&vdev->dev, &dev_attr_button); -	if (rc) -		goto err; -	if (pdev->features & FEATURE_MOTOR_PANTILT) { -		rc = device_create_file(&vdev->dev, &dev_attr_pan_tilt); -		if (rc) -			goto err_button; -	} - -	return 0; - -err_button: -	device_remove_file(&vdev->dev, &dev_attr_button); -err: -	PWC_ERROR("Could not create sysfs files.\n"); -	return rc; -} - -static void pwc_remove_sysfs_files(struct video_device *vdev) -{ -	struct pwc_device *pdev = video_get_drvdata(vdev); - -	if (pdev->features & FEATURE_MOTOR_PANTILT) -		device_remove_file(&vdev->dev, &dev_attr_pan_tilt); -	device_remove_file(&vdev->dev, &dev_attr_button); -} - -#ifdef CONFIG_USB_PWC_DEBUG -static const char *pwc_sensor_type_to_string(unsigned int sensor_type) -{ -	switch(sensor_type) { -		case 0x00: -			return "Hyundai CMOS sensor"; -		case 0x20: -			return "Sony CCD sensor + TDA8787"; -		case 0x2E: -			return "Sony CCD sensor + Exas 98L59"; -		case 0x2F: -			return "Sony CCD sensor + ADI 9804"; -		case 0x30: -			return "Sharp CCD sensor + TDA8787"; -		case 0x3E: -			return "Sharp CCD sensor + Exas 98L59"; -		case 0x3F: -			return "Sharp CCD sensor + ADI 9804"; -		case 0x40: -			return "UPA 1021 sensor"; -		case 0x100: -			return "VGA sensor"; -		case 0x101: -			return "PAL MR sensor"; -		default: -			return "unknown type of sensor"; -	} -} -#endif - -/***************************************************************************/ -/* Video4Linux functions */ - -static int pwc_video_open(struct file *file) -{ -	int i, ret; -	struct video_device *vdev = video_devdata(file); -	struct pwc_device *pdev; - -	PWC_DEBUG_OPEN(">> video_open called(vdev = 0x%p).\n", vdev); - -	pdev = video_get_drvdata(vdev); -	BUG_ON(!pdev); -	if (pdev->vopen) { -		PWC_DEBUG_OPEN("I'm busy, someone is using the device.\n"); -		return -EBUSY; -	} - -	mutex_lock(&pdev->modlock); -	pwc_construct(pdev); /* set min/max sizes correct */ -	if (!pdev->usb_init) { -		PWC_DEBUG_OPEN("Doing first time initialization.\n"); -		pdev->usb_init = 1; - -		/* Query sensor type */ -		ret = pwc_get_cmos_sensor(pdev, &i); -		if (ret >= 0) -		{ -			PWC_DEBUG_OPEN("This %s camera is equipped with a %s (%d).\n", -					pdev->vdev->name, -					pwc_sensor_type_to_string(i), i); -		} -	} - -	/* Turn on camera */ -	if (power_save) { -		i = pwc_camera_power(pdev, 1); -		if (i < 0) -			PWC_DEBUG_OPEN("Failed to restore power to the camera! (%d)\n", i); -	} -	/* Set LED on/off time */ -	if (pwc_set_leds(pdev, led_on, led_off) < 0) -		PWC_DEBUG_OPEN("Failed to set LED on/off time.\n"); - - -	/* So far, so good. Allocate memory. */ -	i = pwc_allocate_buffers(pdev); -	if (i < 0) { -		PWC_DEBUG_OPEN("Failed to allocate buffers memory.\n"); -		pwc_free_buffers(pdev); -		mutex_unlock(&pdev->modlock); -		return i; -	} - -	/* Reset buffers & parameters */ -	pwc_reset_buffers(pdev); -	for (i = 0; i < pwc_mbufs; i++) -		pdev->image_used[i] = 0; -	pdev->vframe_count = 0; -	pdev->vframes_dumped = 0; -	pdev->vframes_error = 0; -	pdev->visoc_errors = 0; -	pdev->error_status = 0; -	pwc_construct(pdev); /* set min/max sizes correct */ - -	/* Set some defaults */ -	pdev->vsnapshot = 0; - -	/* Start iso pipe for video; first try the last used video size -	   (or the default one); if that fails try QCIF/10 or QSIF/10; -	   it that fails too, give up. -	 */ -	i = pwc_set_video_mode(pdev, pwc_image_sizes[pdev->vsize].x, pwc_image_sizes[pdev->vsize].y, pdev->vframes, pdev->vcompression, 0); -	if (i)	{ -		unsigned int default_resolution; -		PWC_DEBUG_OPEN("First attempt at set_video_mode failed.\n"); -		if (pdev->type>= 730) -			default_resolution = PSZ_QSIF; -		else -			default_resolution = PSZ_QCIF; - -		i = pwc_set_video_mode(pdev, -				       pwc_image_sizes[default_resolution].x, -				       pwc_image_sizes[default_resolution].y, -				       10, -				       pdev->vcompression, -				       0); -	} -	if (i) { -		PWC_DEBUG_OPEN("Second attempt at set_video_mode failed.\n"); -		pwc_free_buffers(pdev); -		mutex_unlock(&pdev->modlock); -		return i; -	} - -	i = pwc_isoc_init(pdev); -	if (i) { -		PWC_DEBUG_OPEN("Failed to init ISOC stuff = %d.\n", i); -		pwc_isoc_cleanup(pdev); -		pwc_free_buffers(pdev); -		mutex_unlock(&pdev->modlock); -		return i; -	} - -	/* Initialize the webcam to sane value */ -	pwc_set_brightness(pdev, 0x7fff); -	pwc_set_agc(pdev, 1, 0); - -	pdev->vopen++; -	file->private_data = vdev; -	mutex_unlock(&pdev->modlock); -	PWC_DEBUG_OPEN("<< video_open() returns 0.\n"); -	return 0; -} - - -static void pwc_cleanup(struct pwc_device *pdev) -{ -	pwc_remove_sysfs_files(pdev->vdev); -	video_unregister_device(pdev->vdev); - -#ifdef CONFIG_USB_PWC_INPUT_EVDEV -	if (pdev->button_dev) -		input_unregister_device(pdev->button_dev); -#endif - -	kfree(pdev); -} - -/* Note that all cleanup is done in the reverse order as in _open */ -static int pwc_video_close(struct file *file) -{ -	struct video_device *vdev = file->private_data; -	struct pwc_device *pdev; -	int i, hint; - -	PWC_DEBUG_OPEN(">> video_close called(vdev = 0x%p).\n", vdev); - -	pdev = video_get_drvdata(vdev); -	mutex_lock(&pdev->modlock); -	if (pdev->vopen == 0) -		PWC_DEBUG_MODULE("video_close() called on closed device?\n"); - -	/* Dump statistics, but only if a reasonable amount of frames were -	   processed (to prevent endless log-entries in case of snap-shot -	   programs) -	 */ -	if (pdev->vframe_count > 20) -		PWC_DEBUG_MODULE("Closing video device: %d frames received, dumped %d frames, %d frames with errors.\n", pdev->vframe_count, pdev->vframes_dumped, pdev->vframes_error); - -	if (DEVICE_USE_CODEC1(pdev->type)) -	    pwc_dec1_exit(); -	else -	    pwc_dec23_exit(); - -	pwc_isoc_cleanup(pdev); -	pwc_free_buffers(pdev); - -	/* Turn off LEDS and power down camera, but only when not unplugged */ -	if (!pdev->unplugged) { -		/* Turn LEDs off */ -		if (pwc_set_leds(pdev, 0, 0) < 0) -			PWC_DEBUG_MODULE("Failed to set LED on/off time.\n"); -		if (power_save) { -			i = pwc_camera_power(pdev, 0); -			if (i < 0) -				PWC_ERROR("Failed to power down camera (%d)\n", i); -		} -		pdev->vopen--; -		PWC_DEBUG_OPEN("<< video_close() vopen=%d\n", pdev->vopen); -	} else { -		pwc_cleanup(pdev); -		/* search device_hint[] table if we occupy a slot, by any chance */ -		for (hint = 0; hint < MAX_DEV_HINTS; hint++) -			if (device_hint[hint].pdev == pdev) -				device_hint[hint].pdev = NULL; -	} -	mutex_unlock(&pdev->modlock); - -	return 0; -} - -/* - *	FIXME: what about two parallel reads ???? - *      ANSWER: Not supported. You can't open the device more than once, -		despite what the V4L1 interface says. First, I don't see -		the need, second there's no mechanism of alerting the -		2nd/3rd/... process of events like changing image size. -		And I don't see the point of blocking that for the -		2nd/3rd/... process. -		In multi-threaded environments reading parallel from any -		device is tricky anyhow. - */ - -static ssize_t pwc_video_read(struct file *file, char __user *buf, -			  size_t count, loff_t *ppos) -{ -	struct video_device *vdev = file->private_data; -	struct pwc_device *pdev; -	int noblock = file->f_flags & O_NONBLOCK; -	DECLARE_WAITQUEUE(wait, current); -	int bytes_to_read, rv = 0; -	void *image_buffer_addr; - -	PWC_DEBUG_READ("pwc_video_read(vdev=0x%p, buf=%p, count=%zd) called.\n", -			vdev, buf, count); -	if (vdev == NULL) -		return -EFAULT; -	pdev = video_get_drvdata(vdev); -	if (pdev == NULL) -		return -EFAULT; - -	mutex_lock(&pdev->modlock); -	if (pdev->error_status) { -		rv = -pdev->error_status; /* Something happened, report what. */ -		goto err_out; -	} - -	/* In case we're doing partial reads, we don't have to wait for a frame */ -	if (pdev->image_read_pos == 0) { -		/* Do wait queueing according to the (doc)book */ -		add_wait_queue(&pdev->frameq, &wait); -		while (pdev->full_frames == NULL) { -			/* Check for unplugged/etc. here */ -			if (pdev->error_status) { -				remove_wait_queue(&pdev->frameq, &wait); -				set_current_state(TASK_RUNNING); -				rv = -pdev->error_status ; -				goto err_out; -			} -			if (noblock) { -				remove_wait_queue(&pdev->frameq, &wait); -				set_current_state(TASK_RUNNING); -				rv = -EWOULDBLOCK; -				goto err_out; -			} -			if (signal_pending(current)) { -				remove_wait_queue(&pdev->frameq, &wait); -				set_current_state(TASK_RUNNING); -				rv = -ERESTARTSYS; -				goto err_out; -			} -			schedule(); -			set_current_state(TASK_INTERRUPTIBLE); -		} -		remove_wait_queue(&pdev->frameq, &wait); -		set_current_state(TASK_RUNNING); - -		/* Decompress and release frame */ -		if (pwc_handle_frame(pdev)) { -			rv = -EFAULT; -			goto err_out; -		} -	} - -	PWC_DEBUG_READ("Copying data to user space.\n"); -	if (pdev->pixfmt != V4L2_PIX_FMT_YUV420) -		bytes_to_read = pdev->frame_size + sizeof(struct pwc_raw_frame); -	else -		bytes_to_read = pdev->view.size; - -	/* copy bytes to user space; we allow for partial reads */ -	if (count + pdev->image_read_pos > bytes_to_read) -		count = bytes_to_read - pdev->image_read_pos; -	image_buffer_addr = pdev->image_data; -	image_buffer_addr += pdev->images[pdev->fill_image].offset; -	image_buffer_addr += pdev->image_read_pos; -	if (copy_to_user(buf, image_buffer_addr, count)) { -		rv = -EFAULT; -		goto err_out; -	} -	pdev->image_read_pos += count; -	if (pdev->image_read_pos >= bytes_to_read) { /* All data has been read */ -		pdev->image_read_pos = 0; -		pwc_next_image(pdev); -	} -	mutex_unlock(&pdev->modlock); -	return count; -err_out: -	mutex_unlock(&pdev->modlock); -	return rv; -} - -static unsigned int pwc_video_poll(struct file *file, poll_table *wait) -{ -	struct video_device *vdev = file->private_data; -	struct pwc_device *pdev; - -	if (vdev == NULL) -		return -EFAULT; -	pdev = video_get_drvdata(vdev); -	if (pdev == NULL) -		return -EFAULT; - -	poll_wait(file, &pdev->frameq, wait); -	if (pdev->error_status) -		return POLLERR; -	if (pdev->full_frames != NULL) /* we have frames waiting */ -		return (POLLIN | POLLRDNORM); - -	return 0; -} - -static long pwc_video_ioctl(struct file *file, -			   unsigned int cmd, unsigned long arg) -{ -	struct video_device *vdev = file->private_data; -	struct pwc_device *pdev; -	long r = -ENODEV; - -	if (!vdev) -		goto out; -	pdev = video_get_drvdata(vdev); - -	mutex_lock(&pdev->modlock); -	if (!pdev->unplugged) -		r = video_usercopy(file, cmd, arg, pwc_video_do_ioctl); -	mutex_unlock(&pdev->modlock); -out: -	return r; -} - -static int pwc_video_mmap(struct file *file, struct vm_area_struct *vma) -{ -	struct video_device *vdev = file->private_data; -	struct pwc_device *pdev; -	unsigned long start; -	unsigned long size; -	unsigned long page, pos = 0; -	int index; - -	PWC_DEBUG_MEMORY(">> %s\n", __func__); -	pdev = video_get_drvdata(vdev); -	size = vma->vm_end - vma->vm_start; -	start = vma->vm_start; - -	/* Find the idx buffer for this mapping */ -	for (index = 0; index < pwc_mbufs; index++) { -		pos = pdev->images[index].offset; -		if ((pos>>PAGE_SHIFT) == vma->vm_pgoff) -			break; -	} -	if (index == MAX_IMAGES) -		return -EINVAL; -	if (index == 0) { -		/* -		 * Special case for v4l1. In v4l1, we map only one big buffer, -		 * but in v4l2 each buffer is mapped -		 */ -		unsigned long total_size; -		total_size = pwc_mbufs * pdev->len_per_image; -		if (size != pdev->len_per_image && size != total_size) { -			PWC_ERROR("Wrong size (%lu) needed to be len_per_image=%d or total_size=%lu\n", -				   size, pdev->len_per_image, total_size); -			return -EINVAL; -		} -	} else if (size > pdev->len_per_image) -		return -EINVAL; - -	vma->vm_flags |= VM_IO;	/* from 2.6.9-acX */ - -	pos += (unsigned long)pdev->image_data; -	while (size > 0) { -		page = vmalloc_to_pfn((void *)pos); -		if (remap_pfn_range(vma, start, page, PAGE_SIZE, PAGE_SHARED)) -			return -EAGAIN; -		start += PAGE_SIZE; -		pos += PAGE_SIZE; -		if (size > PAGE_SIZE) -			size -= PAGE_SIZE; -		else -			size = 0; -	} -	return 0; -} - -/***************************************************************************/ -/* USB functions */ - -/* This function gets called when a new device is plugged in or the usb core - * is loaded. - */ - -static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id *id) -{ -	struct usb_device *udev = interface_to_usbdev(intf); -	struct pwc_device *pdev = NULL; -	int vendor_id, product_id, type_id; -	int hint, rc; -	int features = 0; -	int video_nr = -1; /* default: use next available device */ -	char serial_number[30], *name; - -	vendor_id = le16_to_cpu(udev->descriptor.idVendor); -	product_id = le16_to_cpu(udev->descriptor.idProduct); - -	/* Check if we can handle this device */ -	PWC_DEBUG_PROBE("probe() called [%04X %04X], if %d\n", -		vendor_id, product_id, -		intf->altsetting->desc.bInterfaceNumber); - -	/* the interfaces are probed one by one. We are only interested in the -	   video interface (0) now. -	   Interface 1 is the Audio Control, and interface 2 Audio itself. -	 */ -	if (intf->altsetting->desc.bInterfaceNumber > 0) -		return -ENODEV; - -	if (vendor_id == 0x0471) { -		switch (product_id) { -		case 0x0302: -			PWC_INFO("Philips PCA645VC USB webcam detected.\n"); -			name = "Philips 645 webcam"; -			type_id = 645; -			break; -		case 0x0303: -			PWC_INFO("Philips PCA646VC USB webcam detected.\n"); -			name = "Philips 646 webcam"; -			type_id = 646; -			break; -		case 0x0304: -			PWC_INFO("Askey VC010 type 2 USB webcam detected.\n"); -			name = "Askey VC010 webcam"; -			type_id = 646; -			break; -		case 0x0307: -			PWC_INFO("Philips PCVC675K (Vesta) USB webcam detected.\n"); -			name = "Philips 675 webcam"; -			type_id = 675; -			break; -		case 0x0308: -			PWC_INFO("Philips PCVC680K (Vesta Pro) USB webcam detected.\n"); -			name = "Philips 680 webcam"; -			type_id = 680; -			break; -		case 0x030C: -			PWC_INFO("Philips PCVC690K (Vesta Pro Scan) USB webcam detected.\n"); -			name = "Philips 690 webcam"; -			type_id = 690; -			break; -		case 0x0310: -			PWC_INFO("Philips PCVC730K (ToUCam Fun)/PCVC830 (ToUCam II) USB webcam detected.\n"); -			name = "Philips 730 webcam"; -			type_id = 730; -			break; -		case 0x0311: -			PWC_INFO("Philips PCVC740K (ToUCam Pro)/PCVC840 (ToUCam II) USB webcam detected.\n"); -			name = "Philips 740 webcam"; -			type_id = 740; -			break; -		case 0x0312: -			PWC_INFO("Philips PCVC750K (ToUCam Pro Scan) USB webcam detected.\n"); -			name = "Philips 750 webcam"; -			type_id = 750; -			break; -		case 0x0313: -			PWC_INFO("Philips PCVC720K/40 (ToUCam XS) USB webcam detected.\n"); -			name = "Philips 720K/40 webcam"; -			type_id = 720; -			break; -		case 0x0329: -			PWC_INFO("Philips SPC 900NC USB webcam detected.\n"); -			name = "Philips SPC 900NC webcam"; -			type_id = 740; -			break; -		default: -			return -ENODEV; -			break; -		} -	} -	else if (vendor_id == 0x069A) { -		switch(product_id) { -		case 0x0001: -			PWC_INFO("Askey VC010 type 1 USB webcam detected.\n"); -			name = "Askey VC010 webcam"; -			type_id = 645; -			break; -		default: -			return -ENODEV; -			break; -		} -	} -	else if (vendor_id == 0x046d) { -		switch(product_id) { -		case 0x08b0: -			PWC_INFO("Logitech QuickCam Pro 3000 USB webcam detected.\n"); -			name = "Logitech QuickCam Pro 3000"; -			type_id = 740; /* CCD sensor */ -			break; -		case 0x08b1: -			PWC_INFO("Logitech QuickCam Notebook Pro USB webcam detected.\n"); -			name = "Logitech QuickCam Notebook Pro"; -			type_id = 740; /* CCD sensor */ -			break; -		case 0x08b2: -			PWC_INFO("Logitech QuickCam 4000 Pro USB webcam detected.\n"); -			name = "Logitech QuickCam Pro 4000"; -			type_id = 740; /* CCD sensor */ -			break; -		case 0x08b3: -			PWC_INFO("Logitech QuickCam Zoom USB webcam detected.\n"); -			name = "Logitech QuickCam Zoom"; -			type_id = 740; /* CCD sensor */ -			break; -		case 0x08B4: -			PWC_INFO("Logitech QuickCam Zoom (new model) USB webcam detected.\n"); -			name = "Logitech QuickCam Zoom"; -			type_id = 740; /* CCD sensor */ -			power_save = 1; -			break; -		case 0x08b5: -			PWC_INFO("Logitech QuickCam Orbit/Sphere USB webcam detected.\n"); -			name = "Logitech QuickCam Orbit"; -			type_id = 740; /* CCD sensor */ -			features |= FEATURE_MOTOR_PANTILT; -			break; -		case 0x08b6: -			PWC_INFO("Logitech/Cisco VT Camera webcam detected.\n"); -			name = "Cisco VT Camera"; -			type_id = 740; /* CCD sensor */ -			break; -		case 0x08b7: -			PWC_INFO("Logitech ViewPort AV 100 webcam detected.\n"); -			name = "Logitech ViewPort AV 100"; -			type_id = 740; /* CCD sensor */ -			break; -		case 0x08b8: /* Where this released? */ -			PWC_INFO("Logitech QuickCam detected (reserved ID).\n"); -			name = "Logitech QuickCam (res.)"; -			type_id = 730; /* Assuming CMOS */ -			break; -		default: -			return -ENODEV; -			break; -		} -	} -	else if (vendor_id == 0x055d) { -		/* I don't know the difference between the C10 and the C30; -		   I suppose the difference is the sensor, but both cameras -		   work equally well with a type_id of 675 -		 */ -		switch(product_id) { -		case 0x9000: -			PWC_INFO("Samsung MPC-C10 USB webcam detected.\n"); -			name = "Samsung MPC-C10"; -			type_id = 675; -			break; -		case 0x9001: -			PWC_INFO("Samsung MPC-C30 USB webcam detected.\n"); -			name = "Samsung MPC-C30"; -			type_id = 675; -			break; -		case 0x9002: -			PWC_INFO("Samsung SNC-35E (v3.0) USB webcam detected.\n"); -			name = "Samsung MPC-C30"; -			type_id = 740; -			break; -		default: -			return -ENODEV; -			break; -		} -	} -	else if (vendor_id == 0x041e) { -		switch(product_id) { -		case 0x400c: -			PWC_INFO("Creative Labs Webcam 5 detected.\n"); -			name = "Creative Labs Webcam 5"; -			type_id = 730; -			break; -		case 0x4011: -			PWC_INFO("Creative Labs Webcam Pro Ex detected.\n"); -			name = "Creative Labs Webcam Pro Ex"; -			type_id = 740; -			break; -		default: -			return -ENODEV; -			break; -		} -	} -	else if (vendor_id == 0x04cc) { -		switch(product_id) { -		case 0x8116: -			PWC_INFO("Sotec Afina Eye USB webcam detected.\n"); -			name = "Sotec Afina Eye"; -			type_id = 730; -			break; -		default: -			return -ENODEV; -			break; -		} -	} -	else if (vendor_id == 0x06be) { -		switch(product_id) { -		case 0x8116: -			/* This is essentially the same cam as the Sotec Afina Eye */ -			PWC_INFO("AME Co. Afina Eye USB webcam detected.\n"); -			name = "AME Co. Afina Eye"; -			type_id = 750; -			break; -		default: -			return -ENODEV; -			break; -		} - -	} -	else if (vendor_id == 0x0d81) { -		switch(product_id) { -		case 0x1900: -			PWC_INFO("Visionite VCS-UC300 USB webcam detected.\n"); -			name = "Visionite VCS-UC300"; -			type_id = 740; /* CCD sensor */ -			break; -		case 0x1910: -			PWC_INFO("Visionite VCS-UM100 USB webcam detected.\n"); -			name = "Visionite VCS-UM100"; -			type_id = 730; /* CMOS sensor */ -			break; -		default: -			return -ENODEV; -			break; -		} -	} -	else -		return -ENODEV; /* Not any of the know types; but the list keeps growing. */ - -	memset(serial_number, 0, 30); -	usb_string(udev, udev->descriptor.iSerialNumber, serial_number, 29); -	PWC_DEBUG_PROBE("Device serial number is %s\n", serial_number); - -	if (udev->descriptor.bNumConfigurations > 1) -		PWC_WARNING("Warning: more than 1 configuration available.\n"); - -	/* Allocate structure, initialize pointers, mutexes, etc. and link it to the usb_device */ -	pdev = kzalloc(sizeof(struct pwc_device), GFP_KERNEL); -	if (pdev == NULL) { -		PWC_ERROR("Oops, could not allocate memory for pwc_device.\n"); -		return -ENOMEM; -	} -	pdev->type = type_id; -	pdev->vsize = default_size; -	pdev->vframes = default_fps; -	strcpy(pdev->serial, serial_number); -	pdev->features = features; -	if (vendor_id == 0x046D && product_id == 0x08B5) { -		/* Logitech QuickCam Orbit -		   The ranges have been determined experimentally; they may differ from cam to cam. -		   Also, the exact ranges left-right and up-down are different for my cam -		  */ -		pdev->angle_range.pan_min  = -7000; -		pdev->angle_range.pan_max  =  7000; -		pdev->angle_range.tilt_min = -3000; -		pdev->angle_range.tilt_max =  2500; -	} - -	mutex_init(&pdev->modlock); -	spin_lock_init(&pdev->ptrlock); - -	pdev->udev = udev; -	init_waitqueue_head(&pdev->frameq); -	pdev->vcompression = pwc_preferred_compression; - -	/* Allocate video_device structure */ -	pdev->vdev = video_device_alloc(); -	if (!pdev->vdev) { -		PWC_ERROR("Err, cannot allocate video_device struture. Failing probe."); -		rc = -ENOMEM; -		goto err_free_mem; -	} -	memcpy(pdev->vdev, &pwc_template, sizeof(pwc_template)); -	pdev->vdev->parent = &intf->dev; -	strcpy(pdev->vdev->name, name); -	video_set_drvdata(pdev->vdev, pdev); - -	pdev->release = le16_to_cpu(udev->descriptor.bcdDevice); -	PWC_DEBUG_PROBE("Release: %04x\n", pdev->release); - -	/* Now search device_hint[] table for a match, so we can hint a node number. */ -	for (hint = 0; hint < MAX_DEV_HINTS; hint++) { -		if (((device_hint[hint].type == -1) || (device_hint[hint].type == pdev->type)) && -		     (device_hint[hint].pdev == NULL)) { -			/* so far, so good... try serial number */ -			if ((device_hint[hint].serial_number[0] == '*') || !strcmp(device_hint[hint].serial_number, serial_number)) { -				/* match! */ -				video_nr = device_hint[hint].device_node; -				PWC_DEBUG_PROBE("Found hint, will try to register as /dev/video%d\n", video_nr); -				break; -			} -		} -	} - -	pdev->vdev->release = video_device_release; - -	/* occupy slot */ -	if (hint < MAX_DEV_HINTS) -		device_hint[hint].pdev = pdev; - -	PWC_DEBUG_PROBE("probe() function returning struct at 0x%p.\n", pdev); -	usb_set_intfdata(intf, pdev); - -	/* Set the leds off */ -	pwc_set_leds(pdev, 0, 0); -	pwc_camera_power(pdev, 0); - -	rc = video_register_device(pdev->vdev, VFL_TYPE_GRABBER, video_nr); -	if (rc < 0) { -		PWC_ERROR("Failed to register as video device (%d).\n", rc); -		goto err_video_release; -	} -	rc = pwc_create_sysfs_files(pdev->vdev); -	if (rc) -		goto err_video_unreg; - -	PWC_INFO("Registered as %s.\n", video_device_node_name(pdev->vdev)); - -#ifdef CONFIG_USB_PWC_INPUT_EVDEV -	/* register webcam snapshot button input device */ -	pdev->button_dev = input_allocate_device(); -	if (!pdev->button_dev) { -		PWC_ERROR("Err, insufficient memory for webcam snapshot button device."); -		rc = -ENOMEM; -		pwc_remove_sysfs_files(pdev->vdev); -		goto err_video_unreg; -	} - -	usb_make_path(udev, pdev->button_phys, sizeof(pdev->button_phys)); -	strlcat(pdev->button_phys, "/input0", sizeof(pdev->button_phys)); - -	pdev->button_dev->name = "PWC snapshot button"; -	pdev->button_dev->phys = pdev->button_phys; -	usb_to_input_id(pdev->udev, &pdev->button_dev->id); -	pdev->button_dev->dev.parent = &pdev->udev->dev; -	pdev->button_dev->evbit[0] = BIT_MASK(EV_KEY); -	pdev->button_dev->keybit[BIT_WORD(KEY_CAMERA)] = BIT_MASK(KEY_CAMERA); - -	rc = input_register_device(pdev->button_dev); -	if (rc) { -		input_free_device(pdev->button_dev); -		pdev->button_dev = NULL; -		pwc_remove_sysfs_files(pdev->vdev); -		goto err_video_unreg; -	} -#endif - -	return 0; - -err_video_unreg: -	if (hint < MAX_DEV_HINTS) -		device_hint[hint].pdev = NULL; -	video_unregister_device(pdev->vdev); -	pdev->vdev = NULL;	/* So we don't try to release it below */ -err_video_release: -	video_device_release(pdev->vdev); -err_free_mem: -	kfree(pdev); -	return rc; -} - -/* The user yanked out the cable... */ -static void usb_pwc_disconnect(struct usb_interface *intf) -{ -	struct pwc_device *pdev; -	int hint; - -	pdev = usb_get_intfdata (intf); -	mutex_lock(&pdev->modlock); -	usb_set_intfdata (intf, NULL); -	if (pdev == NULL) { -		PWC_ERROR("pwc_disconnect() Called without private pointer.\n"); -		goto disconnect_out; -	} -	if (pdev->udev == NULL) { -		PWC_ERROR("pwc_disconnect() already called for %p\n", pdev); -		goto disconnect_out; -	} -	if (pdev->udev != interface_to_usbdev(intf)) { -		PWC_ERROR("pwc_disconnect() Woops: pointer mismatch udev/pdev.\n"); -		goto disconnect_out; -	} - -	/* We got unplugged; this is signalled by an EPIPE error code */ -	if (pdev->vopen) { -		PWC_INFO("Disconnected while webcam is in use!\n"); -		pdev->error_status = EPIPE; -	} - -	/* Alert waiting processes */ -	wake_up_interruptible(&pdev->frameq); -	/* Wait until device is closed */ -	if (pdev->vopen) { -		pdev->unplugged = 1; -		pwc_iso_stop(pdev); -	} else { -		/* Device is closed, so we can safely unregister it */ -		PWC_DEBUG_PROBE("Unregistering video device in disconnect().\n"); -		pwc_cleanup(pdev); - -disconnect_out: -		/* search device_hint[] table if we occupy a slot, by any chance */ -		for (hint = 0; hint < MAX_DEV_HINTS; hint++) -			if (device_hint[hint].pdev == pdev) -				device_hint[hint].pdev = NULL; -	} - -	mutex_unlock(&pdev->modlock); -} - - -/* - * Initialization code & module stuff - */ - -static char *size; -static int fps; -static int fbufs; -static int mbufs; -static int compression = -1; -static int leds[2] = { -1, -1 }; -static unsigned int leds_nargs; -static char *dev_hint[MAX_DEV_HINTS]; -static unsigned int dev_hint_nargs; - -module_param(size, charp, 0444); -module_param(fps, int, 0444); -module_param(fbufs, int, 0444); -module_param(mbufs, int, 0444); -#ifdef CONFIG_USB_PWC_DEBUG -module_param_named(trace, pwc_trace, int, 0644); -#endif -module_param(power_save, int, 0444); -module_param(compression, int, 0444); -module_param_array(leds, int, &leds_nargs, 0444); -module_param_array(dev_hint, charp, &dev_hint_nargs, 0444); - -MODULE_PARM_DESC(size, "Initial image size. One of sqcif, qsif, qcif, sif, cif, vga"); -MODULE_PARM_DESC(fps, "Initial frames per second. Varies with model, useful range 5-30"); -MODULE_PARM_DESC(fbufs, "Number of internal frame buffers to reserve"); -MODULE_PARM_DESC(mbufs, "Number of external (mmap()ed) image buffers"); -#ifdef CONFIG_USB_PWC_DEBUG -MODULE_PARM_DESC(trace, "For debugging purposes"); -#endif -MODULE_PARM_DESC(power_save, "Turn power save feature in camera on or off"); -MODULE_PARM_DESC(compression, "Preferred compression quality. Range 0 (uncompressed) to 3 (high compression)"); -MODULE_PARM_DESC(leds, "LED on,off time in milliseconds"); -MODULE_PARM_DESC(dev_hint, "Device node hints"); - -MODULE_DESCRIPTION("Philips & OEM USB webcam driver"); -MODULE_AUTHOR("Luc Saillard <luc@saillard.org>"); -MODULE_LICENSE("GPL"); -MODULE_ALIAS("pwcx"); -MODULE_VERSION( PWC_VERSION ); - -static int __init usb_pwc_init(void) -{ -	int i, sz; -	char *sizenames[PSZ_MAX] = { "sqcif", "qsif", "qcif", "sif", "cif", "vga" }; - -	PWC_INFO("Philips webcam module version " PWC_VERSION " loaded.\n"); -	PWC_INFO("Supports Philips PCA645/646, PCVC675/680/690, PCVC720[40]/730/740/750 & PCVC830/840.\n"); -	PWC_INFO("Also supports the Askey VC010, various Logitech Quickcams, Samsung MPC-C10 and MPC-C30,\n"); -	PWC_INFO("the Creative WebCam 5 & Pro Ex, SOTEC Afina Eye and Visionite VCS-UC300 and VCS-UM100.\n"); - -	if (fps) { -		if (fps < 4 || fps > 30) { -			PWC_ERROR("Framerate out of bounds (4-30).\n"); -			return -EINVAL; -		} -		default_fps = fps; -		PWC_DEBUG_MODULE("Default framerate set to %d.\n", default_fps); -	} - -	if (size) { -		/* string; try matching with array */ -		for (sz = 0; sz < PSZ_MAX; sz++) { -			if (!strcmp(sizenames[sz], size)) { /* Found! */ -				default_size = sz; -				break; -			} -		} -		if (sz == PSZ_MAX) { -			PWC_ERROR("Size not recognized; try size=[sqcif | qsif | qcif | sif | cif | vga].\n"); -			return -EINVAL; -		} -		PWC_DEBUG_MODULE("Default image size set to %s [%dx%d].\n", sizenames[default_size], pwc_image_sizes[default_size].x, pwc_image_sizes[default_size].y); -	} -	if (mbufs) { -		if (mbufs < 1 || mbufs > MAX_IMAGES) { -			PWC_ERROR("Illegal number of mmap() buffers; use a number between 1 and %d.\n", MAX_IMAGES); -			return -EINVAL; -		} -		pwc_mbufs = mbufs; -		PWC_DEBUG_MODULE("Number of image buffers set to %d.\n", pwc_mbufs); -	} -	if (fbufs) { -		if (fbufs < 2 || fbufs > MAX_FRAMES) { -			PWC_ERROR("Illegal number of frame buffers; use a number between 2 and %d.\n", MAX_FRAMES); -			return -EINVAL; -		} -		default_fbufs = fbufs; -		PWC_DEBUG_MODULE("Number of frame buffers set to %d.\n", default_fbufs); -	} -#ifdef CONFIG_USB_PWC_DEBUG -	if (pwc_trace >= 0) { -		PWC_DEBUG_MODULE("Trace options: 0x%04x\n", pwc_trace); -	} -#endif -	if (compression >= 0) { -		if (compression > 3) { -			PWC_ERROR("Invalid compression setting; use a number between 0 (uncompressed) and 3 (high).\n"); -			return -EINVAL; -		} -		pwc_preferred_compression = compression; -		PWC_DEBUG_MODULE("Preferred compression set to %d.\n", pwc_preferred_compression); -	} -	if (power_save) -		PWC_DEBUG_MODULE("Enabling power save on open/close.\n"); -	if (leds[0] >= 0) -		led_on = leds[0]; -	if (leds[1] >= 0) -		led_off = leds[1]; - -	/* Big device node whoopla. Basically, it allows you to assign a -	   device node (/dev/videoX) to a camera, based on its type -	   & serial number. The format is [type[.serialnumber]:]node. - -	   Any camera that isn't matched by these rules gets the next -	   available free device node. -	 */ -	for (i = 0; i < MAX_DEV_HINTS; i++) { -		char *s, *colon, *dot; - -		/* This loop also initializes the array */ -		device_hint[i].pdev = NULL; -		s = dev_hint[i]; -		if (s != NULL && *s != '\0') { -			device_hint[i].type = -1; /* wildcard */ -			strcpy(device_hint[i].serial_number, "*"); - -			/* parse string: chop at ':' & '/' */ -			colon = dot = s; -			while (*colon != '\0' && *colon != ':') -				colon++; -			while (*dot != '\0' && *dot != '.') -				dot++; -			/* Few sanity checks */ -			if (*dot != '\0' && dot > colon) { -				PWC_ERROR("Malformed camera hint: the colon must be after the dot.\n"); -				return -EINVAL; -			} - -			if (*colon == '\0') { -				/* No colon */ -				if (*dot != '\0') { -					PWC_ERROR("Malformed camera hint: no colon + device node given.\n"); -					return -EINVAL; -				} -				else { -					/* No type or serial number specified, just a number. */ -					device_hint[i].device_node = -						simple_strtol(s, NULL, 10); -				} -			} -			else { -				/* There's a colon, so we have at least a type and a device node */ -				device_hint[i].type = -					simple_strtol(s, NULL, 10); -				device_hint[i].device_node = -					simple_strtol(colon + 1, NULL, 10); -				if (*dot != '\0') { -					/* There's a serial number as well */ -					int k; - -					dot++; -					k = 0; -					while (*dot != ':' && k < 29) { -						device_hint[i].serial_number[k++] = *dot; -						dot++; -					} -					device_hint[i].serial_number[k] = '\0'; -				} -			} -			PWC_TRACE("device_hint[%d]:\n", i); -			PWC_TRACE("  type    : %d\n", device_hint[i].type); -			PWC_TRACE("  serial# : %s\n", device_hint[i].serial_number); -			PWC_TRACE("  node    : %d\n", device_hint[i].device_node); -		} -		else -			device_hint[i].type = 0; /* not filled */ -	} /* ..for MAX_DEV_HINTS */ - -	PWC_DEBUG_PROBE("Registering driver at address 0x%p.\n", &pwc_driver); -	return usb_register(&pwc_driver); -} - -static void __exit usb_pwc_exit(void) -{ -	PWC_DEBUG_MODULE("Deregistering driver.\n"); -	usb_deregister(&pwc_driver); -	PWC_INFO("Philips webcam module removed.\n"); -} - -module_init(usb_pwc_init); -module_exit(usb_pwc_exit); - -/* vim: set cino= formatoptions=croql cindent shiftwidth=8 tabstop=8: */ diff --git a/drivers/media/video/pwc/pwc-ioctl.h b/drivers/media/video/pwc/pwc-ioctl.h deleted file mode 100644 index 8c0cae7b3da..00000000000 --- a/drivers/media/video/pwc/pwc-ioctl.h +++ /dev/null @@ -1,323 +0,0 @@ -#ifndef PWC_IOCTL_H -#define PWC_IOCTL_H - -/* (C) 2001-2004 Nemosoft Unv. -   (C) 2004-2006 Luc Saillard (luc@saillard.org) - -   NOTE: this version of pwc is an unofficial (modified) release of pwc & pcwx -   driver and thus may have bugs that are not present in the original version. -   Please send bug reports and support requests to <luc@saillard.org>. -   The decompression routines have been implemented by reverse-engineering the -   Nemosoft binary pwcx module. Caveat emptor. - -   This program is free software; you can redistribute it and/or modify -   it under the terms of the GNU General Public License as published by -   the Free Software Foundation; either version 2 of the License, or -   (at your option) any later version. - -   This program is distributed in the hope that it will be useful, -   but WITHOUT ANY WARRANTY; without even the implied warranty of -   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the -   GNU General Public License for more details. - -   You should have received a copy of the GNU General Public License -   along with this program; if not, write to the Free Software -   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA -*/ - -/* This is pwc-ioctl.h belonging to PWC 10.0.10 -   It contains structures and defines to communicate from user space -   directly to the driver. - */ - -/* -   Changes -   2001/08/03  Alvarado   Added ioctl constants to access methods for -			  changing white balance and red/blue gains -   2002/12/15  G. H. Fernandez-Toribio   VIDIOCGREALSIZE -   2003/12/13  Nemosft Unv. Some modifications to make interfacing to -	       PWCX easier - */ - -/* These are private ioctl() commands, specific for the Philips webcams. -   They contain functions not found in other webcams, and settings not -   specified in the Video4Linux API. - -   The #define names are built up like follows: -   VIDIOC		VIDeo IOCtl prefix -	 PWC		Philps WebCam -	    G           optional: Get -	    S           optional: Set -	     ... 	the function - */ - -#include <linux/types.h> -#include <linux/version.h> - - /* Enumeration of image sizes */ -#define PSZ_SQCIF	0x00 -#define PSZ_QSIF	0x01 -#define PSZ_QCIF	0x02 -#define PSZ_SIF		0x03 -#define PSZ_CIF		0x04 -#define PSZ_VGA		0x05 -#define PSZ_MAX		6 - - -/* The frame rate is encoded in the video_window.flags parameter using -   the upper 16 bits, since some flags are defined nowadays. The following -   defines provide a mask and shift to filter out this value. -   This value can also be passing using the private flag when using v4l2 and -   VIDIOC_S_FMT ioctl. - -   In 'Snapshot' mode the camera freezes its automatic exposure and colour -   balance controls. - */ -#define PWC_FPS_SHIFT		16 -#define PWC_FPS_MASK		0x00FF0000 -#define PWC_FPS_FRMASK		0x003F0000 -#define PWC_FPS_SNAPSHOT	0x00400000 -#define PWC_QLT_MASK		0x03000000 -#define PWC_QLT_SHIFT		24 - - -/* structure for transferring x & y coordinates */ -struct pwc_coord -{ -	int x, y;		/* guess what */ -	int size;		/* size, or offset */ -}; - - -/* Used with VIDIOCPWCPROBE */ -struct pwc_probe -{ -	char name[32]; -	int type; -}; - -struct pwc_serial -{ -	char serial[30];	/* String with serial number. Contains terminating 0 */ -}; - -/* pwc_whitebalance.mode values */ -#define PWC_WB_INDOOR		0 -#define PWC_WB_OUTDOOR		1 -#define PWC_WB_FL		2 -#define PWC_WB_MANUAL		3 -#define PWC_WB_AUTO		4 - -/* Used with VIDIOCPWC[SG]AWB (Auto White Balance). -   Set mode to one of the PWC_WB_* values above. -   *red and *blue are the respective gains of these colour components inside -   the camera; range 0..65535 -   When 'mode' == PWC_WB_MANUAL, 'manual_red' and 'manual_blue' are set or read; -   otherwise undefined. -   'read_red' and 'read_blue' are read-only. -*/ -struct pwc_whitebalance -{ -	int mode; -	int manual_red, manual_blue;	/* R/W */ -	int read_red, read_blue;	/* R/O */ -}; - -/* -   'control_speed' and 'control_delay' are used in automatic whitebalance mode, -   and tell the camera how fast it should react to changes in lighting, and -   with how much delay. Valid values are 0..65535. -*/ -struct pwc_wb_speed -{ -	int control_speed; -	int control_delay; - -}; - -/* Used with VIDIOCPWC[SG]LED */ -struct pwc_leds -{ -	int led_on;			/* Led on-time; range = 0..25000 */ -	int led_off;			/* Led off-time; range = 0..25000  */ -}; - -/* Image size (used with GREALSIZE) */ -struct pwc_imagesize -{ -	int width; -	int height; -}; - -/* Defines and structures for Motorized Pan & Tilt */ -#define PWC_MPT_PAN		0x01 -#define PWC_MPT_TILT		0x02 -#define PWC_MPT_TIMEOUT		0x04 /* for status */ - -/* Set angles; when absolute != 0, the angle is absolute and the -   driver calculates the relative offset for you. This can only -   be used with VIDIOCPWCSANGLE; VIDIOCPWCGANGLE always returns -   absolute angles. - */ -struct pwc_mpt_angles -{ -	int absolute;		/* write-only */ -	int pan;		/* degrees * 100 */ -	int tilt;		/* degress * 100 */ -}; - -/* Range of angles of the camera, both horizontally and vertically. - */ -struct pwc_mpt_range -{ -	int pan_min, pan_max;		/* degrees * 100 */ -	int tilt_min, tilt_max; -}; - -struct pwc_mpt_status -{ -	int status; -	int time_pan; -	int time_tilt; -}; - - -/* This is used for out-of-kernel decompression. With it, you can get -   all the necessary information to initialize and use the decompressor -   routines in standalone applications. - */ -struct pwc_video_command -{ -	int type;		/* camera type (645, 675, 730, etc.) */ -	int release;		/* release number */ - -	int size;		/* one of PSZ_* */ -	int alternate; -	int command_len;	/* length of USB video command */ -	unsigned char command_buf[13];	/* Actual USB video command */ -	int bandlength;		/* >0 = compressed */ -	int frame_size;		/* Size of one (un)compressed frame */ -}; - -/* Flags for PWCX subroutines. Not all modules honour all flags. */ -#define PWCX_FLAG_PLANAR	0x0001 -#define PWCX_FLAG_BAYER		0x0008 - - -/* IOCTL definitions */ - - /* Restore user settings */ -#define VIDIOCPWCRUSER		_IO('v', 192) - /* Save user settings */ -#define VIDIOCPWCSUSER		_IO('v', 193) - /* Restore factory settings */ -#define VIDIOCPWCFACTORY	_IO('v', 194) - - /* You can manipulate the compression factor. A compression preference of 0 -    means use uncompressed modes when available; 1 is low compression, 2 is -    medium and 3 is high compression preferred. Of course, the higher the -    compression, the lower the bandwidth used but more chance of artefacts -    in the image. The driver automatically chooses a higher compression when -    the preferred mode is not available. -  */ - /* Set preferred compression quality (0 = uncompressed, 3 = highest compression) */ -#define VIDIOCPWCSCQUAL		_IOW('v', 195, int) - /* Get preferred compression quality */ -#define VIDIOCPWCGCQUAL		_IOR('v', 195, int) - - -/* Retrieve serial number of camera */ -#define VIDIOCPWCGSERIAL	_IOR('v', 198, struct pwc_serial) - - /* This is a probe function; since so many devices are supported, it -    becomes difficult to include all the names in programs that want to -    check for the enhanced Philips stuff. So in stead, try this PROBE; -    it returns a structure with the original name, and the corresponding -    Philips type. -    To use, fill the structure with zeroes, call PROBE and if that succeeds, -    compare the name with that returned from VIDIOCGCAP; they should be the -    same. If so, you can be assured it is a Philips (OEM) cam and the type -    is valid. - */ -#define VIDIOCPWCPROBE		_IOR('v', 199, struct pwc_probe) - - /* Set AGC (Automatic Gain Control); int < 0 = auto, 0..65535 = fixed */ -#define VIDIOCPWCSAGC		_IOW('v', 200, int) - /* Get AGC; int < 0 = auto; >= 0 = fixed, range 0..65535 */ -#define VIDIOCPWCGAGC		_IOR('v', 200, int) - /* Set shutter speed; int < 0 = auto; >= 0 = fixed, range 0..65535 */ -#define VIDIOCPWCSSHUTTER	_IOW('v', 201, int) - - /* Color compensation (Auto White Balance) */ -#define VIDIOCPWCSAWB           _IOW('v', 202, struct pwc_whitebalance) -#define VIDIOCPWCGAWB           _IOR('v', 202, struct pwc_whitebalance) - - /* Auto WB speed */ -#define VIDIOCPWCSAWBSPEED	_IOW('v', 203, struct pwc_wb_speed) -#define VIDIOCPWCGAWBSPEED	_IOR('v', 203, struct pwc_wb_speed) - - /* LEDs on/off/blink; int range 0..65535 */ -#define VIDIOCPWCSLED           _IOW('v', 205, struct pwc_leds) -#define VIDIOCPWCGLED           _IOR('v', 205, struct pwc_leds) - -  /* Contour (sharpness); int < 0 = auto, 0..65536 = fixed */ -#define VIDIOCPWCSCONTOUR	_IOW('v', 206, int) -#define VIDIOCPWCGCONTOUR	_IOR('v', 206, int) - -  /* Backlight compensation; 0 = off, otherwise on */ -#define VIDIOCPWCSBACKLIGHT	_IOW('v', 207, int) -#define VIDIOCPWCGBACKLIGHT	_IOR('v', 207, int) - -  /* Flickerless mode; = 0 off, otherwise on */ -#define VIDIOCPWCSFLICKER	_IOW('v', 208, int) -#define VIDIOCPWCGFLICKER	_IOR('v', 208, int) - -  /* Dynamic noise reduction; 0 off, 3 = high noise reduction */ -#define VIDIOCPWCSDYNNOISE	_IOW('v', 209, int) -#define VIDIOCPWCGDYNNOISE	_IOR('v', 209, int) - - /* Real image size as used by the camera; tells you whether or not there's a gray border around the image */ -#define VIDIOCPWCGREALSIZE	_IOR('v', 210, struct pwc_imagesize) - - /* Motorized pan & tilt functions */ -#define VIDIOCPWCMPTRESET	_IOW('v', 211, int) -#define VIDIOCPWCMPTGRANGE	_IOR('v', 211, struct pwc_mpt_range) -#define VIDIOCPWCMPTSANGLE	_IOW('v', 212, struct pwc_mpt_angles) -#define VIDIOCPWCMPTGANGLE	_IOR('v', 212, struct pwc_mpt_angles) -#define VIDIOCPWCMPTSTATUS	_IOR('v', 213, struct pwc_mpt_status) - - /* Get the USB set-video command; needed for initializing libpwcx */ -#define VIDIOCPWCGVIDCMD	_IOR('v', 215, struct pwc_video_command) -struct pwc_table_init_buffer { -   int len; -   char *buffer; - -}; -#define VIDIOCPWCGVIDTABLE	_IOR('v', 216, struct pwc_table_init_buffer) - -/* - * This is private command used when communicating with v4l2. - * In the future all private ioctl will be remove/replace to - * use interface offer by v4l2. - */ - -#define V4L2_CID_PRIVATE_SAVE_USER       (V4L2_CID_PRIVATE_BASE + 0) -#define V4L2_CID_PRIVATE_RESTORE_USER    (V4L2_CID_PRIVATE_BASE + 1) -#define V4L2_CID_PRIVATE_RESTORE_FACTORY (V4L2_CID_PRIVATE_BASE + 2) -#define V4L2_CID_PRIVATE_COLOUR_MODE     (V4L2_CID_PRIVATE_BASE + 3) -#define V4L2_CID_PRIVATE_AUTOCONTOUR     (V4L2_CID_PRIVATE_BASE + 4) -#define V4L2_CID_PRIVATE_CONTOUR         (V4L2_CID_PRIVATE_BASE + 5) -#define V4L2_CID_PRIVATE_BACKLIGHT       (V4L2_CID_PRIVATE_BASE + 6) -#define V4L2_CID_PRIVATE_FLICKERLESS     (V4L2_CID_PRIVATE_BASE + 7) -#define V4L2_CID_PRIVATE_NOISE_REDUCTION (V4L2_CID_PRIVATE_BASE + 8) - -struct pwc_raw_frame { -   __le16 type;		/* type of the webcam */ -   __le16 vbandlength;	/* Size of 4lines compressed (used by the decompressor) */ -   __u8   cmd[4];	/* the four byte of the command (in case of nala, -			   only the first 3 bytes is filled) */ -   __u8   rawframe[0];	/* frame_size = H/4*vbandlength */ -} __attribute__ ((packed)); - - -#endif diff --git a/drivers/media/video/pwc/pwc-kiara.c b/drivers/media/video/pwc/pwc-kiara.c deleted file mode 100644 index f4ae83c0cf2..00000000000 --- a/drivers/media/video/pwc/pwc-kiara.c +++ /dev/null @@ -1,893 +0,0 @@ -/* Linux driver for Philips webcam -   (C) 2004-2006 Luc Saillard (luc@saillard.org) - -   NOTE: this version of pwc is an unofficial (modified) release of pwc & pcwx -   driver and thus may have bugs that are not present in the original version. -   Please send bug reports and support requests to <luc@saillard.org>. -   The decompression routines have been implemented by reverse-engineering the -   Nemosoft binary pwcx module. Caveat emptor. - -   This program is free software; you can redistribute it and/or modify -   it under the terms of the GNU General Public License as published by -   the Free Software Foundation; either version 2 of the License, or -   (at your option) any later version. - -   This program is distributed in the hope that it will be useful, -   but WITHOUT ANY WARRANTY; without even the implied warranty of -   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the -   GNU General Public License for more details. - -   You should have received a copy of the GNU General Public License -   along with this program; if not, write to the Free Software -   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA -*/ - - -/* This tables contains entries for the 730/740/750 (Kiara) camera, with -   4 different qualities (no compression, low, medium, high). -   It lists the bandwidth requirements for said mode by its alternate interface -   number. An alternate of 0 means that the mode is unavailable. - -   There are 6 * 4 * 4 entries: -     6 different resolutions subqcif, qsif, qcif, sif, cif, vga -     6 framerates: 5, 10, 15, 20, 25, 30 -     4 compression modi: none, low, medium, high - -   When an uncompressed mode is not available, the next available compressed mode -   will be chosen (unless the decompressor is absent). Sometimes there are only -   1 or 2 compressed modes available; in that case entries are duplicated. -*/ - - -#include "pwc-kiara.h" -#include "pwc-uncompress.h" - -const unsigned int Kiara_fps_vector[PWC_FPS_MAX_KIARA] = { 5, 10, 15, 20, 25, 30 }; - -const struct Kiara_table_entry Kiara_table[PSZ_MAX][6][4] = -{ -   /* SQCIF */ -   { -      /* 5 fps */ -      { -	 {0, }, -	 {0, }, -	 {0, }, -	 {0, }, -      }, -      /* 10 fps */ -      { -	 {0, }, -	 {0, }, -	 {0, }, -	 {0, }, -      }, -      /* 15 fps */ -      { -	 {0, }, -	 {0, }, -	 {0, }, -	 {0, }, -      }, -      /* 20 fps */ -      { -	 {0, }, -	 {0, }, -	 {0, }, -	 {0, }, -      }, -      /* 25 fps */ -      { -	 {0, }, -	 {0, }, -	 {0, }, -	 {0, }, -      }, -      /* 30 fps */ -      { -	 {0, }, -	 {0, }, -	 {0, }, -	 {0, }, -      }, -   }, -   /* QSIF */ -   { -      /* 5 fps */ -      { -	 {1, 146,    0, {0x1D, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0x00, 0x80}}, -	 {1, 146,    0, {0x1D, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0x00, 0x80}}, -	 {1, 146,    0, {0x1D, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0x00, 0x80}}, -	 {1, 146,    0, {0x1D, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0x00, 0x80}}, -      }, -      /* 10 fps */ -      { -	 {2, 291,    0, {0x1C, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x23, 0x01, 0x80}}, -	 {1, 192,  630, {0x14, 0xF4, 0x30, 0x13, 0xA9, 0x12, 0xE1, 0x17, 0x08, 0xC0, 0x00, 0x80}}, -	 {1, 192,  630, {0x14, 0xF4, 0x30, 0x13, 0xA9, 0x12, 0xE1, 0x17, 0x08, 0xC0, 0x00, 0x80}}, -	 {1, 192,  630, {0x14, 0xF4, 0x30, 0x13, 0xA9, 0x12, 0xE1, 0x17, 0x08, 0xC0, 0x00, 0x80}}, -      }, -      /* 15 fps */ -      { -	 {3, 437,    0, {0x1B, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0xB5, 0x01, 0x80}}, -	 {2, 292,  640, {0x13, 0xF4, 0x30, 0x13, 0xF7, 0x13, 0x2F, 0x13, 0x20, 0x24, 0x01, 0x80}}, -	 {2, 292,  640, {0x13, 0xF4, 0x30, 0x13, 0xF7, 0x13, 0x2F, 0x13, 0x20, 0x24, 0x01, 0x80}}, -	 {1, 192,  420, {0x13, 0xF4, 0x30, 0x0D, 0x1B, 0x0C, 0x53, 0x1E, 0x18, 0xC0, 0x00, 0x80}}, -      }, -      /* 20 fps */ -      { -	 {4, 589,    0, {0x1A, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x4D, 0x02, 0x80}}, -	 {3, 448,  730, {0x12, 0xF4, 0x30, 0x16, 0xC9, 0x16, 0x01, 0x0E, 0x18, 0xC0, 0x01, 0x80}}, -	 {2, 292,  476, {0x12, 0xF4, 0x30, 0x0E, 0xD8, 0x0E, 0x10, 0x19, 0x18, 0x24, 0x01, 0x80}}, -	 {1, 192,  312, {0x12, 0xF4, 0x50, 0x09, 0xB3, 0x08, 0xEB, 0x1E, 0x18, 0xC0, 0x00, 0x80}}, -      }, -      /* 25 fps */ -      { -	 {5, 703,    0, {0x19, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0xBF, 0x02, 0x80}}, -	 {3, 447,  610, {0x11, 0xF4, 0x30, 0x13, 0x0B, 0x12, 0x43, 0x14, 0x28, 0xBF, 0x01, 0x80}}, -	 {2, 292,  398, {0x11, 0xF4, 0x50, 0x0C, 0x6C, 0x0B, 0xA4, 0x1E, 0x28, 0x24, 0x01, 0x80}}, -	 {1, 193,  262, {0x11, 0xF4, 0x50, 0x08, 0x23, 0x07, 0x5B, 0x1E, 0x28, 0xC1, 0x00, 0x80}}, -      }, -      /* 30 fps */ -      { -	 {8, 874,    0, {0x18, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x6A, 0x03, 0x80}}, -	 {5, 704,  730, {0x10, 0xF4, 0x30, 0x16, 0xC9, 0x16, 0x01, 0x0E, 0x28, 0xC0, 0x02, 0x80}}, -	 {3, 448,  492, {0x10, 0xF4, 0x30, 0x0F, 0x5D, 0x0E, 0x95, 0x15, 0x28, 0xC0, 0x01, 0x80}}, -	 {2, 292,  320, {0x10, 0xF4, 0x50, 0x09, 0xFB, 0x09, 0x33, 0x1E, 0x28, 0x24, 0x01, 0x80}}, -      }, -   }, -   /* QCIF */ -   { -      /* 5 fps */ -      { -	 {0, }, -	 {0, }, -	 {0, }, -	 {0, }, -      }, -      /* 10 fps */ -      { -	 {0, }, -	 {0, }, -	 {0, }, -	 {0, }, -      }, -      /* 15 fps */ -      { -	 {0, }, -	 {0, }, -	 {0, }, -	 {0, }, -      }, -      /* 20 fps */ -      { -	 {0, }, -	 {0, }, -	 {0, }, -	 {0, }, -      }, -      /* 25 fps */ -      { -	 {0, }, -	 {0, }, -	 {0, }, -	 {0, }, -      }, -      /* 30 fps */ -      { -	 {0, }, -	 {0, }, -	 {0, }, -	 {0, }, -      }, -   }, -   /* SIF */ -   { -      /* 5 fps */ -      { -	 {4, 582,    0, {0x0D, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x46, 0x02, 0x80}}, -	 {3, 387, 1276, {0x05, 0xF4, 0x30, 0x27, 0xD8, 0x26, 0x48, 0x03, 0x10, 0x83, 0x01, 0x80}}, -	 {2, 291,  960, {0x05, 0xF4, 0x30, 0x1D, 0xF2, 0x1C, 0x62, 0x04, 0x10, 0x23, 0x01, 0x80}}, -	 {1, 191,  630, {0x05, 0xF4, 0x50, 0x13, 0xA9, 0x12, 0x19, 0x05, 0x18, 0xBF, 0x00, 0x80}}, -      }, -      /* 10 fps */ -      { -	 {0, }, -	 {6, 775, 1278, {0x04, 0xF4, 0x30, 0x27, 0xE8, 0x26, 0x58, 0x05, 0x30, 0x07, 0x03, 0x80}}, -	 {3, 447,  736, {0x04, 0xF4, 0x30, 0x16, 0xFB, 0x15, 0x6B, 0x05, 0x28, 0xBF, 0x01, 0x80}}, -	 {2, 292,  480, {0x04, 0xF4, 0x70, 0x0E, 0xF9, 0x0D, 0x69, 0x09, 0x28, 0x24, 0x01, 0x80}}, -      }, -      /* 15 fps */ -      { -	 {0, }, -	 {9, 955, 1050, {0x03, 0xF4, 0x30, 0x20, 0xCF, 0x1F, 0x3F, 0x06, 0x48, 0xBB, 0x03, 0x80}}, -	 {4, 592,  650, {0x03, 0xF4, 0x30, 0x14, 0x44, 0x12, 0xB4, 0x08, 0x30, 0x50, 0x02, 0x80}}, -	 {3, 448,  492, {0x03, 0xF4, 0x50, 0x0F, 0x52, 0x0D, 0xC2, 0x09, 0x38, 0xC0, 0x01, 0x80}}, -      }, -      /* 20 fps */ -      { -	 {0, }, -	 {9, 958,  782, {0x02, 0xF4, 0x30, 0x18, 0x6A, 0x16, 0xDA, 0x0B, 0x58, 0xBE, 0x03, 0x80}}, -	 {5, 703,  574, {0x02, 0xF4, 0x50, 0x11, 0xE7, 0x10, 0x57, 0x0B, 0x40, 0xBF, 0x02, 0x80}}, -	 {3, 446,  364, {0x02, 0xF4, 0x90, 0x0B, 0x5C, 0x09, 0xCC, 0x0E, 0x38, 0xBE, 0x01, 0x80}}, -      }, -      /* 25 fps */ -      { -	 {0, }, -	 {9, 958,  654, {0x01, 0xF4, 0x30, 0x14, 0x66, 0x12, 0xD6, 0x0B, 0x50, 0xBE, 0x03, 0x80}}, -	 {6, 776,  530, {0x01, 0xF4, 0x50, 0x10, 0x8C, 0x0E, 0xFC, 0x0C, 0x48, 0x08, 0x03, 0x80}}, -	 {4, 592,  404, {0x01, 0xF4, 0x70, 0x0C, 0x96, 0x0B, 0x06, 0x0B, 0x48, 0x50, 0x02, 0x80}}, -      }, -      /* 30 fps */ -      { -	 {0, }, -	 {9, 957,  526, {0x00, 0xF4, 0x50, 0x10, 0x68, 0x0E, 0xD8, 0x0D, 0x58, 0xBD, 0x03, 0x80}}, -	 {6, 775,  426, {0x00, 0xF4, 0x70, 0x0D, 0x48, 0x0B, 0xB8, 0x0F, 0x50, 0x07, 0x03, 0x80}}, -	 {4, 590,  324, {0x00, 0x7A, 0x88, 0x0A, 0x1C, 0x08, 0xB4, 0x0E, 0x50, 0x4E, 0x02, 0x80}}, -      }, -   }, -   /* CIF */ -   { -      /* 5 fps */ -      { -	 {0, }, -	 {0, }, -	 {0, }, -	 {0, }, -      }, -      /* 10 fps */ -      { -	 {0, }, -	 {0, }, -	 {0, }, -	 {0, }, -      }, -      /* 15 fps */ -      { -	 {0, }, -	 {0, }, -	 {0, }, -	 {0, }, -      }, -      /* 20 fps */ -      { -	 {0, }, -	 {0, }, -	 {0, }, -	 {0, }, -      }, -      /* 25 fps */ -      { -	 {0, }, -	 {0, }, -	 {0, }, -	 {0, }, -      }, -      /* 30 fps */ -      { -	 {0, }, -	 {0, }, -	 {0, }, -	 {0, }, -      }, -   }, -   /* VGA */ -   { -      /* 5 fps */ -      { -	 {0, }, -	 {6, 773, 1272, {0x25, 0xF4, 0x30, 0x27, 0xB6, 0x24, 0x96, 0x02, 0x30, 0x05, 0x03, 0x80}}, -	 {4, 592,  976, {0x25, 0xF4, 0x50, 0x1E, 0x78, 0x1B, 0x58, 0x03, 0x30, 0x50, 0x02, 0x80}}, -	 {3, 448,  738, {0x25, 0xF4, 0x90, 0x17, 0x0C, 0x13, 0xEC, 0x04, 0x30, 0xC0, 0x01, 0x80}}, -      }, -      /* 10 fps */ -      { -	 {0, }, -	 {9, 956,  788, {0x24, 0xF4, 0x70, 0x18, 0x9C, 0x15, 0x7C, 0x03, 0x48, 0xBC, 0x03, 0x80}}, -	 {6, 776,  640, {0x24, 0xF4, 0xB0, 0x13, 0xFC, 0x11, 0x2C, 0x04, 0x48, 0x08, 0x03, 0x80}}, -	 {4, 592,  488, {0x24, 0x7A, 0xE8, 0x0F, 0x3C, 0x0C, 0x6C, 0x06, 0x48, 0x50, 0x02, 0x80}}, -      }, -      /* 15 fps */ -      { -	 {0, }, -	 {9, 957,  526, {0x23, 0x7A, 0xE8, 0x10, 0x68, 0x0D, 0x98, 0x06, 0x58, 0xBD, 0x03, 0x80}}, -	 {9, 957,  526, {0x23, 0x7A, 0xE8, 0x10, 0x68, 0x0D, 0x98, 0x06, 0x58, 0xBD, 0x03, 0x80}}, -	 {8, 895,  492, {0x23, 0x7A, 0xE8, 0x0F, 0x5D, 0x0C, 0x8D, 0x06, 0x58, 0x7F, 0x03, 0x80}}, -      }, -      /* 20 fps */ -      { -	 {0, }, -	 {0, }, -	 {0, }, -	 {0, }, -      }, -      /* 25 fps */ -      { -	 {0, }, -	 {0, }, -	 {0, }, -	 {0, }, -      }, -      /* 30 fps */ -      { -	 {0, }, -	 {0, }, -	 {0, }, -	 {0, }, -      }, -   }, -}; - - -/* - * Rom table for kiara chips - * - * 32 roms tables (one for each resolution ?) - *  2 tables per roms (one for each passes) (Y, and U&V) - * 128 bytes per passes - */ - -const unsigned int KiaraRomTable [8][2][16][8] = -{ - { /* version 0 */ -  { /* version 0, passes 0 */ -   {0x00000000,0x00000000,0x00000000,0x00000000, -    0x00000000,0x00000000,0x00000001,0x00000001}, -   {0x00000000,0x00000000,0x00000009,0x00000009, -    0x00000009,0x00000009,0x00000009,0x00000009}, -   {0x00000000,0x00000000,0x00000009,0x00000049, -    0x00000049,0x00000049,0x00000049,0x00000049}, -   {0x00000000,0x00000000,0x00000049,0x00000049, -    0x00000049,0x00000249,0x0000024a,0x00000049}, -   {0x00000000,0x00000000,0x00000049,0x00000049, -    0x00000249,0x00000249,0x0000024a,0x0000024a}, -   {0x00000000,0x00000000,0x00000049,0x00000249, -    0x00000249,0x0000124a,0x0000024a,0x0000024a}, -   {0x00000000,0x00000000,0x00000049,0x00000249, -    0x0000124a,0x00009252,0x00001252,0x00001252}, -   {0x00000000,0x00000000,0x00000249,0x00000249, -    0x00009252,0x00009292,0x00009292,0x00009292}, -   {0x00000000,0x00000000,0x00000249,0x00001249, -    0x00009292,0x00009292,0x00009493,0x000124db}, -   {0x00000000,0x00000000,0x00000249,0x0000924a, -    0x00009492,0x0000a49b,0x0000a49b,0x000124db}, -   {0x00000000,0x00000000,0x00001249,0x00009252, -    0x0000a493,0x000124db,0x000124db,0x000126dc}, -   {0x00000000,0x00000000,0x00001249,0x00009493, -    0x000124db,0x000126dc,0x000136e4,0x000126dc}, -   {0x00000000,0x00000000,0x00009292,0x0000a49b, -    0x000124db,0x000136e4,0x000136e4,0x000136e4}, -   {0x00000000,0x00000000,0x00009292,0x0000a49b, -    0x000126dc,0x0001b724,0x0001b92d,0x0001b925}, -   {0x00000000,0x00000000,0x00009492,0x000124db, -    0x000136e4,0x0001b925,0x0001c96e,0x0001c92d}, -   {0x00000000,0x00000000,0x00000000,0x00000000, -    0x00000000,0x00000000,0x00000000,0x00000000} -  }, -  { /* version 0, passes 1 */ -   {0x00000000,0x00000000,0x00000000,0x00000000, -    0x00000000,0x00000000,0x00000000,0x00000000}, -   {0x00000000,0x00000000,0x00000000,0x00000000, -    0x00000000,0x00000000,0x00000000,0x00000000}, -   {0x00000000,0x00000000,0x00000001,0x00000009, -    0x00000009,0x00000009,0x00000009,0x00000001}, -   {0x00000000,0x00000000,0x00000009,0x00000009, -    0x00000049,0x00000049,0x00000049,0x00000049}, -   {0x00000000,0x00000000,0x00000049,0x00000049, -    0x00000049,0x00000049,0x0000024a,0x0000024a}, -   {0x00000000,0x00000000,0x00000049,0x00000049, -    0x00000249,0x00000249,0x0000024a,0x0000024a}, -   {0x00000000,0x00000000,0x00000049,0x00000249, -    0x00000249,0x00000249,0x0000024a,0x00001252}, -   {0x00000000,0x00000000,0x00000049,0x00001249, -    0x0000124a,0x0000124a,0x00001252,0x00009292}, -   {0x00000000,0x00000000,0x00000249,0x00001249, -    0x00009252,0x00009252,0x00009292,0x00009493}, -   {0x00000000,0x00000000,0x00000249,0x0000924a, -    0x00009292,0x00009292,0x00009292,0x00009493}, -   {0x00000000,0x00000000,0x00000249,0x00009292, -    0x00009492,0x00009493,0x0000a49b,0x00009493}, -   {0x00000000,0x00000000,0x00001249,0x00009292, -    0x0000a493,0x000124db,0x000126dc,0x000126dc}, -   {0x00000000,0x00000000,0x0000924a,0x00009493, -    0x0000a493,0x000126dc,0x000136e4,0x000136e4}, -   {0x00000000,0x00000000,0x00009252,0x00009493, -    0x000126dc,0x000126dc,0x000136e4,0x000136e4}, -   {0x00000000,0x00000000,0x00009292,0x0000a49b, -    0x000136e4,0x000136e4,0x0001b725,0x0001b724}, -   {0x00000000,0x00000000,0x00000000,0x00000000, -    0x00000000,0x00000000,0x00000000,0x00000000} -  } - }, - { /* version 1 */ -  { /* version 1, passes 0 */ -   {0x00000000,0x00000000,0x00000000,0x00000000, -    0x00000000,0x00000000,0x00000000,0x00000001}, -   {0x00000000,0x00000000,0x00000009,0x00000009, -    0x00000009,0x00000009,0x00000009,0x00000009}, -   {0x00000000,0x00000000,0x00000049,0x00000049, -    0x00000049,0x00000049,0x00000049,0x00000049}, -   {0x00000000,0x00000000,0x00000049,0x00000049, -    0x00000049,0x00000249,0x0000024a,0x0000024a}, -   {0x00000000,0x00000000,0x00000049,0x00000249, -    0x00000249,0x00000249,0x0000024a,0x00001252}, -   {0x00000000,0x00000000,0x00000249,0x00000249, -    0x00000249,0x0000124a,0x00001252,0x00001252}, -   {0x00000000,0x00000000,0x00000249,0x00000249, -    0x0000124a,0x0000124a,0x00009292,0x00009292}, -   {0x00000000,0x00000000,0x00000249,0x00001249, -    0x0000124a,0x00009252,0x00009292,0x00009292}, -   {0x00000000,0x00000000,0x00000249,0x00001249, -    0x00009252,0x00009292,0x00009292,0x00009292}, -   {0x00000000,0x00000000,0x00000249,0x00001249, -    0x00009252,0x00009292,0x00009493,0x00009493}, -   {0x00000000,0x00000000,0x00000249,0x0000924a, -    0x00009252,0x00009493,0x00009493,0x00009493}, -   {0x00000000,0x00000000,0x00000249,0x0000924a, -    0x00009292,0x00009493,0x00009493,0x00009493}, -   {0x00000000,0x00000000,0x00000249,0x00009252, -    0x00009492,0x00009493,0x0000a49b,0x0000a49b}, -   {0x00000000,0x00000000,0x00001249,0x00009292, -    0x00009492,0x000124db,0x000124db,0x000124db}, -   {0x00000000,0x00000000,0x0000924a,0x00009493, -    0x0000a493,0x000126dc,0x000126dc,0x000126dc}, -   {0x00000000,0x00000000,0x00000000,0x00000000, -    0x00000000,0x00000000,0x00000000,0x00000000} -  }, -  { /* version 1, passes 1 */ -   {0x00000000,0x00000000,0x00000000,0x00000000, -    0x00000000,0x00000000,0x00000000,0x00000000}, -   {0x00000000,0x00000000,0x00000049,0x00000009, -    0x00000049,0x00000009,0x00000001,0x00000000}, -   {0x00000000,0x00000000,0x00000049,0x00000049, -    0x00000049,0x00000049,0x00000049,0x00000000}, -   {0x00000000,0x00000000,0x00000249,0x00000049, -    0x00000249,0x00000049,0x0000024a,0x00000001}, -   {0x00000000,0x00000000,0x00000249,0x00000249, -    0x00000249,0x00000249,0x0000024a,0x00000001}, -   {0x00000000,0x00000000,0x00000249,0x00000249, -    0x00000249,0x00000249,0x0000024a,0x00000001}, -   {0x00000000,0x00000000,0x00000249,0x00000249, -    0x00000249,0x00000249,0x0000024a,0x00000009}, -   {0x00000000,0x00000000,0x00000249,0x00000249, -    0x0000124a,0x0000124a,0x0000024a,0x00000009}, -   {0x00000000,0x00000000,0x00000249,0x00000249, -    0x0000124a,0x0000124a,0x0000024a,0x00000009}, -   {0x00000000,0x00000000,0x00001249,0x00001249, -    0x0000124a,0x00009252,0x00001252,0x00000049}, -   {0x00000000,0x00000000,0x00001249,0x00001249, -    0x0000124a,0x00009292,0x00001252,0x00000049}, -   {0x00000000,0x00000000,0x00001249,0x00001249, -    0x0000124a,0x00009292,0x00001252,0x00000049}, -   {0x00000000,0x00000000,0x00001249,0x00001249, -    0x00009252,0x00009292,0x00001252,0x0000024a}, -   {0x00000000,0x00000000,0x00001249,0x00001249, -    0x00009292,0x00009292,0x00001252,0x0000024a}, -   {0x00000000,0x00000000,0x0000924a,0x0000924a, -    0x00009492,0x00009493,0x00009292,0x00001252}, -   {0x00000000,0x00000000,0x00000000,0x00000000, -    0x00000000,0x00000000,0x00000000,0x00000000} -  } - }, - { /* version 2 */ -  { /* version 2, passes 0 */ -   {0x00000000,0x00000000,0x00000049,0x00000049, -    0x00000049,0x00000049,0x0000024a,0x0000024a}, -   {0x00000000,0x00000000,0x00000249,0x00000249, -    0x00000249,0x0000124a,0x00001252,0x00009292}, -   {0x00000000,0x00000000,0x00000249,0x00000249, -    0x0000124a,0x00009252,0x00009292,0x00009292}, -   {0x00000000,0x00000000,0x00000249,0x00001249, -    0x0000124a,0x00009292,0x00009493,0x00009493}, -   {0x00000000,0x00000000,0x00000249,0x00001249, -    0x00009252,0x00009493,0x00009493,0x0000a49b}, -   {0x00000000,0x00000000,0x00000249,0x0000924a, -    0x00009292,0x00009493,0x0000a49b,0x0000a49b}, -   {0x00000000,0x00000000,0x00001249,0x0000924a, -    0x00009292,0x00009493,0x0000a49b,0x000124db}, -   {0x00000000,0x00000000,0x00001249,0x00009252, -    0x00009492,0x0000a49b,0x0000a49b,0x000124db}, -   {0x00000000,0x00000000,0x00001249,0x00009292, -    0x00009492,0x000124db,0x000124db,0x000126dc}, -   {0x00000000,0x00000000,0x00001249,0x00009292, -    0x0000a493,0x000124db,0x000126dc,0x000126dc}, -   {0x00000000,0x00000000,0x00001249,0x00009493, -    0x0000a493,0x000124db,0x000126dc,0x000136e4}, -   {0x00000000,0x00000000,0x00001249,0x00009493, -    0x0000a493,0x000126dc,0x000136e4,0x000136e4}, -   {0x00000000,0x00000000,0x0000924a,0x00009493, -    0x0001249b,0x000126dc,0x000136e4,0x000136e4}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x000124db,0x000136e4,0x000136e4,0x0001b724}, -   {0x00000000,0x00000000,0x00009252,0x000124db, -    0x000126dc,0x0001b724,0x0001b725,0x0001b925}, -   {0x00000000,0x00000000,0x00000000,0x00000000, -    0x00000000,0x00000000,0x00000000,0x00000000} -  }, -  { /* version 2, passes 1 */ -   {0x00000000,0x00000000,0x00000049,0x00000049, -    0x00000049,0x00000049,0x00000049,0x00000049}, -   {0x00000000,0x00000000,0x00000249,0x00000249, -    0x00000249,0x00000249,0x0000024a,0x00000049}, -   {0x00000000,0x00000000,0x00001249,0x00000249, -    0x0000124a,0x0000124a,0x00001252,0x00000049}, -   {0x00000000,0x00000000,0x00001249,0x00001249, -    0x0000124a,0x0000124a,0x00009292,0x0000024a}, -   {0x00000000,0x00000000,0x00001249,0x00001249, -    0x00009252,0x00009292,0x00009292,0x0000024a}, -   {0x00000000,0x00000000,0x00001249,0x00001249, -    0x00009252,0x00009292,0x0000a49b,0x0000024a}, -   {0x00000000,0x00000000,0x00001249,0x00001249, -    0x00009292,0x00009493,0x0000a49b,0x00001252}, -   {0x00000000,0x00000000,0x00001249,0x00001249, -    0x00009292,0x00009493,0x0000a49b,0x00001252}, -   {0x00000000,0x00000000,0x00001249,0x0000924a, -    0x00009492,0x0000a49b,0x0000a49b,0x00001252}, -   {0x00000000,0x00000000,0x00001249,0x00009252, -    0x00009492,0x0000a49b,0x0000a49b,0x00009292}, -   {0x00000000,0x00000000,0x00001249,0x00009292, -    0x00009492,0x0000a49b,0x0000a49b,0x00009292}, -   {0x00000000,0x00000000,0x00001249,0x00009493, -    0x0000a493,0x0000a49b,0x0000a49b,0x00009292}, -   {0x00000000,0x00000000,0x00001249,0x00009493, -    0x0000a493,0x0000a49b,0x0000a49b,0x00009493}, -   {0x00000000,0x00000000,0x0000924a,0x00009493, -    0x0000a493,0x000124db,0x0000a49b,0x00009493}, -   {0x00000000,0x00000000,0x00009252,0x0000a49b, -    0x0001249b,0x000126dc,0x000124db,0x0000a49b}, -   {0x00000000,0x00000000,0x00000000,0x00000000, -    0x00000000,0x00000000,0x00000000,0x00000000} -  } - }, - { /* version 3 */ -  { /* version 3, passes 0 */ -   {0x00000000,0x00000000,0x00000249,0x00000249, -    0x0000124a,0x0000124a,0x00009292,0x00009292}, -   {0x00000000,0x00000000,0x00001249,0x00001249, -    0x00009292,0x00009493,0x0000a49b,0x0000a49b}, -   {0x00000000,0x00000000,0x00001249,0x0000924a, -    0x00009492,0x0000a49b,0x0000a49b,0x000124db}, -   {0x00000000,0x00000000,0x00001249,0x00009292, -    0x00009492,0x000124db,0x000126dc,0x000126dc}, -   {0x00000000,0x00000000,0x00001249,0x00009493, -    0x0000a493,0x000124db,0x000126dc,0x000126dc}, -   {0x00000000,0x00000000,0x00001249,0x00009493, -    0x0000a493,0x000126dc,0x000136e4,0x000136e4}, -   {0x00000000,0x00000000,0x00001249,0x00009493, -    0x0000a493,0x000126dc,0x000136e4,0x0001b724}, -   {0x00000000,0x00000000,0x00001249,0x00009493, -    0x0001249b,0x000126dc,0x000136e4,0x0001b724}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x0001249b,0x000126dc,0x000136e4,0x0001b724}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x0001249b,0x000136e4,0x0001b725,0x0001b724}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x000124db,0x000136e4,0x0001b725,0x0001b925}, -   {0x00000000,0x00000000,0x00009292,0x0000a49b, -    0x000126dc,0x000136e4,0x0001b92d,0x0001b925}, -   {0x00000000,0x00000000,0x00009292,0x0000a49b, -    0x000126dc,0x0001b724,0x0001b92d,0x0001c92d}, -   {0x00000000,0x00000000,0x00009492,0x000124db, -    0x000126dc,0x0001b724,0x0001c96e,0x0001c92d}, -   {0x00000000,0x00000000,0x0000a492,0x000126db, -    0x000136e4,0x0001b925,0x00025bb6,0x00024b77}, -   {0x00000000,0x00000000,0x00000000,0x00000000, -    0x00000000,0x00000000,0x00000000,0x00000000} -  }, -  { /* version 3, passes 1 */ -   {0x00000000,0x00000000,0x00001249,0x00000249, -    0x0000124a,0x0000124a,0x00001252,0x00001252}, -   {0x00000000,0x00000000,0x00001249,0x00001249, -    0x00009252,0x00009292,0x00009292,0x00001252}, -   {0x00000000,0x00000000,0x00001249,0x0000924a, -    0x00009492,0x00009493,0x0000a49b,0x00001252}, -   {0x00000000,0x00000000,0x00001249,0x00009252, -    0x00009492,0x0000a49b,0x0000a49b,0x00009292}, -   {0x00000000,0x00000000,0x00001249,0x00009292, -    0x00009492,0x0000a49b,0x0000a49b,0x00009292}, -   {0x00000000,0x00000000,0x00001249,0x00009493, -    0x0000a493,0x0000a49b,0x000126dc,0x00009292}, -   {0x00000000,0x00000000,0x0000924a,0x00009493, -    0x0000a493,0x0000a49b,0x000126dc,0x00009493}, -   {0x00000000,0x00000000,0x0000924a,0x00009493, -    0x0000a493,0x0000a49b,0x000126dc,0x00009493}, -   {0x00000000,0x00000000,0x0000924a,0x00009493, -    0x0000a493,0x000124db,0x000126dc,0x00009493}, -   {0x00000000,0x00000000,0x0000924a,0x00009493, -    0x0000a493,0x000124db,0x000126dc,0x0000a49b}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x0000a493,0x000124db,0x000126dc,0x0000a49b}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x0001249b,0x000126dc,0x000126dc,0x0000a49b}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x000124db,0x000136e4,0x000126dc,0x000124db}, -   {0x00000000,0x00000000,0x00009492,0x0000a49b, -    0x000136e4,0x000136e4,0x000126dc,0x000124db}, -   {0x00000000,0x00000000,0x0000a492,0x000124db, -    0x0001b724,0x0001b724,0x000136e4,0x000126dc}, -   {0x00000000,0x00000000,0x00000000,0x00000000, -    0x00000000,0x00000000,0x00000000,0x00000000} -  } - }, - { /* version 4 */ -  { /* version 4, passes 0 */ -   {0x00000000,0x00000000,0x00000049,0x00000049, -    0x00000049,0x00000049,0x00000049,0x00000049}, -   {0x00000000,0x00000000,0x00000249,0x00000049, -    0x00000249,0x00000249,0x0000024a,0x00000049}, -   {0x00000000,0x00000000,0x00000249,0x00000249, -    0x0000124a,0x00009252,0x00001252,0x0000024a}, -   {0x00000000,0x00000000,0x00001249,0x00001249, -    0x00009252,0x00009292,0x00009493,0x00001252}, -   {0x00000000,0x00000000,0x00001249,0x0000924a, -    0x00009292,0x00009493,0x00009493,0x00001252}, -   {0x00000000,0x00000000,0x00001249,0x00009292, -    0x00009492,0x0000a49b,0x0000a49b,0x00009292}, -   {0x00000000,0x00000000,0x00001249,0x00009493, -    0x0000a493,0x000124db,0x000124db,0x00009493}, -   {0x00000000,0x00000000,0x0000924a,0x00009493, -    0x0000a493,0x000124db,0x000126dc,0x0000a49b}, -   {0x00000000,0x00000000,0x0000924a,0x00009493, -    0x0000a493,0x000124db,0x000126dc,0x0000a49b}, -   {0x00000000,0x00000000,0x0000924a,0x00009493, -    0x0001249b,0x000126dc,0x000126dc,0x000124db}, -   {0x00000000,0x00000000,0x00009252,0x00009493, -    0x000124db,0x000136e4,0x000136e4,0x000126dc}, -   {0x00000000,0x00000000,0x00009252,0x0000a49b, -    0x000124db,0x000136e4,0x000136e4,0x000126dc}, -   {0x00000000,0x00000000,0x00009292,0x0000a49b, -    0x000126dc,0x000136e4,0x000136e4,0x000136e4}, -   {0x00000000,0x00000000,0x00009492,0x0000a49b, -    0x000126dc,0x0001b724,0x0001b725,0x0001b724}, -   {0x00000000,0x00000000,0x0000a492,0x000124db, -    0x000136e4,0x0001b925,0x0001b92d,0x0001b925}, -   {0x00000000,0x00000000,0x00000000,0x00000000, -    0x00000000,0x00000000,0x00000000,0x00000000} -  }, -  { /* version 4, passes 1 */ -   {0x00000000,0x00000000,0x00000249,0x00000049, -    0x00000009,0x00000009,0x00000009,0x00000009}, -   {0x00000000,0x00000000,0x00000249,0x00000249, -    0x00000049,0x00000049,0x00000009,0x00000009}, -   {0x00000000,0x00000000,0x00001249,0x00001249, -    0x0000124a,0x00000249,0x00000049,0x00000049}, -   {0x00000000,0x00000000,0x00001249,0x00001249, -    0x0000124a,0x0000124a,0x00000049,0x00000049}, -   {0x00000000,0x00000000,0x00001249,0x00001249, -    0x00009252,0x0000124a,0x0000024a,0x0000024a}, -   {0x00000000,0x00000000,0x00001249,0x0000924a, -    0x00009252,0x0000124a,0x0000024a,0x0000024a}, -   {0x00000000,0x00000000,0x00001249,0x00009292, -    0x00009492,0x00009252,0x00001252,0x00001252}, -   {0x00000000,0x00000000,0x00001249,0x00009493, -    0x0000a493,0x00009292,0x00009292,0x00001252}, -   {0x00000000,0x00000000,0x0000924a,0x00009493, -    0x0000a493,0x00009292,0x00009292,0x00009292}, -   {0x00000000,0x00000000,0x0000924a,0x00009493, -    0x0000a493,0x00009493,0x00009493,0x00009292}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x0000a493,0x0000a49b,0x00009493,0x00009493}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x0000a493,0x0000a49b,0x0000a49b,0x00009493}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x0001249b,0x000124db,0x0000a49b,0x0000a49b}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x000136e4,0x000126dc,0x000124db,0x0000a49b}, -   {0x00000000,0x00000000,0x00009252,0x000124db, -    0x0001b724,0x000136e4,0x000126dc,0x000124db}, -   {0x00000000,0x00000000,0x00000000,0x00000000, -    0x00000000,0x00000000,0x00000000,0x00000000} -  } - }, - { /* version 5 */ -  { /* version 5, passes 0 */ -   {0x00000000,0x00000000,0x00000249,0x00000249, -    0x00000249,0x00000249,0x00001252,0x00001252}, -   {0x00000000,0x00000000,0x00001249,0x00001249, -    0x00009252,0x00009292,0x00009292,0x00001252}, -   {0x00000000,0x00000000,0x00001249,0x0000924a, -    0x00009492,0x0000a49b,0x0000a49b,0x00009292}, -   {0x00000000,0x00000000,0x00001249,0x00009493, -    0x0000a493,0x0000a49b,0x000124db,0x00009493}, -   {0x00000000,0x00000000,0x00001249,0x00009493, -    0x0000a493,0x000124db,0x000126dc,0x00009493}, -   {0x00000000,0x00000000,0x0000924a,0x00009493, -    0x0000a493,0x000126dc,0x000126dc,0x0000a49b}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x0001249b,0x000126dc,0x000136e4,0x000124db}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x000126dc,0x000136e4,0x000136e4,0x000126dc}, -   {0x00000000,0x00000000,0x00009292,0x0000a49b, -    0x000126dc,0x000136e4,0x000136e4,0x000126dc}, -   {0x00000000,0x00000000,0x00009292,0x0000a49b, -    0x000126dc,0x0001b724,0x0001b725,0x000136e4}, -   {0x00000000,0x00000000,0x00009292,0x0000a49b, -    0x000136e4,0x0001b724,0x0001b92d,0x0001b724}, -   {0x00000000,0x00000000,0x00009492,0x0000a49b, -    0x000136e4,0x0001b724,0x0001b92d,0x0001b724}, -   {0x00000000,0x00000000,0x00009492,0x000124db, -    0x000136e4,0x0001b925,0x0001c96e,0x0001b925}, -   {0x00000000,0x00000000,0x00009492,0x000124db, -    0x0001b724,0x0001b925,0x0001c96e,0x0001c92d}, -   {0x00000000,0x00000000,0x0000a492,0x000126db, -    0x0001c924,0x0002496d,0x00025bb6,0x00024b77}, -   {0x00000000,0x00000000,0x00000000,0x00000000, -    0x00000000,0x00000000,0x00000000,0x00000000} -  }, -  { /* version 5, passes 1 */ -   {0x00000000,0x00000000,0x00001249,0x00000249, -    0x00000249,0x00000249,0x0000024a,0x0000024a}, -   {0x00000000,0x00000000,0x00001249,0x00001249, -    0x0000124a,0x0000124a,0x0000024a,0x0000024a}, -   {0x00000000,0x00000000,0x00001249,0x0000924a, -    0x00009252,0x00009252,0x0000024a,0x0000024a}, -   {0x00000000,0x00000000,0x00001249,0x00009292, -    0x00009492,0x0000a49b,0x00001252,0x00001252}, -   {0x00000000,0x00000000,0x0000924a,0x00009493, -    0x0000a493,0x0000a49b,0x00001252,0x00001252}, -   {0x00000000,0x00000000,0x0000924a,0x00009493, -    0x0000a493,0x0000a49b,0x00009292,0x00001252}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x0000a493,0x0000a49b,0x00009292,0x00009292}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x0000a493,0x0000a49b,0x00009493,0x00009292}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x0001249b,0x000124db,0x00009493,0x00009292}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x0001249b,0x000124db,0x00009493,0x00009493}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x000124db,0x000124db,0x0000a49b,0x00009493}, -   {0x00000000,0x00000000,0x0000924a,0x000124db, -    0x000126dc,0x000126dc,0x0000a49b,0x00009493}, -   {0x00000000,0x00000000,0x0000924a,0x000124db, -    0x000136e4,0x000126dc,0x000124db,0x0000a49b}, -   {0x00000000,0x00000000,0x00009292,0x000124db, -    0x000136e4,0x000126dc,0x000124db,0x0000a49b}, -   {0x00000000,0x00000000,0x00009492,0x000126db, -    0x0001b724,0x000136e4,0x000126dc,0x000124db}, -   {0x00000000,0x00000000,0x00000000,0x00000000, -    0x00000000,0x00000000,0x00000000,0x00000000} -  } - }, - { /* version 6 */ -  { /* version 6, passes 0 */ -   {0x00000000,0x00000000,0x00001249,0x00001249, -    0x00009252,0x00009292,0x00009493,0x00009493}, -   {0x00000000,0x00000000,0x00001249,0x00009292, -    0x0000a493,0x0000a49b,0x0000a49b,0x00009493}, -   {0x00000000,0x00000000,0x00001249,0x00009493, -    0x0000a493,0x000124db,0x000124db,0x0000a49b}, -   {0x00000000,0x00000000,0x0000924a,0x00009493, -    0x0000a493,0x000126dc,0x000126dc,0x0000a49b}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x0001249b,0x000126dc,0x000136e4,0x000124db}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x000126dc,0x000136e4,0x000136e4,0x000126dc}, -   {0x00000000,0x00000000,0x00009292,0x0000a49b, -    0x000126dc,0x0001b724,0x0001b725,0x000126dc}, -   {0x00000000,0x00000000,0x00009292,0x0000a49b, -    0x000136e4,0x0001b724,0x0001b92d,0x000136e4}, -   {0x00000000,0x00000000,0x00009492,0x0000a49b, -    0x000136e4,0x0001b724,0x0001b92d,0x0001b724}, -   {0x00000000,0x00000000,0x00009492,0x000124db, -    0x000136e4,0x0001b724,0x0001b92d,0x0001b724}, -   {0x00000000,0x00000000,0x00009492,0x000124db, -    0x000136e4,0x0001b925,0x0001b92d,0x0001b925}, -   {0x00000000,0x00000000,0x00009492,0x000124db, -    0x0001b724,0x0001b925,0x0001c96e,0x0001c92d}, -   {0x00000000,0x00000000,0x0000a492,0x000124db, -    0x0001b724,0x0001c92d,0x0001c96e,0x0001c92d}, -   {0x00000000,0x00000000,0x0000a492,0x000124db, -    0x0001b724,0x0001c92d,0x00024b76,0x0002496e}, -   {0x00000000,0x00000000,0x00012492,0x000126db, -    0x0001c924,0x00024b6d,0x0002ddb6,0x00025bbf}, -   {0x00000000,0x00000000,0x00000000,0x00000000, -    0x00000000,0x00000000,0x00000000,0x00000000} -  }, -  { /* version 6, passes 1 */ -   {0x00000000,0x00000000,0x00001249,0x00001249, -    0x0000124a,0x0000124a,0x00001252,0x00001252}, -   {0x00000000,0x00000000,0x00001249,0x00009292, -    0x00009492,0x00009252,0x00001252,0x00001252}, -   {0x00000000,0x00000000,0x0000924a,0x00009493, -    0x0000a493,0x00009292,0x00001252,0x00001252}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x0000a493,0x0000a49b,0x00009292,0x00009292}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x0000a493,0x0000a49b,0x00009292,0x00009292}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x0001249b,0x0000a49b,0x00009493,0x00009292}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x000124db,0x000124db,0x00009493,0x00009493}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x000124db,0x000124db,0x0000a49b,0x00009493}, -   {0x00000000,0x00000000,0x0000924a,0x000124db, -    0x000126dc,0x000124db,0x0000a49b,0x00009493}, -   {0x00000000,0x00000000,0x0000924a,0x000124db, -    0x000126dc,0x000126dc,0x0000a49b,0x0000a49b}, -   {0x00000000,0x00000000,0x0000924a,0x000124db, -    0x000136e4,0x000126dc,0x000124db,0x0000a49b}, -   {0x00000000,0x00000000,0x00009492,0x000126db, -    0x000136e4,0x000126dc,0x000124db,0x0000a49b}, -   {0x00000000,0x00000000,0x00009492,0x000126db, -    0x0001b724,0x000136e4,0x000126dc,0x000124db}, -   {0x00000000,0x00000000,0x00009492,0x000126db, -    0x0001b724,0x000136e4,0x000126dc,0x000124db}, -   {0x00000000,0x00000000,0x0000a492,0x000136db, -    0x0001c924,0x0001b724,0x000136e4,0x000126dc}, -   {0x00000000,0x00000000,0x00000000,0x00000000, -    0x00000000,0x00000000,0x00000000,0x00000000} -  } - }, - { /* version 7 */ -  { /* version 7, passes 0 */ -   {0x00000000,0x00000000,0x00001249,0x00001249, -    0x00009252,0x00009292,0x00009493,0x00009493}, -   {0x00000000,0x00000000,0x00001249,0x00009493, -    0x0000a493,0x000124db,0x000126dc,0x00009493}, -   {0x00000000,0x00000000,0x00001249,0x0000a49b, -    0x0001249b,0x000126dc,0x000126dc,0x0000a49b}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x0001249b,0x000126dc,0x000136e4,0x0000a49b}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x000126dc,0x000136e4,0x0001b725,0x000124db}, -   {0x00000000,0x00000000,0x00009292,0x0000a49b, -    0x000136e4,0x0001b724,0x0001b725,0x000126dc}, -   {0x00000000,0x00000000,0x00009292,0x000124db, -    0x000136e4,0x0001b724,0x0001b725,0x000126dc}, -   {0x00000000,0x00000000,0x00009492,0x000124db, -    0x000136e4,0x0001b724,0x0001c96e,0x000136e4}, -   {0x00000000,0x00000000,0x00009492,0x000124db, -    0x000136e4,0x0001c92d,0x0001c96e,0x0001b724}, -   {0x00000000,0x00000000,0x0000a492,0x000124db, -    0x000136e4,0x0001c92d,0x0001c96e,0x0001b724}, -   {0x00000000,0x00000000,0x0000a492,0x000124db, -    0x0001b724,0x0001c92d,0x0001c96e,0x0001b925}, -   {0x00000000,0x00000000,0x0000a492,0x000126db, -    0x0001b724,0x0001c92d,0x00024b76,0x0001c92d}, -   {0x00000000,0x00000000,0x0000a492,0x000126db, -    0x0001b924,0x0001c92d,0x00024b76,0x0001c92d}, -   {0x00000000,0x00000000,0x0000a492,0x000126db, -    0x0001b924,0x0001c92d,0x00024b76,0x0002496e}, -   {0x00000000,0x00000000,0x00012492,0x000136db, -    0x00024924,0x00024b6d,0x0002ddb6,0x00025bbf}, -   {0x00000000,0x00000000,0x00000000,0x00000000, -    0x00000000,0x00000000,0x00000000,0x00000000} -  }, -  { /* version 7, passes 1 */ -   {0x00000000,0x00000000,0x00001249,0x00001249, -    0x0000124a,0x0000124a,0x00001252,0x00001252}, -   {0x00000000,0x00000000,0x0000924a,0x00009493, -    0x00009492,0x00009292,0x00001252,0x00001252}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x0000a493,0x0000a49b,0x00001252,0x00001252}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x0000a493,0x0000a49b,0x00009292,0x00009292}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x0000a493,0x0000a49b,0x00009292,0x00009292}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x000126dc,0x0000a49b,0x00009493,0x00009292}, -   {0x00000000,0x00000000,0x0000924a,0x000124db, -    0x000126dc,0x000124db,0x00009493,0x00009493}, -   {0x00000000,0x00000000,0x0000924a,0x000124db, -    0x000136e4,0x000124db,0x0000a49b,0x00009493}, -   {0x00000000,0x00000000,0x0000924a,0x000136db, -    0x0001b724,0x000124db,0x0000a49b,0x00009493}, -   {0x00000000,0x00000000,0x0000924a,0x000136db, -    0x0001b724,0x000126dc,0x0000a49b,0x0000a49b}, -   {0x00000000,0x00000000,0x00009292,0x000136db, -    0x0001b724,0x000126dc,0x000124db,0x0000a49b}, -   {0x00000000,0x00000000,0x00009492,0x000136db, -    0x0001b724,0x000126dc,0x000124db,0x0000a49b}, -   {0x00000000,0x00000000,0x0000a492,0x000136db, -    0x0001b724,0x000136e4,0x000126dc,0x000124db}, -   {0x00000000,0x00000000,0x0000a492,0x000136db, -    0x0001b724,0x000136e4,0x000126dc,0x000124db}, -   {0x00000000,0x00000000,0x00012492,0x0001b6db, -    0x0001c924,0x0001b724,0x000136e4,0x000126dc}, -   {0x00000000,0x00000000,0x00000000,0x00000000, -    0x00000000,0x00000000,0x00000000,0x00000000} -  } - } -}; - diff --git a/drivers/media/video/pwc/pwc-kiara.h b/drivers/media/video/pwc/pwc-kiara.h deleted file mode 100644 index 047dad8c15f..00000000000 --- a/drivers/media/video/pwc/pwc-kiara.h +++ /dev/null @@ -1,48 +0,0 @@ -/* Linux driver for Philips webcam -   (C) 2004-2006 Luc Saillard (luc@saillard.org) - -   NOTE: this version of pwc is an unofficial (modified) release of pwc & pcwx -   driver and thus may have bugs that are not present in the original version. -   Please send bug reports and support requests to <luc@saillard.org>. -   The decompression routines have been implemented by reverse-engineering the -   Nemosoft binary pwcx module. Caveat emptor. - -   This program is free software; you can redistribute it and/or modify -   it under the terms of the GNU General Public License as published by -   the Free Software Foundation; either version 2 of the License, or -   (at your option) any later version. - -   This program is distributed in the hope that it will be useful, -   but WITHOUT ANY WARRANTY; without even the implied warranty of -   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the -   GNU General Public License for more details. - -   You should have received a copy of the GNU General Public License -   along with this program; if not, write to the Free Software -   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA -*/ - -/* Entries for the Kiara (730/740/750) camera */ - -#ifndef PWC_KIARA_H -#define PWC_KIARA_H - -#include <media/pwc-ioctl.h> - -#define PWC_FPS_MAX_KIARA 6 - -struct Kiara_table_entry -{ -	char alternate;			/* USB alternate interface */ -	unsigned short packetsize;	/* Normal packet size */ -	unsigned short bandlength;	/* Bandlength when decompressing */ -	unsigned char mode[12];		/* precomputed mode settings for cam */ -}; - -extern const struct Kiara_table_entry Kiara_table[PSZ_MAX][PWC_FPS_MAX_KIARA][4]; -extern const unsigned int KiaraRomTable[8][2][16][8]; -extern const unsigned int Kiara_fps_vector[PWC_FPS_MAX_KIARA]; - -#endif - - diff --git a/drivers/media/video/pwc/pwc-misc.c b/drivers/media/video/pwc/pwc-misc.c deleted file mode 100644 index 6af5bb53835..00000000000 --- a/drivers/media/video/pwc/pwc-misc.c +++ /dev/null @@ -1,133 +0,0 @@ -/* Linux driver for Philips webcam -   Various miscellaneous functions and tables. -   (C) 1999-2003 Nemosoft Unv. -   (C) 2004-2006 Luc Saillard (luc@saillard.org) - -   NOTE: this version of pwc is an unofficial (modified) release of pwc & pcwx -   driver and thus may have bugs that are not present in the original version. -   Please send bug reports and support requests to <luc@saillard.org>. -   The decompression routines have been implemented by reverse-engineering the -   Nemosoft binary pwcx module. Caveat emptor. - -   This program is free software; you can redistribute it and/or modify -   it under the terms of the GNU General Public License as published by -   the Free Software Foundation; either version 2 of the License, or -   (at your option) any later version. - -   This program is distributed in the hope that it will be useful, -   but WITHOUT ANY WARRANTY; without even the implied warranty of -   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the -   GNU General Public License for more details. - -   You should have received a copy of the GNU General Public License -   along with this program; if not, write to the Free Software -   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA -*/ - - -#include "pwc.h" - -const struct pwc_coord pwc_image_sizes[PSZ_MAX] = -{ -	{ 128,  96, 0 }, /* sqcif */ -	{ 160, 120, 0 }, /* qsif */ -	{ 176, 144, 0 }, /* qcif */ -	{ 320, 240, 0 }, /* sif */ -	{ 352, 288, 0 }, /* cif */ -	{ 640, 480, 0 }, /* vga */ -}; - -/* x,y -> PSZ_ */ -int pwc_decode_size(struct pwc_device *pdev, int width, int height) -{ -	int i, find; - -	/* Make sure we don't go beyond our max size. -	   NB: we have different limits for RAW and normal modes. In case -	   you don't have the decompressor loaded or use RAW mode, -	   the maximum viewable size is smaller. -	*/ -	if (pdev->pixfmt != V4L2_PIX_FMT_YUV420) -	{ -		if (width > pdev->abs_max.x || height > pdev->abs_max.y) -		{ -			PWC_DEBUG_SIZE("VIDEO_PALETTE_RAW: going beyond abs_max.\n"); -			return -1; -		} -	} -	else -	{ -		if (width > pdev->view_max.x || height > pdev->view_max.y) -		{ -			PWC_DEBUG_SIZE("VIDEO_PALETTE_not RAW: going beyond view_max.\n"); -			return -1; -		} -	} - -	/* Find the largest size supported by the camera that fits into the -	   requested size. -	 */ -	find = -1; -	for (i = 0; i < PSZ_MAX; i++) { -		if (pdev->image_mask & (1 << i)) { -			if (pwc_image_sizes[i].x <= width && pwc_image_sizes[i].y <= height) -				find = i; -		} -	} -	return find; -} - -/* initialize variables depending on type and decompressor*/ -void pwc_construct(struct pwc_device *pdev) -{ -	if (DEVICE_USE_CODEC1(pdev->type)) { - -		pdev->view_min.x = 128; -		pdev->view_min.y =  96; -		pdev->view_max.x = 352; -		pdev->view_max.y = 288; -		pdev->abs_max.x  = 352; -		pdev->abs_max.y  = 288; -		pdev->image_mask = 1 << PSZ_SQCIF | 1 << PSZ_QCIF | 1 << PSZ_CIF; -		pdev->vcinterface = 2; -		pdev->vendpoint = 4; -		pdev->frame_header_size = 0; -		pdev->frame_trailer_size = 0; - -	} else if (DEVICE_USE_CODEC3(pdev->type)) { - -		pdev->view_min.x = 160; -		pdev->view_min.y = 120; -		pdev->view_max.x = 640; -		pdev->view_max.y = 480; -		pdev->image_mask = 1 << PSZ_QSIF | 1 << PSZ_SIF | 1 << PSZ_VGA; -		pdev->abs_max.x = 640; -		pdev->abs_max.y = 480; -		pdev->vcinterface = 3; -		pdev->vendpoint = 5; -		pdev->frame_header_size = TOUCAM_HEADER_SIZE; -		pdev->frame_trailer_size = TOUCAM_TRAILER_SIZE; - -	} else /* if (DEVICE_USE_CODEC2(pdev->type)) */ { - -		pdev->view_min.x = 128; -		pdev->view_min.y =  96; -		/* Anthill bug #38: PWC always reports max size, even without PWCX */ -		pdev->view_max.x = 640; -		pdev->view_max.y = 480; -		pdev->image_mask = 1 << PSZ_SQCIF | 1 << PSZ_QSIF | 1 << PSZ_QCIF | 1 << PSZ_SIF | 1 << PSZ_CIF | 1 << PSZ_VGA; -		pdev->abs_max.x = 640; -		pdev->abs_max.y = 480; -		pdev->vcinterface = 3; -		pdev->vendpoint = 4; -		pdev->frame_header_size = 0; -		pdev->frame_trailer_size = 0; -	} -	pdev->pixfmt = V4L2_PIX_FMT_YUV420; /* default */ -	pdev->view_min.size = pdev->view_min.x * pdev->view_min.y; -	pdev->view_max.size = pdev->view_max.x * pdev->view_max.y; -	/* length of image, in YUV format; always allocate enough memory. */ -	pdev->len_per_image = PAGE_ALIGN((pdev->abs_max.x * pdev->abs_max.y * 3) / 2); -} - - diff --git a/drivers/media/video/pwc/pwc-nala.h b/drivers/media/video/pwc/pwc-nala.h deleted file mode 100644 index 168c73ef75d..00000000000 --- a/drivers/media/video/pwc/pwc-nala.h +++ /dev/null @@ -1,66 +0,0 @@ -   /* SQCIF */ -   { -      {0, 0, {0x04, 0x01, 0x03}}, -      {8, 0, {0x05, 0x01, 0x03}}, -      {7, 0, {0x08, 0x01, 0x03}}, -      {7, 0, {0x0A, 0x01, 0x03}}, -      {6, 0, {0x0C, 0x01, 0x03}}, -      {5, 0, {0x0F, 0x01, 0x03}}, -      {4, 0, {0x14, 0x01, 0x03}}, -      {3, 0, {0x18, 0x01, 0x03}}, -   }, -   /* QSIF */ -   { -      {0}, -      {0}, -      {0}, -      {0}, -      {0}, -      {0}, -      {0}, -      {0}, -   }, -   /* QCIF */ -   { -      {0, 0, {0x04, 0x01, 0x02}}, -      {8, 0, {0x05, 0x01, 0x02}}, -      {7, 0, {0x08, 0x01, 0x02}}, -      {6, 0, {0x0A, 0x01, 0x02}}, -      {5, 0, {0x0C, 0x01, 0x02}}, -      {4, 0, {0x0F, 0x01, 0x02}}, -      {1, 0, {0x14, 0x01, 0x02}}, -      {1, 0, {0x18, 0x01, 0x02}}, -   }, -   /* SIF */ -   { -      {0}, -      {0}, -      {0}, -      {0}, -      {0}, -      {0}, -      {0}, -      {0}, -   }, -   /* CIF */ -   { -      {4, 0, {0x04, 0x01, 0x01}}, -      {7, 1, {0x05, 0x03, 0x01}}, -      {6, 1, {0x08, 0x03, 0x01}}, -      {4, 1, {0x0A, 0x03, 0x01}}, -      {3, 1, {0x0C, 0x03, 0x01}}, -      {2, 1, {0x0F, 0x03, 0x01}}, -      {0}, -      {0}, -   }, -   /* VGA */ -   { -      {0}, -      {0}, -      {0}, -      {0}, -      {0}, -      {0}, -      {0}, -      {0}, -   }, diff --git a/drivers/media/video/pwc/pwc-timon.c b/drivers/media/video/pwc/pwc-timon.c deleted file mode 100644 index c56c174b161..00000000000 --- a/drivers/media/video/pwc/pwc-timon.c +++ /dev/null @@ -1,1448 +0,0 @@ -/* Linux driver for Philips webcam -   (C) 2004-2006 Luc Saillard (luc@saillard.org) - -   NOTE: this version of pwc is an unofficial (modified) release of pwc & pcwx -   driver and thus may have bugs that are not present in the original version. -   Please send bug reports and support requests to <luc@saillard.org>. -   The decompression routines have been implemented by reverse-engineering the -   Nemosoft binary pwcx module. Caveat emptor. - -   This program is free software; you can redistribute it and/or modify -   it under the terms of the GNU General Public License as published by -   the Free Software Foundation; either version 2 of the License, or -   (at your option) any later version. - -   This program is distributed in the hope that it will be useful, -   but WITHOUT ANY WARRANTY; without even the implied warranty of -   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the -   GNU General Public License for more details. - -   You should have received a copy of the GNU General Public License -   along with this program; if not, write to the Free Software -   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA -*/ - - -/* This tables contains entries for the 675/680/690 (Timon) camera, with -   4 different qualities (no compression, low, medium, high). -   It lists the bandwidth requirements for said mode by its alternate interface -   number. An alternate of 0 means that the mode is unavailable. - -   There are 6 * 4 * 4 entries: -     6 different resolutions subqcif, qsif, qcif, sif, cif, vga -     6 framerates: 5, 10, 15, 20, 25, 30 -     4 compression modi: none, low, medium, high - -   When an uncompressed mode is not available, the next available compressed mode -   will be chosen (unless the decompressor is absent). Sometimes there are only -   1 or 2 compressed modes available; in that case entries are duplicated. -*/ - -#include "pwc-timon.h" - -const unsigned int Timon_fps_vector[PWC_FPS_MAX_TIMON] = { 5, 10, 15, 20, 25, 30 }; - -const struct Timon_table_entry Timon_table[PSZ_MAX][PWC_FPS_MAX_TIMON][4] = -{ -   /* SQCIF */ -   { -      /* 5 fps */ -      { -	 {1, 140,    0, {0x05, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x8C, 0xFC, 0x80, 0x02}}, -	 {1, 140,    0, {0x05, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x8C, 0xFC, 0x80, 0x02}}, -	 {1, 140,    0, {0x05, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x8C, 0xFC, 0x80, 0x02}}, -	 {1, 140,    0, {0x05, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x8C, 0xFC, 0x80, 0x02}}, -      }, -      /* 10 fps */ -      { -	 {2, 280,    0, {0x04, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x18, 0xA9, 0x80, 0x02}}, -	 {2, 280,    0, {0x04, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x18, 0xA9, 0x80, 0x02}}, -	 {2, 280,    0, {0x04, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x18, 0xA9, 0x80, 0x02}}, -	 {2, 280,    0, {0x04, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x18, 0xA9, 0x80, 0x02}}, -      }, -      /* 15 fps */ -      { -	 {3, 410,    0, {0x03, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x9A, 0x71, 0x80, 0x02}}, -	 {3, 410,    0, {0x03, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x9A, 0x71, 0x80, 0x02}}, -	 {3, 410,    0, {0x03, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x9A, 0x71, 0x80, 0x02}}, -	 {3, 410,    0, {0x03, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x9A, 0x71, 0x80, 0x02}}, -      }, -      /* 20 fps */ -      { -	 {4, 559,    0, {0x02, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x2F, 0x56, 0x80, 0x02}}, -	 {4, 559,    0, {0x02, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x2F, 0x56, 0x80, 0x02}}, -	 {4, 559,    0, {0x02, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x2F, 0x56, 0x80, 0x02}}, -	 {4, 559,    0, {0x02, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x2F, 0x56, 0x80, 0x02}}, -      }, -      /* 25 fps */ -      { -	 {5, 659,    0, {0x01, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x93, 0x46, 0x80, 0x02}}, -	 {5, 659,    0, {0x01, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x93, 0x46, 0x80, 0x02}}, -	 {5, 659,    0, {0x01, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x93, 0x46, 0x80, 0x02}}, -	 {5, 659,    0, {0x01, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x93, 0x46, 0x80, 0x02}}, -      }, -      /* 30 fps */ -      { -	 {7, 838,    0, {0x00, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x46, 0x3B, 0x80, 0x02}}, -	 {7, 838,    0, {0x00, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x46, 0x3B, 0x80, 0x02}}, -	 {7, 838,    0, {0x00, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x46, 0x3B, 0x80, 0x02}}, -	 {7, 838,    0, {0x00, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x46, 0x3B, 0x80, 0x02}}, -      }, -   }, -   /* QSIF */ -   { -      /* 5 fps */ -      { -	 {1, 146,    0, {0x2D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0xFC, 0xC0, 0x02}}, -	 {1, 146,    0, {0x2D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0xFC, 0xC0, 0x02}}, -	 {1, 146,    0, {0x2D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0xFC, 0xC0, 0x02}}, -	 {1, 146,    0, {0x2D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0xFC, 0xC0, 0x02}}, -      }, -      /* 10 fps */ -      { -	 {2, 291,    0, {0x2C, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x23, 0xA1, 0xC0, 0x02}}, -	 {1, 191,  630, {0x2C, 0xF4, 0x05, 0x13, 0xA9, 0x12, 0xE1, 0x17, 0x08, 0xBF, 0xF4, 0xC0, 0x02}}, -	 {1, 191,  630, {0x2C, 0xF4, 0x05, 0x13, 0xA9, 0x12, 0xE1, 0x17, 0x08, 0xBF, 0xF4, 0xC0, 0x02}}, -	 {1, 191,  630, {0x2C, 0xF4, 0x05, 0x13, 0xA9, 0x12, 0xE1, 0x17, 0x08, 0xBF, 0xF4, 0xC0, 0x02}}, -      }, -      /* 15 fps */ -      { -	 {3, 437,    0, {0x2B, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0xB5, 0x6D, 0xC0, 0x02}}, -	 {2, 291,  640, {0x2B, 0xF4, 0x05, 0x13, 0xF7, 0x13, 0x2F, 0x13, 0x08, 0x23, 0xA1, 0xC0, 0x02}}, -	 {2, 291,  640, {0x2B, 0xF4, 0x05, 0x13, 0xF7, 0x13, 0x2F, 0x13, 0x08, 0x23, 0xA1, 0xC0, 0x02}}, -	 {1, 191,  420, {0x2B, 0xF4, 0x0D, 0x0D, 0x1B, 0x0C, 0x53, 0x1E, 0x08, 0xBF, 0xF4, 0xC0, 0x02}}, -      }, -      /* 20 fps */ -      { -	 {4, 588,    0, {0x2A, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x4C, 0x52, 0xC0, 0x02}}, -	 {3, 447,  730, {0x2A, 0xF4, 0x05, 0x16, 0xC9, 0x16, 0x01, 0x0E, 0x18, 0xBF, 0x69, 0xC0, 0x02}}, -	 {2, 292,  476, {0x2A, 0xF4, 0x0D, 0x0E, 0xD8, 0x0E, 0x10, 0x19, 0x18, 0x24, 0xA1, 0xC0, 0x02}}, -	 {1, 192,  312, {0x2A, 0xF4, 0x1D, 0x09, 0xB3, 0x08, 0xEB, 0x1E, 0x18, 0xC0, 0xF4, 0xC0, 0x02}}, -      }, -      /* 25 fps */ -      { -	 {5, 703,    0, {0x29, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0xBF, 0x42, 0xC0, 0x02}}, -	 {3, 447,  610, {0x29, 0xF4, 0x05, 0x13, 0x0B, 0x12, 0x43, 0x14, 0x18, 0xBF, 0x69, 0xC0, 0x02}}, -	 {2, 292,  398, {0x29, 0xF4, 0x0D, 0x0C, 0x6C, 0x0B, 0xA4, 0x1E, 0x18, 0x24, 0xA1, 0xC0, 0x02}}, -	 {1, 192,  262, {0x29, 0xF4, 0x25, 0x08, 0x23, 0x07, 0x5B, 0x1E, 0x18, 0xC0, 0xF4, 0xC0, 0x02}}, -      }, -      /* 30 fps */ -      { -	 {8, 873,    0, {0x28, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x69, 0x37, 0xC0, 0x02}}, -	 {5, 704,  774, {0x28, 0xF4, 0x05, 0x18, 0x21, 0x17, 0x59, 0x0F, 0x18, 0xC0, 0x42, 0xC0, 0x02}}, -	 {3, 448,  492, {0x28, 0xF4, 0x05, 0x0F, 0x5D, 0x0E, 0x95, 0x15, 0x18, 0xC0, 0x69, 0xC0, 0x02}}, -	 {2, 291,  320, {0x28, 0xF4, 0x1D, 0x09, 0xFB, 0x09, 0x33, 0x1E, 0x18, 0x23, 0xA1, 0xC0, 0x02}}, -      }, -   }, -   /* QCIF */ -   { -      /* 5 fps */ -      { -	 {1, 193,    0, {0x0D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0xC1, 0xF4, 0xC0, 0x02}}, -	 {1, 193,    0, {0x0D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0xC1, 0xF4, 0xC0, 0x02}}, -	 {1, 193,    0, {0x0D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0xC1, 0xF4, 0xC0, 0x02}}, -	 {1, 193,    0, {0x0D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0xC1, 0xF4, 0xC0, 0x02}}, -      }, -      /* 10 fps */ -      { -	 {3, 385,    0, {0x0C, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x81, 0x79, 0xC0, 0x02}}, -	 {2, 291,  800, {0x0C, 0xF4, 0x05, 0x18, 0xF4, 0x18, 0x18, 0x11, 0x08, 0x23, 0xA1, 0xC0, 0x02}}, -	 {2, 291,  800, {0x0C, 0xF4, 0x05, 0x18, 0xF4, 0x18, 0x18, 0x11, 0x08, 0x23, 0xA1, 0xC0, 0x02}}, -	 {1, 194,  532, {0x0C, 0xF4, 0x05, 0x10, 0x9A, 0x0F, 0xBE, 0x1B, 0x08, 0xC2, 0xF0, 0xC0, 0x02}}, -      }, -      /* 15 fps */ -      { -	 {4, 577,    0, {0x0B, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x41, 0x52, 0xC0, 0x02}}, -	 {3, 447,  818, {0x0B, 0xF4, 0x05, 0x19, 0x89, 0x18, 0xAD, 0x0F, 0x10, 0xBF, 0x69, 0xC0, 0x02}}, -	 {2, 292,  534, {0x0B, 0xF4, 0x05, 0x10, 0xA3, 0x0F, 0xC7, 0x19, 0x10, 0x24, 0xA1, 0xC0, 0x02}}, -	 {1, 195,  356, {0x0B, 0xF4, 0x15, 0x0B, 0x11, 0x0A, 0x35, 0x1E, 0x10, 0xC3, 0xF0, 0xC0, 0x02}}, -      }, -      /* 20 fps */ -      { -	 {6, 776,    0, {0x0A, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x08, 0x3F, 0xC0, 0x02}}, -	 {4, 591,  804, {0x0A, 0xF4, 0x05, 0x19, 0x1E, 0x18, 0x42, 0x0F, 0x18, 0x4F, 0x4E, 0xC0, 0x02}}, -	 {3, 447,  608, {0x0A, 0xF4, 0x05, 0x12, 0xFD, 0x12, 0x21, 0x15, 0x18, 0xBF, 0x69, 0xC0, 0x02}}, -	 {2, 291,  396, {0x0A, 0xF4, 0x15, 0x0C, 0x5E, 0x0B, 0x82, 0x1E, 0x18, 0x23, 0xA1, 0xC0, 0x02}}, -      }, -      /* 25 fps */ -      { -	 {9, 928,    0, {0x09, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0xA0, 0x33, 0xC0, 0x02}}, -	 {5, 703,  800, {0x09, 0xF4, 0x05, 0x18, 0xF4, 0x18, 0x18, 0x10, 0x18, 0xBF, 0x42, 0xC0, 0x02}}, -	 {3, 447,  508, {0x09, 0xF4, 0x0D, 0x0F, 0xD2, 0x0E, 0xF6, 0x1B, 0x18, 0xBF, 0x69, 0xC0, 0x02}}, -	 {2, 292,  332, {0x09, 0xF4, 0x1D, 0x0A, 0x5A, 0x09, 0x7E, 0x1E, 0x18, 0x24, 0xA1, 0xC0, 0x02}}, -      }, -      /* 30 fps */ -      { -	 {0, }, -	 {9, 956,  876, {0x08, 0xF4, 0x05, 0x1B, 0x58, 0x1A, 0x7C, 0x0E, 0x20, 0xBC, 0x33, 0x10, 0x02}}, -	 {4, 592,  542, {0x08, 0xF4, 0x05, 0x10, 0xE4, 0x10, 0x08, 0x17, 0x20, 0x50, 0x4E, 0x10, 0x02}}, -	 {2, 291,  266, {0x08, 0xF4, 0x25, 0x08, 0x48, 0x07, 0x6C, 0x1E, 0x20, 0x23, 0xA1, 0x10, 0x02}}, -      }, -   }, -   /* SIF */ -   { -      /* 5 fps */ -      { -	 {4, 582,    0, {0x35, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x46, 0x52, 0x60, 0x02}}, -	 {3, 387, 1276, {0x35, 0xF4, 0x05, 0x27, 0xD8, 0x26, 0x48, 0x03, 0x10, 0x83, 0x79, 0x60, 0x02}}, -	 {2, 291,  960, {0x35, 0xF4, 0x0D, 0x1D, 0xF2, 0x1C, 0x62, 0x04, 0x10, 0x23, 0xA1, 0x60, 0x02}}, -	 {1, 191,  630, {0x35, 0xF4, 0x1D, 0x13, 0xA9, 0x12, 0x19, 0x05, 0x08, 0xBF, 0xF4, 0x60, 0x02}}, -      }, -      /* 10 fps */ -      { -	 {0, }, -	 {6, 775, 1278, {0x34, 0xF4, 0x05, 0x27, 0xE8, 0x26, 0x58, 0x05, 0x30, 0x07, 0x3F, 0x10, 0x02}}, -	 {3, 447,  736, {0x34, 0xF4, 0x15, 0x16, 0xFB, 0x15, 0x6B, 0x05, 0x18, 0xBF, 0x69, 0x10, 0x02}}, -	 {2, 291,  480, {0x34, 0xF4, 0x2D, 0x0E, 0xF9, 0x0D, 0x69, 0x09, 0x18, 0x23, 0xA1, 0x10, 0x02}}, -      }, -      /* 15 fps */ -      { -	 {0, }, -	 {9, 955, 1050, {0x33, 0xF4, 0x05, 0x20, 0xCF, 0x1F, 0x3F, 0x06, 0x48, 0xBB, 0x33, 0x10, 0x02}}, -	 {4, 591,  650, {0x33, 0xF4, 0x15, 0x14, 0x44, 0x12, 0xB4, 0x08, 0x30, 0x4F, 0x4E, 0x10, 0x02}}, -	 {3, 448,  492, {0x33, 0xF4, 0x25, 0x0F, 0x52, 0x0D, 0xC2, 0x09, 0x28, 0xC0, 0x69, 0x10, 0x02}}, -      }, -      /* 20 fps */ -      { -	 {0, }, -	 {9, 958,  782, {0x32, 0xF4, 0x0D, 0x18, 0x6A, 0x16, 0xDA, 0x0B, 0x58, 0xBE, 0x33, 0xD0, 0x02}}, -	 {5, 703,  574, {0x32, 0xF4, 0x1D, 0x11, 0xE7, 0x10, 0x57, 0x0B, 0x40, 0xBF, 0x42, 0xD0, 0x02}}, -	 {3, 446,  364, {0x32, 0xF4, 0x3D, 0x0B, 0x5C, 0x09, 0xCC, 0x0E, 0x30, 0xBE, 0x69, 0xD0, 0x02}}, -      }, -      /* 25 fps */ -      { -	 {0, }, -	 {9, 958,  654, {0x31, 0xF4, 0x15, 0x14, 0x66, 0x12, 0xD6, 0x0B, 0x50, 0xBE, 0x33, 0x90, 0x02}}, -	 {6, 776,  530, {0x31, 0xF4, 0x25, 0x10, 0x8C, 0x0E, 0xFC, 0x0C, 0x48, 0x08, 0x3F, 0x90, 0x02}}, -	 {4, 592,  404, {0x31, 0xF4, 0x35, 0x0C, 0x96, 0x0B, 0x06, 0x0B, 0x38, 0x50, 0x4E, 0x90, 0x02}}, -      }, -      /* 30 fps */ -      { -	 {0, }, -	 {9, 957,  526, {0x30, 0xF4, 0x25, 0x10, 0x68, 0x0E, 0xD8, 0x0D, 0x58, 0xBD, 0x33, 0x60, 0x02}}, -	 {6, 775,  426, {0x30, 0xF4, 0x35, 0x0D, 0x48, 0x0B, 0xB8, 0x0F, 0x50, 0x07, 0x3F, 0x60, 0x02}}, -	 {4, 590,  324, {0x30, 0x7A, 0x4B, 0x0A, 0x1C, 0x08, 0xB4, 0x0E, 0x40, 0x4E, 0x52, 0x60, 0x02}}, -      }, -   }, -   /* CIF */ -   { -      /* 5 fps */ -      { -	 {6, 771,    0, {0x15, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x3F, 0x80, 0x02}}, -	 {4, 465, 1278, {0x15, 0xF4, 0x05, 0x27, 0xEE, 0x26, 0x36, 0x03, 0x18, 0xD1, 0x65, 0x80, 0x02}}, -	 {2, 291,  800, {0x15, 0xF4, 0x15, 0x18, 0xF4, 0x17, 0x3C, 0x05, 0x18, 0x23, 0xA1, 0x80, 0x02}}, -	 {1, 193,  528, {0x15, 0xF4, 0x2D, 0x10, 0x7E, 0x0E, 0xC6, 0x0A, 0x18, 0xC1, 0xF4, 0x80, 0x02}}, -      }, -      /* 10 fps */ -      { -	 {0, }, -	 {9, 932, 1278, {0x14, 0xF4, 0x05, 0x27, 0xEE, 0x26, 0x36, 0x04, 0x30, 0xA4, 0x33, 0x10, 0x02}}, -	 {4, 591,  812, {0x14, 0xF4, 0x15, 0x19, 0x56, 0x17, 0x9E, 0x06, 0x28, 0x4F, 0x4E, 0x10, 0x02}}, -	 {2, 291,  400, {0x14, 0xF4, 0x3D, 0x0C, 0x7A, 0x0A, 0xC2, 0x0E, 0x28, 0x23, 0xA1, 0x10, 0x02}}, -      }, -      /* 15 fps */ -      { -	 {0, }, -	 {9, 956,  876, {0x13, 0xF4, 0x0D, 0x1B, 0x58, 0x19, 0xA0, 0x05, 0x38, 0xBC, 0x33, 0x60, 0x02}}, -	 {5, 703,  644, {0x13, 0xF4, 0x1D, 0x14, 0x1C, 0x12, 0x64, 0x08, 0x38, 0xBF, 0x42, 0x60, 0x02}}, -	 {3, 448,  410, {0x13, 0xF4, 0x3D, 0x0C, 0xC4, 0x0B, 0x0C, 0x0E, 0x38, 0xC0, 0x69, 0x60, 0x02}}, -      }, -      /* 20 fps */ -      { -	 {0, }, -	 {9, 956,  650, {0x12, 0xF4, 0x1D, 0x14, 0x4A, 0x12, 0x92, 0x09, 0x48, 0xBC, 0x33, 0x10, 0x03}}, -	 {6, 776,  528, {0x12, 0xF4, 0x2D, 0x10, 0x7E, 0x0E, 0xC6, 0x0A, 0x40, 0x08, 0x3F, 0x10, 0x03}}, -	 {4, 591,  402, {0x12, 0xF4, 0x3D, 0x0C, 0x8F, 0x0A, 0xD7, 0x0E, 0x40, 0x4F, 0x4E, 0x10, 0x03}}, -      }, -      /* 25 fps */ -      { -	 {0, }, -	 {9, 956,  544, {0x11, 0xF4, 0x25, 0x10, 0xF4, 0x0F, 0x3C, 0x0A, 0x48, 0xBC, 0x33, 0xC0, 0x02}}, -	 {7, 840,  478, {0x11, 0xF4, 0x2D, 0x0E, 0xEB, 0x0D, 0x33, 0x0B, 0x48, 0x48, 0x3B, 0xC0, 0x02}}, -	 {5, 703,  400, {0x11, 0xF4, 0x3D, 0x0C, 0x7A, 0x0A, 0xC2, 0x0E, 0x48, 0xBF, 0x42, 0xC0, 0x02}}, -      }, -      /* 30 fps */ -      { -	 {0, }, -	 {9, 956,  438, {0x10, 0xF4, 0x35, 0x0D, 0xAC, 0x0B, 0xF4, 0x0D, 0x50, 0xBC, 0x33, 0x10, 0x02}}, -	 {7, 838,  384, {0x10, 0xF4, 0x45, 0x0B, 0xFD, 0x0A, 0x45, 0x0F, 0x50, 0x46, 0x3B, 0x10, 0x02}}, -	 {6, 773,  354, {0x10, 0x7A, 0x4B, 0x0B, 0x0C, 0x09, 0x80, 0x10, 0x50, 0x05, 0x3F, 0x10, 0x02}}, -      }, -   }, -   /* VGA */ -   { -      /* 5 fps */ -      { -	 {0, }, -	 {6, 773, 1272, {0x1D, 0xF4, 0x15, 0x27, 0xB6, 0x24, 0x96, 0x02, 0x30, 0x05, 0x3F, 0x10, 0x02}}, -	 {4, 592,  976, {0x1D, 0xF4, 0x25, 0x1E, 0x78, 0x1B, 0x58, 0x03, 0x30, 0x50, 0x4E, 0x10, 0x02}}, -	 {3, 448,  738, {0x1D, 0xF4, 0x3D, 0x17, 0x0C, 0x13, 0xEC, 0x04, 0x30, 0xC0, 0x69, 0x10, 0x02}}, -      }, -      /* 10 fps */ -      { -	 {0, }, -	 {9, 956,  788, {0x1C, 0xF4, 0x35, 0x18, 0x9C, 0x15, 0x7C, 0x03, 0x48, 0xBC, 0x33, 0x10, 0x02}}, -	 {6, 776,  640, {0x1C, 0x7A, 0x53, 0x13, 0xFC, 0x11, 0x2C, 0x04, 0x48, 0x08, 0x3F, 0x10, 0x02}}, -	 {4, 592,  488, {0x1C, 0x7A, 0x6B, 0x0F, 0x3C, 0x0C, 0x6C, 0x06, 0x48, 0x50, 0x4E, 0x10, 0x02}}, -      }, -      /* 15 fps */ -      { -	 {0, }, -	 {9, 957,  526, {0x1B, 0x7A, 0x63, 0x10, 0x68, 0x0D, 0x98, 0x06, 0x58, 0xBD, 0x33, 0x80, 0x02}}, -	 {9, 957,  526, {0x1B, 0x7A, 0x63, 0x10, 0x68, 0x0D, 0x98, 0x06, 0x58, 0xBD, 0x33, 0x80, 0x02}}, -	 {8, 895,  492, {0x1B, 0x7A, 0x6B, 0x0F, 0x5D, 0x0C, 0x8D, 0x06, 0x58, 0x7F, 0x37, 0x80, 0x02}}, -      }, -      /* 20 fps */ -      { -	 {0, }, -	 {0, }, -	 {0, }, -	 {0, }, -      }, -      /* 25 fps */ -      { -	 {0, }, -	 {0, }, -	 {0, }, -	 {0, }, -      }, -      /* 30 fps */ -      { -	 {0, }, -	 {0, }, -	 {0, }, -	 {0, }, -      }, -   }, -}; - -/* - * 16 versions: - *   2 tables  (one for Y, and one for U&V) - *   16 levels of details per tables - *   8 blocs - */ - -const unsigned int TimonRomTable [16][2][16][8] = -{ - { /* version 0 */ -  { /* version 0, passes 0 */ -   {0x00000000,0x00000000,0x00000000,0x00000000, -    0x00000000,0x00000000,0x00000000,0x00000001}, -   {0x00000000,0x00000000,0x00000001,0x00000001, -    0x00000001,0x00000001,0x00000001,0x00000001}, -   {0x00000000,0x00000000,0x00000001,0x00000001, -    0x00000001,0x00000009,0x00000009,0x00000009}, -   {0x00000000,0x00000000,0x00000009,0x00000001, -    0x00000009,0x00000009,0x00000009,0x00000009}, -   {0x00000000,0x00000000,0x00000009,0x00000009, -    0x00000009,0x00000009,0x00000049,0x00000009}, -   {0x00000000,0x00000000,0x00000009,0x00000009, -    0x00000009,0x00000049,0x00000049,0x00000049}, -   {0x00000000,0x00000000,0x00000009,0x00000009, -    0x00000049,0x00000049,0x00000049,0x00000049}, -   {0x00000000,0x00000000,0x00000009,0x00000049, -    0x00000049,0x00000049,0x00000049,0x00000049}, -   {0x00000000,0x00000000,0x00000049,0x00000049, -    0x00000049,0x00000049,0x0000024a,0x0000024a}, -   {0x00000000,0x00000000,0x00000049,0x00000049, -    0x00000049,0x00000249,0x0000024a,0x0000024a}, -   {0x00000000,0x00000000,0x00000049,0x00000049, -    0x00000249,0x00000249,0x0000024a,0x0000024a}, -   {0x00000000,0x00000000,0x00000049,0x00000049, -    0x00000249,0x00000249,0x00001252,0x0000024a}, -   {0x00000000,0x00000000,0x00000049,0x00000049, -    0x00000249,0x0000124a,0x00001252,0x0000024a}, -   {0x00000000,0x00000000,0x00000049,0x00000249, -    0x00000249,0x0000124a,0x00001252,0x0000024a}, -   {0x00000000,0x00000000,0x00000249,0x00001249, -    0x0000124a,0x00009252,0x00009292,0x00001252}, -   {0x00000000,0x00000000,0x00000000,0x00000000, -    0x00000000,0x00000000,0x00000000,0x00000000} -  }, -  { /* version 0, passes 1 */ -   {0x00000000,0x00000000,0x00000000,0x00000000, -    0x00000000,0x00000000,0x00000000,0x00000000}, -   {0x00000000,0x00000000,0x00000001,0x00000001, -    0x00000001,0x00000001,0x00000000,0x00000000}, -   {0x00000000,0x00000000,0x00000009,0x00000001, -    0x00000001,0x00000009,0x00000000,0x00000000}, -   {0x00000000,0x00000000,0x00000009,0x00000009, -    0x00000009,0x00000009,0x00000000,0x00000000}, -   {0x00000000,0x00000000,0x00000009,0x00000009, -    0x00000009,0x00000009,0x00000001,0x00000000}, -   {0x00000000,0x00000000,0x00000049,0x00000009, -    0x00000009,0x00000049,0x00000001,0x00000001}, -   {0x00000000,0x00000000,0x00000049,0x00000009, -    0x00000009,0x00000049,0x00000001,0x00000001}, -   {0x00000000,0x00000000,0x00000049,0x00000049, -    0x00000049,0x00000049,0x00000009,0x00000001}, -   {0x00000000,0x00000000,0x00000049,0x00000049, -    0x00000049,0x00000049,0x00000009,0x00000001}, -   {0x00000000,0x00000000,0x00000049,0x00000049, -    0x00000049,0x00000049,0x00000009,0x00000001}, -   {0x00000000,0x00000000,0x00000049,0x00000049, -    0x00000049,0x00000049,0x00000009,0x00000009}, -   {0x00000000,0x00000000,0x00000049,0x00000049, -    0x00000049,0x00000249,0x00000049,0x00000009}, -   {0x00000000,0x00000000,0x00000049,0x00000049, -    0x00000049,0x00000249,0x00000049,0x00000009}, -   {0x00000000,0x00000000,0x00000249,0x00000049, -    0x00000249,0x00000249,0x00000049,0x00000009}, -   {0x00000000,0x00000000,0x00001249,0x00000249, -    0x0000124a,0x0000124a,0x0000024a,0x00000049}, -   {0x00000000,0x00000000,0x00000000,0x00000000, -    0x00000000,0x00000000,0x00000000,0x00000000} -  } - }, - { /* version 1 */ -  { /* version 1, passes 0 */ -   {0x00000000,0x00000000,0x00000000,0x00000000, -    0x00000000,0x00000000,0x00000000,0x00000001}, -   {0x00000000,0x00000000,0x00000001,0x00000001, -    0x00000001,0x00000009,0x00000009,0x00000009}, -   {0x00000000,0x00000000,0x00000009,0x00000009, -    0x00000009,0x00000009,0x00000009,0x00000009}, -   {0x00000000,0x00000000,0x00000009,0x00000009, -    0x00000009,0x00000049,0x00000049,0x00000049}, -   {0x00000000,0x00000000,0x00000009,0x00000049, -    0x00000049,0x00000049,0x00000049,0x00000049}, -   {0x00000000,0x00000000,0x00000049,0x00000049, -    0x00000049,0x00000249,0x0000024a,0x0000024a}, -   {0x00000000,0x00000000,0x00000049,0x00000049, -    0x00000249,0x00000249,0x0000024a,0x0000024a}, -   {0x00000000,0x00000000,0x00000049,0x00000249, -    0x00000249,0x00000249,0x0000024a,0x00001252}, -   {0x00000000,0x00000000,0x00000049,0x00000249, -    0x00000249,0x0000124a,0x00001252,0x00001252}, -   {0x00000000,0x00000000,0x00000049,0x00000249, -    0x0000124a,0x0000124a,0x00001252,0x00001252}, -   {0x00000000,0x00000000,0x00000249,0x00000249, -    0x0000124a,0x0000124a,0x00009292,0x00009292}, -   {0x00000000,0x00000000,0x00000249,0x00001249, -    0x0000124a,0x00009252,0x00009292,0x00009292}, -   {0x00000000,0x00000000,0x00000249,0x00001249, -    0x00009252,0x00009252,0x00009292,0x00009292}, -   {0x00000000,0x00000000,0x00000249,0x0000924a, -    0x00009292,0x00009493,0x00009493,0x00009493}, -   {0x00000000,0x00000000,0x00001249,0x00009252, -    0x00009492,0x0000a49b,0x0000a49b,0x0000a49b}, -   {0x00000000,0x00000000,0x00000000,0x00000000, -    0x00000000,0x00000000,0x00000000,0x00000000} -  }, -  { /* version 1, passes 1 */ -   {0x00000000,0x00000000,0x00000000,0x00000000, -    0x00000000,0x00000000,0x00000000,0x00000000}, -   {0x00000000,0x00000000,0x00000009,0x00000009, -    0x00000009,0x00000001,0x00000001,0x00000000}, -   {0x00000000,0x00000000,0x00000009,0x00000009, -    0x00000009,0x00000009,0x00000001,0x00000000}, -   {0x00000000,0x00000000,0x00000049,0x00000049, -    0x00000049,0x00000009,0x00000001,0x00000000}, -   {0x00000000,0x00000000,0x00000049,0x00000049, -    0x00000049,0x00000049,0x00000001,0x00000001}, -   {0x00000000,0x00000000,0x00000049,0x00000049, -    0x00000049,0x00000049,0x00000009,0x00000001}, -   {0x00000000,0x00000000,0x00000249,0x00000049, -    0x00000049,0x00000249,0x00000009,0x00000001}, -   {0x00000000,0x00000000,0x00000249,0x00000049, -    0x00000249,0x00000249,0x00000009,0x00000009}, -   {0x00000000,0x00000000,0x00000249,0x00000249, -    0x00000249,0x00000249,0x00000049,0x00000009}, -   {0x00000000,0x00000000,0x00000249,0x00000249, -    0x00000249,0x0000124a,0x00000049,0x00000009}, -   {0x00000000,0x00000000,0x00000249,0x00000249, -    0x00000249,0x0000124a,0x00000049,0x00000009}, -   {0x00000000,0x00000000,0x00000249,0x00000249, -    0x00000249,0x0000124a,0x0000024a,0x00000049}, -   {0x00000000,0x00000000,0x00000249,0x00000249, -    0x0000124a,0x0000124a,0x0000024a,0x00000049}, -   {0x00000000,0x00000000,0x00000249,0x00000249, -    0x0000124a,0x0000124a,0x0000024a,0x00000049}, -   {0x00000000,0x00000000,0x00001249,0x00001249, -    0x00009252,0x00009252,0x00001252,0x0000024a}, -   {0x00000000,0x00000000,0x00000000,0x00000000, -    0x00000000,0x00000000,0x00000000,0x00000000} -  } - }, - { /* version 2 */ -  { /* version 2, passes 0 */ -   {0x00000000,0x00000000,0x00000000,0x00000000, -    0x00000000,0x00000000,0x00000000,0x00000001}, -   {0x00000000,0x00000000,0x00000009,0x00000009, -    0x00000009,0x00000009,0x00000009,0x00000009}, -   {0x00000000,0x00000000,0x00000049,0x00000049, -    0x00000049,0x00000049,0x00000049,0x00000049}, -   {0x00000000,0x00000000,0x00000049,0x00000049, -    0x00000049,0x00000249,0x0000024a,0x0000024a}, -   {0x00000000,0x00000000,0x00000049,0x00000249, -    0x00000249,0x00000249,0x0000024a,0x00001252}, -   {0x00000000,0x00000000,0x00000249,0x00000249, -    0x00000249,0x0000124a,0x00001252,0x00001252}, -   {0x00000000,0x00000000,0x00000249,0x00000249, -    0x0000124a,0x0000124a,0x00009292,0x00009292}, -   {0x00000000,0x00000000,0x00000249,0x00001249, -    0x0000124a,0x00009252,0x00009292,0x00009292}, -   {0x00000000,0x00000000,0x00000249,0x00001249, -    0x00009252,0x00009292,0x00009292,0x00009292}, -   {0x00000000,0x00000000,0x00000249,0x00001249, -    0x00009252,0x00009292,0x00009493,0x00009493}, -   {0x00000000,0x00000000,0x00000249,0x0000924a, -    0x00009252,0x00009493,0x00009493,0x00009493}, -   {0x00000000,0x00000000,0x00000249,0x0000924a, -    0x00009292,0x00009493,0x00009493,0x00009493}, -   {0x00000000,0x00000000,0x00000249,0x00009252, -    0x00009492,0x00009493,0x0000a49b,0x0000a49b}, -   {0x00000000,0x00000000,0x00001249,0x00009292, -    0x00009492,0x000124db,0x000124db,0x000124db}, -   {0x00000000,0x00000000,0x0000924a,0x00009493, -    0x0000a493,0x000126dc,0x000126dc,0x000126dc}, -   {0x00000000,0x00000000,0x00000000,0x00000000, -    0x00000000,0x00000000,0x00000000,0x00000000} -  }, -  { /* version 2, passes 1 */ -   {0x00000000,0x00000000,0x00000000,0x00000000, -    0x00000000,0x00000000,0x00000000,0x00000000}, -   {0x00000000,0x00000000,0x00000049,0x00000009, -    0x00000049,0x00000009,0x00000001,0x00000000}, -   {0x00000000,0x00000000,0x00000049,0x00000049, -    0x00000049,0x00000049,0x00000049,0x00000000}, -   {0x00000000,0x00000000,0x00000249,0x00000049, -    0x00000249,0x00000049,0x0000024a,0x00000001}, -   {0x00000000,0x00000000,0x00000249,0x00000249, -    0x00000249,0x00000249,0x0000024a,0x00000001}, -   {0x00000000,0x00000000,0x00000249,0x00000249, -    0x00000249,0x00000249,0x0000024a,0x00000001}, -   {0x00000000,0x00000000,0x00000249,0x00000249, -    0x00000249,0x00000249,0x0000024a,0x00000009}, -   {0x00000000,0x00000000,0x00000249,0x00000249, -    0x0000124a,0x0000124a,0x0000024a,0x00000009}, -   {0x00000000,0x00000000,0x00000249,0x00000249, -    0x0000124a,0x0000124a,0x0000024a,0x00000009}, -   {0x00000000,0x00000000,0x00001249,0x00001249, -    0x0000124a,0x00009252,0x00001252,0x00000049}, -   {0x00000000,0x00000000,0x00001249,0x00001249, -    0x0000124a,0x00009292,0x00001252,0x00000049}, -   {0x00000000,0x00000000,0x00001249,0x00001249, -    0x0000124a,0x00009292,0x00001252,0x00000049}, -   {0x00000000,0x00000000,0x00001249,0x00001249, -    0x00009252,0x00009292,0x00001252,0x0000024a}, -   {0x00000000,0x00000000,0x00001249,0x00001249, -    0x00009292,0x00009292,0x00001252,0x0000024a}, -   {0x00000000,0x00000000,0x0000924a,0x0000924a, -    0x00009492,0x00009493,0x00009292,0x00001252}, -   {0x00000000,0x00000000,0x00000000,0x00000000, -    0x00000000,0x00000000,0x00000000,0x00000000} -  } - }, - { /* version 3 */ -  { /* version 3, passes 0 */ -   {0x00000000,0x00000000,0x00000000,0x00000000, -    0x00000000,0x00000000,0x00000000,0x00000001}, -   {0x00000000,0x00000000,0x00000049,0x00000049, -    0x00000049,0x00000049,0x00000049,0x00000049}, -   {0x00000000,0x00000000,0x00000049,0x00000249, -    0x00000249,0x00000249,0x00001252,0x0000024a}, -   {0x00000000,0x00000000,0x00000249,0x00000249, -    0x00000249,0x0000124a,0x00001252,0x00001252}, -   {0x00000000,0x00000000,0x00000249,0x00000249, -    0x0000124a,0x00009252,0x00009292,0x00009292}, -   {0x00000000,0x00000000,0x00000249,0x00001249, -    0x0000124a,0x00009292,0x00009292,0x00009493}, -   {0x00000000,0x00000000,0x00000249,0x00001249, -    0x00009252,0x00009292,0x00009493,0x00009493}, -   {0x00000000,0x00000000,0x00000249,0x00001249, -    0x00009292,0x00009493,0x00009493,0x00009493}, -   {0x00000000,0x00000000,0x00000249,0x00009252, -    0x00009292,0x00009493,0x0000a49b,0x0000a49b}, -   {0x00000000,0x00000000,0x00001249,0x00009252, -    0x00009292,0x0000a49b,0x0000a49b,0x0000a49b}, -   {0x00000000,0x00000000,0x00001249,0x00009252, -    0x00009492,0x0000a49b,0x0000a49b,0x0000a49b}, -   {0x00000000,0x00000000,0x00001249,0x00009292, -    0x00009492,0x0000a49b,0x000124db,0x000124db}, -   {0x00000000,0x00000000,0x00001249,0x00009292, -    0x0000a493,0x0000a49b,0x000124db,0x000124db}, -   {0x00000000,0x00000000,0x00001249,0x00009493, -    0x0001249b,0x000126dc,0x000136e4,0x000126dc}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x000124db,0x000136e4,0x0001b725,0x000136e4}, -   {0x00000000,0x00000000,0x00000000,0x00000000, -    0x00000000,0x00000000,0x00000000,0x00000000} -  }, -  { /* version 3, passes 1 */ -   {0x00000000,0x00000000,0x00000000,0x00000000, -    0x00000000,0x00000000,0x00000000,0x00000000}, -   {0x00000000,0x00000000,0x00000049,0x00000049, -    0x00000049,0x00000049,0x00000001,0x00000000}, -   {0x00000000,0x00000000,0x00000249,0x00000249, -    0x00000249,0x00000249,0x00000049,0x00000001}, -   {0x00000000,0x00000000,0x00000249,0x00000249, -    0x00000249,0x0000124a,0x00001252,0x00000001}, -   {0x00000000,0x00000000,0x00000249,0x00000249, -    0x0000124a,0x0000124a,0x00001252,0x00000009}, -   {0x00000000,0x00000000,0x00000249,0x00001249, -    0x0000124a,0x00009252,0x00009292,0x00000009}, -   {0x00000000,0x00000000,0x00001249,0x00001249, -    0x0000124a,0x00009252,0x00009292,0x00000049}, -   {0x00000000,0x00000000,0x00001249,0x00001249, -    0x00009252,0x00009252,0x00009292,0x00000049}, -   {0x00000000,0x00000000,0x00001249,0x00001249, -    0x00009252,0x00009493,0x00009292,0x0000024a}, -   {0x00000000,0x00000000,0x00001249,0x00001249, -    0x00009252,0x00009493,0x00009292,0x0000024a}, -   {0x00000000,0x00000000,0x00001249,0x00001249, -    0x00009252,0x00009493,0x00009493,0x00001252}, -   {0x00000000,0x00000000,0x00001249,0x0000924a, -    0x00009292,0x00009493,0x00009493,0x00001252}, -   {0x00000000,0x00000000,0x00001249,0x0000924a, -    0x00009492,0x00009493,0x00009493,0x00009292}, -   {0x00000000,0x00000000,0x00001249,0x00009252, -    0x00009492,0x0000a49b,0x00009493,0x00009292}, -   {0x00000000,0x00000000,0x0000924a,0x00009292, -    0x0000a493,0x000124db,0x0000a49b,0x00009493}, -   {0x00000000,0x00000000,0x00000000,0x00000000, -    0x00000000,0x00000000,0x00000000,0x00000000} -  } - }, - { /* version 4 */ -  { /* version 4, passes 0 */ -   {0x00000000,0x00000000,0x00000049,0x00000049, -    0x00000049,0x00000049,0x0000024a,0x0000024a}, -   {0x00000000,0x00000000,0x00000249,0x00000249, -    0x00000249,0x0000124a,0x00001252,0x00009292}, -   {0x00000000,0x00000000,0x00000249,0x00000249, -    0x0000124a,0x00009252,0x00009292,0x00009292}, -   {0x00000000,0x00000000,0x00000249,0x00001249, -    0x0000124a,0x00009292,0x00009493,0x00009493}, -   {0x00000000,0x00000000,0x00000249,0x00001249, -    0x00009252,0x00009493,0x00009493,0x0000a49b}, -   {0x00000000,0x00000000,0x00000249,0x0000924a, -    0x00009292,0x00009493,0x0000a49b,0x0000a49b}, -   {0x00000000,0x00000000,0x00001249,0x0000924a, -    0x00009292,0x00009493,0x0000a49b,0x000124db}, -   {0x00000000,0x00000000,0x00001249,0x00009252, -    0x00009492,0x0000a49b,0x0000a49b,0x000124db}, -   {0x00000000,0x00000000,0x00001249,0x00009292, -    0x00009492,0x000124db,0x000124db,0x000126dc}, -   {0x00000000,0x00000000,0x00001249,0x00009292, -    0x0000a493,0x000124db,0x000126dc,0x000126dc}, -   {0x00000000,0x00000000,0x00001249,0x00009493, -    0x0000a493,0x000124db,0x000126dc,0x000136e4}, -   {0x00000000,0x00000000,0x00001249,0x00009493, -    0x0000a493,0x000126dc,0x000136e4,0x000136e4}, -   {0x00000000,0x00000000,0x0000924a,0x00009493, -    0x0001249b,0x000126dc,0x000136e4,0x000136e4}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x000124db,0x000136e4,0x000136e4,0x0001b724}, -   {0x00000000,0x00000000,0x00009252,0x000124db, -    0x000126dc,0x0001b724,0x0001b725,0x0001b925}, -   {0x00000000,0x00000000,0x00000000,0x00000000, -    0x00000000,0x00000000,0x00000000,0x00000000} -  }, -  { /* version 4, passes 1 */ -   {0x00000000,0x00000000,0x00000049,0x00000049, -    0x00000049,0x00000049,0x00000049,0x00000049}, -   {0x00000000,0x00000000,0x00000249,0x00000249, -    0x00000249,0x00000249,0x0000024a,0x00000049}, -   {0x00000000,0x00000000,0x00001249,0x00000249, -    0x0000124a,0x0000124a,0x00001252,0x00000049}, -   {0x00000000,0x00000000,0x00001249,0x00001249, -    0x0000124a,0x0000124a,0x00009292,0x0000024a}, -   {0x00000000,0x00000000,0x00001249,0x00001249, -    0x00009252,0x00009292,0x00009292,0x0000024a}, -   {0x00000000,0x00000000,0x00001249,0x00001249, -    0x00009252,0x00009292,0x0000a49b,0x0000024a}, -   {0x00000000,0x00000000,0x00001249,0x00001249, -    0x00009292,0x00009493,0x0000a49b,0x00001252}, -   {0x00000000,0x00000000,0x00001249,0x00001249, -    0x00009292,0x00009493,0x0000a49b,0x00001252}, -   {0x00000000,0x00000000,0x00001249,0x0000924a, -    0x00009492,0x0000a49b,0x0000a49b,0x00001252}, -   {0x00000000,0x00000000,0x00001249,0x00009252, -    0x00009492,0x0000a49b,0x0000a49b,0x00009292}, -   {0x00000000,0x00000000,0x00001249,0x00009292, -    0x00009492,0x0000a49b,0x0000a49b,0x00009292}, -   {0x00000000,0x00000000,0x00001249,0x00009493, -    0x0000a493,0x0000a49b,0x0000a49b,0x00009292}, -   {0x00000000,0x00000000,0x00001249,0x00009493, -    0x0000a493,0x0000a49b,0x0000a49b,0x00009493}, -   {0x00000000,0x00000000,0x0000924a,0x00009493, -    0x0000a493,0x000124db,0x0000a49b,0x00009493}, -   {0x00000000,0x00000000,0x00009252,0x0000a49b, -    0x0001249b,0x000126dc,0x000124db,0x0000a49b}, -   {0x00000000,0x00000000,0x00000000,0x00000000, -    0x00000000,0x00000000,0x00000000,0x00000000} -  } - }, - { /* version 5 */ -  { /* version 5, passes 0 */ -   {0x00000000,0x00000000,0x00000249,0x00000249, -    0x00000249,0x0000124a,0x00001252,0x00009292}, -   {0x00000000,0x00000000,0x00000249,0x00001249, -    0x0000124a,0x00009292,0x00009292,0x00009493}, -   {0x00000000,0x00000000,0x00000249,0x0000924a, -    0x00009292,0x00009493,0x0000a49b,0x0000a49b}, -   {0x00000000,0x00000000,0x00001249,0x0000924a, -    0x00009292,0x00009493,0x0000a49b,0x0000a49b}, -   {0x00000000,0x00000000,0x00001249,0x0000924a, -    0x00009492,0x0000a49b,0x0000a49b,0x000124db}, -   {0x00000000,0x00000000,0x00001249,0x00009292, -    0x00009492,0x0000a49b,0x000124db,0x000124db}, -   {0x00000000,0x00000000,0x00001249,0x00009292, -    0x0000a493,0x000124db,0x000124db,0x000126dc}, -   {0x00000000,0x00000000,0x00001249,0x00009493, -    0x0000a493,0x000124db,0x000126dc,0x000126dc}, -   {0x00000000,0x00000000,0x00001249,0x00009493, -    0x0000a493,0x000126dc,0x000136e4,0x000136e4}, -   {0x00000000,0x00000000,0x00001249,0x00009493, -    0x0001249b,0x000126dc,0x000136e4,0x000136e4}, -   {0x00000000,0x00000000,0x00001249,0x00009493, -    0x0001249b,0x000126dc,0x000136e4,0x000136e4}, -   {0x00000000,0x00000000,0x0000924a,0x00009493, -    0x0001249b,0x000126dc,0x0001b725,0x0001b724}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x000124db,0x000126dc,0x0001b725,0x0001b724}, -   {0x00000000,0x00000000,0x00009292,0x0000a49b, -    0x000126dc,0x000136e4,0x0001b92d,0x0001b925}, -   {0x00000000,0x00000000,0x00009492,0x000124db, -    0x000136e4,0x0001b724,0x0001c96e,0x0001c92d}, -   {0x00000000,0x00000000,0x00000000,0x00000000, -    0x00000000,0x00000000,0x00000000,0x00000000} -  }, -  { /* version 5, passes 1 */ -   {0x00000000,0x00000000,0x00000249,0x00000249, -    0x0000124a,0x00000249,0x0000024a,0x0000024a}, -   {0x00000000,0x00000000,0x00001249,0x00001249, -    0x0000124a,0x0000124a,0x00001252,0x0000024a}, -   {0x00000000,0x00000000,0x00001249,0x00001249, -    0x00009292,0x00009493,0x00009493,0x0000024a}, -   {0x00000000,0x00000000,0x00001249,0x00001249, -    0x00009292,0x00009493,0x00009493,0x00001252}, -   {0x00000000,0x00000000,0x00001249,0x00001249, -    0x00009292,0x00009493,0x0000a49b,0x00001252}, -   {0x00000000,0x00000000,0x00001249,0x0000924a, -    0x00009492,0x00009493,0x000124db,0x00001252}, -   {0x00000000,0x00000000,0x00001249,0x00009292, -    0x00009492,0x00009493,0x000124db,0x00009292}, -   {0x00000000,0x00000000,0x00001249,0x00009292, -    0x00009492,0x0000a49b,0x000124db,0x00009292}, -   {0x00000000,0x00000000,0x00001249,0x00009493, -    0x0000a493,0x0000a49b,0x000124db,0x00009292}, -   {0x00000000,0x00000000,0x00001249,0x00009493, -    0x0000a493,0x000124db,0x000124db,0x00009493}, -   {0x00000000,0x00000000,0x0000924a,0x00009493, -    0x0000a493,0x000124db,0x000124db,0x00009493}, -   {0x00000000,0x00000000,0x0000924a,0x00009493, -    0x0000a493,0x000124db,0x000124db,0x00009493}, -   {0x00000000,0x00000000,0x0000924a,0x00009493, -    0x0000a493,0x000124db,0x000124db,0x0000a49b}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x000124db,0x000126dc,0x000124db,0x0000a49b}, -   {0x00000000,0x00000000,0x00009252,0x000124db, -    0x000126dc,0x000136e4,0x000126dc,0x000124db}, -   {0x00000000,0x00000000,0x00000000,0x00000000, -    0x00000000,0x00000000,0x00000000,0x00000000} -  } - }, - { /* version 6 */ -  { /* version 6, passes 0 */ -   {0x00000000,0x00000000,0x00000249,0x00000249, -    0x0000124a,0x0000124a,0x00009292,0x00009292}, -   {0x00000000,0x00000000,0x00001249,0x00001249, -    0x00009292,0x00009493,0x0000a49b,0x0000a49b}, -   {0x00000000,0x00000000,0x00001249,0x0000924a, -    0x00009492,0x0000a49b,0x0000a49b,0x000124db}, -   {0x00000000,0x00000000,0x00001249,0x00009292, -    0x00009492,0x000124db,0x000126dc,0x000126dc}, -   {0x00000000,0x00000000,0x00001249,0x00009493, -    0x0000a493,0x000124db,0x000126dc,0x000126dc}, -   {0x00000000,0x00000000,0x00001249,0x00009493, -    0x0000a493,0x000126dc,0x000136e4,0x000136e4}, -   {0x00000000,0x00000000,0x00001249,0x00009493, -    0x0000a493,0x000126dc,0x000136e4,0x0001b724}, -   {0x00000000,0x00000000,0x00001249,0x00009493, -    0x0001249b,0x000126dc,0x000136e4,0x0001b724}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x0001249b,0x000126dc,0x000136e4,0x0001b724}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x0001249b,0x000136e4,0x0001b725,0x0001b724}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x000124db,0x000136e4,0x0001b725,0x0001b925}, -   {0x00000000,0x00000000,0x00009292,0x0000a49b, -    0x000126dc,0x000136e4,0x0001b92d,0x0001b925}, -   {0x00000000,0x00000000,0x00009292,0x0000a49b, -    0x000126dc,0x0001b724,0x0001b92d,0x0001c92d}, -   {0x00000000,0x00000000,0x00009492,0x000124db, -    0x000126dc,0x0001b724,0x0001c96e,0x0001c92d}, -   {0x00000000,0x00000000,0x0000a492,0x000126db, -    0x000136e4,0x0001b925,0x00025bb6,0x00024b77}, -   {0x00000000,0x00000000,0x00000000,0x00000000, -    0x00000000,0x00000000,0x00000000,0x00000000} -  }, -  { /* version 6, passes 1 */ -   {0x00000000,0x00000000,0x00001249,0x00000249, -    0x0000124a,0x0000124a,0x00001252,0x00001252}, -   {0x00000000,0x00000000,0x00001249,0x00001249, -    0x00009252,0x00009292,0x00009292,0x00001252}, -   {0x00000000,0x00000000,0x00001249,0x0000924a, -    0x00009492,0x00009493,0x0000a49b,0x00001252}, -   {0x00000000,0x00000000,0x00001249,0x00009252, -    0x00009492,0x0000a49b,0x0000a49b,0x00009292}, -   {0x00000000,0x00000000,0x00001249,0x00009292, -    0x00009492,0x0000a49b,0x0000a49b,0x00009292}, -   {0x00000000,0x00000000,0x00001249,0x00009493, -    0x0000a493,0x0000a49b,0x000126dc,0x00009292}, -   {0x00000000,0x00000000,0x0000924a,0x00009493, -    0x0000a493,0x0000a49b,0x000126dc,0x00009493}, -   {0x00000000,0x00000000,0x0000924a,0x00009493, -    0x0000a493,0x0000a49b,0x000126dc,0x00009493}, -   {0x00000000,0x00000000,0x0000924a,0x00009493, -    0x0000a493,0x000124db,0x000126dc,0x00009493}, -   {0x00000000,0x00000000,0x0000924a,0x00009493, -    0x0000a493,0x000124db,0x000126dc,0x0000a49b}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x0000a493,0x000124db,0x000126dc,0x0000a49b}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x0001249b,0x000126dc,0x000126dc,0x0000a49b}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x000124db,0x000136e4,0x000126dc,0x000124db}, -   {0x00000000,0x00000000,0x00009492,0x0000a49b, -    0x000136e4,0x000136e4,0x000126dc,0x000124db}, -   {0x00000000,0x00000000,0x0000a492,0x000124db, -    0x0001b724,0x0001b724,0x000136e4,0x000126dc}, -   {0x00000000,0x00000000,0x00000000,0x00000000, -    0x00000000,0x00000000,0x00000000,0x00000000} -  } - }, - { /* version 7 */ -  { /* version 7, passes 0 */ -   {0x00000000,0x00000000,0x00001249,0x00001249, -    0x00009292,0x00009493,0x0000a49b,0x000124db}, -   {0x00000000,0x00000000,0x00001249,0x00009292, -    0x0000a493,0x0000a49b,0x000124db,0x000126dc}, -   {0x00000000,0x00000000,0x00001249,0x00009493, -    0x0000a493,0x000124db,0x000126dc,0x000136e4}, -   {0x00000000,0x00000000,0x00001249,0x00009493, -    0x0000a493,0x000124db,0x000136e4,0x000136e4}, -   {0x00000000,0x00000000,0x00001249,0x00009493, -    0x0001249b,0x000126dc,0x000136e4,0x000136e4}, -   {0x00000000,0x00000000,0x00001249,0x0000a49b, -    0x0001249b,0x000126dc,0x000136e4,0x0001b724}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x0001249b,0x000126dc,0x000136e4,0x0001b724}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x000124db,0x000136e4,0x0001b725,0x0001b724}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x000126dc,0x000136e4,0x0001b725,0x0001b925}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x000126dc,0x0001b724,0x0001b92d,0x0001b925}, -   {0x00000000,0x00000000,0x00009292,0x0000a49b, -    0x000126dc,0x0001b724,0x0001c96e,0x0001c92d}, -   {0x00000000,0x00000000,0x00009292,0x000124db, -    0x000126dc,0x0001b724,0x0001c96e,0x0001c92d}, -   {0x00000000,0x00000000,0x00009492,0x000124db, -    0x000136e4,0x0001b724,0x0001c96e,0x0002496e}, -   {0x00000000,0x00000000,0x00009492,0x000126db, -    0x000136e4,0x0001b925,0x0001c96e,0x0002496e}, -   {0x00000000,0x00000000,0x0000a492,0x000136db, -    0x0001b724,0x0002496d,0x00025bb6,0x00025bbf}, -   {0x00000000,0x00000000,0x00000000,0x00000000, -    0x00000000,0x00000000,0x00000000,0x00000000} -  }, -  { /* version 7, passes 1 */ -   {0x00000000,0x00000000,0x00001249,0x00001249, -    0x00009252,0x00009292,0x00009292,0x00009292}, -   {0x00000000,0x00000000,0x00001249,0x0000924a, -    0x00009492,0x00009493,0x00009493,0x00009292}, -   {0x00000000,0x00000000,0x00001249,0x00009493, -    0x0000a493,0x0000a49b,0x0000a49b,0x00009292}, -   {0x00000000,0x00000000,0x0000924a,0x00009493, -    0x0000a493,0x0000a49b,0x000124db,0x00009493}, -   {0x00000000,0x00000000,0x0000924a,0x00009493, -    0x0000a493,0x000124db,0x000124db,0x00009493}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x0000a493,0x000124db,0x000136e4,0x00009493}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x0000a493,0x000124db,0x000136e4,0x0000a49b}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x0001249b,0x000124db,0x000136e4,0x0000a49b}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x0001249b,0x000126dc,0x000136e4,0x0000a49b}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x0001249b,0x000126dc,0x000136e4,0x000124db}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x000126dc,0x000136e4,0x000136e4,0x000124db}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x000126dc,0x000136e4,0x000136e4,0x000124db}, -   {0x00000000,0x00000000,0x0000924a,0x000124db, -    0x000136e4,0x000136e4,0x000136e4,0x000126dc}, -   {0x00000000,0x00000000,0x0000a492,0x000124db, -    0x000136e4,0x0001b724,0x000136e4,0x000126dc}, -   {0x00000000,0x00000000,0x00012492,0x000126db, -    0x0001b724,0x0001b925,0x0001b725,0x000136e4}, -   {0x00000000,0x00000000,0x00000000,0x00000000, -    0x00000000,0x00000000,0x00000000,0x00000000} -  } - }, - { /* version 8 */ -  { /* version 8, passes 0 */ -   {0x00000000,0x00000000,0x00001249,0x00001249, -    0x00009292,0x00009493,0x0000a49b,0x000124db}, -   {0x00000000,0x00000000,0x00001249,0x00009292, -    0x0000a493,0x000124db,0x000126dc,0x000126dc}, -   {0x00000000,0x00000000,0x00001249,0x00009493, -    0x0000a493,0x000124db,0x000126dc,0x000136e4}, -   {0x00000000,0x00000000,0x00001249,0x0000a49b, -    0x0001249b,0x000126dc,0x000136e4,0x0001b724}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x0001249b,0x000126dc,0x000136e4,0x0001b724}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x000124db,0x000136e4,0x0001b725,0x0001b724}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x000126dc,0x000136e4,0x0001b725,0x0001b925}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x000126dc,0x0001b724,0x0001b92d,0x0001c92d}, -   {0x00000000,0x00000000,0x00009252,0x000124db, -    0x000126dc,0x0001b724,0x0001b92d,0x0001c92d}, -   {0x00000000,0x00000000,0x00009292,0x000124db, -    0x000126dc,0x0001b925,0x0001c96e,0x0001c92d}, -   {0x00000000,0x00000000,0x00009492,0x000124db, -    0x000136e4,0x0001b925,0x0001c96e,0x0001c92d}, -   {0x00000000,0x00000000,0x00009492,0x000124db, -    0x000136e4,0x0001b925,0x00024b76,0x00024b77}, -   {0x00000000,0x00000000,0x00009492,0x000126db, -    0x000136e4,0x0001b925,0x00024b76,0x00025bbf}, -   {0x00000000,0x00000000,0x0000a492,0x000126db, -    0x000136e4,0x0001c92d,0x00024b76,0x00025bbf}, -   {0x00000000,0x00000000,0x00012492,0x000136db, -    0x0001b724,0x00024b6d,0x0002ddb6,0x0002efff}, -   {0x00000000,0x00000000,0x00000000,0x00000000, -    0x00000000,0x00000000,0x00000000,0x00000000} -  }, -  { /* version 8, passes 1 */ -   {0x00000000,0x00000000,0x00001249,0x00001249, -    0x00009252,0x00009493,0x00009493,0x00009493}, -   {0x00000000,0x00000000,0x00001249,0x00009292, -    0x0000a493,0x0000a49b,0x0000a49b,0x00009493}, -   {0x00000000,0x00000000,0x0000924a,0x00009493, -    0x0000a493,0x0000a49b,0x000124db,0x00009493}, -   {0x00000000,0x00000000,0x0000924a,0x00009493, -    0x0000a493,0x000124db,0x000126dc,0x0000a49b}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x0000a493,0x000124db,0x000126dc,0x0000a49b}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x0000a493,0x000124db,0x000136e4,0x000124db}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x0001249b,0x000126dc,0x000136e4,0x000124db}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x000126dc,0x000126dc,0x000136e4,0x000126dc}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x000126dc,0x000136e4,0x000136e4,0x000126dc}, -   {0x00000000,0x00000000,0x0000924a,0x000124db, -    0x000126dc,0x000136e4,0x000136e4,0x000126dc}, -   {0x00000000,0x00000000,0x0000924a,0x000124db, -    0x000126dc,0x000136e4,0x000136e4,0x000136e4}, -   {0x00000000,0x00000000,0x00009292,0x000124db, -    0x000136e4,0x0001b724,0x0001b725,0x000136e4}, -   {0x00000000,0x00000000,0x00009492,0x000126db, -    0x000136e4,0x0001b925,0x0001b725,0x0001b724}, -   {0x00000000,0x00000000,0x00009492,0x000126db, -    0x000136e4,0x0001b925,0x0001b725,0x0001b724}, -   {0x00000000,0x00000000,0x0000a492,0x000136db, -    0x0001b724,0x0002496d,0x0001b92d,0x0001b925}, -   {0x00000000,0x00000000,0x00000000,0x00000000, -    0x00000000,0x00000000,0x00000000,0x00000000} -  } - }, - { /* version 9 */ -  { /* version 9, passes 0 */ -   {0x00000000,0x00000000,0x00000049,0x00000049, -    0x00000049,0x00000049,0x00000049,0x00000049}, -   {0x00000000,0x00000000,0x00000249,0x00000049, -    0x00000249,0x00000249,0x0000024a,0x00000049}, -   {0x00000000,0x00000000,0x00000249,0x00000249, -    0x0000124a,0x00009252,0x00001252,0x0000024a}, -   {0x00000000,0x00000000,0x00001249,0x00001249, -    0x00009252,0x00009292,0x00009493,0x00001252}, -   {0x00000000,0x00000000,0x00001249,0x0000924a, -    0x00009292,0x00009493,0x00009493,0x00001252}, -   {0x00000000,0x00000000,0x00001249,0x00009292, -    0x00009492,0x0000a49b,0x0000a49b,0x00009292}, -   {0x00000000,0x00000000,0x00001249,0x00009493, -    0x0000a493,0x000124db,0x000124db,0x00009493}, -   {0x00000000,0x00000000,0x0000924a,0x00009493, -    0x0000a493,0x000124db,0x000126dc,0x0000a49b}, -   {0x00000000,0x00000000,0x0000924a,0x00009493, -    0x0000a493,0x000124db,0x000126dc,0x0000a49b}, -   {0x00000000,0x00000000,0x0000924a,0x00009493, -    0x0001249b,0x000126dc,0x000126dc,0x000124db}, -   {0x00000000,0x00000000,0x00009252,0x00009493, -    0x000124db,0x000136e4,0x000136e4,0x000126dc}, -   {0x00000000,0x00000000,0x00009252,0x0000a49b, -    0x000124db,0x000136e4,0x000136e4,0x000126dc}, -   {0x00000000,0x00000000,0x00009292,0x0000a49b, -    0x000126dc,0x000136e4,0x000136e4,0x000136e4}, -   {0x00000000,0x00000000,0x00009492,0x0000a49b, -    0x000126dc,0x0001b724,0x0001b725,0x0001b724}, -   {0x00000000,0x00000000,0x0000a492,0x000124db, -    0x000136e4,0x0001b925,0x0001b92d,0x0001b925}, -   {0x00000000,0x00000000,0x00000000,0x00000000, -    0x00000000,0x00000000,0x00000000,0x00000000} -  }, -  { /* version 9, passes 1 */ -   {0x00000000,0x00000000,0x00000249,0x00000049, -    0x00000009,0x00000009,0x00000009,0x00000009}, -   {0x00000000,0x00000000,0x00000249,0x00000249, -    0x00000049,0x00000049,0x00000009,0x00000009}, -   {0x00000000,0x00000000,0x00001249,0x00001249, -    0x0000124a,0x00000249,0x00000049,0x00000049}, -   {0x00000000,0x00000000,0x00001249,0x00001249, -    0x0000124a,0x0000124a,0x00000049,0x00000049}, -   {0x00000000,0x00000000,0x00001249,0x00001249, -    0x00009252,0x0000124a,0x0000024a,0x0000024a}, -   {0x00000000,0x00000000,0x00001249,0x0000924a, -    0x00009252,0x0000124a,0x0000024a,0x0000024a}, -   {0x00000000,0x00000000,0x00001249,0x00009292, -    0x00009492,0x00009252,0x00001252,0x00001252}, -   {0x00000000,0x00000000,0x00001249,0x00009493, -    0x0000a493,0x00009292,0x00009292,0x00001252}, -   {0x00000000,0x00000000,0x0000924a,0x00009493, -    0x0000a493,0x00009292,0x00009292,0x00009292}, -   {0x00000000,0x00000000,0x0000924a,0x00009493, -    0x0000a493,0x00009493,0x00009493,0x00009292}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x0000a493,0x0000a49b,0x00009493,0x00009493}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x0000a493,0x0000a49b,0x0000a49b,0x00009493}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x0001249b,0x000124db,0x0000a49b,0x0000a49b}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x000136e4,0x000126dc,0x000124db,0x0000a49b}, -   {0x00000000,0x00000000,0x00009252,0x000124db, -    0x0001b724,0x000136e4,0x000126dc,0x000124db}, -   {0x00000000,0x00000000,0x00000000,0x00000000, -    0x00000000,0x00000000,0x00000000,0x00000000} -  } - }, - { /* version 10 */ -  { /* version 10, passes 0 */ -   {0x00000000,0x00000000,0x00000249,0x00000249, -    0x00000249,0x00000249,0x0000024a,0x0000024a}, -   {0x00000000,0x00000000,0x00000249,0x00001249, -    0x00009252,0x00009292,0x00009292,0x0000024a}, -   {0x00000000,0x00000000,0x00001249,0x00001249, -    0x00009252,0x00009292,0x00009292,0x00001252}, -   {0x00000000,0x00000000,0x00001249,0x0000924a, -    0x00009492,0x00009493,0x0000a49b,0x00009292}, -   {0x00000000,0x00000000,0x00001249,0x00009292, -    0x00009492,0x000124db,0x000124db,0x00009292}, -   {0x00000000,0x00000000,0x00001249,0x00009493, -    0x0000a493,0x000124db,0x000124db,0x00009493}, -   {0x00000000,0x00000000,0x00001249,0x00009493, -    0x0000a493,0x000124db,0x000126dc,0x0000a49b}, -   {0x00000000,0x00000000,0x0000924a,0x00009493, -    0x0000a493,0x000124db,0x000126dc,0x000124db}, -   {0x00000000,0x00000000,0x0000924a,0x00009493, -    0x0001249b,0x000126dc,0x000126dc,0x000124db}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x000124db,0x000126dc,0x000136e4,0x000126dc}, -   {0x00000000,0x00000000,0x00009252,0x0000a49b, -    0x000124db,0x000136e4,0x000136e4,0x000136e4}, -   {0x00000000,0x00000000,0x00009292,0x0000a49b, -    0x000126dc,0x000136e4,0x000136e4,0x000136e4}, -   {0x00000000,0x00000000,0x00009492,0x0000a49b, -    0x000126dc,0x0001b724,0x0001b92d,0x0001b724}, -   {0x00000000,0x00000000,0x00009492,0x000124db, -    0x000126dc,0x0001b925,0x0001b92d,0x0001b925}, -   {0x00000000,0x00000000,0x0000a492,0x000126db, -    0x000136e4,0x0002496d,0x0001c96e,0x0001c92d}, -   {0x00000000,0x00000000,0x00000000,0x00000000, -    0x00000000,0x00000000,0x00000000,0x00000000} -  }, -  { /* version 10, passes 1 */ -   {0x00000000,0x00000000,0x00000249,0x00000249, -    0x00000049,0x00000049,0x00000049,0x00000049}, -   {0x00000000,0x00000000,0x00001249,0x00001249, -    0x0000124a,0x00000249,0x00000049,0x00000049}, -   {0x00000000,0x00000000,0x00001249,0x00001249, -    0x0000124a,0x00009252,0x0000024a,0x00000049}, -   {0x00000000,0x00000000,0x00001249,0x00001249, -    0x00009252,0x00009493,0x0000024a,0x0000024a}, -   {0x00000000,0x00000000,0x00001249,0x00009252, -    0x00009492,0x00009493,0x00001252,0x0000024a}, -   {0x00000000,0x00000000,0x00001249,0x00009292, -    0x00009492,0x00009493,0x00001252,0x00001252}, -   {0x00000000,0x00000000,0x0000924a,0x00009493, -    0x00009492,0x00009493,0x00009292,0x00001252}, -   {0x00000000,0x00000000,0x0000924a,0x00009493, -    0x0000a493,0x00009493,0x00009292,0x00009292}, -   {0x00000000,0x00000000,0x0000924a,0x00009493, -    0x0000a493,0x0000a49b,0x00009493,0x00009292}, -   {0x00000000,0x00000000,0x0000924a,0x00009493, -    0x0000a493,0x0000a49b,0x00009493,0x00009292}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x0000a493,0x000124db,0x0000a49b,0x00009493}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x0000a493,0x000124db,0x0000a49b,0x00009493}, -   {0x00000000,0x00000000,0x0000924a,0x000124db, -    0x000136e4,0x000126dc,0x000124db,0x0000a49b}, -   {0x00000000,0x00000000,0x0000924a,0x000124db, -    0x000136e4,0x000126dc,0x000124db,0x0000a49b}, -   {0x00000000,0x00000000,0x00009252,0x000126db, -    0x0001b724,0x000136e4,0x000126dc,0x000124db}, -   {0x00000000,0x00000000,0x00000000,0x00000000, -    0x00000000,0x00000000,0x00000000,0x00000000} -  } - }, - { /* version 11 */ -  { /* version 11, passes 0 */ -   {0x00000000,0x00000000,0x00000249,0x00000249, -    0x00000249,0x00000249,0x00001252,0x00001252}, -   {0x00000000,0x00000000,0x00001249,0x00001249, -    0x00009252,0x00009292,0x00009292,0x00001252}, -   {0x00000000,0x00000000,0x00001249,0x0000924a, -    0x00009492,0x0000a49b,0x0000a49b,0x00009292}, -   {0x00000000,0x00000000,0x00001249,0x00009493, -    0x0000a493,0x0000a49b,0x000124db,0x00009493}, -   {0x00000000,0x00000000,0x00001249,0x00009493, -    0x0000a493,0x000124db,0x000126dc,0x00009493}, -   {0x00000000,0x00000000,0x0000924a,0x00009493, -    0x0000a493,0x000126dc,0x000126dc,0x0000a49b}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x0001249b,0x000126dc,0x000136e4,0x000124db}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x000126dc,0x000136e4,0x000136e4,0x000126dc}, -   {0x00000000,0x00000000,0x00009292,0x0000a49b, -    0x000126dc,0x000136e4,0x000136e4,0x000126dc}, -   {0x00000000,0x00000000,0x00009292,0x0000a49b, -    0x000126dc,0x0001b724,0x0001b725,0x000136e4}, -   {0x00000000,0x00000000,0x00009292,0x0000a49b, -    0x000136e4,0x0001b724,0x0001b92d,0x0001b724}, -   {0x00000000,0x00000000,0x00009492,0x0000a49b, -    0x000136e4,0x0001b724,0x0001b92d,0x0001b724}, -   {0x00000000,0x00000000,0x00009492,0x000124db, -    0x000136e4,0x0001b925,0x0001c96e,0x0001b925}, -   {0x00000000,0x00000000,0x00009492,0x000124db, -    0x0001b724,0x0001b925,0x0001c96e,0x0001c92d}, -   {0x00000000,0x00000000,0x0000a492,0x000126db, -    0x0001c924,0x0002496d,0x00025bb6,0x00024b77}, -   {0x00000000,0x00000000,0x00000000,0x00000000, -    0x00000000,0x00000000,0x00000000,0x00000000} -  }, -  { /* version 11, passes 1 */ -   {0x00000000,0x00000000,0x00001249,0x00000249, -    0x00000249,0x00000249,0x0000024a,0x0000024a}, -   {0x00000000,0x00000000,0x00001249,0x00001249, -    0x0000124a,0x0000124a,0x0000024a,0x0000024a}, -   {0x00000000,0x00000000,0x00001249,0x0000924a, -    0x00009252,0x00009252,0x0000024a,0x0000024a}, -   {0x00000000,0x00000000,0x00001249,0x00009292, -    0x00009492,0x0000a49b,0x00001252,0x00001252}, -   {0x00000000,0x00000000,0x0000924a,0x00009493, -    0x0000a493,0x0000a49b,0x00001252,0x00001252}, -   {0x00000000,0x00000000,0x0000924a,0x00009493, -    0x0000a493,0x0000a49b,0x00009292,0x00001252}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x0000a493,0x0000a49b,0x00009292,0x00009292}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x0000a493,0x0000a49b,0x00009493,0x00009292}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x0001249b,0x000124db,0x00009493,0x00009292}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x0001249b,0x000124db,0x00009493,0x00009493}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x000124db,0x000124db,0x0000a49b,0x00009493}, -   {0x00000000,0x00000000,0x0000924a,0x000124db, -    0x000126dc,0x000126dc,0x0000a49b,0x00009493}, -   {0x00000000,0x00000000,0x0000924a,0x000124db, -    0x000136e4,0x000126dc,0x000124db,0x0000a49b}, -   {0x00000000,0x00000000,0x00009292,0x000124db, -    0x000136e4,0x000126dc,0x000124db,0x0000a49b}, -   {0x00000000,0x00000000,0x00009492,0x000126db, -    0x0001b724,0x000136e4,0x000126dc,0x000124db}, -   {0x00000000,0x00000000,0x00000000,0x00000000, -    0x00000000,0x00000000,0x00000000,0x00000000} -  } - }, - { /* version 12 */ -  { /* version 12, passes 0 */ -   {0x00000000,0x00000000,0x00001249,0x00001249, -    0x00009252,0x00009292,0x00009493,0x00009493}, -   {0x00000000,0x00000000,0x00001249,0x00009292, -    0x0000a493,0x0000a49b,0x0000a49b,0x00009493}, -   {0x00000000,0x00000000,0x00001249,0x00009493, -    0x0000a493,0x000124db,0x000124db,0x0000a49b}, -   {0x00000000,0x00000000,0x0000924a,0x00009493, -    0x0000a493,0x000126dc,0x000126dc,0x0000a49b}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x0001249b,0x000126dc,0x000136e4,0x000124db}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x000126dc,0x000136e4,0x000136e4,0x000126dc}, -   {0x00000000,0x00000000,0x00009292,0x0000a49b, -    0x000126dc,0x0001b724,0x0001b725,0x000126dc}, -   {0x00000000,0x00000000,0x00009292,0x0000a49b, -    0x000136e4,0x0001b724,0x0001b92d,0x000136e4}, -   {0x00000000,0x00000000,0x00009492,0x0000a49b, -    0x000136e4,0x0001b724,0x0001b92d,0x0001b724}, -   {0x00000000,0x00000000,0x00009492,0x000124db, -    0x000136e4,0x0001b724,0x0001b92d,0x0001b724}, -   {0x00000000,0x00000000,0x00009492,0x000124db, -    0x000136e4,0x0001b925,0x0001b92d,0x0001b925}, -   {0x00000000,0x00000000,0x00009492,0x000124db, -    0x0001b724,0x0001b925,0x0001c96e,0x0001c92d}, -   {0x00000000,0x00000000,0x0000a492,0x000124db, -    0x0001b724,0x0001c92d,0x0001c96e,0x0001c92d}, -   {0x00000000,0x00000000,0x0000a492,0x000124db, -    0x0001b724,0x0001c92d,0x00024b76,0x0002496e}, -   {0x00000000,0x00000000,0x00012492,0x000126db, -    0x0001c924,0x00024b6d,0x0002ddb6,0x00025bbf}, -   {0x00000000,0x00000000,0x00000000,0x00000000, -    0x00000000,0x00000000,0x00000000,0x00000000} -  }, -  { /* version 12, passes 1 */ -   {0x00000000,0x00000000,0x00001249,0x00001249, -    0x0000124a,0x0000124a,0x00001252,0x00001252}, -   {0x00000000,0x00000000,0x00001249,0x00009292, -    0x00009492,0x00009252,0x00001252,0x00001252}, -   {0x00000000,0x00000000,0x0000924a,0x00009493, -    0x0000a493,0x00009292,0x00001252,0x00001252}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x0000a493,0x0000a49b,0x00009292,0x00009292}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x0000a493,0x0000a49b,0x00009292,0x00009292}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x0001249b,0x0000a49b,0x00009493,0x00009292}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x000124db,0x000124db,0x00009493,0x00009493}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x000124db,0x000124db,0x0000a49b,0x00009493}, -   {0x00000000,0x00000000,0x0000924a,0x000124db, -    0x000126dc,0x000124db,0x0000a49b,0x00009493}, -   {0x00000000,0x00000000,0x0000924a,0x000124db, -    0x000126dc,0x000126dc,0x0000a49b,0x0000a49b}, -   {0x00000000,0x00000000,0x0000924a,0x000124db, -    0x000136e4,0x000126dc,0x000124db,0x0000a49b}, -   {0x00000000,0x00000000,0x00009492,0x000126db, -    0x000136e4,0x000126dc,0x000124db,0x0000a49b}, -   {0x00000000,0x00000000,0x00009492,0x000126db, -    0x0001b724,0x000136e4,0x000126dc,0x000124db}, -   {0x00000000,0x00000000,0x00009492,0x000126db, -    0x0001b724,0x000136e4,0x000126dc,0x000124db}, -   {0x00000000,0x00000000,0x0000a492,0x000136db, -    0x0001c924,0x0001b724,0x000136e4,0x000126dc}, -   {0x00000000,0x00000000,0x00000000,0x00000000, -    0x00000000,0x00000000,0x00000000,0x00000000} -  } - }, - { /* version 13 */ -  { /* version 13, passes 0 */ -   {0x00000000,0x00000000,0x00001249,0x00001249, -    0x00009252,0x00009292,0x00009493,0x00009493}, -   {0x00000000,0x00000000,0x00001249,0x00009493, -    0x0000a493,0x000124db,0x000126dc,0x00009493}, -   {0x00000000,0x00000000,0x00001249,0x0000a49b, -    0x0001249b,0x000126dc,0x000126dc,0x0000a49b}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x0001249b,0x000126dc,0x000136e4,0x0000a49b}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x000126dc,0x000136e4,0x0001b725,0x000124db}, -   {0x00000000,0x00000000,0x00009292,0x0000a49b, -    0x000136e4,0x0001b724,0x0001b725,0x000126dc}, -   {0x00000000,0x00000000,0x00009292,0x000124db, -    0x000136e4,0x0001b724,0x0001b725,0x000126dc}, -   {0x00000000,0x00000000,0x00009492,0x000124db, -    0x000136e4,0x0001b724,0x0001c96e,0x000136e4}, -   {0x00000000,0x00000000,0x00009492,0x000124db, -    0x000136e4,0x0001c92d,0x0001c96e,0x0001b724}, -   {0x00000000,0x00000000,0x0000a492,0x000124db, -    0x000136e4,0x0001c92d,0x0001c96e,0x0001b724}, -   {0x00000000,0x00000000,0x0000a492,0x000124db, -    0x0001b724,0x0001c92d,0x0001c96e,0x0001b925}, -   {0x00000000,0x00000000,0x0000a492,0x000126db, -    0x0001b724,0x0001c92d,0x00024b76,0x0001c92d}, -   {0x00000000,0x00000000,0x0000a492,0x000126db, -    0x0001b924,0x0001c92d,0x00024b76,0x0001c92d}, -   {0x00000000,0x00000000,0x0000a492,0x000126db, -    0x0001b924,0x0001c92d,0x00024b76,0x0002496e}, -   {0x00000000,0x00000000,0x00012492,0x000136db, -    0x00024924,0x00024b6d,0x0002ddb6,0x00025bbf}, -   {0x00000000,0x00000000,0x00000000,0x00000000, -    0x00000000,0x00000000,0x00000000,0x00000000} -  }, -  { /* version 13, passes 1 */ -   {0x00000000,0x00000000,0x00001249,0x00001249, -    0x0000124a,0x0000124a,0x00001252,0x00001252}, -   {0x00000000,0x00000000,0x0000924a,0x00009493, -    0x00009492,0x00009292,0x00001252,0x00001252}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x0000a493,0x0000a49b,0x00001252,0x00001252}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x0000a493,0x0000a49b,0x00009292,0x00009292}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x0000a493,0x0000a49b,0x00009292,0x00009292}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x000126dc,0x0000a49b,0x00009493,0x00009292}, -   {0x00000000,0x00000000,0x0000924a,0x000124db, -    0x000126dc,0x000124db,0x00009493,0x00009493}, -   {0x00000000,0x00000000,0x0000924a,0x000124db, -    0x000136e4,0x000124db,0x0000a49b,0x00009493}, -   {0x00000000,0x00000000,0x0000924a,0x000136db, -    0x0001b724,0x000124db,0x0000a49b,0x00009493}, -   {0x00000000,0x00000000,0x0000924a,0x000136db, -    0x0001b724,0x000126dc,0x0000a49b,0x0000a49b}, -   {0x00000000,0x00000000,0x00009292,0x000136db, -    0x0001b724,0x000126dc,0x000124db,0x0000a49b}, -   {0x00000000,0x00000000,0x00009492,0x000136db, -    0x0001b724,0x000126dc,0x000124db,0x0000a49b}, -   {0x00000000,0x00000000,0x0000a492,0x000136db, -    0x0001b724,0x000136e4,0x000126dc,0x000124db}, -   {0x00000000,0x00000000,0x0000a492,0x000136db, -    0x0001b724,0x000136e4,0x000126dc,0x000124db}, -   {0x00000000,0x00000000,0x00012492,0x0001b6db, -    0x0001c924,0x0001b724,0x000136e4,0x000126dc}, -   {0x00000000,0x00000000,0x00000000,0x00000000, -    0x00000000,0x00000000,0x00000000,0x00000000} -  } - }, - { /* version 14 */ -  { /* version 14, passes 0 */ -   {0x00000000,0x00000000,0x00001249,0x0000924a, -    0x00009292,0x00009493,0x00009493,0x00009493}, -   {0x00000000,0x00000000,0x00001249,0x0000a49b, -    0x0000a493,0x000124db,0x000126dc,0x00009493}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x0001249b,0x000126dc,0x000136e4,0x0000a49b}, -   {0x00000000,0x00000000,0x0000924a,0x000124db, -    0x000126dc,0x000136e4,0x0001b725,0x000124db}, -   {0x00000000,0x00000000,0x00009292,0x000124db, -    0x000126dc,0x0001b724,0x0001b92d,0x000126dc}, -   {0x00000000,0x00000000,0x00009492,0x000124db, -    0x000136e4,0x0001b724,0x0001b92d,0x000126dc}, -   {0x00000000,0x00000000,0x00009492,0x000124db, -    0x000136e4,0x0001c92d,0x0001c96e,0x000136e4}, -   {0x00000000,0x00000000,0x00009492,0x000124db, -    0x0001b724,0x0001c92d,0x0001c96e,0x0001b724}, -   {0x00000000,0x00000000,0x0000a492,0x000124db, -    0x0001b724,0x0001c92d,0x00024b76,0x0001b925}, -   {0x00000000,0x00000000,0x0000a492,0x000126db, -    0x0001b724,0x0001c92d,0x00024b76,0x0001c92d}, -   {0x00000000,0x00000000,0x0000a492,0x000126db, -    0x0001b724,0x0001c92d,0x00024b76,0x0001c92d}, -   {0x00000000,0x00000000,0x0000a492,0x000136db, -    0x0001b724,0x0001c92d,0x00024b76,0x0002496e}, -   {0x00000000,0x00000000,0x0000a492,0x000136db, -    0x0001b924,0x0002496d,0x00024b76,0x00024b77}, -   {0x00000000,0x00000000,0x0000a492,0x000136db, -    0x0001b924,0x00024b6d,0x0002ddb6,0x00025bbf}, -   {0x00000000,0x00000000,0x00012492,0x0001b6db, -    0x00024924,0x0002db6d,0x00036db6,0x0002efff}, -   {0x00000000,0x00000000,0x00000000,0x00000000, -    0x00000000,0x00000000,0x00000000,0x00000000} -  }, -  { /* version 14, passes 1 */ -   {0x00000000,0x00000000,0x00001249,0x00001249, -    0x0000124a,0x0000124a,0x00001252,0x00001252}, -   {0x00000000,0x00000000,0x0000924a,0x00009493, -    0x0000a493,0x00009292,0x00001252,0x00001252}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x0000a493,0x0000a49b,0x00001252,0x00001252}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x0001249b,0x000136e4,0x00009292,0x00009292}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x0001249b,0x000136e4,0x00009292,0x00009292}, -   {0x00000000,0x00000000,0x0000924a,0x000124db, -    0x000136e4,0x000136e4,0x00009493,0x00009292}, -   {0x00000000,0x00000000,0x00009492,0x000136db, -    0x0001b724,0x000136e4,0x00009493,0x00009493}, -   {0x00000000,0x00000000,0x00009492,0x000136db, -    0x0001b724,0x000136e4,0x0000a49b,0x00009493}, -   {0x00000000,0x00000000,0x00009492,0x000136db, -    0x0001b724,0x000136e4,0x0000a49b,0x00009493}, -   {0x00000000,0x00000000,0x00009492,0x000136db, -    0x0001b724,0x000136e4,0x0000a49b,0x0000a49b}, -   {0x00000000,0x00000000,0x0000a492,0x000136db, -    0x0001b724,0x000136e4,0x000124db,0x0000a49b}, -   {0x00000000,0x00000000,0x0000a492,0x000136db, -    0x0001b724,0x000136e4,0x000124db,0x0000a49b}, -   {0x00000000,0x00000000,0x0000a492,0x000136db, -    0x0001b724,0x000136e4,0x000126dc,0x000124db}, -   {0x00000000,0x00000000,0x0000a492,0x000136db, -    0x0001b724,0x000136e4,0x000126dc,0x000124db}, -   {0x00000000,0x00000000,0x00012492,0x0001b6db, -    0x0001c924,0x0001b724,0x000136e4,0x000126dc}, -   {0x00000000,0x00000000,0x00000000,0x00000000, -    0x00000000,0x00000000,0x00000000,0x00000000} -  } - }, - { /* version 15 */ -  { /* version 15, passes 0 */ -   {0x00000000,0x00000000,0x00001249,0x00009493, -    0x0000a493,0x0000a49b,0x000124db,0x000124db}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x0001249b,0x000126dc,0x000136e4,0x000124db}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x000126dc,0x0001b724,0x0001b725,0x000126dc}, -   {0x00000000,0x00000000,0x0000924a,0x000124db, -    0x000136e4,0x0001b724,0x0001b92d,0x000126dc}, -   {0x00000000,0x00000000,0x00009492,0x000124db, -    0x000136e4,0x0001b925,0x0001c96e,0x000136e4}, -   {0x00000000,0x00000000,0x00009492,0x000124db, -    0x0001b724,0x0001c92d,0x0001c96e,0x0001b724}, -   {0x00000000,0x00000000,0x0000a492,0x000124db, -    0x0001b724,0x0001c92d,0x0001c96e,0x0001b724}, -   {0x00000000,0x00000000,0x0000a492,0x000126db, -    0x0001b724,0x0001c92d,0x0001c96e,0x0001b925}, -   {0x00000000,0x00000000,0x0000a492,0x000126db, -    0x0001b924,0x0001c92d,0x00024b76,0x0001c92d}, -   {0x00000000,0x00000000,0x0000a492,0x000136db, -    0x0001b924,0x0001c92d,0x00024b76,0x0001c92d}, -   {0x00000000,0x00000000,0x0000a492,0x000136db, -    0x0001b924,0x0002496d,0x00024b76,0x0002496e}, -   {0x00000000,0x00000000,0x0000a492,0x000136db, -    0x0001c924,0x0002496d,0x00025bb6,0x00024b77}, -   {0x00000000,0x00000000,0x0000a492,0x000136db, -    0x0001c924,0x00024b6d,0x00025bb6,0x00024b77}, -   {0x00000000,0x00000000,0x00012492,0x000136db, -    0x0001c924,0x00024b6d,0x0002ddb6,0x00025bbf}, -   {0x00000000,0x00000000,0x00012492,0x0001b6db, -    0x00024924,0x0002db6d,0x00036db6,0x0002efff}, -   {0x00000000,0x00000000,0x00000000,0x00000000, -    0x00000000,0x00000000,0x00000000,0x00000000} -  }, -  { /* version 15, passes 1 */ -   {0x00000000,0x00000000,0x0000924a,0x0000924a, -    0x00009292,0x00009292,0x00009292,0x00009292}, -   {0x00000000,0x00000000,0x0000924a,0x0000a49b, -    0x0000a493,0x000124db,0x00009292,0x00009292}, -   {0x00000000,0x00000000,0x0000924a,0x000124db, -    0x000124db,0x0001b724,0x00009493,0x00009493}, -   {0x00000000,0x00000000,0x0000924a,0x000124db, -    0x000126dc,0x0001b724,0x00009493,0x00009493}, -   {0x00000000,0x00000000,0x0000924a,0x000124db, -    0x000136e4,0x0001b724,0x0000a49b,0x0000a49b}, -   {0x00000000,0x00000000,0x00009292,0x000136db, -    0x0001b724,0x0001b724,0x0000a49b,0x0000a49b}, -   {0x00000000,0x00000000,0x00009492,0x000136db, -    0x0001c924,0x0001b724,0x000124db,0x000124db}, -   {0x00000000,0x00000000,0x00009492,0x000136db, -    0x0001c924,0x0001b724,0x000124db,0x000124db}, -   {0x00000000,0x00000000,0x0000a492,0x000136db, -    0x0001c924,0x0001b724,0x000126dc,0x000126dc}, -   {0x00000000,0x00000000,0x0000a492,0x000136db, -    0x0001c924,0x0001b925,0x000126dc,0x000126dc}, -   {0x00000000,0x00000000,0x0000a492,0x000136db, -    0x0001c924,0x0001b925,0x000136e4,0x000136e4}, -   {0x00000000,0x00000000,0x0000a492,0x000136db, -    0x0001c924,0x0001b925,0x000136e4,0x000136e4}, -   {0x00000000,0x00000000,0x0000a492,0x000136db, -    0x0001c924,0x0001b925,0x0001b725,0x0001b724}, -   {0x00000000,0x00000000,0x00012492,0x000136db, -    0x0001c924,0x0001b925,0x0001b725,0x0001b724}, -   {0x00000000,0x00000000,0x00012492,0x0001b6db, -    0x00024924,0x0002496d,0x0001b92d,0x0001b925}, -   {0x00000000,0x00000000,0x00000000,0x00000000, -    0x00000000,0x00000000,0x00000000,0x00000000} -  } - } -}; diff --git a/drivers/media/video/pwc/pwc-timon.h b/drivers/media/video/pwc/pwc-timon.h deleted file mode 100644 index a6e22224c95..00000000000 --- a/drivers/media/video/pwc/pwc-timon.h +++ /dev/null @@ -1,63 +0,0 @@ -/* Linux driver for Philips webcam -   (C) 2004-2006 Luc Saillard (luc@saillard.org) - -   NOTE: this version of pwc is an unofficial (modified) release of pwc & pcwx -   driver and thus may have bugs that are not present in the original version. -   Please send bug reports and support requests to <luc@saillard.org>. -   The decompression routines have been implemented by reverse-engineering the -   Nemosoft binary pwcx module. Caveat emptor. - -   This program is free software; you can redistribute it and/or modify -   it under the terms of the GNU General Public License as published by -   the Free Software Foundation; either version 2 of the License, or -   (at your option) any later version. - -   This program is distributed in the hope that it will be useful, -   but WITHOUT ANY WARRANTY; without even the implied warranty of -   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the -   GNU General Public License for more details. - -   You should have received a copy of the GNU General Public License -   along with this program; if not, write to the Free Software -   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA -*/ - - - -/* This tables contains entries for the 675/680/690 (Timon) camera, with -   4 different qualities (no compression, low, medium, high). -   It lists the bandwidth requirements for said mode by its alternate interface -   number. An alternate of 0 means that the mode is unavailable. - -   There are 6 * 4 * 4 entries: -     6 different resolutions subqcif, qsif, qcif, sif, cif, vga -     6 framerates: 5, 10, 15, 20, 25, 30 -     4 compression modi: none, low, medium, high - -   When an uncompressed mode is not available, the next available compressed mode -   will be chosen (unless the decompressor is absent). Sometimes there are only -   1 or 2 compressed modes available; in that case entries are duplicated. -*/ - -#ifndef PWC_TIMON_H -#define PWC_TIMON_H - -#include <media/pwc-ioctl.h> - -#define PWC_FPS_MAX_TIMON 6 - -struct Timon_table_entry -{ -	char alternate;			/* USB alternate interface */ -	unsigned short packetsize;	/* Normal packet size */ -	unsigned short bandlength;	/* Bandlength when decompressing */ -	unsigned char mode[13];		/* precomputed mode settings for cam */ -}; - -extern const struct Timon_table_entry Timon_table[PSZ_MAX][PWC_FPS_MAX_TIMON][4]; -extern const unsigned int TimonRomTable [16][2][16][8]; -extern const unsigned int Timon_fps_vector[PWC_FPS_MAX_TIMON]; - -#endif - - diff --git a/drivers/media/video/pwc/pwc-uncompress.c b/drivers/media/video/pwc/pwc-uncompress.c deleted file mode 100644 index 3b73f295f03..00000000000 --- a/drivers/media/video/pwc/pwc-uncompress.c +++ /dev/null @@ -1,138 +0,0 @@ -/* Linux driver for Philips webcam -   Decompression frontend. -   (C) 1999-2003 Nemosoft Unv. -   (C) 2004-2006 Luc Saillard (luc@saillard.org) - -   NOTE: this version of pwc is an unofficial (modified) release of pwc & pcwx -   driver and thus may have bugs that are not present in the original version. -   Please send bug reports and support requests to <luc@saillard.org>. -   The decompression routines have been implemented by reverse-engineering the -   Nemosoft binary pwcx module. Caveat emptor. - -   This program is free software; you can redistribute it and/or modify -   it under the terms of the GNU General Public License as published by -   the Free Software Foundation; either version 2 of the License, or -   (at your option) any later version. - -   This program is distributed in the hope that it will be useful, -   but WITHOUT ANY WARRANTY; without even the implied warranty of -   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the -   GNU General Public License for more details. - -   You should have received a copy of the GNU General Public License -   along with this program; if not, write to the Free Software -   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA - -   vim: set ts=8: -*/ - -#include <asm/current.h> -#include <asm/types.h> - -#include "pwc.h" -#include "pwc-uncompress.h" -#include "pwc-dec1.h" -#include "pwc-dec23.h" - -int pwc_decompress(struct pwc_device *pdev) -{ -	struct pwc_frame_buf *fbuf; -	int n, line, col, stride; -	void *yuv, *image; -	u16 *src; -	u16 *dsty, *dstu, *dstv; - -	if (pdev == NULL) -		return -EFAULT; - -	fbuf = pdev->read_frame; -	if (fbuf == NULL) -		return -EFAULT; -	image  = pdev->image_data; -	image += pdev->images[pdev->fill_image].offset; - -	yuv = fbuf->data + pdev->frame_header_size;  /* Skip header */ - -	/* Raw format; that's easy... */ -	if (pdev->pixfmt != V4L2_PIX_FMT_YUV420) -	{ -		struct pwc_raw_frame *raw_frame = image; -		raw_frame->type = cpu_to_le16(pdev->type); -		raw_frame->vbandlength = cpu_to_le16(pdev->vbandlength); -			/* cmd_buf is always 4 bytes, but sometimes, only the -			 * first 3 bytes is filled (Nala case). We can -			 * determine this using the type of the webcam */ -		memcpy(raw_frame->cmd, pdev->cmd_buf, 4); -		memcpy(raw_frame+1, yuv, pdev->frame_size); -		return 0; -	} - -	if (pdev->vbandlength == 0) { -		/* Uncompressed mode. -		 * We copy the data into the output buffer, using the viewport -		 * size (which may be larger than the image size). -		 * Unfortunately we have to do a bit of byte stuffing to get -		 * the desired output format/size. -		 * -		 * We do some byte shuffling here to go from the -		 * native format to YUV420P. -		 */ -		src = (u16 *)yuv; -		n = pdev->view.x * pdev->view.y; - -		/* offset in Y plane */ -		stride = pdev->view.x * pdev->offset.y + pdev->offset.x; -		dsty = (u16 *)(image + stride); - -		/* offsets in U/V planes */ -		stride = pdev->view.x * pdev->offset.y / 4 + pdev->offset.x / 2; -		dstu = (u16 *)(image + n +         stride); -		dstv = (u16 *)(image + n + n / 4 + stride); - -		/* increment after each line */ -		stride = (pdev->view.x - pdev->image.x) / 2; /* u16 is 2 bytes */ - -		for (line = 0; line < pdev->image.y; line++) { -			for (col = 0; col < pdev->image.x; col += 4) { -				*dsty++ = *src++; -				*dsty++ = *src++; -				if (line & 1) -					*dstv++ = *src++; -				else -					*dstu++ = *src++; -			} -			dsty += stride; -			if (line & 1) -				dstv += (stride >> 1); -			else -				dstu += (stride >> 1); -		} - -		return 0; -	} - -	/* -	 * Compressed; -	 * the decompressor routines will write the data in planar format -	 * immediately. -	 */ -	if (pdev->vsize == PSZ_VGA && pdev->vframes == 5 && pdev->vsnapshot) { -		PWC_ERROR("Mode Bayer is not supported for now\n"); -		/* flags |= PWCX_FLAG_BAYER; */ -		return -ENXIO; /* No such device or address: missing decompressor */ -	} - -	if (DEVICE_USE_CODEC1(pdev->type)) { - -		/* TODO & FIXME */ -		PWC_ERROR("This chipset is not supported for now\n"); -		return -ENXIO; /* No such device or address: missing decompressor */ - -	} else { -		pwc_dec23_decompress(pdev, yuv, image, PWCX_FLAG_PLANAR); -	} -	return 0; -} - - -/* vim: set cino= formatoptions=croql cindent shiftwidth=8 tabstop=8: */ diff --git a/drivers/media/video/pwc/pwc-uncompress.h b/drivers/media/video/pwc/pwc-uncompress.h deleted file mode 100644 index 43028e74e9e..00000000000 --- a/drivers/media/video/pwc/pwc-uncompress.h +++ /dev/null @@ -1,40 +0,0 @@ -/* (C) 1999-2003 Nemosoft Unv. -   (C) 2004-2006 Luc Saillard (luc@saillard.org) - -   NOTE: this version of pwc is an unofficial (modified) release of pwc & pcwx -   driver and thus may have bugs that are not present in the original version. -   Please send bug reports and support requests to <luc@saillard.org>. -   The decompression routines have been implemented by reverse-engineering the -   Nemosoft binary pwcx module. Caveat emptor. - -   This program is free software; you can redistribute it and/or modify -   it under the terms of the GNU General Public License as published by -   the Free Software Foundation; either version 2 of the License, or -   (at your option) any later version. - -   This program is distributed in the hope that it will be useful, -   but WITHOUT ANY WARRANTY; without even the implied warranty of -   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the -   GNU General Public License for more details. - -   You should have received a copy of the GNU General Public License -   along with this program; if not, write to the Free Software -   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA -*/ - -/* This file is the bridge between the kernel module and the plugin; it -   describes the structures and datatypes used in both modules. Any -   significant change should be reflected by increasing the -   pwc_decompressor_version major number. - */ -#ifndef PWC_UNCOMPRESS_H -#define PWC_UNCOMPRESS_H - - -#include <media/pwc-ioctl.h> - -/* from pwc-dec.h */ -#define PWCX_FLAG_PLANAR        0x0001 -/* */ - -#endif diff --git a/drivers/media/video/pwc/pwc-v4l.c b/drivers/media/video/pwc/pwc-v4l.c deleted file mode 100644 index 7061a03f5cf..00000000000 --- a/drivers/media/video/pwc/pwc-v4l.c +++ /dev/null @@ -1,960 +0,0 @@ -/* Linux driver for Philips webcam -   USB and Video4Linux interface part. -   (C) 1999-2004 Nemosoft Unv. -   (C) 2004-2006 Luc Saillard (luc@saillard.org) - -   NOTE: this version of pwc is an unofficial (modified) release of pwc & pcwx -   driver and thus may have bugs that are not present in the original version. -   Please send bug reports and support requests to <luc@saillard.org>. -   The decompression routines have been implemented by reverse-engineering the -   Nemosoft binary pwcx module. Caveat emptor. - -   This program is free software; you can redistribute it and/or modify -   it under the terms of the GNU General Public License as published by -   the Free Software Foundation; either version 2 of the License, or -   (at your option) any later version. - -   This program is distributed in the hope that it will be useful, -   but WITHOUT ANY WARRANTY; without even the implied warranty of -   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the -   GNU General Public License for more details. - -   You should have received a copy of the GNU General Public License -   along with this program; if not, write to the Free Software -   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA - -*/ - -#include <linux/errno.h> -#include <linux/init.h> -#include <linux/mm.h> -#include <linux/module.h> -#include <linux/poll.h> -#include <linux/vmalloc.h> -#include <asm/io.h> - -#include "pwc.h" - -static struct v4l2_queryctrl pwc_controls[] = { -	{ -	    .id      = V4L2_CID_BRIGHTNESS, -	    .type    = V4L2_CTRL_TYPE_INTEGER, -	    .name    = "Brightness", -	    .minimum = 0, -	    .maximum = 128, -	    .step    = 1, -	    .default_value = 64, -	}, -	{ -	    .id      = V4L2_CID_CONTRAST, -	    .type    = V4L2_CTRL_TYPE_INTEGER, -	    .name    = "Contrast", -	    .minimum = 0, -	    .maximum = 64, -	    .step    = 1, -	    .default_value = 0, -	}, -	{ -	    .id      = V4L2_CID_SATURATION, -	    .type    = V4L2_CTRL_TYPE_INTEGER, -	    .name    = "Saturation", -	    .minimum = -100, -	    .maximum = 100, -	    .step    = 1, -	    .default_value = 0, -	}, -	{ -	    .id      = V4L2_CID_GAMMA, -	    .type    = V4L2_CTRL_TYPE_INTEGER, -	    .name    = "Gamma", -	    .minimum = 0, -	    .maximum = 32, -	    .step    = 1, -	    .default_value = 0, -	}, -	{ -	    .id      = V4L2_CID_RED_BALANCE, -	    .type    = V4L2_CTRL_TYPE_INTEGER, -	    .name    = "Red Gain", -	    .minimum = 0, -	    .maximum = 256, -	    .step    = 1, -	    .default_value = 0, -	}, -	{ -	    .id      = V4L2_CID_BLUE_BALANCE, -	    .type    = V4L2_CTRL_TYPE_INTEGER, -	    .name    = "Blue Gain", -	    .minimum = 0, -	    .maximum = 256, -	    .step    = 1, -	    .default_value = 0, -	}, -	{ -	    .id      = V4L2_CID_AUTO_WHITE_BALANCE, -	    .type    = V4L2_CTRL_TYPE_BOOLEAN, -	    .name    = "Auto White Balance", -	    .minimum = 0, -	    .maximum = 1, -	    .step    = 1, -	    .default_value = 0, -	}, -	{ -	    .id      = V4L2_CID_EXPOSURE, -	    .type    = V4L2_CTRL_TYPE_INTEGER, -	    .name    = "Shutter Speed (Exposure)", -	    .minimum = 0, -	    .maximum = 256, -	    .step    = 1, -	    .default_value = 200, -	}, -	{ -	    .id      = V4L2_CID_AUTOGAIN, -	    .type    = V4L2_CTRL_TYPE_BOOLEAN, -	    .name    = "Auto Gain Enabled", -	    .minimum = 0, -	    .maximum = 1, -	    .step    = 1, -	    .default_value = 1, -	}, -	{ -	    .id      = V4L2_CID_GAIN, -	    .type    = V4L2_CTRL_TYPE_INTEGER, -	    .name    = "Gain Level", -	    .minimum = 0, -	    .maximum = 256, -	    .step    = 1, -	    .default_value = 0, -	}, -	{ -	    .id      = V4L2_CID_PRIVATE_SAVE_USER, -	    .type    = V4L2_CTRL_TYPE_BUTTON, -	    .name    = "Save User Settings", -	    .minimum = 0, -	    .maximum = 0, -	    .step    = 0, -	    .default_value = 0, -	}, -	{ -	    .id      = V4L2_CID_PRIVATE_RESTORE_USER, -	    .type    = V4L2_CTRL_TYPE_BUTTON, -	    .name    = "Restore User Settings", -	    .minimum = 0, -	    .maximum = 0, -	    .step    = 0, -	    .default_value = 0, -	}, -	{ -	    .id      = V4L2_CID_PRIVATE_RESTORE_FACTORY, -	    .type    = V4L2_CTRL_TYPE_BUTTON, -	    .name    = "Restore Factory Settings", -	    .minimum = 0, -	    .maximum = 0, -	    .step    = 0, -	    .default_value = 0, -	}, -	{ -	    .id      = V4L2_CID_PRIVATE_COLOUR_MODE, -	    .type    = V4L2_CTRL_TYPE_BOOLEAN, -	    .name    = "Colour mode", -	    .minimum = 0, -	    .maximum = 1, -	    .step    = 1, -	    .default_value = 0, -	}, -	{ -	    .id      = V4L2_CID_PRIVATE_AUTOCONTOUR, -	    .type    = V4L2_CTRL_TYPE_BOOLEAN, -	    .name    = "Auto contour", -	    .minimum = 0, -	    .maximum = 1, -	    .step    = 1, -	    .default_value = 0, -	}, -	{ -	    .id      = V4L2_CID_PRIVATE_CONTOUR, -	    .type    = V4L2_CTRL_TYPE_INTEGER, -	    .name    = "Contour", -	    .minimum = 0, -	    .maximum = 63, -	    .step    = 1, -	    .default_value = 0, -	}, -	{ -	    .id      = V4L2_CID_PRIVATE_BACKLIGHT, -	    .type    = V4L2_CTRL_TYPE_BOOLEAN, -	    .name    = "Backlight compensation", -	    .minimum = 0, -	    .maximum = 1, -	    .step    = 1, -	    .default_value = 0, -	}, -	{ -	  .id      = V4L2_CID_PRIVATE_FLICKERLESS, -	    .type    = V4L2_CTRL_TYPE_BOOLEAN, -	    .name    = "Flickerless", -	    .minimum = 0, -	    .maximum = 1, -	    .step    = 1, -	    .default_value = 0, -	}, -	{ -	    .id      = V4L2_CID_PRIVATE_NOISE_REDUCTION, -	    .type    = V4L2_CTRL_TYPE_INTEGER, -	    .name    = "Noise reduction", -	    .minimum = 0, -	    .maximum = 3, -	    .step    = 1, -	    .default_value = 0, -	}, -}; - - -static void pwc_vidioc_fill_fmt(const struct pwc_device *pdev, struct v4l2_format *f) -{ -	memset(&f->fmt.pix, 0, sizeof(struct v4l2_pix_format)); -	f->fmt.pix.width        = pdev->view.x; -	f->fmt.pix.height       = pdev->view.y; -	f->fmt.pix.field        = V4L2_FIELD_NONE; -	if (pdev->pixfmt == V4L2_PIX_FMT_YUV420) { -		f->fmt.pix.pixelformat  = V4L2_PIX_FMT_YUV420; -		f->fmt.pix.bytesperline = (f->fmt.pix.width * 3)/2; -		f->fmt.pix.sizeimage = f->fmt.pix.height * f->fmt.pix.bytesperline; -	} else { -		/* vbandlength contains 4 lines ...  */ -		f->fmt.pix.bytesperline = pdev->vbandlength/4; -		f->fmt.pix.sizeimage = pdev->frame_size + sizeof(struct pwc_raw_frame); -		if (DEVICE_USE_CODEC1(pdev->type)) -			f->fmt.pix.pixelformat  = V4L2_PIX_FMT_PWC1; -		else -			f->fmt.pix.pixelformat  = V4L2_PIX_FMT_PWC2; -	} -	PWC_DEBUG_IOCTL("pwc_vidioc_fill_fmt() " -			"width=%d, height=%d, bytesperline=%d, sizeimage=%d, pixelformat=%c%c%c%c\n", -			f->fmt.pix.width, -			f->fmt.pix.height, -			f->fmt.pix.bytesperline, -			f->fmt.pix.sizeimage, -			(f->fmt.pix.pixelformat)&255, -			(f->fmt.pix.pixelformat>>8)&255, -			(f->fmt.pix.pixelformat>>16)&255, -			(f->fmt.pix.pixelformat>>24)&255); -} - -/* ioctl(VIDIOC_TRY_FMT) */ -static int pwc_vidioc_try_fmt(struct pwc_device *pdev, struct v4l2_format *f) -{ -	if (f->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) { -		PWC_DEBUG_IOCTL("Bad video type must be V4L2_BUF_TYPE_VIDEO_CAPTURE\n"); -		return -EINVAL; -	} - -	switch (f->fmt.pix.pixelformat) { -		case V4L2_PIX_FMT_YUV420: -			break; -		case V4L2_PIX_FMT_PWC1: -			if (DEVICE_USE_CODEC23(pdev->type)) { -				PWC_DEBUG_IOCTL("codec1 is only supported for old pwc webcam\n"); -				return -EINVAL; -			} -			break; -		case V4L2_PIX_FMT_PWC2: -			if (DEVICE_USE_CODEC1(pdev->type)) { -				PWC_DEBUG_IOCTL("codec23 is only supported for new pwc webcam\n"); -				return -EINVAL; -			} -			break; -		default: -			PWC_DEBUG_IOCTL("Unsupported pixel format\n"); -			return -EINVAL; - -	} - -	if (f->fmt.pix.width > pdev->view_max.x) -		f->fmt.pix.width = pdev->view_max.x; -	else if (f->fmt.pix.width < pdev->view_min.x) -		f->fmt.pix.width = pdev->view_min.x; - -	if (f->fmt.pix.height > pdev->view_max.y) -		f->fmt.pix.height = pdev->view_max.y; -	else if (f->fmt.pix.height < pdev->view_min.y) -		f->fmt.pix.height = pdev->view_min.y; - -	return 0; -} - -/* ioctl(VIDIOC_SET_FMT) */ -static int pwc_vidioc_set_fmt(struct pwc_device *pdev, struct v4l2_format *f) -{ -	int ret, fps, snapshot, compression, pixelformat; - -	ret = pwc_vidioc_try_fmt(pdev, f); -	if (ret<0) -		return ret; - -	pixelformat = f->fmt.pix.pixelformat; -	compression = pdev->vcompression; -	snapshot = 0; -	fps = pdev->vframes; -	if (f->fmt.pix.priv) { -		compression = (f->fmt.pix.priv & PWC_QLT_MASK) >> PWC_QLT_SHIFT; -		snapshot = !!(f->fmt.pix.priv & PWC_FPS_SNAPSHOT); -		fps = (f->fmt.pix.priv & PWC_FPS_FRMASK) >> PWC_FPS_SHIFT; -		if (fps == 0) -			fps = pdev->vframes; -	} - -	if (pixelformat != V4L2_PIX_FMT_YUV420 && -	    pixelformat != V4L2_PIX_FMT_PWC1 && -	    pixelformat != V4L2_PIX_FMT_PWC2) -		return -EINVAL; - -	PWC_DEBUG_IOCTL("Try to change format to: width=%d height=%d fps=%d " -			"compression=%d snapshot=%d format=%c%c%c%c\n", -			f->fmt.pix.width, f->fmt.pix.height, fps, -			compression, snapshot, -			(pixelformat)&255, -			(pixelformat>>8)&255, -			(pixelformat>>16)&255, -			(pixelformat>>24)&255); - -	ret = pwc_try_video_mode(pdev, -				 f->fmt.pix.width, -				 f->fmt.pix.height, -				 fps, -				 compression, -				 snapshot); - -	PWC_DEBUG_IOCTL("pwc_try_video_mode(), return=%d\n", ret); - -	if (ret) -		return ret; - -	pdev->pixfmt = pixelformat; - -	pwc_vidioc_fill_fmt(pdev, f); - -	return 0; - -} - -long pwc_video_do_ioctl(struct file *file, unsigned int cmd, void *arg) -{ -	struct video_device *vdev = video_devdata(file); -	struct pwc_device *pdev; -	DECLARE_WAITQUEUE(wait, current); - -	if (vdev == NULL) -		return -EFAULT; -	pdev = video_get_drvdata(vdev); -	if (pdev == NULL) -		return -EFAULT; - -#ifdef CONFIG_USB_PWC_DEBUG -	if (PWC_DEBUG_LEVEL_IOCTL & pwc_trace) { -		v4l_printk_ioctl(cmd); -		printk("\n"); -	} -#endif - - -	switch (cmd) { -#ifdef CONFIG_VIDEO_V4L1_COMPAT -		/* mmap() functions */ -		case VIDIOCGMBUF: -		{ -			/* Tell the user program how much memory is needed for a mmap() */ -			struct video_mbuf *vm = arg; -			int i; - -			memset(vm, 0, sizeof(*vm)); -			vm->size = pwc_mbufs * pdev->len_per_image; -			vm->frames = pwc_mbufs; /* double buffering should be enough for most applications */ -			for (i = 0; i < pwc_mbufs; i++) -				vm->offsets[i] = i * pdev->len_per_image; -			break; -		} -#endif - -		/* V4L2 Layer */ -		case VIDIOC_QUERYCAP: -		{ -		    struct v4l2_capability *cap = arg; - -		    PWC_DEBUG_IOCTL("ioctl(VIDIOC_QUERYCAP) This application "\ -				       "try to use the v4l2 layer\n"); -		    strcpy(cap->driver,PWC_NAME); -		    strlcpy(cap->card, vdev->name, sizeof(cap->card)); -		    usb_make_path(pdev->udev,cap->bus_info,sizeof(cap->bus_info)); -		    cap->version = PWC_VERSION_CODE; -		    cap->capabilities = -			V4L2_CAP_VIDEO_CAPTURE	| -			V4L2_CAP_STREAMING	| -			V4L2_CAP_READWRITE; -		    return 0; -		} - -		case VIDIOC_ENUMINPUT: -		{ -		    struct v4l2_input *i = arg; - -		    if ( i->index )	/* Only one INPUT is supported */ -			  return -EINVAL; - -		    memset(i, 0, sizeof(struct v4l2_input)); -		    strcpy(i->name, "usb"); -		    return 0; -		} - -		case VIDIOC_G_INPUT: -		{ -		    int *i = arg; -		    *i = 0;	/* Only one INPUT is supported */ -		    return 0; -		} -		case VIDIOC_S_INPUT: -		{ -			int *i = arg; - -			if ( *i ) {	/* Only one INPUT is supported */ -				PWC_DEBUG_IOCTL("Only one input source is"\ -					" supported with this webcam.\n"); -				return -EINVAL; -			} -			return 0; -		} - -		/* TODO: */ -		case VIDIOC_QUERYCTRL: -		{ -			struct v4l2_queryctrl *c = arg; -			int i; - -			PWC_DEBUG_IOCTL("ioctl(VIDIOC_QUERYCTRL) query id=%d\n", c->id); -			for (i=0; i<sizeof(pwc_controls)/sizeof(struct v4l2_queryctrl); i++) { -				if (pwc_controls[i].id == c->id) { -					PWC_DEBUG_IOCTL("ioctl(VIDIOC_QUERYCTRL) found\n"); -					memcpy(c,&pwc_controls[i],sizeof(struct v4l2_queryctrl)); -					return 0; -				} -			} -			PWC_DEBUG_IOCTL("ioctl(VIDIOC_QUERYCTRL) not found\n"); - -			return -EINVAL; -		} -		case VIDIOC_G_CTRL: -		{ -			struct v4l2_control *c = arg; -			int ret; - -			switch (c->id) -			{ -				case V4L2_CID_BRIGHTNESS: -					c->value = pwc_get_brightness(pdev); -					if (c->value<0) -						return -EINVAL; -					return 0; -				case V4L2_CID_CONTRAST: -					c->value = pwc_get_contrast(pdev); -					if (c->value<0) -						return -EINVAL; -					return 0; -				case V4L2_CID_SATURATION: -					ret = pwc_get_saturation(pdev, &c->value); -					if (ret<0) -						return -EINVAL; -					return 0; -				case V4L2_CID_GAMMA: -					c->value = pwc_get_gamma(pdev); -					if (c->value<0) -						return -EINVAL; -					return 0; -				case V4L2_CID_RED_BALANCE: -					ret = pwc_get_red_gain(pdev, &c->value); -					if (ret<0) -						return -EINVAL; -					c->value >>= 8; -					return 0; -				case V4L2_CID_BLUE_BALANCE: -					ret = pwc_get_blue_gain(pdev, &c->value); -					if (ret<0) -						return -EINVAL; -					c->value >>= 8; -					return 0; -				case V4L2_CID_AUTO_WHITE_BALANCE: -					ret = pwc_get_awb(pdev); -					if (ret<0) -						return -EINVAL; -					c->value = (ret == PWC_WB_MANUAL)?0:1; -					return 0; -				case V4L2_CID_GAIN: -					ret = pwc_get_agc(pdev, &c->value); -					if (ret<0) -						return -EINVAL; -					c->value >>= 8; -					return 0; -				case V4L2_CID_AUTOGAIN: -					ret = pwc_get_agc(pdev, &c->value); -					if (ret<0) -						return -EINVAL; -					c->value = (c->value < 0)?1:0; -					return 0; -				case V4L2_CID_EXPOSURE: -					ret = pwc_get_shutter_speed(pdev, &c->value); -					if (ret<0) -						return -EINVAL; -					return 0; -				case V4L2_CID_PRIVATE_COLOUR_MODE: -					ret = pwc_get_colour_mode(pdev, &c->value); -					if (ret < 0) -						return -EINVAL; -					return 0; -				case V4L2_CID_PRIVATE_AUTOCONTOUR: -					ret = pwc_get_contour(pdev, &c->value); -					if (ret < 0) -						return -EINVAL; -					c->value=(c->value == -1?1:0); -					return 0; -				case V4L2_CID_PRIVATE_CONTOUR: -					ret = pwc_get_contour(pdev, &c->value); -					if (ret < 0) -						return -EINVAL; -					c->value >>= 10; -					return 0; -				case V4L2_CID_PRIVATE_BACKLIGHT: -					ret = pwc_get_backlight(pdev, &c->value); -					if (ret < 0) -						return -EINVAL; -					return 0; -				case V4L2_CID_PRIVATE_FLICKERLESS: -					ret = pwc_get_flicker(pdev, &c->value); -					if (ret < 0) -						return -EINVAL; -					c->value=(c->value?1:0); -					return 0; -				case V4L2_CID_PRIVATE_NOISE_REDUCTION: -					ret = pwc_get_dynamic_noise(pdev, &c->value); -					if (ret < 0) -						return -EINVAL; -					return 0; - -				case V4L2_CID_PRIVATE_SAVE_USER: -				case V4L2_CID_PRIVATE_RESTORE_USER: -				case V4L2_CID_PRIVATE_RESTORE_FACTORY: -					return -EINVAL; -			} -			return -EINVAL; -		} -		case VIDIOC_S_CTRL: -		{ -			struct v4l2_control *c = arg; -			int ret; - -			switch (c->id) -			{ -				case V4L2_CID_BRIGHTNESS: -					c->value <<= 9; -					ret = pwc_set_brightness(pdev, c->value); -					if (ret<0) -						return -EINVAL; -					return 0; -				case V4L2_CID_CONTRAST: -					c->value <<= 10; -					ret = pwc_set_contrast(pdev, c->value); -					if (ret<0) -						return -EINVAL; -					return 0; -				case V4L2_CID_SATURATION: -					ret = pwc_set_saturation(pdev, c->value); -					if (ret<0) -					  return -EINVAL; -					return 0; -				case V4L2_CID_GAMMA: -					c->value <<= 11; -					ret = pwc_set_gamma(pdev, c->value); -					if (ret<0) -						return -EINVAL; -					return 0; -				case V4L2_CID_RED_BALANCE: -					c->value <<= 8; -					ret = pwc_set_red_gain(pdev, c->value); -					if (ret<0) -						return -EINVAL; -					return 0; -				case V4L2_CID_BLUE_BALANCE: -					c->value <<= 8; -					ret = pwc_set_blue_gain(pdev, c->value); -					if (ret<0) -						return -EINVAL; -					return 0; -				case V4L2_CID_AUTO_WHITE_BALANCE: -					c->value = (c->value == 0)?PWC_WB_MANUAL:PWC_WB_AUTO; -					ret = pwc_set_awb(pdev, c->value); -					if (ret<0) -						return -EINVAL; -					return 0; -				case V4L2_CID_EXPOSURE: -					c->value <<= 8; -					ret = pwc_set_shutter_speed(pdev, c->value?0:1, c->value); -					if (ret<0) -						return -EINVAL; -					return 0; -				case V4L2_CID_AUTOGAIN: -					/* autogain off means nothing without a gain */ -					if (c->value == 0) -						return 0; -					ret = pwc_set_agc(pdev, c->value, 0); -					if (ret<0) -						return -EINVAL; -					return 0; -				case V4L2_CID_GAIN: -					c->value <<= 8; -					ret = pwc_set_agc(pdev, 0, c->value); -					if (ret<0) -						return -EINVAL; -					return 0; -				case V4L2_CID_PRIVATE_SAVE_USER: -					if (pwc_save_user(pdev)) -						return -EINVAL; -					return 0; -				case V4L2_CID_PRIVATE_RESTORE_USER: -					if (pwc_restore_user(pdev)) -						return -EINVAL; -					return 0; -				case V4L2_CID_PRIVATE_RESTORE_FACTORY: -					if (pwc_restore_factory(pdev)) -						return -EINVAL; -					return 0; -				case V4L2_CID_PRIVATE_COLOUR_MODE: -					ret = pwc_set_colour_mode(pdev, c->value); -					if (ret < 0) -					  return -EINVAL; -					return 0; -				case V4L2_CID_PRIVATE_AUTOCONTOUR: -				  c->value=(c->value == 1)?-1:0; -				  ret = pwc_set_contour(pdev, c->value); -				  if (ret < 0) -				    return -EINVAL; -				  return 0; -				case V4L2_CID_PRIVATE_CONTOUR: -				  c->value <<= 10; -				  ret = pwc_set_contour(pdev, c->value); -				  if (ret < 0) -				    return -EINVAL; -				  return 0; -				case V4L2_CID_PRIVATE_BACKLIGHT: -				  ret = pwc_set_backlight(pdev, c->value); -				  if (ret < 0) -				    return -EINVAL; -				  return 0; -				case V4L2_CID_PRIVATE_FLICKERLESS: -				  ret = pwc_set_flicker(pdev, c->value); -				  if (ret < 0) -				    return -EINVAL; -				case V4L2_CID_PRIVATE_NOISE_REDUCTION: -				  ret = pwc_set_dynamic_noise(pdev, c->value); -				  if (ret < 0) -				    return -EINVAL; -				  return 0; - -			} -			return -EINVAL; -		} - -		case VIDIOC_ENUM_FMT: -		{ -			struct v4l2_fmtdesc *f = arg; -			int index; - -			if (f->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) -			      return -EINVAL; - -			/* We only support two format: the raw format, and YUV */ -			index = f->index; -			memset(f,0,sizeof(struct v4l2_fmtdesc)); -			f->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; -			f->index = index; -			switch(index) -			{ -				case 0: -					/* RAW format */ -					f->pixelformat = pdev->type<=646?V4L2_PIX_FMT_PWC1:V4L2_PIX_FMT_PWC2; -					f->flags = V4L2_FMT_FLAG_COMPRESSED; -					strlcpy(f->description,"Raw Philips Webcam",sizeof(f->description)); -					break; -				case 1: -					f->pixelformat = V4L2_PIX_FMT_YUV420; -					strlcpy(f->description,"4:2:0, planar, Y-Cb-Cr",sizeof(f->description)); -					break; -				default: -					return -EINVAL; -			} -			return 0; -		} - -		case VIDIOC_G_FMT: -		{ -			struct v4l2_format *f = arg; - -			PWC_DEBUG_IOCTL("ioctl(VIDIOC_G_FMT) return size %dx%d\n",pdev->image.x,pdev->image.y); -			if (f->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) -			      return -EINVAL; - -			pwc_vidioc_fill_fmt(pdev, f); - -			return 0; -		} - -		case VIDIOC_TRY_FMT: -			return pwc_vidioc_try_fmt(pdev, arg); - -		case VIDIOC_S_FMT: -			return pwc_vidioc_set_fmt(pdev, arg); - -		case VIDIOC_G_STD: -		{ -			v4l2_std_id *std = arg; -			*std = V4L2_STD_UNKNOWN; -			return 0; -		} - -		case VIDIOC_S_STD: -		{ -			v4l2_std_id *std = arg; -			if (*std != V4L2_STD_UNKNOWN) -				return -EINVAL; -			return 0; -		} - -		case VIDIOC_ENUMSTD: -		{ -			struct v4l2_standard *std = arg; -			if (std->index != 0) -				return -EINVAL; -			std->id = V4L2_STD_UNKNOWN; -			strlcpy(std->name, "webcam", sizeof(std->name)); -			return 0; -		} - -		case VIDIOC_REQBUFS: -		{ -			struct v4l2_requestbuffers *rb = arg; -			int nbuffers; - -			PWC_DEBUG_IOCTL("ioctl(VIDIOC_REQBUFS) count=%d\n",rb->count); -			if (rb->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) -				return -EINVAL; -			if (rb->memory != V4L2_MEMORY_MMAP) -				return -EINVAL; - -			nbuffers = rb->count; -			if (nbuffers < 2) -				nbuffers = 2; -			else if (nbuffers > pwc_mbufs) -				nbuffers = pwc_mbufs; -			/* Force to use our # of buffers */ -			rb->count = pwc_mbufs; -			return 0; -		} - -		case VIDIOC_QUERYBUF: -		{ -			struct v4l2_buffer *buf = arg; -			int index; - -			PWC_DEBUG_IOCTL("ioctl(VIDIOC_QUERYBUF) index=%d\n",buf->index); -			if (buf->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) { -				PWC_DEBUG_IOCTL("ioctl(VIDIOC_QUERYBUF) Bad type\n"); -				return -EINVAL; -			} -			if (buf->memory != V4L2_MEMORY_MMAP) { -				PWC_DEBUG_IOCTL("ioctl(VIDIOC_QUERYBUF) Bad memory type\n"); -				return -EINVAL; -			} -			index = buf->index; -			if (index < 0 || index >= pwc_mbufs) { -				PWC_DEBUG_IOCTL("ioctl(VIDIOC_QUERYBUF) Bad index %d\n", buf->index); -				return -EINVAL; -			} - -			memset(buf, 0, sizeof(struct v4l2_buffer)); -			buf->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; -			buf->index = index; -			buf->m.offset = index * pdev->len_per_image; -			if (pdev->pixfmt != V4L2_PIX_FMT_YUV420) -				buf->bytesused = pdev->frame_size + sizeof(struct pwc_raw_frame); -			else -				buf->bytesused = pdev->view.size; -			buf->field = V4L2_FIELD_NONE; -			buf->memory = V4L2_MEMORY_MMAP; -			//buf->flags = V4L2_BUF_FLAG_MAPPED; -			buf->length = pdev->len_per_image; - -			PWC_DEBUG_READ("VIDIOC_QUERYBUF: index=%d\n",buf->index); -			PWC_DEBUG_READ("VIDIOC_QUERYBUF: m.offset=%d\n",buf->m.offset); -			PWC_DEBUG_READ("VIDIOC_QUERYBUF: bytesused=%d\n",buf->bytesused); - -			return 0; -		} - -		case VIDIOC_QBUF: -		{ -			struct v4l2_buffer *buf = arg; - -			PWC_DEBUG_IOCTL("ioctl(VIDIOC_QBUF) index=%d\n",buf->index); -			if (buf->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) -				return -EINVAL; -			if (buf->memory != V4L2_MEMORY_MMAP) -				return -EINVAL; -			if (buf->index >= pwc_mbufs) -				return -EINVAL; - -			buf->flags |= V4L2_BUF_FLAG_QUEUED; -			buf->flags &= ~V4L2_BUF_FLAG_DONE; - -			return 0; -		} - -		case VIDIOC_DQBUF: -		{ -			struct v4l2_buffer *buf = arg; -			int ret; - -			PWC_DEBUG_IOCTL("ioctl(VIDIOC_DQBUF)\n"); - -			if (buf->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) -				return -EINVAL; - -			/* Add ourselves to the frame wait-queue. - -			   FIXME: needs auditing for safety. -			   QUESTION: In what respect? I think that using the -				     frameq is safe now. -			 */ -			add_wait_queue(&pdev->frameq, &wait); -			while (pdev->full_frames == NULL) { -				if (pdev->error_status) { -					remove_wait_queue(&pdev->frameq, &wait); -					set_current_state(TASK_RUNNING); -					return -pdev->error_status; -				} - -				if (signal_pending(current)) { -					remove_wait_queue(&pdev->frameq, &wait); -					set_current_state(TASK_RUNNING); -					return -ERESTARTSYS; -				} -				schedule(); -				set_current_state(TASK_INTERRUPTIBLE); -			} -			remove_wait_queue(&pdev->frameq, &wait); -			set_current_state(TASK_RUNNING); - -			PWC_DEBUG_IOCTL("VIDIOC_DQBUF: frame ready.\n"); -			/* Decompress data in pdev->images[pdev->fill_image] */ -			ret = pwc_handle_frame(pdev); -			if (ret) -				return -EFAULT; -			PWC_DEBUG_IOCTL("VIDIOC_DQBUF: after pwc_handle_frame\n"); - -			buf->index = pdev->fill_image; -			if (pdev->pixfmt != V4L2_PIX_FMT_YUV420) -				buf->bytesused = pdev->frame_size + sizeof(struct pwc_raw_frame); -			else -				buf->bytesused = pdev->view.size; -			buf->flags = V4L2_BUF_FLAG_MAPPED; -			buf->field = V4L2_FIELD_NONE; -			do_gettimeofday(&buf->timestamp); -			buf->sequence = 0; -			buf->memory = V4L2_MEMORY_MMAP; -			buf->m.offset = pdev->fill_image * pdev->len_per_image; -			buf->length = pdev->len_per_image; -			pwc_next_image(pdev); - -			PWC_DEBUG_IOCTL("VIDIOC_DQBUF: buf->index=%d\n",buf->index); -			PWC_DEBUG_IOCTL("VIDIOC_DQBUF: buf->length=%d\n",buf->length); -			PWC_DEBUG_IOCTL("VIDIOC_DQBUF: m.offset=%d\n",buf->m.offset); -			PWC_DEBUG_IOCTL("VIDIOC_DQBUF: bytesused=%d\n",buf->bytesused); -			PWC_DEBUG_IOCTL("VIDIOC_DQBUF: leaving\n"); -			return 0; - -		} - -		case VIDIOC_STREAMON: -		{ -			/* WARNING: pwc_try_video_mode() called pwc_isoc_init */ -			pwc_isoc_init(pdev); -			return 0; -		} - -		case VIDIOC_STREAMOFF: -		{ -			pwc_isoc_cleanup(pdev); -			return 0; -		} - -		case VIDIOC_ENUM_FRAMESIZES: -		{ -			struct v4l2_frmsizeenum *fsize = arg; -			unsigned int i = 0, index = fsize->index; - -			if (fsize->pixel_format == V4L2_PIX_FMT_YUV420) { -				for (i = 0; i < PSZ_MAX; i++) { -					if (pdev->image_mask & (1UL << i)) { -						if (!index--) { -							fsize->type = V4L2_FRMSIZE_TYPE_DISCRETE; -							fsize->discrete.width = pwc_image_sizes[i].x; -							fsize->discrete.height = pwc_image_sizes[i].y; -							return 0; -						} -					} -				} -			} else if (fsize->index == 0 && -				   ((fsize->pixel_format == V4L2_PIX_FMT_PWC1 && DEVICE_USE_CODEC1(pdev->type)) || -				    (fsize->pixel_format == V4L2_PIX_FMT_PWC2 && DEVICE_USE_CODEC23(pdev->type)))) { - -				fsize->type = V4L2_FRMSIZE_TYPE_DISCRETE; -				fsize->discrete.width = pdev->abs_max.x; -				fsize->discrete.height = pdev->abs_max.y; -				return 0; -			} -			return -EINVAL; -		} - -		case VIDIOC_ENUM_FRAMEINTERVALS: -		{ -			struct v4l2_frmivalenum *fival = arg; -			int size = -1; -			unsigned int i; - -			for (i = 0; i < PSZ_MAX; i++) { -				if (pwc_image_sizes[i].x == fival->width && -				    pwc_image_sizes[i].y == fival->height) { -					size = i; -					break; -				} -			} - -			/* TODO: Support raw format */ -			if (size < 0 || fival->pixel_format != V4L2_PIX_FMT_YUV420) { -				return -EINVAL; -			} - -			i = pwc_get_fps(pdev, fival->index, size); -			if (!i) -				return -EINVAL; - -			fival->type = V4L2_FRMIVAL_TYPE_DISCRETE; -			fival->discrete.numerator = 1; -			fival->discrete.denominator = i; - -			return 0; -		} - -		default: -			return pwc_ioctl(pdev, cmd, arg); -	} /* ..switch */ -	return 0; -} - -/* vim: set cino= formatoptions=croql cindent shiftwidth=8 tabstop=8: */ diff --git a/drivers/media/video/pwc/pwc.h b/drivers/media/video/pwc/pwc.h deleted file mode 100644 index 36a9c83b5f5..00000000000 --- a/drivers/media/video/pwc/pwc.h +++ /dev/null @@ -1,356 +0,0 @@ -/* (C) 1999-2003 Nemosoft Unv. -   (C) 2004-2006 Luc Saillard (luc@saillard.org) - -   NOTE: this version of pwc is an unofficial (modified) release of pwc & pcwx -   driver and thus may have bugs that are not present in the original version. -   Please send bug reports and support requests to <luc@saillard.org>. -   The decompression routines have been implemented by reverse-engineering the -   Nemosoft binary pwcx module. Caveat emptor. - -   This program is free software; you can redistribute it and/or modify -   it under the terms of the GNU General Public License as published by -   the Free Software Foundation; either version 2 of the License, or -   (at your option) any later version. - -   This program is distributed in the hope that it will be useful, -   but WITHOUT ANY WARRANTY; without even the implied warranty of -   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the -   GNU General Public License for more details. - -   You should have received a copy of the GNU General Public License -   along with this program; if not, write to the Free Software -   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA -*/ - -#ifndef PWC_H -#define PWC_H - -#include <linux/module.h> -#include <linux/usb.h> -#include <linux/spinlock.h> -#include <linux/wait.h> -#include <linux/version.h> -#include <linux/mutex.h> -#include <linux/mm.h> -#include <linux/slab.h> -#include <asm/errno.h> -#include <linux/videodev2.h> -#include <media/v4l2-common.h> -#include <media/v4l2-ioctl.h> -#ifdef CONFIG_USB_PWC_INPUT_EVDEV -#include <linux/input.h> -#endif - -#include "pwc-uncompress.h" -#include <media/pwc-ioctl.h> - -/* Version block */ -#define PWC_MAJOR	10 -#define PWC_MINOR	0 -#define PWC_EXTRAMINOR	12 -#define PWC_VERSION_CODE KERNEL_VERSION(PWC_MAJOR,PWC_MINOR,PWC_EXTRAMINOR) -#define PWC_VERSION	"10.0.14" -#define PWC_NAME 	"pwc" -#define PFX		PWC_NAME ": " - - -/* Trace certain actions in the driver */ -#define PWC_DEBUG_LEVEL_MODULE	(1<<0) -#define PWC_DEBUG_LEVEL_PROBE	(1<<1) -#define PWC_DEBUG_LEVEL_OPEN	(1<<2) -#define PWC_DEBUG_LEVEL_READ	(1<<3) -#define PWC_DEBUG_LEVEL_MEMORY	(1<<4) -#define PWC_DEBUG_LEVEL_FLOW	(1<<5) -#define PWC_DEBUG_LEVEL_SIZE	(1<<6) -#define PWC_DEBUG_LEVEL_IOCTL	(1<<7) -#define PWC_DEBUG_LEVEL_TRACE	(1<<8) - -#define PWC_DEBUG_MODULE(fmt, args...) PWC_DEBUG(MODULE, fmt, ##args) -#define PWC_DEBUG_PROBE(fmt, args...) PWC_DEBUG(PROBE, fmt, ##args) -#define PWC_DEBUG_OPEN(fmt, args...) PWC_DEBUG(OPEN, fmt, ##args) -#define PWC_DEBUG_READ(fmt, args...) PWC_DEBUG(READ, fmt, ##args) -#define PWC_DEBUG_MEMORY(fmt, args...) PWC_DEBUG(MEMORY, fmt, ##args) -#define PWC_DEBUG_FLOW(fmt, args...) PWC_DEBUG(FLOW, fmt, ##args) -#define PWC_DEBUG_SIZE(fmt, args...) PWC_DEBUG(SIZE, fmt, ##args) -#define PWC_DEBUG_IOCTL(fmt, args...) PWC_DEBUG(IOCTL, fmt, ##args) -#define PWC_DEBUG_TRACE(fmt, args...) PWC_DEBUG(TRACE, fmt, ##args) - - -#ifdef CONFIG_USB_PWC_DEBUG - -#define PWC_DEBUG_LEVEL	(PWC_DEBUG_LEVEL_MODULE) - -#define PWC_DEBUG(level, fmt, args...) do {\ -	  if ((PWC_DEBUG_LEVEL_ ##level) & pwc_trace) \ -	     printk(KERN_DEBUG PFX fmt, ##args); \ -	  } while(0) - -#define PWC_ERROR(fmt, args...) printk(KERN_ERR PFX fmt, ##args) -#define PWC_WARNING(fmt, args...) printk(KERN_WARNING PFX fmt, ##args) -#define PWC_INFO(fmt, args...) printk(KERN_INFO PFX fmt, ##args) -#define PWC_TRACE(fmt, args...) PWC_DEBUG(TRACE, fmt, ##args) - -#else /* if ! CONFIG_USB_PWC_DEBUG */ - -#define PWC_ERROR(fmt, args...) printk(KERN_ERR PFX fmt, ##args) -#define PWC_WARNING(fmt, args...) printk(KERN_WARNING PFX fmt, ##args) -#define PWC_INFO(fmt, args...) printk(KERN_INFO PFX fmt, ##args) -#define PWC_TRACE(fmt, args...) do { } while(0) -#define PWC_DEBUG(level, fmt, args...) do { } while(0) - -#define pwc_trace 0 - -#endif - -/* Defines for ToUCam cameras */ -#define TOUCAM_HEADER_SIZE		8 -#define TOUCAM_TRAILER_SIZE		4 - -#define FEATURE_MOTOR_PANTILT		0x0001 -#define FEATURE_CODEC1			0x0002 -#define FEATURE_CODEC2			0x0004 - -/* Turn certain features on/off */ -#define PWC_INT_PIPE 0 - -/* Ignore errors in the first N frames, to allow for startup delays */ -#define FRAME_LOWMARK 5 - -/* Size and number of buffers for the ISO pipe. */ -#define MAX_ISO_BUFS		2 -#define ISO_FRAMES_PER_DESC	10 -#define ISO_MAX_FRAME_SIZE	960 -#define ISO_BUFFER_SIZE 	(ISO_FRAMES_PER_DESC * ISO_MAX_FRAME_SIZE) - -/* Frame buffers: contains compressed or uncompressed video data. */ -#define MAX_FRAMES		5 -/* Maximum size after decompression is 640x480 YUV data, 1.5 * 640 * 480 */ -#define PWC_FRAME_SIZE 		(460800 + TOUCAM_HEADER_SIZE + TOUCAM_TRAILER_SIZE) - -/* Absolute maximum number of buffers available for mmap() */ -#define MAX_IMAGES 		10 - -/* Some macros to quickly find the type of a webcam */ -#define DEVICE_USE_CODEC1(x) ((x)<675) -#define DEVICE_USE_CODEC2(x) ((x)>=675 && (x)<700) -#define DEVICE_USE_CODEC3(x) ((x)>=700) -#define DEVICE_USE_CODEC23(x) ((x)>=675) - -/* The following structures were based on cpia.h. Why reinvent the wheel? :-) */ -struct pwc_iso_buf -{ -	void *data; -	int  length; -	int  read; -	struct urb *urb; -}; - -/* intermediate buffers with raw data from the USB cam */ -struct pwc_frame_buf -{ -   void *data; -   volatile int filled;		/* number of bytes filled */ -   struct pwc_frame_buf *next;	/* list */ -}; - -/* additionnal informations used when dealing image between kernel and userland */ -struct pwc_imgbuf -{ -	unsigned long offset;	/* offset of this buffer in the big array of image_data */ -	int   vma_use_count;	/* count the number of time this memory is mapped */ -}; - -struct pwc_device -{ -   struct video_device *vdev; - -   /* Pointer to our usb_device */ -   struct usb_device *udev; - -   int type;                    /* type of cam (645, 646, 675, 680, 690, 720, 730, 740, 750) */ -   int release;			/* release number */ -   int features;		/* feature bits */ -   char serial[30];		/* serial number (string) */ -   int error_status;		/* set when something goes wrong with the cam (unplugged, USB errors) */ -   int usb_init;		/* set when the cam has been initialized over USB */ - -   /*** Video data ***/ -   int vopen;			/* flag */ -   int vendpoint;		/* video isoc endpoint */ -   int vcinterface;		/* video control interface */ -   int valternate;		/* alternate interface needed */ -   int vframes, vsize;		/* frames-per-second & size (see PSZ_*) */ -   int pixfmt;			/* pixelformat: V4L2_PIX_FMT_YUV420 or raw: _PWC1, _PWC2 */ -   int vframe_count;		/* received frames */ -   int vframes_dumped; 		/* counter for dumped frames */ -   int vframes_error;		/* frames received in error */ -   int vmax_packet_size;	/* USB maxpacket size */ -   int vlast_packet_size;	/* for frame synchronisation */ -   int visoc_errors;		/* number of contiguous ISOC errors */ -   int vcompression;		/* desired compression factor */ -   int vbandlength;		/* compressed band length; 0 is uncompressed */ -   char vsnapshot;		/* snapshot mode */ -   char vsync;			/* used by isoc handler */ -   char vmirror;		/* for ToUCaM series */ -	char unplugged; - -   int cmd_len; -   unsigned char cmd_buf[13]; - -   /* The image acquisition requires 3 to 4 steps: -      1. data is gathered in short packets from the USB controller -      2. data is synchronized and packed into a frame buffer -      3a. in case data is compressed, decompress it directly into image buffer -      3b. in case data is uncompressed, copy into image buffer with viewport -      4. data is transferred to the user process - -      Note that MAX_ISO_BUFS != MAX_FRAMES != MAX_IMAGES.... -      We have in effect a back-to-back-double-buffer system. -    */ -   /* 1: isoc */ -   struct pwc_iso_buf sbuf[MAX_ISO_BUFS]; -   char iso_init; - -   /* 2: frame */ -   struct pwc_frame_buf *fbuf;	/* all frames */ -   struct pwc_frame_buf *empty_frames, *empty_frames_tail;	/* all empty frames */ -   struct pwc_frame_buf *full_frames, *full_frames_tail;	/* all filled frames */ -   struct pwc_frame_buf *fill_frame;	/* frame currently being filled */ -   struct pwc_frame_buf *read_frame;	/* frame currently read by user process */ -   int frame_header_size, frame_trailer_size; -   int frame_size; -   int frame_total_size; /* including header & trailer */ -   int drop_frames; - -   /* 3: decompression */ -   void *decompress_data;		/* private data for decompression engine */ - -   /* 4: image */ -   /* We have an 'image' and a 'view', where 'image' is the fixed-size image -      as delivered by the camera, and 'view' is the size requested by the -      program. The camera image is centered in this viewport, laced with -      a gray or black border. view_min <= image <= view <= view_max; -    */ -   int image_mask;			/* bitmask of supported sizes */ -   struct pwc_coord view_min, view_max;	/* minimum and maximum viewable sizes */ -   struct pwc_coord abs_max;            /* maximum supported size with compression */ -   struct pwc_coord image, view;	/* image and viewport size */ -   struct pwc_coord offset;		/* offset within the viewport */ - -   void *image_data;			/* total buffer, which is subdivided into ... */ -   struct pwc_imgbuf images[MAX_IMAGES];/* ...several images... */ -   int fill_image;			/* ...which are rotated. */ -   int len_per_image;			/* length per image */ -   int image_read_pos;			/* In case we read data in pieces, keep track of were we are in the imagebuffer */ -   int image_used[MAX_IMAGES];		/* For MCAPTURE and SYNC */ - -   struct mutex modlock;		/* to prevent races in video_open(), etc */ -   spinlock_t ptrlock;			/* for manipulating the buffer pointers */ - -   /*** motorized pan/tilt feature */ -   struct pwc_mpt_range angle_range; -   int pan_angle;			/* in degrees * 100 */ -   int tilt_angle;			/* absolute angle; 0,0 is home position */ -   int snapshot_button_status;		/* set to 1 when the user push the button, reset to 0 when this value is read */ -#ifdef CONFIG_USB_PWC_INPUT_EVDEV -   struct input_dev *button_dev;	/* webcam snapshot button input */ -   char button_phys[64]; -#endif - -   /*** Misc. data ***/ -   wait_queue_head_t frameq;		/* When waiting for a frame to finish... */ -#if PWC_INT_PIPE -   void *usb_int_handler;		/* for the interrupt endpoint */ -#endif -}; - -#ifdef __cplusplus -extern "C" { -#endif - -/* Global variables */ -#ifdef CONFIG_USB_PWC_DEBUG -extern int pwc_trace; -#endif -extern int pwc_mbufs; - -/** functions in pwc-if.c */ -int pwc_try_video_mode(struct pwc_device *pdev, int width, int height, int new_fps, int new_compression, int new_snapshot); -int pwc_handle_frame(struct pwc_device *pdev); -void pwc_next_image(struct pwc_device *pdev); -int pwc_isoc_init(struct pwc_device *pdev); -void pwc_isoc_cleanup(struct pwc_device *pdev); - -/** Functions in pwc-misc.c */ -/* sizes in pixels */ -extern const struct pwc_coord pwc_image_sizes[PSZ_MAX]; - -int pwc_decode_size(struct pwc_device *pdev, int width, int height); -void pwc_construct(struct pwc_device *pdev); - -/** Functions in pwc-ctrl.c */ -/* Request a certain video mode. Returns < 0 if not possible */ -extern int pwc_set_video_mode(struct pwc_device *pdev, int width, int height, int frames, int compression, int snapshot); -extern unsigned int pwc_get_fps(struct pwc_device *pdev, unsigned int index, unsigned int size); -/* Calculate the number of bytes per image (not frame) */ -extern int pwc_mpt_reset(struct pwc_device *pdev, int flags); -extern int pwc_mpt_set_angle(struct pwc_device *pdev, int pan, int tilt); - -/* Various controls; should be obvious. Value 0..65535, or < 0 on error */ -extern int pwc_get_brightness(struct pwc_device *pdev); -extern int pwc_set_brightness(struct pwc_device *pdev, int value); -extern int pwc_get_contrast(struct pwc_device *pdev); -extern int pwc_set_contrast(struct pwc_device *pdev, int value); -extern int pwc_get_gamma(struct pwc_device *pdev); -extern int pwc_set_gamma(struct pwc_device *pdev, int value); -extern int pwc_get_saturation(struct pwc_device *pdev, int *value); -extern int pwc_set_saturation(struct pwc_device *pdev, int value); -extern int pwc_set_leds(struct pwc_device *pdev, int on_value, int off_value); -extern int pwc_get_cmos_sensor(struct pwc_device *pdev, int *sensor); -extern int pwc_restore_user(struct pwc_device *pdev); -extern int pwc_save_user(struct pwc_device *pdev); -extern int pwc_restore_factory(struct pwc_device *pdev); - -/* exported for use by v4l2 controls */ -extern int pwc_get_red_gain(struct pwc_device *pdev, int *value); -extern int pwc_set_red_gain(struct pwc_device *pdev, int value); -extern int pwc_get_blue_gain(struct pwc_device *pdev, int *value); -extern int pwc_set_blue_gain(struct pwc_device *pdev, int value); -extern int pwc_get_awb(struct pwc_device *pdev); -extern int pwc_set_awb(struct pwc_device *pdev, int mode); -extern int pwc_set_agc(struct pwc_device *pdev, int mode, int value); -extern int pwc_get_agc(struct pwc_device *pdev, int *value); -extern int pwc_set_shutter_speed(struct pwc_device *pdev, int mode, int value); -extern int pwc_get_shutter_speed(struct pwc_device *pdev, int *value); - -extern int pwc_set_colour_mode(struct pwc_device *pdev, int colour); -extern int pwc_get_colour_mode(struct pwc_device *pdev, int *colour); -extern int pwc_set_contour(struct pwc_device *pdev, int contour); -extern int pwc_get_contour(struct pwc_device *pdev, int *contour); -extern int pwc_set_backlight(struct pwc_device *pdev, int backlight); -extern int pwc_get_backlight(struct pwc_device *pdev, int *backlight); -extern int pwc_set_flicker(struct pwc_device *pdev, int flicker); -extern int pwc_get_flicker(struct pwc_device *pdev, int *flicker); -extern int pwc_set_dynamic_noise(struct pwc_device *pdev, int noise); -extern int pwc_get_dynamic_noise(struct pwc_device *pdev, int *noise); - -/* Power down or up the camera; not supported by all models */ -extern int pwc_camera_power(struct pwc_device *pdev, int power); - -/* Private ioctl()s; see pwc-ioctl.h */ -extern long pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg); - -/** Functions in pwc-v4l.c */ -extern long pwc_video_do_ioctl(struct file *file, unsigned int cmd, void *arg); - -/** pwc-uncompress.c */ -/* Expand frame to image, possibly including decompression. Uses read_frame and fill_image */ -extern int pwc_decompress(struct pwc_device *pdev); - -#ifdef __cplusplus -} -#endif - - -#endif -/* vim: set cino= formatoptions=croql cindent shiftwidth=8 tabstop=8: */  | 
