This changeset adds the OV511 decompression module to 2.5.x and updates the OV511 Config.help.
I've made sure that it builds, but since 2.5.5 doesn't compile for me it isn't tested. It's known to work under other kernels, so please apply it anyway Greg. Thanks, -- Mark McClelland [EMAIL PROTECTED]
This BitKeeper patch contains the following changesets: 1.344 # This is a BitKeeper patch. What follows are the unified diffs for the # set of deltas contained in the patch. The rest of the patch, the part # that BitKeeper cares about, is below these diffs. # User: mark # Host: hal9000.dyndns.org # Root: /mnt/home2/mark/tmp/bk/usb-2.5 # #--- 1.13/drivers/usb/Config.in Wed Feb 13 21:26:53 2002 #+++ 1.14/drivers/usb/Config.in Thu Feb 21 22:06:56 2002 #@@ -74,6 +74,7 @@ # else # dep_tristate ' USB IBM (Xirlink) C-it Camera support' CONFIG_USB_IBMCAM $CONFIG_USB $CONFIG_VIDEO_DEV # dep_tristate ' USB OV511 Camera support' CONFIG_USB_OV511 $CONFIG_USB $CONFIG_VIDEO_DEV #+ dep_tristate ' OV511 Decompression support' CONFIG_USB_OV511_DEC $CONFIG_USB_OV511 # dep_tristate ' USB Philips Cameras' CONFIG_USB_PWC $CONFIG_USB $CONFIG_VIDEO_DEV # dep_tristate ' USB SE401 Camera support' CONFIG_USB_SE401 $CONFIG_USB $CONFIG_VIDEO_DEV # dep_tristate ' USB STV680 (Pencam) Camera support' CONFIG_USB_STV680 $CONFIG_USB $CONFIG_VIDEO_DEV # #--- 1.20/drivers/usb/Makefile Wed Feb 13 21:26:53 2002 #+++ 1.21/drivers/usb/Makefile Thu Feb 21 22:06:56 2002 #@@ -72,6 +72,7 @@ # obj-$(CONFIG_USB_DABUSB) += dabusb.o # obj-$(CONFIG_USB_VICAM) += vicam.o # obj-$(CONFIG_USB_OV511) += ov511.o #+obj-$(CONFIG_USB_OV511_DEC) += ov511_decomp.o # obj-$(CONFIG_USB_SE401) += se401.o # obj-$(CONFIG_USB_STV680) += stv680.o # obj-$(CONFIG_USB_PEGASUS) += pegasus.o #--- New file --- #+++ drivers/usb/ov511_decomp.c 02/02/21 21:21:39 #/* OV511 Decompression Support Module (No-MMX version) # * # * Copyright (c) 1999-2002 Mark W. McClelland. All rights reserved. # * Original decompression code Copyright 1998-2000 OmniVision Technologies # * # * Please see the file: linux/Documentation/usb/ov511.txt # * and the web site at: http://alpha.dyndns.org/ov511 # * for more info. # * # * 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; version 2 of the License. You may also, at your # * option, follow the terms under the heading "BSD LICENSE", below. # * # * 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., 675 Mass Ave, Cambridge, MA 02139, USA. # * # */ # ##include <linux/config.h> ##include <linux/version.h> ##include <linux/module.h> ##include <linux/init.h> # ##include "ov511.h" # #/* Version Information */ # ##define DRIVER_VERSION "v1.3" ##define DRIVER_AUTHOR "Mark McClelland <[EMAIL PROTECTED]>, OmniVision \ #Technologies <http://www.ovt.com/>" ##define DRIVER_DESC "OV511 Decompression Module" # #/* Prototypes */ # #extern int ov511_register_decomp_module(int ver, struct ov51x_decomp_ops *ops, # int ov518, int mmx); #extern void ov511_deregister_decomp_module(int ov518, int mmx); #extern void * ov511_vmalloc(unsigned long size); #extern void ov511_vfree(void * addr); # #/* Constants */ # #static const int interface_ver = DECOMP_INTERFACE_VER; #static const int ov518 = 0; #static const int mmx = 0; # #/* Module features */ # #/* 0=no debug messages # * 1=init/detection/unload and other significant messages, # * 2=some warning messages # * 3=config/control function calls # * 4=most function calls and data parsing messages # * 5=highly repetitive mesgs # * NOTE: This should be changed to 0, 1, or 2 for production kernels # */ #static int debug = 0; # #MODULE_PARM(debug, "i"); #MODULE_PARM_DESC(debug, # "Debug level: 0=none, 1=inits, 2=warning, 3=config, 4=functions, 5=max"); # #MODULE_AUTHOR(DRIVER_AUTHOR); #MODULE_DESCRIPTION(DRIVER_DESC); #MODULE_LICENSE("GPL"); # #static void #DecompressYHI(unsigned char *pIn, # unsigned char *pOut, # int *iIn, /* in/out */ # int *iOut, /* in/out */ # const int w, # const int YUVFlag) #{ # short ZigZag[64]; # int temp[64]; # int Zcnt_Flag = 0; # int Num8_Flag = 0; # int in_pos = *iIn; # int out_pos = *iOut; # int tmp, tmp1, tmp2, tmp3; # unsigned char header, ZTable[64]; # short tmpl, tmph, half_byte, idx, count; # unsigned long ZigZag_length = 0, ZT_length, i, j; # short DeZigZag[64]; # # const short a = 11584; # const short b = 16068; # const short c = 15136; # const short d = 13624; # const short e = 9104; # const short f = 6270; # const short g = 3196; # # int out_idx; # # /* Take off every 'Zig' */ # for (i = 0; i < 64; i++) { # ZigZag[i] = 0; # } # # /***************************** # * Read in the Y header byte * # *****************************/ # # header = pIn[in_pos]; # in_pos++; # # ZigZag_length = header & 0x3f; # ZigZag_length = ZigZag_length + 1; # # Num8_Flag = header & 0x40; # Zcnt_Flag = header & 0x80; # # /************************* # * Read in the Y content * # *************************/ # # if (Zcnt_Flag == 0) { /* Without Zero Table read contents directly */ # /* Read in ZigZag[0] */ # ZigZag[0] = pIn[in_pos++]; # tmpl = pIn[in_pos++]; # tmph = tmpl<<8; # ZigZag[0] = ZigZag[0] | tmph; # ZigZag[0] = ZigZag[0]<<4; # ZigZag[0] = ZigZag[0]>>4; # # if (Num8_Flag) { /* 8 Bits */ # for (i = 1; i < ZigZag_length; i++) { # ZigZag[i] = pIn[in_pos++]; # ZigZag[i] = ZigZag[i]<<8; # ZigZag[i] = ZigZag[i]>>8; # } # } else { /* 12 bits and has no Zero Table */ # idx = 1; # half_byte = 0; # for (i = 1; i < ZigZag_length; i++) { # if (half_byte == 0) { # ZigZag[i] = pIn[in_pos++]; # tmpl = pIn[in_pos++]; # tmph = tmpl<<8; # tmph = tmph&0x0f00; # ZigZag[i] = ZigZag[i] | tmph; # ZigZag[i] = ZigZag[i]<<4; # ZigZag[i] = ZigZag[i]>>4; # half_byte = 1; # } else { # ZigZag[i] = pIn[in_pos++]; # ZigZag[i] = ZigZag[i]<<8; # tmpl = tmpl & 0x00f0; # ZigZag[i] = ZigZag[i] | tmpl; # ZigZag[i] = ZigZag[i]>>4; # half_byte = 0; # } # } # } # } else { /* Has Zero Table */ # /* Calculate Z-Table length */ # ZT_length = ZigZag_length/8; # tmp = ZigZag_length%8; # # if (tmp > 0) { # ZT_length = ZT_length + 1; # } # # /* Read in Zero Table */ # for (j = 0; j < ZT_length; j++) { # ZTable[j] = pIn[in_pos++]; # } # # /* Read in ZigZag[0] */ # ZigZag[0] = pIn[in_pos++]; # tmpl = pIn[in_pos++]; # tmph = tmpl<<8; # ZigZag[0] = ZigZag[0] | tmph; # ZigZag[0] = ZigZag[0]<<4; # ZigZag[0] = ZigZag[0]>>4; # # /* Decode ZigZag */ # idx = 0; # ZTable[idx] = ZTable[idx]<<1; # count = 7; # # if (Num8_Flag) { /* 8 Bits and has zero table */ # for (i = 1; i < ZigZag_length; i++) { # if ((ZTable[idx]&0x80)) { # ZigZag[i] = pIn[in_pos++]; # ZigZag[i] = ZigZag[i]<<8; # ZigZag[i] = ZigZag[i]>>8; # } # # ZTable[idx]=ZTable[idx]<<1; # count--; # if (count == 0) { # count = 8; # idx++; # } # } # # } else { /* 12 bits and has Zero Table */ # half_byte = 0; # for (i = 1; i < ZigZag_length; i++) { # if (ZTable[idx]&0x80) { # if (half_byte == 0) { # ZigZag[i] = pIn[in_pos++]; # tmpl = pIn[in_pos++]; # tmph = tmpl <<8; # tmph = tmph & 0x0f00; # ZigZag[i] = ZigZag[i] | tmph; # ZigZag[i] = ZigZag[i]<<4; # ZigZag[i] = ZigZag[i]>>4; # half_byte = 1; # } else { # ZigZag[i] = pIn[in_pos++]; # ZigZag[i] = ZigZag[i]<<8; # tmpl = tmpl & 0x00f0; # ZigZag[i] = ZigZag[i] | tmpl; # ZigZag[i] = ZigZag[i]>>4; # half_byte = 0; # } # } # # ZTable[idx] = ZTable[idx]<<1; # count--; # if (count == 0) { # count = 8; # idx++; # } # } # } # } # # /************* # * De-ZigZag * # *************/ # # for (j = 0; j < 64; j++) { # DeZigZag[j] = 0; # } # # if (YUVFlag == 1) { # DeZigZag[0] = ZigZag[0]; # DeZigZag[1] = ZigZag[1]<<1; # DeZigZag[2] = ZigZag[5]<<1; # DeZigZag[3] = ZigZag[6]<<2; # # DeZigZag[8] = ZigZag[2]<<1; # DeZigZag[9] = ZigZag[4]<<1; # DeZigZag[10] = ZigZag[7]<<1; # DeZigZag[11] = ZigZag[13]<<2; # # DeZigZag[16] = ZigZag[3]<<1; # DeZigZag[17] = ZigZag[8]<<1; # DeZigZag[18] = ZigZag[12]<<2; # DeZigZag[19] = ZigZag[17]<<2; # # DeZigZag[24] = ZigZag[9]<<2; # DeZigZag[25] = ZigZag[11]<<2; # DeZigZag[26] = ZigZag[18]<<2; # DeZigZag[27] = ZigZag[24]<<3; # } else { # DeZigZag[0] = ZigZag[0]; # DeZigZag[1] = ZigZag[1]<<2; # DeZigZag[2] = ZigZag[5]<<2; # DeZigZag[3] = ZigZag[6]<<3; # # DeZigZag[8] = ZigZag[2]<<2; # DeZigZag[9] = ZigZag[4]<<2; # DeZigZag[10] = ZigZag[7]<<2; # DeZigZag[11] = ZigZag[13]<<4; # # DeZigZag[16] = ZigZag[3]<<2; # DeZigZag[17] = ZigZag[8]<<2; # DeZigZag[18] = ZigZag[12]<<3; # DeZigZag[19] = ZigZag[17]<<4; # # DeZigZag[24] = ZigZag[9]<<3; # DeZigZag[25] = ZigZag[11]<<4; # DeZigZag[26] = ZigZag[18]<<4; # DeZigZag[27] = ZigZag[24]<<4; # } # ##if 0 # /* Dequante */ # if (YUVFlag == 1) { # /* Dequante Y */ # for (i=0; i<64; i++) { # ZigZag[i] = DeZigZag[i]<<DQTY[i]; # } # } else { # /* Dequante UV */ # for (i=0; i<64; i++) { # ZigZag[i] = DeZigZag[i]<<DQTUV[i]; # } # } ##endif # # /***************** # **** IDCT 1D **** # *****************/ # # /* j = 0 */ # tmp1=a*DeZigZag[0]+c*DeZigZag[2]; # tmp2=b*DeZigZag[1]; # tmp3=d*DeZigZag[3]; # # tmp=tmp1+tmp2+tmp3; # temp[0] = tmp>>15; # # tmp=tmp1-tmp2-tmp3; # temp[56] = tmp>>15; # # tmp1=a*DeZigZag[8]+c*DeZigZag[10]; # tmp2=b*DeZigZag[9]; # tmp3=d*DeZigZag[11]; # # tmp=tmp1+tmp2+tmp3; # temp[1] = tmp>>15; # # tmp=tmp1-tmp2-tmp3; # temp[57] = tmp>>15; # # tmp1=a*DeZigZag[16]+c*DeZigZag[18]; # tmp2=b*DeZigZag[17]; # tmp3=d*DeZigZag[19]; # # tmp=tmp1+tmp2+tmp3; # temp[2] = tmp>>15; # # tmp=tmp1-tmp2-tmp3; # temp[58] = tmp>>15; # # tmp1=a*DeZigZag[24]+c*DeZigZag[26]; # tmp2=b*DeZigZag[25]; # tmp3=d*DeZigZag[27]; # # tmp=tmp1+tmp2+tmp3; # temp[3] = tmp>>15; # # tmp=tmp1-tmp2-tmp3; # temp[59] = tmp>>15; # # # /* j = 1 */ # tmp1=a*DeZigZag[0]+f*DeZigZag[2]; # tmp2=d*DeZigZag[1]; # tmp3=g*DeZigZag[3]; # # tmp=tmp1+tmp2-tmp3; # temp[8] = tmp>>15; # # tmp=tmp1-tmp2+tmp3; # temp[48] = tmp>>15; # # tmp1=a*DeZigZag[8]+f*DeZigZag[10]; # tmp2=d*DeZigZag[9]; # tmp3=g*DeZigZag[11]; # # tmp=tmp1+tmp2-tmp3; # temp[9] = tmp>>15; # # tmp=tmp1-tmp2+tmp3; # temp[49] = tmp>>15; # # tmp1=a*DeZigZag[16]+f*DeZigZag[18]; # tmp2=d*DeZigZag[17]; # tmp3=g*DeZigZag[19]; # # tmp=tmp1+tmp2-tmp3; # temp[10] = tmp>>15; # # tmp=tmp1-tmp2+tmp3; # temp[50] = tmp>>15; # # tmp1=a*DeZigZag[24]+f*DeZigZag[26]; # tmp2=d*DeZigZag[25]; # tmp3=g*DeZigZag[27]; # # tmp=tmp1+tmp2-tmp3; # temp[11] = tmp>>15; # # tmp=tmp1-tmp2+tmp3; # temp[51] = tmp>>15; # # # /* j = 2 */ # tmp1=a*DeZigZag[0]-f*DeZigZag[2]; # tmp2=e*DeZigZag[1]; # tmp3=b*DeZigZag[3]; # # tmp=tmp1+tmp2-tmp3; # temp[16] = tmp>>15; # # tmp=tmp1-tmp2+tmp3; # temp[40] = tmp>>15; # # tmp1=a*DeZigZag[8]-f*DeZigZag[10]; # tmp2=e*DeZigZag[9]; # tmp3=b*DeZigZag[11]; # # tmp=tmp1+tmp2-tmp3; # temp[17] = tmp>>15; # # tmp=tmp1-tmp2+tmp3; # temp[41] = tmp>>15; # # tmp1=a*DeZigZag[16]-f*DeZigZag[18]; # tmp2=e*DeZigZag[17]; # tmp3=b*DeZigZag[19]; # # tmp=tmp1+tmp2-tmp3; # temp[18] = tmp>>15; # # tmp=tmp1-tmp2+tmp3; # temp[42] = tmp>>15; # # tmp1=a*DeZigZag[24]-f*DeZigZag[26]; # tmp2=e*DeZigZag[25]; # tmp3=b*DeZigZag[27]; # # tmp=tmp1+tmp2-tmp3; # temp[19] = tmp>>15; # # tmp=tmp1-tmp2+tmp3; # temp[43] = tmp>>15; # # # /* j = 3 */ # tmp1=a*DeZigZag[0]-c*DeZigZag[2]; # tmp2=g*DeZigZag[1]; # tmp3=e*DeZigZag[3]; # # tmp=tmp1+tmp2-tmp3; # temp[24] = tmp>>15; # # tmp=tmp1-tmp2+tmp3; # temp[32] = tmp>>15; # # tmp1=a*DeZigZag[8]-c*DeZigZag[10]; # tmp2=g*DeZigZag[9]; # tmp3=e*DeZigZag[11]; # # tmp=tmp1+tmp2-tmp3; # temp[25] = tmp>>15; # # tmp=tmp1-tmp2+tmp3; # temp[33] = tmp>>15; # # tmp1=a*DeZigZag[16]-c*DeZigZag[18]; # tmp2=g*DeZigZag[17]; # tmp3=e*DeZigZag[19]; # # tmp=tmp1+tmp2-tmp3; # temp[26] = tmp>>15; # # tmp=tmp1-tmp2+tmp3; # temp[34] = tmp>>15; # # tmp1=a*DeZigZag[24]-c*DeZigZag[26]; # tmp2=g*DeZigZag[25]; # tmp3=e*DeZigZag[27]; # # tmp=tmp1+tmp2-tmp3; # temp[27] = tmp>>15; # # tmp=tmp1-tmp2+tmp3; # temp[35] = tmp>>15; # # # /***************** # **** IDCT 2D **** # *****************/ # # out_idx = out_pos; # # /* i=0 */ # # /* j=0 */ # tmp = temp[0]*a+temp[1]*b+temp[2]*c+temp[3]*d; # tmp = tmp>>15; # tmp = tmp + 128; # if (tmp > 255) tmp=255; # if (tmp < 0) tmp=0; # pOut[0+out_idx] = (unsigned char) tmp; # # /* j=1 */ # tmp = temp[0]*a+temp[1]*d+temp[2]*f+temp[3]*(-g); # tmp = tmp>>15; # tmp = tmp + 128; # if (tmp > 255) tmp=255; # if (tmp < 0) tmp=0; # pOut[1+out_idx] = (unsigned char) tmp; # # /* j=2 */ # tmp = temp[0]*a+temp[1]*e+temp[2]*(-f)+temp[3]*(-b); # tmp = tmp>>15; # tmp = tmp + 128; # if (tmp > 255) tmp=255; # if (tmp < 0) tmp=0; # pOut[2+out_idx] = (unsigned char) tmp; # # /* j=3 */ # tmp = temp[0]*a+temp[1]*g+temp[2]*(-c)+temp[3]*(-e); # tmp = tmp>>15; # tmp = tmp + 128; # if (tmp > 255) tmp=255; # if (tmp < 0) tmp=0; # pOut[3+out_idx] = (unsigned char) tmp; # # /* j=4 */ # tmp = temp[0]*a+temp[1]*(-g)+temp[2]*(-c)+temp[3]*e; # tmp = tmp>>15; # tmp = tmp + 128; # if (tmp > 255) tmp=255; # if (tmp < 0) tmp=0; # pOut[4+out_idx] = (unsigned char) tmp; # # /* j=5 */ # tmp = temp[0]*a+temp[1]*(-e)+temp[2]*(-f)+temp[3]*b; # tmp = tmp>>15; # tmp = tmp + 128; # if (tmp > 255) tmp=255; # if (tmp < 0) tmp=0; # pOut[5+out_idx] = (unsigned char) tmp; # # /* j=6 */ # tmp = temp[0]*a+temp[1]*(-d)+temp[2]*f+temp[3]*g; # tmp = tmp>>15; # tmp = tmp + 128; # if (tmp > 255) tmp=255; # if (tmp < 0) tmp=0; # pOut[6+out_idx] = (unsigned char) tmp; # # /* j=7 */ # tmp = temp[0]*a+temp[1]*(-b)+temp[2]*c+temp[3]*(-d); # tmp = tmp>>15; # tmp = tmp + 128; # if (tmp > 255) tmp=255; # if (tmp < 0) tmp=0; # pOut[7+out_idx] = (unsigned char) tmp; # # # out_idx += w; # # /* i=1 */ # # /* j=0 */ # tmp = temp[8]*a+temp[9]*b+temp[10]*c+temp[11]*d; # tmp = tmp>>15; # tmp = tmp + 128; # if (tmp > 255) tmp=255; # if (tmp < 0) tmp=0; # pOut[out_idx] = (unsigned char) tmp; # # /* j=1 */ # tmp = temp[8]*a+temp[9]*d+temp[10]*f+temp[11]*(-g); # tmp = tmp>>15; # tmp = tmp + 128; # if (tmp > 255) tmp=255; # if (tmp < 0) tmp=0; # pOut[out_idx+1] = (unsigned char) tmp; # # /* j=2 */ # tmp = temp[8]*a+temp[9]*e+temp[10]*(-f)+temp[11]*(-b); # tmp = tmp>>15; # tmp = tmp + 128; # if (tmp > 255) tmp=255; # if (tmp < 0) tmp=0; # pOut[out_idx+2] = (unsigned char) tmp; # # /* j=3 */ # tmp = temp[8]*a+temp[9]*g+temp[10]*(-c)+temp[11]*(-e); # tmp = tmp>>15; # tmp = tmp + 128; # if (tmp > 255) tmp=255; # if (tmp < 0) tmp=0; # pOut[out_idx+3] = (unsigned char) tmp; # # /* j=4 */ # tmp = temp[8]*a+temp[9]*(-g)+temp[10]*(-c)+temp[11]*e; # tmp = tmp>>15; # tmp = tmp + 128; # if (tmp > 255) tmp=255; # if (tmp < 0) tmp=0; # pOut[out_idx+4] = (unsigned char) tmp; # # /* j=5 */ # tmp = temp[8]*a+temp[9]*(-e)+temp[10]*(-f)+temp[11]*b; # tmp = tmp>>15; # tmp = tmp + 128; # if (tmp > 255) tmp=255; # if (tmp < 0) tmp=0; # pOut[out_idx+5] = (unsigned char) tmp; # # /* j=6 */ # tmp = temp[8]*a+temp[9]*(-d)+temp[10]*f+temp[11]*g; # tmp = tmp>>15; # tmp = tmp + 128; # if (tmp > 255) tmp=255; # if (tmp < 0) tmp=0; # pOut[out_idx+6] = (unsigned char) tmp; # # /* j=7 */ # tmp = temp[8]*a+temp[9]*(-b)+temp[10]*c+temp[11]*(-d); # tmp = tmp>>15; # tmp = tmp + 128; # if (tmp > 255) tmp=255; # if (tmp < 0) tmp=0; # pOut[out_idx+7] = (unsigned char) tmp; # # # out_idx += w; # # # /* i=2 */ # # /* j=0 */ # tmp = temp[16]*a+temp[17]*b+temp[18]*c+temp[19]*d; # tmp = tmp>>15; # tmp = tmp + 128; # if (tmp > 255) tmp=255; # if (tmp < 0) tmp=0; # pOut[out_idx] = (unsigned char) tmp; # # /* j=1 */ # tmp = temp[16]*a+temp[17]*d+temp[18]*f+temp[19]*(-g); # tmp = tmp>>15; # tmp = tmp + 128; # if (tmp > 255) tmp=255; # if (tmp < 0) tmp=0; # pOut[out_idx+1] = (unsigned char) tmp; # # /* j=2 */ # tmp = temp[16]*a+temp[17]*e+temp[18]*(-f)+temp[19]*(-b); # tmp = tmp>>15; # tmp = tmp + 128; # if (tmp > 255) tmp=255; # if (tmp < 0) tmp=0; # pOut[out_idx+2] = (unsigned char) tmp; # # /* j=3 */ # tmp = temp[16]*a+temp[17]*g+temp[18]*(-c)+temp[19]*(-e); # tmp = tmp>>15; # tmp = tmp + 128; # if (tmp > 255) tmp=255; # if (tmp < 0) tmp=0; # pOut[out_idx+3] = (unsigned char) tmp; # # /* j=4 */ # tmp = temp[16]*a+temp[17]*(-g)+temp[18]*(-c)+temp[19]*e; # tmp = tmp>>15; # tmp = tmp + 128; # if (tmp > 255) tmp=255; # if (tmp < 0) tmp=0; # pOut[out_idx+4] = (unsigned char) tmp; # # /* j=5 */ # tmp = temp[16]*a+temp[17]*(-e)+temp[18]*(-f)+temp[19]*b; # tmp = tmp>>15; # tmp = tmp + 128; # if (tmp > 255) tmp=255; # if (tmp < 0) tmp=0; # pOut[out_idx+5] = (unsigned char) tmp; # # /* j=6 */ # tmp = temp[16]*a+temp[17]*(-d)+temp[18]*f+temp[19]*g; # tmp = tmp>>15; # tmp = tmp + 128; # if (tmp > 255) tmp=255; # if (tmp < 0) tmp=0; # pOut[out_idx+6] = (unsigned char) tmp; # # /* j=7 */ # tmp = temp[16]*a+temp[17]*(-b)+temp[18]*c+temp[19]*(-d); # tmp = tmp>>15; # tmp = tmp + 128; # if (tmp > 255) tmp=255; # if (tmp < 0) tmp=0; # pOut[out_idx+7] = (unsigned char) tmp; # # # out_idx += w; # # /* i=3 */ # # /* j=0 */ # tmp = temp[24]*a+temp[25]*b+temp[26]*c+temp[27]*d; # tmp = tmp>>15; # tmp = tmp + 128; # if (tmp > 255) tmp=255; # if (tmp < 0) tmp=0; # pOut[out_idx] = (unsigned char) tmp; # # /* j=1 */ # tmp = temp[24]*a+temp[25]*d+temp[26]*f+temp[27]*(-g); # tmp = tmp>>15; # tmp = tmp + 128; # if (tmp > 255) tmp=255; # if (tmp < 0) tmp=0; # pOut[out_idx+1] = (unsigned char) tmp; # # /* j=2 */ # tmp = temp[24]*a+temp[25]*e+temp[26]*(-f)+temp[27]*(-b); # tmp = tmp>>15; # tmp = tmp + 128; # if (tmp > 255) tmp=255; # if (tmp < 0) tmp=0; # pOut[out_idx+2] = (unsigned char) tmp; # # /* j=3 */ # tmp = temp[24]*a+temp[25]*g+temp[26]*(-c)+temp[27]*(-e); # tmp = tmp>>15; # tmp = tmp + 128; # if (tmp > 255) tmp=255; # if (tmp < 0) tmp=0; # pOut[out_idx+3] = (unsigned char) tmp; # # /* j=4 */ # tmp = temp[24]*a+temp[25]*(-g)+temp[26]*(-c)+temp[27]*e; # tmp = tmp>>15; # tmp = tmp + 128; # if (tmp > 255) tmp=255; # if (tmp < 0) tmp=0; # pOut[out_idx+4] = (unsigned char) tmp; # # /* j=5 */ # tmp = temp[24]*a+temp[25]*(-e)+temp[26]*(-f)+temp[27]*b; # tmp = tmp>>15; # tmp = tmp + 128; # if (tmp > 255) tmp=255; # if (tmp < 0) tmp=0; # pOut[out_idx+5] = (unsigned char) tmp; # # /* j=6 */ # tmp = temp[24]*a+temp[25]*(-d)+temp[26]*f+temp[27]*g; # tmp = tmp>>15; # tmp = tmp + 128; # if (tmp > 255) tmp=255; # if (tmp < 0) tmp=0; # pOut[out_idx+6] = (unsigned char) tmp; # # /* j=7 */ # tmp = temp[24]*a+temp[25]*(-b)+temp[26]*c+temp[27]*(-d); # tmp = tmp>>15; # tmp = tmp + 128; # if (tmp > 255) tmp=255; # if (tmp < 0) tmp=0; # pOut[out_idx+7] = (unsigned char) tmp; # # # out_idx += w; # # /* i=4 */ # # /* j=0 */ # tmp = temp[32]*a+temp[33]*b+temp[34]*c+temp[35]*d; # tmp = tmp>>15; # tmp = tmp + 128; # if (tmp > 255) tmp=255; # if (tmp < 0) tmp=0; # pOut[out_idx] = (unsigned char) tmp; # # /* j=1 */ # tmp = temp[32]*a+temp[33]*d+temp[34]*f+temp[35]*(-g); # tmp = tmp>>15; # tmp = tmp + 128; # if (tmp > 255) tmp=255; # if (tmp < 0) tmp=0; # pOut[out_idx+1] = (unsigned char) tmp; # # /* j=2 */ # tmp = temp[32]*a+temp[33]*e+temp[34]*(-f)+temp[35]*(-b); # tmp = tmp>>15; # tmp = tmp + 128; # if (tmp > 255) tmp=255; # if (tmp < 0) tmp=0; # pOut[out_idx+2] = (unsigned char) tmp; # # /* j=3 */ # tmp = temp[32]*a+temp[33]*g+temp[34]*(-c)+temp[35]*(-e); # tmp = tmp>>15; # tmp = tmp + 128; # if (tmp > 255) tmp=255; # if (tmp < 0) tmp=0; # pOut[out_idx+3] = (unsigned char) tmp; # # /* j=4 */ # tmp = temp[32]*a+temp[33]*(-g)+temp[34]*(-c)+temp[35]*e; # tmp = tmp>>15; # tmp = tmp + 128; # if (tmp > 255) tmp=255; # if (tmp < 0) tmp=0; # pOut[out_idx+4] = (unsigned char) tmp; # # /* j=5 */ # tmp = temp[32]*a+temp[33]*(-e)+temp[34]*(-f)+temp[35]*b; # tmp = tmp>>15; # tmp = tmp + 128; # if (tmp > 255) tmp=255; # if (tmp < 0) tmp=0; # pOut[out_idx+5] = (unsigned char) tmp; # # /* j=6 */ # tmp = temp[32]*a+temp[33]*(-d)+temp[34]*f+temp[35]*g; # tmp = tmp>>15; # tmp = tmp + 128; # if (tmp > 255) tmp=255; # if (tmp < 0) tmp=0; # pOut[out_idx+6] = (unsigned char) tmp; # # /* j=7 */ # tmp = temp[32]*a+temp[33]*(-b)+temp[34]*c+temp[35]*(-d); # tmp = tmp>>15; # tmp = tmp + 128; # if (tmp > 255) tmp=255; # if (tmp < 0) tmp=0; # pOut[out_idx+7] = (unsigned char) tmp; # # # out_idx += w; # # /* i=5 */ # # /* j=0 */ # tmp = temp[40]*a+temp[41]*b+temp[42]*c+temp[43]*d; # tmp = tmp>>15; # tmp = tmp + 128; # if (tmp > 255) tmp=255; # if (tmp < 0) tmp=0; # pOut[out_idx] = (unsigned char) tmp; # # /* j=1 */ # tmp = temp[40]*a+temp[41]*d+temp[42]*f+temp[43]*(-g); # tmp = tmp>>15; # tmp = tmp + 128; # if (tmp > 255) tmp=255; # if (tmp < 0) tmp=0; # pOut[out_idx+1] = (unsigned char) tmp; # # /* j=2 */ # tmp = temp[40]*a+temp[41]*e+temp[42]*(-f)+temp[43]*(-b); # tmp = tmp>>15; # tmp = tmp + 128; # if (tmp > 255) tmp=255; # if (tmp < 0) tmp=0; # pOut[out_idx+2] = (unsigned char) tmp; # # /* j=3 */ # tmp = temp[40]*a+temp[41]*g+temp[42]*(-c)+temp[43]*(-e); # tmp = tmp>>15; # tmp = tmp + 128; # if (tmp > 255) tmp=255; # if (tmp < 0) tmp=0; # pOut[out_idx+3] = (unsigned char) tmp; # # /* j=4 */ # tmp = temp[40]*a+temp[41]*(-g)+temp[42]*(-c)+temp[43]*e; # tmp = tmp>>15; # tmp = tmp + 128; # if (tmp > 255) tmp=255; # if (tmp < 0) tmp=0; # pOut[out_idx+4] = (unsigned char) tmp; # # /* j=5 */ # tmp = temp[40]*a+temp[41]*(-e)+temp[42]*(-f)+temp[43]*b; # tmp = tmp>>15; # tmp = tmp + 128; # if (tmp > 255) tmp=255; # if (tmp < 0) tmp=0; # pOut[out_idx+5] = (unsigned char) tmp; # # /* j=6 */ # tmp = temp[40]*a+temp[41]*(-d)+temp[42]*f+temp[43]*g; # tmp = tmp>>15; # tmp = tmp + 128; # if (tmp > 255) tmp=255; # if (tmp < 0) tmp=0; # pOut[out_idx+6] = (unsigned char) tmp; # # /* j=7 */ # tmp = temp[40]*a+temp[41]*(-b)+temp[42]*c+temp[43]*(-d); # tmp = tmp>>15; # tmp = tmp + 128; # if (tmp > 255) tmp=255; # if (tmp < 0) tmp=0; # pOut[out_idx+7] = (unsigned char) tmp; # # # out_idx += w; # # /* i=6 */ # # tmp1=temp[48]*a+temp[50]*c; # tmp2=temp[49]*b; # tmp3=temp[51]*d; # /* j=0 */ # tmp=tmp1+tmp2+tmp3; # tmp = tmp>>15; # tmp = tmp + 128; # if (tmp > 255) tmp=255; # if (tmp < 0) tmp=0; # pOut[out_idx] = (unsigned char) tmp; # # /* j=7 */ # tmp=tmp1-tmp2-tmp3; # tmp = tmp>>15; # tmp = tmp + 128; # if (tmp > 255) tmp=255; # if (tmp < 0) tmp=0; # pOut[out_idx+7] = (unsigned char) tmp; # # tmp1=temp[48]*a+temp[50]*f; # tmp2=temp[49]*d; # tmp3=temp[51]*g; # /* j=1 */ # tmp=tmp1+tmp2-tmp3; # tmp = tmp>>15; # tmp = tmp + 128; # if (tmp > 255) tmp=255; # if (tmp < 0) tmp=0; # pOut[out_idx+1] = (unsigned char) tmp; # # /* j=6 */ # tmp=tmp1-tmp2+tmp3; # tmp = tmp>>15; # tmp = tmp + 128; # if (tmp > 255) tmp=255; # if (tmp < 0) tmp=0; # pOut[out_idx+6] = (unsigned char) tmp; # # tmp1=temp[48]*a-temp[50]*f; # tmp2=temp[49]*e; # tmp3=temp[51]*b; # /* j=2 */ # tmp=tmp1+tmp2-tmp3; # tmp = tmp>>15; # tmp = tmp + 128; # if (tmp > 255) tmp=255; # if (tmp < 0) tmp=0; # pOut[out_idx+2] = (unsigned char) tmp; # # /* j=5 */ # tmp=tmp1-tmp2+tmp3; # tmp = tmp>>15; # tmp = tmp + 128; # if (tmp > 255) tmp=255; # if (tmp < 0) tmp=0; # pOut[out_idx+5] = (unsigned char) tmp; # # tmp1=temp[48]*a-temp[50]*c; # tmp2=temp[49]*g; # tmp3=temp[51]*e; # /* j=3 */ # tmp=tmp1+tmp2-tmp3; # tmp = tmp>>15; # tmp = tmp + 128; # if (tmp > 255) tmp=255; # if (tmp < 0) tmp=0; # pOut[out_idx+3] = (unsigned char) tmp; # # /* j=4 */ # tmp=tmp1-tmp2+tmp3; # tmp = tmp>>15; # tmp = tmp + 128; # if (tmp > 255) tmp=255; # if (tmp < 0) tmp=0; # pOut[out_idx+4] = (unsigned char) tmp; # # # out_idx += w; # # /* i=7 */ # # tmp1=temp[56]*a+temp[58]*c; # tmp2=temp[57]*b; # tmp3=temp[59]*d; # # /* j=0 */ # tmp=tmp1+tmp2+tmp3; # tmp = tmp>>15; # tmp = tmp + 128; # if (tmp > 255) tmp=255; # if (tmp < 0) tmp=0; # pOut[out_idx] = (unsigned char) tmp; # # /* j=7 */ # tmp=tmp1-tmp2-tmp3; # tmp = tmp>>15; # tmp = tmp + 128; # if (tmp > 255) tmp=255; # if (tmp < 0) tmp=0; # pOut[out_idx+7] = (unsigned char) tmp; # # tmp1=temp[56]*a+temp[58]*f; # tmp2=temp[57]*d; # tmp3=temp[59]*g; # # /* j=1 */ # tmp=tmp1+tmp2-tmp3; # tmp = tmp>>15; # tmp = tmp + 128; # if (tmp > 255) tmp=255; # if (tmp < 0) tmp=0; # pOut[out_idx+1] = (unsigned char) tmp; # # /* j=6 */ # tmp=tmp1-tmp2+tmp3; # tmp = tmp>>15; # tmp = tmp + 128; # if (tmp > 255) tmp=255; # if (tmp < 0) tmp=0; # pOut[out_idx+6] = (unsigned char) tmp; # # tmp1=temp[56]*a-temp[58]*f; # tmp2=temp[57]*e; # tmp3=temp[59]*b; # # /* j=2 */ # tmp=tmp1+tmp2-tmp3; # tmp = tmp>>15; # tmp = tmp + 128; # if (tmp > 255) tmp=255; # if (tmp < 0) tmp=0; # pOut[out_idx+2] = (unsigned char) tmp; # # /* j=5 */ # tmp=tmp1-tmp2+tmp3; # tmp = tmp>>15; # tmp = tmp + 128; # if (tmp > 255) tmp=255; # if (tmp < 0) tmp=0; # pOut[out_idx+5] = (unsigned char) tmp; # # tmp1=temp[56]*a-temp[58]*c; # tmp2=temp[57]*g; # tmp3=temp[59]*e; # # /* j=3 */ # tmp=tmp1+tmp2-tmp3; # tmp = tmp>>15; # tmp = tmp + 128; # if (tmp > 255) tmp=255; # if (tmp < 0) tmp=0; # pOut[out_idx+3] = (unsigned char) tmp; # # /* j=4 */ # tmp=tmp1-tmp2+tmp3; # tmp = tmp>>15; # tmp = tmp + 128; # if (tmp > 255) tmp=255; # if (tmp < 0) tmp=0; # pOut[out_idx+4] = (unsigned char) tmp; # # *iIn = in_pos; # *iOut = out_pos + 8; #} # ##define DECOMP_Y() DecompressYHI(pIn, pY, &iIn, &iY, w, 1) # ##define DECOMP_U() DecompressYHI(pIn, pU, &iIn, &iU, w/2, 2) # ##define DECOMP_V() DecompressYHI(pIn, pV, &iIn, &iV, w/2, 2) # #inline static int #Decompress400HiNoMMX(unsigned char *pIn, # unsigned char *pOut, # const int w, # const int h, # const int inSize) #{ # unsigned char *pY = pOut; # int x, y, iIn, iY; # # iIn = 0; # for (y = 0; y < h; y += 8) { # iY = w*y; # # for (x = 0; x < w; x += 8) # DECOMP_Y(); # } # # return 0; #} # #inline static int #Decompress420HiNoMMX(unsigned char *pIn, # unsigned char *pOut, # const int w, # const int h, # const int inSize) #{ # unsigned char *pY = pOut; # unsigned char *pU = pY + w*h; # unsigned char *pV = pU + w*h/4; # int x, y, iY, iU, iV, iIn; # # iIn = 0; # for (y = 0; y < h; y += 16) { # iY = w*y; # iU = iY/4; # iV = iU; # # if (iIn > inSize) # return -1; # # for (x = 0; x < w; x += 32) { # DECOMP_U(); # DECOMP_V(); # DECOMP_Y(); # DECOMP_Y(); # DECOMP_Y(); # DECOMP_Y(); # } # # iY = w*(y + 8); # iV = (w*y + w)/4; # iU = iV; # # for (x = 0; x < w; x += 32) { # DECOMP_U(); # DECOMP_V(); # DECOMP_Y(); # DECOMP_Y(); # DECOMP_Y(); # DECOMP_Y(); # } # } # # return 0; #} # #/* Input format is raw isoc. data (with header and packet # * number stripped, and all-zero blocks removed). # * Output format is YUV400 # * Returns uncompressed data length if success, or zero if error # */ #static int #Decompress400(unsigned char *pIn, # unsigned char *pOut, # int w, # int h, # int inSize) #{ # int numpix = w * h; # int rc; # # PDEBUG(4, "%dx%d pIn=%p pOut=%p inSize=%d", w, h, pIn, pOut, inSize); # # rc = Decompress400HiNoMMX(pIn, pOut, w, h, inSize); # # if (rc) # return 0; # # return numpix; #} # # #/* Input format is raw isoc. data (with header and packet # * number stripped, and all-zero blocks removed). # * Output format is planar YUV420 # * Returns uncompressed data length if success, or zero if error # */ #static int #Decompress420(unsigned char *pIn, # unsigned char *pOut, # int w, # int h, # int inSize) #{ # int numpix = w * h; # int rc; # # PDEBUG(4, "%dx%d pIn=%p pOut=%p inSize=%d", w, h, pIn, pOut, inSize); # # rc = Decompress420HiNoMMX(pIn, pOut, w, h, inSize); # # if (rc) # return 0; # #/* Disabled by Mark */ ##if 0 # /* For color saturation 8/22/00 */ # { # long u , v; # unsigned char *pU = pOut + numpix; # unsigned char *pV = pU + numpix/4; # for (int i = 0; i < numpix/4; i++) { # u = (long)*pU; # v = (long)*pV; # u -= 128; # v -= 128; # u = (u * 577) >> 10; # v = (v * 730) >> 10; # u += 128; # v += 128; # *pU++ = (unsigned char)u; # *pV++ = (unsigned char)v; #/* u=0.564 */ #/* v=0.713 */ # } # } ##endif # # return (numpix * 3 / 2); #} # #static void #DecompLock(void) #{ # MOD_INC_USE_COUNT; #} # #static void #DecompUnlock(void) #{ # MOD_DEC_USE_COUNT; #} # #static struct ov51x_decomp_ops decomp_ops = { # decomp_400: Decompress400, # decomp_420: Decompress420, # decomp_lock: DecompLock, # decomp_unlock: DecompUnlock #}; # #static int __init #decomp_init(void) #{ # int rc; # # EXPORT_NO_SYMBOLS; # # rc = ov511_register_decomp_module(DECOMP_INTERFACE_VER, &decomp_ops, # ov518, mmx); # if (rc) { # err("Could not register with ov511 (rc=%d)", rc); # return -1; # } # # info(DRIVER_VERSION " : " DRIVER_DESC); # # return 0; #} # #static void __exit #decomp_exit(void) #{ # ov511_deregister_decomp_module(ov518, mmx); # info("deregistered\n"); #} # #module_init(decomp_init); #module_exit(decomp_exit); # # #--- 1.5/drivers/usb/Config.help Wed Feb 13 21:26:53 2002 #+++ 1.6/drivers/usb/Config.help Thu Feb 21 22:06:56 2002 #@@ -210,8 +210,10 @@ # # CONFIG_USB_OV511 # Say Y here if you want to connect this type of camera to your #- computer's USB port. See <file:Documentation/usb/ov511.txt> for more #- information and for a list of supported cameras. #+ computer's USB port. See <file:Documentation/usb/ov511.txt> for #+ configuration options, and the driver homepage at #+ <http://alpha.dyndns.org/ov511/> for a list of supported cameras #+ and other information. # # This driver uses the Video For Linux API. You must say Y or M to # "Video For Linux" (under Character Devices) to use this driver. #@@ -222,6 +224,23 @@ # inserted in and removed from the running kernel whenever you want). # The module will be called ov511.o. If you want to compile it as a # module, say M here and read <file:Documentation/modules.txt>. #+ #+OV511 Decompression support #+CONFIG_USB_OV511_DEC #+ Say M here if you want to achieve higher frame rates, at the #+ expense of image quality. A 300 MHz or faster CPU is recommended. #+ #+ This feature is NOT activated by default. The OV511 driver must have #+ compression enabled (eg. loaded with the "compress=1" module #+ parameter). See <file:Documentation/usb/ov511.txt> for more #+ information. #+ #+ This code is also available as a module ( = code which can be #+ inserted in and removed from the running kernel whenever you want). #+ The module will be called ov511_decomp.o. You must load ov511.o #+ before loading this module, and you must unload this module before #+ unloading ov511.o. Read <file:Documentation/modules.txt> to learn #+ more about modules. # # CONFIG_USB_CDCETHER # This driver supports devices conforming to the Communication Device # # Diff checksum=9aa032b9 # Patch vers: 1.3 # Patch type: REGULAR == ChangeSet == [EMAIL PROTECTED]|ChangeSet|20011125035615|28334|160bd283d279fb69 [EMAIL PROTECTED]|ChangeSet|20020221081336|24997 D 1.344 02/02/21 22:07:05-08:00 [EMAIL PROTECTED] +4 -0 B [EMAIL PROTECTED]|ChangeSet|20011125035615|28334|160bd283d279fb69 C c This adds the OV511 decompression module (ov511_decomp.o). c The Config.help entry for OV511 is also updated. K 39943 P ChangeSet ------------------------------------------------ 0a0 > [EMAIL PROTECTED]|drivers/usb/Config.help|20020124212758|13980|945547e94a71831f >[EMAIL PROTECTED]|drivers/usb/Config.help|20020222060656|00962 > [EMAIL PROTECTED]|drivers/usb/Makefile|20011125040916|14130|78e9848bfbc29935 >[EMAIL PROTECTED]|drivers/usb/Makefile|20020222060656|19086 > >[EMAIL PROTECTED]|drivers/usb/ov511_decomp.c|20020222052139|14820|c7542626412f17f2 > [EMAIL PROTECTED]|drivers/usb/ov511_decomp.c|20020222052140|57996 > [EMAIL PROTECTED]|drivers/usb/Config.in|20011125040916|60123|2b68c66e269ec659 >[EMAIL PROTECTED]|drivers/usb/Config.in|20020222060656|27133 == drivers/usb/Config.in == [EMAIL PROTECTED]|drivers/usb/Config.in|20011125040916|60123|2b68c66e269ec659 [EMAIL PROTECTED]|drivers/usb/Config.in|20020214052653|20102 D 1.14 02/02/21 22:06:56-08:00 [EMAIL PROTECTED] +1 -0 B [EMAIL PROTECTED]|ChangeSet|20011125035615|28334|160bd283d279fb69 C c Added config option for ov511 decompressor K 27133 O -rw-rw-r-- P drivers/usb/Config.in ------------------------------------------------ I76 1 dep_tristate ' OV511 Decompression support' CONFIG_USB_OV511_DEC $CONFIG_USB_OV511 == drivers/usb/Makefile == [EMAIL PROTECTED]|drivers/usb/Makefile|20011125040916|14130|78e9848bfbc29935 [EMAIL PROTECTED]|drivers/usb/Makefile|20020214052653|15713 D 1.21 02/02/21 22:06:56-08:00 [EMAIL PROTECTED] +1 -0 B [EMAIL PROTECTED]|ChangeSet|20011125035615|28334|160bd283d279fb69 C c Added ov511 decompressor (ov511_decomp.o) target K 19086 O -rw-rw-r-- P drivers/usb/Makefile ------------------------------------------------ I74 1 obj-$(CONFIG_USB_OV511_DEC) += ov511_decomp.o == drivers/usb/ov511_decomp.c == New file: drivers/usb/ov511_decomp.c V 4 [EMAIL PROTECTED]|drivers/usb/ov511_decomp.c|20020222052139|14820|c7542626412f17f2 D 1.0 02/02/21 21:21:39-08:00 [EMAIL PROTECTED] +0 -0 B [EMAIL PROTECTED]|ChangeSet|20011125035615|28334|160bd283d279fb69 c BitKeeper file /mnt/home2/mark/tmp/bk/usb-2.5/drivers/usb/ov511_decomp.c K 14820 P drivers/usb/ov511_decomp.c R c7542626412f17f2 X 0x821 ------------------------------------------------ [EMAIL PROTECTED]|drivers/usb/ov511_decomp.c|20020222052139|14820|c7542626412f17f2 D 1.1 02/02/21 21:21:39-08:00 [EMAIL PROTECTED] +1260 -0 B [EMAIL PROTECTED]|ChangeSet|20011125035615|28334|160bd283d279fb69 C F 1 K 57996 O -rw-rw-r-- P drivers/usb/ov511_decomp.c ------------------------------------------------ I0 1260 /* OV511 Decompression Support Module (No-MMX version) * * Copyright (c) 1999-2002 Mark W. McClelland. All rights reserved. * Original decompression code Copyright 1998-2000 OmniVision Technologies * * Please see the file: linux/Documentation/usb/ov511.txt * and the web site at: http://alpha.dyndns.org/ov511 * for more info. * * 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; version 2 of the License. You may also, at your * option, follow the terms under the heading "BSD LICENSE", below. * * 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., 675 Mass Ave, Cambridge, MA 02139, USA. * */ \ #include <linux/config.h> #include <linux/version.h> #include <linux/module.h> #include <linux/init.h> \ #include "ov511.h" \ /* Version Information */ \ #define DRIVER_VERSION "v1.3" #define DRIVER_AUTHOR "Mark McClelland <[EMAIL PROTECTED]>, OmniVision \ Technologies <http://www.ovt.com/>" #define DRIVER_DESC "OV511 Decompression Module" \ /* Prototypes */ \ extern int ov511_register_decomp_module(int ver, struct ov51x_decomp_ops *ops, int ov518, int mmx); extern void ov511_deregister_decomp_module(int ov518, int mmx); extern void * ov511_vmalloc(unsigned long size); extern void ov511_vfree(void * addr); \ /* Constants */ \ static const int interface_ver = DECOMP_INTERFACE_VER; static const int ov518 = 0; static const int mmx = 0; \ /* Module features */ \ /* 0=no debug messages * 1=init/detection/unload and other significant messages, * 2=some warning messages * 3=config/control function calls * 4=most function calls and data parsing messages * 5=highly repetitive mesgs * NOTE: This should be changed to 0, 1, or 2 for production kernels */ static int debug = 0; \ MODULE_PARM(debug, "i"); MODULE_PARM_DESC(debug, "Debug level: 0=none, 1=inits, 2=warning, 3=config, 4=functions, 5=max"); \ MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESC); MODULE_LICENSE("GPL"); \ static void DecompressYHI(unsigned char *pIn, unsigned char *pOut, int *iIn, /* in/out */ int *iOut, /* in/out */ const int w, const int YUVFlag) { short ZigZag[64]; int temp[64]; int Zcnt_Flag = 0; int Num8_Flag = 0; int in_pos = *iIn; int out_pos = *iOut; int tmp, tmp1, tmp2, tmp3; unsigned char header, ZTable[64]; short tmpl, tmph, half_byte, idx, count; unsigned long ZigZag_length = 0, ZT_length, i, j; short DeZigZag[64]; \ const short a = 11584; const short b = 16068; const short c = 15136; const short d = 13624; const short e = 9104; const short f = 6270; const short g = 3196; \ int out_idx; \ /* Take off every 'Zig' */ for (i = 0; i < 64; i++) { ZigZag[i] = 0; } \ /***************************** * Read in the Y header byte * *****************************/ \ header = pIn[in_pos]; in_pos++; \ ZigZag_length = header & 0x3f; ZigZag_length = ZigZag_length + 1; \ Num8_Flag = header & 0x40; Zcnt_Flag = header & 0x80; \ /************************* * Read in the Y content * *************************/ \ if (Zcnt_Flag == 0) { /* Without Zero Table read contents directly */ /* Read in ZigZag[0] */ ZigZag[0] = pIn[in_pos++]; tmpl = pIn[in_pos++]; tmph = tmpl<<8; ZigZag[0] = ZigZag[0] | tmph; ZigZag[0] = ZigZag[0]<<4; ZigZag[0] = ZigZag[0]>>4; \ if (Num8_Flag) { /* 8 Bits */ for (i = 1; i < ZigZag_length; i++) { ZigZag[i] = pIn[in_pos++]; ZigZag[i] = ZigZag[i]<<8; ZigZag[i] = ZigZag[i]>>8; } } else { /* 12 bits and has no Zero Table */ idx = 1; half_byte = 0; for (i = 1; i < ZigZag_length; i++) { if (half_byte == 0) { ZigZag[i] = pIn[in_pos++]; tmpl = pIn[in_pos++]; tmph = tmpl<<8; tmph = tmph&0x0f00; ZigZag[i] = ZigZag[i] | tmph; ZigZag[i] = ZigZag[i]<<4; ZigZag[i] = ZigZag[i]>>4; half_byte = 1; } else { ZigZag[i] = pIn[in_pos++]; ZigZag[i] = ZigZag[i]<<8; tmpl = tmpl & 0x00f0; ZigZag[i] = ZigZag[i] | tmpl; ZigZag[i] = ZigZag[i]>>4; half_byte = 0; } } } } else { /* Has Zero Table */ /* Calculate Z-Table length */ ZT_length = ZigZag_length/8; tmp = ZigZag_length%8; \ if (tmp > 0) { ZT_length = ZT_length + 1; } \ /* Read in Zero Table */ for (j = 0; j < ZT_length; j++) { ZTable[j] = pIn[in_pos++]; } \ /* Read in ZigZag[0] */ ZigZag[0] = pIn[in_pos++]; tmpl = pIn[in_pos++]; tmph = tmpl<<8; ZigZag[0] = ZigZag[0] | tmph; ZigZag[0] = ZigZag[0]<<4; ZigZag[0] = ZigZag[0]>>4; \ /* Decode ZigZag */ idx = 0; ZTable[idx] = ZTable[idx]<<1; count = 7; \ if (Num8_Flag) { /* 8 Bits and has zero table */ for (i = 1; i < ZigZag_length; i++) { if ((ZTable[idx]&0x80)) { ZigZag[i] = pIn[in_pos++]; ZigZag[i] = ZigZag[i]<<8; ZigZag[i] = ZigZag[i]>>8; } \ ZTable[idx]=ZTable[idx]<<1; count--; if (count == 0) { count = 8; idx++; } } \ } else { /* 12 bits and has Zero Table */ half_byte = 0; for (i = 1; i < ZigZag_length; i++) { if (ZTable[idx]&0x80) { if (half_byte == 0) { ZigZag[i] = pIn[in_pos++]; tmpl = pIn[in_pos++]; tmph = tmpl <<8; tmph = tmph & 0x0f00; ZigZag[i] = ZigZag[i] | tmph; ZigZag[i] = ZigZag[i]<<4; ZigZag[i] = ZigZag[i]>>4; half_byte = 1; } else { ZigZag[i] = pIn[in_pos++]; ZigZag[i] = ZigZag[i]<<8; tmpl = tmpl & 0x00f0; ZigZag[i] = ZigZag[i] | tmpl; ZigZag[i] = ZigZag[i]>>4; half_byte = 0; } } ZTable[idx] = ZTable[idx]<<1; count--; if (count == 0) { count = 8; idx++; } } } } \ /************* * De-ZigZag * *************/ \ for (j = 0; j < 64; j++) { DeZigZag[j] = 0; } \ if (YUVFlag == 1) { DeZigZag[0] = ZigZag[0]; DeZigZag[1] = ZigZag[1]<<1; DeZigZag[2] = ZigZag[5]<<1; DeZigZag[3] = ZigZag[6]<<2; \ DeZigZag[8] = ZigZag[2]<<1; DeZigZag[9] = ZigZag[4]<<1; DeZigZag[10] = ZigZag[7]<<1; DeZigZag[11] = ZigZag[13]<<2; \ DeZigZag[16] = ZigZag[3]<<1; DeZigZag[17] = ZigZag[8]<<1; DeZigZag[18] = ZigZag[12]<<2; DeZigZag[19] = ZigZag[17]<<2; \ DeZigZag[24] = ZigZag[9]<<2; DeZigZag[25] = ZigZag[11]<<2; DeZigZag[26] = ZigZag[18]<<2; DeZigZag[27] = ZigZag[24]<<3; } else { DeZigZag[0] = ZigZag[0]; DeZigZag[1] = ZigZag[1]<<2; DeZigZag[2] = ZigZag[5]<<2; DeZigZag[3] = ZigZag[6]<<3; \ DeZigZag[8] = ZigZag[2]<<2; DeZigZag[9] = ZigZag[4]<<2; DeZigZag[10] = ZigZag[7]<<2; DeZigZag[11] = ZigZag[13]<<4; \ DeZigZag[16] = ZigZag[3]<<2; DeZigZag[17] = ZigZag[8]<<2; DeZigZag[18] = ZigZag[12]<<3; DeZigZag[19] = ZigZag[17]<<4; \ DeZigZag[24] = ZigZag[9]<<3; DeZigZag[25] = ZigZag[11]<<4; DeZigZag[26] = ZigZag[18]<<4; DeZigZag[27] = ZigZag[24]<<4; } \ #if 0 /* Dequante */ if (YUVFlag == 1) { /* Dequante Y */ for (i=0; i<64; i++) { ZigZag[i] = DeZigZag[i]<<DQTY[i]; } } else { /* Dequante UV */ for (i=0; i<64; i++) { ZigZag[i] = DeZigZag[i]<<DQTUV[i]; } } #endif \ /***************** **** IDCT 1D **** *****************/ \ /* j = 0 */ tmp1=a*DeZigZag[0]+c*DeZigZag[2]; tmp2=b*DeZigZag[1]; tmp3=d*DeZigZag[3]; \ tmp=tmp1+tmp2+tmp3; temp[0] = tmp>>15; \ tmp=tmp1-tmp2-tmp3; temp[56] = tmp>>15; \ tmp1=a*DeZigZag[8]+c*DeZigZag[10]; tmp2=b*DeZigZag[9]; tmp3=d*DeZigZag[11]; \ tmp=tmp1+tmp2+tmp3; temp[1] = tmp>>15; \ tmp=tmp1-tmp2-tmp3; temp[57] = tmp>>15; \ tmp1=a*DeZigZag[16]+c*DeZigZag[18]; tmp2=b*DeZigZag[17]; tmp3=d*DeZigZag[19]; \ tmp=tmp1+tmp2+tmp3; temp[2] = tmp>>15; \ tmp=tmp1-tmp2-tmp3; temp[58] = tmp>>15; \ tmp1=a*DeZigZag[24]+c*DeZigZag[26]; tmp2=b*DeZigZag[25]; tmp3=d*DeZigZag[27]; \ tmp=tmp1+tmp2+tmp3; temp[3] = tmp>>15; \ tmp=tmp1-tmp2-tmp3; temp[59] = tmp>>15; \ \ /* j = 1 */ tmp1=a*DeZigZag[0]+f*DeZigZag[2]; tmp2=d*DeZigZag[1]; tmp3=g*DeZigZag[3]; \ tmp=tmp1+tmp2-tmp3; temp[8] = tmp>>15; \ tmp=tmp1-tmp2+tmp3; temp[48] = tmp>>15; \ tmp1=a*DeZigZag[8]+f*DeZigZag[10]; tmp2=d*DeZigZag[9]; tmp3=g*DeZigZag[11]; \ tmp=tmp1+tmp2-tmp3; temp[9] = tmp>>15; \ tmp=tmp1-tmp2+tmp3; temp[49] = tmp>>15; \ tmp1=a*DeZigZag[16]+f*DeZigZag[18]; tmp2=d*DeZigZag[17]; tmp3=g*DeZigZag[19]; \ tmp=tmp1+tmp2-tmp3; temp[10] = tmp>>15; \ tmp=tmp1-tmp2+tmp3; temp[50] = tmp>>15; \ tmp1=a*DeZigZag[24]+f*DeZigZag[26]; tmp2=d*DeZigZag[25]; tmp3=g*DeZigZag[27]; \ tmp=tmp1+tmp2-tmp3; temp[11] = tmp>>15; \ tmp=tmp1-tmp2+tmp3; temp[51] = tmp>>15; \ \ /* j = 2 */ tmp1=a*DeZigZag[0]-f*DeZigZag[2]; tmp2=e*DeZigZag[1]; tmp3=b*DeZigZag[3]; \ tmp=tmp1+tmp2-tmp3; temp[16] = tmp>>15; \ tmp=tmp1-tmp2+tmp3; temp[40] = tmp>>15; \ tmp1=a*DeZigZag[8]-f*DeZigZag[10]; tmp2=e*DeZigZag[9]; tmp3=b*DeZigZag[11]; \ tmp=tmp1+tmp2-tmp3; temp[17] = tmp>>15; \ tmp=tmp1-tmp2+tmp3; temp[41] = tmp>>15; \ tmp1=a*DeZigZag[16]-f*DeZigZag[18]; tmp2=e*DeZigZag[17]; tmp3=b*DeZigZag[19]; \ tmp=tmp1+tmp2-tmp3; temp[18] = tmp>>15; \ tmp=tmp1-tmp2+tmp3; temp[42] = tmp>>15; \ tmp1=a*DeZigZag[24]-f*DeZigZag[26]; tmp2=e*DeZigZag[25]; tmp3=b*DeZigZag[27]; \ tmp=tmp1+tmp2-tmp3; temp[19] = tmp>>15; \ tmp=tmp1-tmp2+tmp3; temp[43] = tmp>>15; \ \ /* j = 3 */ tmp1=a*DeZigZag[0]-c*DeZigZag[2]; tmp2=g*DeZigZag[1]; tmp3=e*DeZigZag[3]; \ tmp=tmp1+tmp2-tmp3; temp[24] = tmp>>15; \ tmp=tmp1-tmp2+tmp3; temp[32] = tmp>>15; \ tmp1=a*DeZigZag[8]-c*DeZigZag[10]; tmp2=g*DeZigZag[9]; tmp3=e*DeZigZag[11]; \ tmp=tmp1+tmp2-tmp3; temp[25] = tmp>>15; \ tmp=tmp1-tmp2+tmp3; temp[33] = tmp>>15; \ tmp1=a*DeZigZag[16]-c*DeZigZag[18]; tmp2=g*DeZigZag[17]; tmp3=e*DeZigZag[19]; \ tmp=tmp1+tmp2-tmp3; temp[26] = tmp>>15; \ tmp=tmp1-tmp2+tmp3; temp[34] = tmp>>15; \ tmp1=a*DeZigZag[24]-c*DeZigZag[26]; tmp2=g*DeZigZag[25]; tmp3=e*DeZigZag[27]; \ tmp=tmp1+tmp2-tmp3; temp[27] = tmp>>15; \ tmp=tmp1-tmp2+tmp3; temp[35] = tmp>>15; \ \ /***************** **** IDCT 2D **** *****************/ \ out_idx = out_pos; \ /* i=0 */ \ /* j=0 */ tmp = temp[0]*a+temp[1]*b+temp[2]*c+temp[3]*d; tmp = tmp>>15; tmp = tmp + 128; if (tmp > 255) tmp=255; if (tmp < 0) tmp=0; pOut[0+out_idx] = (unsigned char) tmp; \ /* j=1 */ tmp = temp[0]*a+temp[1]*d+temp[2]*f+temp[3]*(-g); tmp = tmp>>15; tmp = tmp + 128; if (tmp > 255) tmp=255; if (tmp < 0) tmp=0; pOut[1+out_idx] = (unsigned char) tmp; \ /* j=2 */ tmp = temp[0]*a+temp[1]*e+temp[2]*(-f)+temp[3]*(-b); tmp = tmp>>15; tmp = tmp + 128; if (tmp > 255) tmp=255; if (tmp < 0) tmp=0; pOut[2+out_idx] = (unsigned char) tmp; \ /* j=3 */ tmp = temp[0]*a+temp[1]*g+temp[2]*(-c)+temp[3]*(-e); tmp = tmp>>15; tmp = tmp + 128; if (tmp > 255) tmp=255; if (tmp < 0) tmp=0; pOut[3+out_idx] = (unsigned char) tmp; \ /* j=4 */ tmp = temp[0]*a+temp[1]*(-g)+temp[2]*(-c)+temp[3]*e; tmp = tmp>>15; tmp = tmp + 128; if (tmp > 255) tmp=255; if (tmp < 0) tmp=0; pOut[4+out_idx] = (unsigned char) tmp; \ /* j=5 */ tmp = temp[0]*a+temp[1]*(-e)+temp[2]*(-f)+temp[3]*b; tmp = tmp>>15; tmp = tmp + 128; if (tmp > 255) tmp=255; if (tmp < 0) tmp=0; pOut[5+out_idx] = (unsigned char) tmp; \ /* j=6 */ tmp = temp[0]*a+temp[1]*(-d)+temp[2]*f+temp[3]*g; tmp = tmp>>15; tmp = tmp + 128; if (tmp > 255) tmp=255; if (tmp < 0) tmp=0; pOut[6+out_idx] = (unsigned char) tmp; \ /* j=7 */ tmp = temp[0]*a+temp[1]*(-b)+temp[2]*c+temp[3]*(-d); tmp = tmp>>15; tmp = tmp + 128; if (tmp > 255) tmp=255; if (tmp < 0) tmp=0; pOut[7+out_idx] = (unsigned char) tmp; \ \ out_idx += w; \ /* i=1 */ \ /* j=0 */ tmp = temp[8]*a+temp[9]*b+temp[10]*c+temp[11]*d; tmp = tmp>>15; tmp = tmp + 128; if (tmp > 255) tmp=255; if (tmp < 0) tmp=0; pOut[out_idx] = (unsigned char) tmp; \ /* j=1 */ tmp = temp[8]*a+temp[9]*d+temp[10]*f+temp[11]*(-g); tmp = tmp>>15; tmp = tmp + 128; if (tmp > 255) tmp=255; if (tmp < 0) tmp=0; pOut[out_idx+1] = (unsigned char) tmp; \ /* j=2 */ tmp = temp[8]*a+temp[9]*e+temp[10]*(-f)+temp[11]*(-b); tmp = tmp>>15; tmp = tmp + 128; if (tmp > 255) tmp=255; if (tmp < 0) tmp=0; pOut[out_idx+2] = (unsigned char) tmp; \ /* j=3 */ tmp = temp[8]*a+temp[9]*g+temp[10]*(-c)+temp[11]*(-e); tmp = tmp>>15; tmp = tmp + 128; if (tmp > 255) tmp=255; if (tmp < 0) tmp=0; pOut[out_idx+3] = (unsigned char) tmp; \ /* j=4 */ tmp = temp[8]*a+temp[9]*(-g)+temp[10]*(-c)+temp[11]*e; tmp = tmp>>15; tmp = tmp + 128; if (tmp > 255) tmp=255; if (tmp < 0) tmp=0; pOut[out_idx+4] = (unsigned char) tmp; \ /* j=5 */ tmp = temp[8]*a+temp[9]*(-e)+temp[10]*(-f)+temp[11]*b; tmp = tmp>>15; tmp = tmp + 128; if (tmp > 255) tmp=255; if (tmp < 0) tmp=0; pOut[out_idx+5] = (unsigned char) tmp; \ /* j=6 */ tmp = temp[8]*a+temp[9]*(-d)+temp[10]*f+temp[11]*g; tmp = tmp>>15; tmp = tmp + 128; if (tmp > 255) tmp=255; if (tmp < 0) tmp=0; pOut[out_idx+6] = (unsigned char) tmp; \ /* j=7 */ tmp = temp[8]*a+temp[9]*(-b)+temp[10]*c+temp[11]*(-d); tmp = tmp>>15; tmp = tmp + 128; if (tmp > 255) tmp=255; if (tmp < 0) tmp=0; pOut[out_idx+7] = (unsigned char) tmp; \ \ out_idx += w; \ \ /* i=2 */ \ /* j=0 */ tmp = temp[16]*a+temp[17]*b+temp[18]*c+temp[19]*d; tmp = tmp>>15; tmp = tmp + 128; if (tmp > 255) tmp=255; if (tmp < 0) tmp=0; pOut[out_idx] = (unsigned char) tmp; \ /* j=1 */ tmp = temp[16]*a+temp[17]*d+temp[18]*f+temp[19]*(-g); tmp = tmp>>15; tmp = tmp + 128; if (tmp > 255) tmp=255; if (tmp < 0) tmp=0; pOut[out_idx+1] = (unsigned char) tmp; \ /* j=2 */ tmp = temp[16]*a+temp[17]*e+temp[18]*(-f)+temp[19]*(-b); tmp = tmp>>15; tmp = tmp + 128; if (tmp > 255) tmp=255; if (tmp < 0) tmp=0; pOut[out_idx+2] = (unsigned char) tmp; \ /* j=3 */ tmp = temp[16]*a+temp[17]*g+temp[18]*(-c)+temp[19]*(-e); tmp = tmp>>15; tmp = tmp + 128; if (tmp > 255) tmp=255; if (tmp < 0) tmp=0; pOut[out_idx+3] = (unsigned char) tmp; \ /* j=4 */ tmp = temp[16]*a+temp[17]*(-g)+temp[18]*(-c)+temp[19]*e; tmp = tmp>>15; tmp = tmp + 128; if (tmp > 255) tmp=255; if (tmp < 0) tmp=0; pOut[out_idx+4] = (unsigned char) tmp; \ /* j=5 */ tmp = temp[16]*a+temp[17]*(-e)+temp[18]*(-f)+temp[19]*b; tmp = tmp>>15; tmp = tmp + 128; if (tmp > 255) tmp=255; if (tmp < 0) tmp=0; pOut[out_idx+5] = (unsigned char) tmp; \ /* j=6 */ tmp = temp[16]*a+temp[17]*(-d)+temp[18]*f+temp[19]*g; tmp = tmp>>15; tmp = tmp + 128; if (tmp > 255) tmp=255; if (tmp < 0) tmp=0; pOut[out_idx+6] = (unsigned char) tmp; \ /* j=7 */ tmp = temp[16]*a+temp[17]*(-b)+temp[18]*c+temp[19]*(-d); tmp = tmp>>15; tmp = tmp + 128; if (tmp > 255) tmp=255; if (tmp < 0) tmp=0; pOut[out_idx+7] = (unsigned char) tmp; \ \ out_idx += w; \ /* i=3 */ \ /* j=0 */ tmp = temp[24]*a+temp[25]*b+temp[26]*c+temp[27]*d; tmp = tmp>>15; tmp = tmp + 128; if (tmp > 255) tmp=255; if (tmp < 0) tmp=0; pOut[out_idx] = (unsigned char) tmp; \ /* j=1 */ tmp = temp[24]*a+temp[25]*d+temp[26]*f+temp[27]*(-g); tmp = tmp>>15; tmp = tmp + 128; if (tmp > 255) tmp=255; if (tmp < 0) tmp=0; pOut[out_idx+1] = (unsigned char) tmp; \ /* j=2 */ tmp = temp[24]*a+temp[25]*e+temp[26]*(-f)+temp[27]*(-b); tmp = tmp>>15; tmp = tmp + 128; if (tmp > 255) tmp=255; if (tmp < 0) tmp=0; pOut[out_idx+2] = (unsigned char) tmp; \ /* j=3 */ tmp = temp[24]*a+temp[25]*g+temp[26]*(-c)+temp[27]*(-e); tmp = tmp>>15; tmp = tmp + 128; if (tmp > 255) tmp=255; if (tmp < 0) tmp=0; pOut[out_idx+3] = (unsigned char) tmp; \ /* j=4 */ tmp = temp[24]*a+temp[25]*(-g)+temp[26]*(-c)+temp[27]*e; tmp = tmp>>15; tmp = tmp + 128; if (tmp > 255) tmp=255; if (tmp < 0) tmp=0; pOut[out_idx+4] = (unsigned char) tmp; \ /* j=5 */ tmp = temp[24]*a+temp[25]*(-e)+temp[26]*(-f)+temp[27]*b; tmp = tmp>>15; tmp = tmp + 128; if (tmp > 255) tmp=255; if (tmp < 0) tmp=0; pOut[out_idx+5] = (unsigned char) tmp; \ /* j=6 */ tmp = temp[24]*a+temp[25]*(-d)+temp[26]*f+temp[27]*g; tmp = tmp>>15; tmp = tmp + 128; if (tmp > 255) tmp=255; if (tmp < 0) tmp=0; pOut[out_idx+6] = (unsigned char) tmp; \ /* j=7 */ tmp = temp[24]*a+temp[25]*(-b)+temp[26]*c+temp[27]*(-d); tmp = tmp>>15; tmp = tmp + 128; if (tmp > 255) tmp=255; if (tmp < 0) tmp=0; pOut[out_idx+7] = (unsigned char) tmp; \ \ out_idx += w; \ /* i=4 */ \ /* j=0 */ tmp = temp[32]*a+temp[33]*b+temp[34]*c+temp[35]*d; tmp = tmp>>15; tmp = tmp + 128; if (tmp > 255) tmp=255; if (tmp < 0) tmp=0; pOut[out_idx] = (unsigned char) tmp; \ /* j=1 */ tmp = temp[32]*a+temp[33]*d+temp[34]*f+temp[35]*(-g); tmp = tmp>>15; tmp = tmp + 128; if (tmp > 255) tmp=255; if (tmp < 0) tmp=0; pOut[out_idx+1] = (unsigned char) tmp; \ /* j=2 */ tmp = temp[32]*a+temp[33]*e+temp[34]*(-f)+temp[35]*(-b); tmp = tmp>>15; tmp = tmp + 128; if (tmp > 255) tmp=255; if (tmp < 0) tmp=0; pOut[out_idx+2] = (unsigned char) tmp; \ /* j=3 */ tmp = temp[32]*a+temp[33]*g+temp[34]*(-c)+temp[35]*(-e); tmp = tmp>>15; tmp = tmp + 128; if (tmp > 255) tmp=255; if (tmp < 0) tmp=0; pOut[out_idx+3] = (unsigned char) tmp; \ /* j=4 */ tmp = temp[32]*a+temp[33]*(-g)+temp[34]*(-c)+temp[35]*e; tmp = tmp>>15; tmp = tmp + 128; if (tmp > 255) tmp=255; if (tmp < 0) tmp=0; pOut[out_idx+4] = (unsigned char) tmp; \ /* j=5 */ tmp = temp[32]*a+temp[33]*(-e)+temp[34]*(-f)+temp[35]*b; tmp = tmp>>15; tmp = tmp + 128; if (tmp > 255) tmp=255; if (tmp < 0) tmp=0; pOut[out_idx+5] = (unsigned char) tmp; \ /* j=6 */ tmp = temp[32]*a+temp[33]*(-d)+temp[34]*f+temp[35]*g; tmp = tmp>>15; tmp = tmp + 128; if (tmp > 255) tmp=255; if (tmp < 0) tmp=0; pOut[out_idx+6] = (unsigned char) tmp; \ /* j=7 */ tmp = temp[32]*a+temp[33]*(-b)+temp[34]*c+temp[35]*(-d); tmp = tmp>>15; tmp = tmp + 128; if (tmp > 255) tmp=255; if (tmp < 0) tmp=0; pOut[out_idx+7] = (unsigned char) tmp; \ \ out_idx += w; \ /* i=5 */ \ /* j=0 */ tmp = temp[40]*a+temp[41]*b+temp[42]*c+temp[43]*d; tmp = tmp>>15; tmp = tmp + 128; if (tmp > 255) tmp=255; if (tmp < 0) tmp=0; pOut[out_idx] = (unsigned char) tmp; \ /* j=1 */ tmp = temp[40]*a+temp[41]*d+temp[42]*f+temp[43]*(-g); tmp = tmp>>15; tmp = tmp + 128; if (tmp > 255) tmp=255; if (tmp < 0) tmp=0; pOut[out_idx+1] = (unsigned char) tmp; \ /* j=2 */ tmp = temp[40]*a+temp[41]*e+temp[42]*(-f)+temp[43]*(-b); tmp = tmp>>15; tmp = tmp + 128; if (tmp > 255) tmp=255; if (tmp < 0) tmp=0; pOut[out_idx+2] = (unsigned char) tmp; \ /* j=3 */ tmp = temp[40]*a+temp[41]*g+temp[42]*(-c)+temp[43]*(-e); tmp = tmp>>15; tmp = tmp + 128; if (tmp > 255) tmp=255; if (tmp < 0) tmp=0; pOut[out_idx+3] = (unsigned char) tmp; \ /* j=4 */ tmp = temp[40]*a+temp[41]*(-g)+temp[42]*(-c)+temp[43]*e; tmp = tmp>>15; tmp = tmp + 128; if (tmp > 255) tmp=255; if (tmp < 0) tmp=0; pOut[out_idx+4] = (unsigned char) tmp; \ /* j=5 */ tmp = temp[40]*a+temp[41]*(-e)+temp[42]*(-f)+temp[43]*b; tmp = tmp>>15; tmp = tmp + 128; if (tmp > 255) tmp=255; if (tmp < 0) tmp=0; pOut[out_idx+5] = (unsigned char) tmp; \ /* j=6 */ tmp = temp[40]*a+temp[41]*(-d)+temp[42]*f+temp[43]*g; tmp = tmp>>15; tmp = tmp + 128; if (tmp > 255) tmp=255; if (tmp < 0) tmp=0; pOut[out_idx+6] = (unsigned char) tmp; \ /* j=7 */ tmp = temp[40]*a+temp[41]*(-b)+temp[42]*c+temp[43]*(-d); tmp = tmp>>15; tmp = tmp + 128; if (tmp > 255) tmp=255; if (tmp < 0) tmp=0; pOut[out_idx+7] = (unsigned char) tmp; \ \ out_idx += w; \ /* i=6 */ \ tmp1=temp[48]*a+temp[50]*c; tmp2=temp[49]*b; tmp3=temp[51]*d; /* j=0 */ tmp=tmp1+tmp2+tmp3; tmp = tmp>>15; tmp = tmp + 128; if (tmp > 255) tmp=255; if (tmp < 0) tmp=0; pOut[out_idx] = (unsigned char) tmp; \ /* j=7 */ tmp=tmp1-tmp2-tmp3; tmp = tmp>>15; tmp = tmp + 128; if (tmp > 255) tmp=255; if (tmp < 0) tmp=0; pOut[out_idx+7] = (unsigned char) tmp; \ tmp1=temp[48]*a+temp[50]*f; tmp2=temp[49]*d; tmp3=temp[51]*g; /* j=1 */ tmp=tmp1+tmp2-tmp3; tmp = tmp>>15; tmp = tmp + 128; if (tmp > 255) tmp=255; if (tmp < 0) tmp=0; pOut[out_idx+1] = (unsigned char) tmp; \ /* j=6 */ tmp=tmp1-tmp2+tmp3; tmp = tmp>>15; tmp = tmp + 128; if (tmp > 255) tmp=255; if (tmp < 0) tmp=0; pOut[out_idx+6] = (unsigned char) tmp; tmp1=temp[48]*a-temp[50]*f; tmp2=temp[49]*e; tmp3=temp[51]*b; /* j=2 */ tmp=tmp1+tmp2-tmp3; tmp = tmp>>15; tmp = tmp + 128; if (tmp > 255) tmp=255; if (tmp < 0) tmp=0; pOut[out_idx+2] = (unsigned char) tmp; \ /* j=5 */ tmp=tmp1-tmp2+tmp3; tmp = tmp>>15; tmp = tmp + 128; if (tmp > 255) tmp=255; if (tmp < 0) tmp=0; pOut[out_idx+5] = (unsigned char) tmp; \ tmp1=temp[48]*a-temp[50]*c; tmp2=temp[49]*g; tmp3=temp[51]*e; /* j=3 */ tmp=tmp1+tmp2-tmp3; tmp = tmp>>15; tmp = tmp + 128; if (tmp > 255) tmp=255; if (tmp < 0) tmp=0; pOut[out_idx+3] = (unsigned char) tmp; \ /* j=4 */ tmp=tmp1-tmp2+tmp3; tmp = tmp>>15; tmp = tmp + 128; if (tmp > 255) tmp=255; if (tmp < 0) tmp=0; pOut[out_idx+4] = (unsigned char) tmp; \ \ out_idx += w; \ /* i=7 */ \ tmp1=temp[56]*a+temp[58]*c; tmp2=temp[57]*b; tmp3=temp[59]*d; \ /* j=0 */ tmp=tmp1+tmp2+tmp3; tmp = tmp>>15; tmp = tmp + 128; if (tmp > 255) tmp=255; if (tmp < 0) tmp=0; pOut[out_idx] = (unsigned char) tmp; \ /* j=7 */ tmp=tmp1-tmp2-tmp3; tmp = tmp>>15; tmp = tmp + 128; if (tmp > 255) tmp=255; if (tmp < 0) tmp=0; pOut[out_idx+7] = (unsigned char) tmp; \ tmp1=temp[56]*a+temp[58]*f; tmp2=temp[57]*d; tmp3=temp[59]*g; \ /* j=1 */ tmp=tmp1+tmp2-tmp3; tmp = tmp>>15; tmp = tmp + 128; if (tmp > 255) tmp=255; if (tmp < 0) tmp=0; pOut[out_idx+1] = (unsigned char) tmp; \ /* j=6 */ tmp=tmp1-tmp2+tmp3; tmp = tmp>>15; tmp = tmp + 128; if (tmp > 255) tmp=255; if (tmp < 0) tmp=0; pOut[out_idx+6] = (unsigned char) tmp; \ tmp1=temp[56]*a-temp[58]*f; tmp2=temp[57]*e; tmp3=temp[59]*b; \ /* j=2 */ tmp=tmp1+tmp2-tmp3; tmp = tmp>>15; tmp = tmp + 128; if (tmp > 255) tmp=255; if (tmp < 0) tmp=0; pOut[out_idx+2] = (unsigned char) tmp; \ /* j=5 */ tmp=tmp1-tmp2+tmp3; tmp = tmp>>15; tmp = tmp + 128; if (tmp > 255) tmp=255; if (tmp < 0) tmp=0; pOut[out_idx+5] = (unsigned char) tmp; \ tmp1=temp[56]*a-temp[58]*c; tmp2=temp[57]*g; tmp3=temp[59]*e; \ /* j=3 */ tmp=tmp1+tmp2-tmp3; tmp = tmp>>15; tmp = tmp + 128; if (tmp > 255) tmp=255; if (tmp < 0) tmp=0; pOut[out_idx+3] = (unsigned char) tmp; \ /* j=4 */ tmp=tmp1-tmp2+tmp3; tmp = tmp>>15; tmp = tmp + 128; if (tmp > 255) tmp=255; if (tmp < 0) tmp=0; pOut[out_idx+4] = (unsigned char) tmp; \ *iIn = in_pos; *iOut = out_pos + 8; } \ #define DECOMP_Y() DecompressYHI(pIn, pY, &iIn, &iY, w, 1) \ #define DECOMP_U() DecompressYHI(pIn, pU, &iIn, &iU, w/2, 2) \ #define DECOMP_V() DecompressYHI(pIn, pV, &iIn, &iV, w/2, 2) \ inline static int Decompress400HiNoMMX(unsigned char *pIn, unsigned char *pOut, const int w, const int h, const int inSize) { unsigned char *pY = pOut; int x, y, iIn, iY; \ iIn = 0; for (y = 0; y < h; y += 8) { iY = w*y; \ for (x = 0; x < w; x += 8) DECOMP_Y(); } \ return 0; } \ inline static int Decompress420HiNoMMX(unsigned char *pIn, unsigned char *pOut, const int w, const int h, const int inSize) { unsigned char *pY = pOut; unsigned char *pU = pY + w*h; unsigned char *pV = pU + w*h/4; int x, y, iY, iU, iV, iIn; \ iIn = 0; for (y = 0; y < h; y += 16) { iY = w*y; iU = iY/4; iV = iU; \ if (iIn > inSize) return -1; \ for (x = 0; x < w; x += 32) { DECOMP_U(); DECOMP_V(); DECOMP_Y(); DECOMP_Y(); DECOMP_Y(); DECOMP_Y(); } \ iY = w*(y + 8); iV = (w*y + w)/4; iU = iV; for (x = 0; x < w; x += 32) { DECOMP_U(); DECOMP_V(); DECOMP_Y(); DECOMP_Y(); DECOMP_Y(); DECOMP_Y(); } } \ return 0; } \ /* Input format is raw isoc. data (with header and packet * number stripped, and all-zero blocks removed). * Output format is YUV400 * Returns uncompressed data length if success, or zero if error */ static int Decompress400(unsigned char *pIn, unsigned char *pOut, int w, int h, int inSize) { int numpix = w * h; int rc; \ PDEBUG(4, "%dx%d pIn=%p pOut=%p inSize=%d", w, h, pIn, pOut, inSize); \ rc = Decompress400HiNoMMX(pIn, pOut, w, h, inSize); \ if (rc) return 0; \ return numpix; } \ \ /* Input format is raw isoc. data (with header and packet * number stripped, and all-zero blocks removed). * Output format is planar YUV420 * Returns uncompressed data length if success, or zero if error */ static int Decompress420(unsigned char *pIn, unsigned char *pOut, int w, int h, int inSize) { int numpix = w * h; int rc; \ PDEBUG(4, "%dx%d pIn=%p pOut=%p inSize=%d", w, h, pIn, pOut, inSize); \ rc = Decompress420HiNoMMX(pIn, pOut, w, h, inSize); \ if (rc) return 0; \ /* Disabled by Mark */ #if 0 /* For color saturation 8/22/00 */ { long u , v; unsigned char *pU = pOut + numpix; unsigned char *pV = pU + numpix/4; for (int i = 0; i < numpix/4; i++) { u = (long)*pU; v = (long)*pV; u -= 128; v -= 128; u = (u * 577) >> 10; v = (v * 730) >> 10; u += 128; v += 128; *pU++ = (unsigned char)u; *pV++ = (unsigned char)v; /* u=0.564 */ /* v=0.713 */ } } #endif \ return (numpix * 3 / 2); } \ static void DecompLock(void) { MOD_INC_USE_COUNT; } \ static void DecompUnlock(void) { MOD_DEC_USE_COUNT; } \ static struct ov51x_decomp_ops decomp_ops = { decomp_400: Decompress400, decomp_420: Decompress420, decomp_lock: DecompLock, decomp_unlock: DecompUnlock }; \ static int __init decomp_init(void) { int rc; \ EXPORT_NO_SYMBOLS; \ rc = ov511_register_decomp_module(DECOMP_INTERFACE_VER, &decomp_ops, ov518, mmx); if (rc) { err("Could not register with ov511 (rc=%d)", rc); return -1; } \ info(DRIVER_VERSION " : " DRIVER_DESC); \ return 0; } \ static void __exit decomp_exit(void) { ov511_deregister_decomp_module(ov518, mmx); info("deregistered\n"); } \ module_init(decomp_init); module_exit(decomp_exit); == drivers/usb/Config.help == [EMAIL PROTECTED]|drivers/usb/Config.help|20020124212758|13980|945547e94a71831f [EMAIL PROTECTED]|drivers/usb/Config.help|20020214052653|58662 D 1.6 02/02/21 22:06:56-08:00 [EMAIL PROTECTED] +21 -2 B [EMAIL PROTECTED]|ChangeSet|20011125035615|28334|160bd283d279fb69 C c - Added entry for OV511 decompressor c - Updated OV511 entry K 962 O -rw-rw-r-- P drivers/usb/Config.help ------------------------------------------------ D213 2 I214 4 computer's USB port. See <file:Documentation/usb/ov511.txt> for configuration options, and the driver homepage at <http://alpha.dyndns.org/ov511/> for a list of supported cameras and other information. I224 17 \ OV511 Decompression support CONFIG_USB_OV511_DEC Say M here if you want to achieve higher frame rates, at the expense of image quality. A 300 MHz or faster CPU is recommended. \ This feature is NOT activated by default. The OV511 driver must have compression enabled (eg. loaded with the "compress=1" module parameter). See <file:Documentation/usb/ov511.txt> for more information. \ This code is also available as a module ( = code which can be inserted in and removed from the running kernel whenever you want). The module will be called ov511_decomp.o. You must load ov511.o before loading this module, and you must unload this module before unloading ov511.o. Read <file:Documentation/modules.txt> to learn more about modules. # Patch checksum=d5625ec3