Web lists-archives.com

[Spca50x-devs] [Patch] Pac7311 improvements




Hello Michel

The following patch should improve PAC7311 support a lot, I hope ;-)
- different Qtable for better JPEG decoding
- different JPEG Header for raw streaming (which doesn't work :-()
- fixed brightness and contrast controls
- lower Pixelclock to get a brighter image

That's it.

diff -Naur gspcav1-20071224/decoder/gspcadecoder.c 
gspcav1-20071224-PAC7311/decoder/gspcadecoder.c
--- gspcav1-20071224/decoder/gspcadecoder.c	2007-12-24 14:35:27.000000000 +0100
+++ gspcav1-20071224-PAC7311/decoder/gspcadecoder.c	2008-01-05 
19:18:45.000000000 +0100
@@ -302,8 +302,28 @@
  0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 
0x18, 0x18, 0x18,
  0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 
0x18, 0x18, 0x18,
  0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 
0x18, 0x18, 0x18,
- }
-
+},
+	//index8 PAC7311
+	{
+	0x07, 0x07, 0x08, 0x0a, 0x09, 0x07, 0x0d, 0x0b,
+	0x0c, 0x0d, 0x11, 0x10, 0x0f, 0x12, 0x17, 0x27,
+	0x1a, 0x18, 0x16, 0x16, 0x18, 0x31, 0x23, 0x25,
+	0x1d, 0x28, 0x3a, 0x33, 0x3d, 0x3c, 0x39, 0x33,
+	0x38, 0x37, 0x40, 0x48, 0x5c, 0x4e, 0x40, 0x44,
+	0x57, 0x45, 0x37, 0x38, 0x50, 0x6d, 0x51, 0x57,
+	0x5f, 0x62, 0x67, 0x68, 0x67, 0x3e, 0x4d, 0x71,
+	0x79, 0x70, 0x64, 0x78, 0x5c, 0x65, 0x67, 0x63,
+	},
+	{
+	0x11, 0x12, 0x12, 0x18, 0x15, 0x18, 0x2f, 0x1a,
+	0x1a, 0x2f, 0x63, 0x42, 0x38, 0x42, 0x63, 0x63,
+	0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63,
+	0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63,
+	0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63,
+	0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63,
+	0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63,
+	0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63,
+	},
  };


@@ -626,8 +646,8 @@
    0xff, 0xd8, 0xff, 0xe0, 0x00, 0x03, 0x20, 0xff, 0xc0, 0x00,
    0x11, 0x08, 0x01, 0xe0, 0x02, 0x80, 0x03, 0x01, 0x21, 0x00,
    0x02, 0x11, 0x01, 0x03, 0x11, 0x01, 0xff, 0xdb, 0x00, 0x84,
-  0x00, 0x10, 0x0b, 0x0c, 0x0e, 0x0c, 0x0a, 0x10, 0x0e, 0x0d,
-  0x0e, 0x12, 0x11, 0x10, 0x13, 0x18, 0x28, 0x1a, 0x18, 0x16,
+  0x00, 0x07, 0x07, 0x08, 0x0a, 0x09, 0x07, 0x0d, 0x0b, 0x0c,
+  0x0d, 0x11, 0x10, 0x0f, 0x12, 0x17, 0x27, 0x1a, 0x18, 0x16,
    0x16, 0x18, 0x31, 0x23, 0x25, 0x1d, 0x28, 0x3a, 0x33, 0x3d,
    0x3c, 0x39, 0x33, 0x38, 0x37, 0x40, 0x48, 0x5c, 0x4e, 0x40,
    0x44, 0x57, 0x45, 0x37, 0x38, 0x50, 0x6d, 0x51, 0x57, 0x5f,
diff -Naur gspcav1-20071224/Makefile gspcav1-20071224-PAC7311/Makefile
--- gspcav1-20071224/Makefile	2007-12-24 18:03:38.000000000 +0100
+++ gspcav1-20071224-PAC7311/Makefile	2008-01-04 20:33:36.000000000 +0100
@@ -37,7 +37,7 @@
  KERNEL_VERSION = `uname -r`
  KERNELDIR := /lib/modules/$(KERNEL_VERSION)/build
  PWD  := $(shell pwd)
-MODULE_INSTALLDIR = /lib/modules/$(KERNEL_VERSION)/kernel/drivers/usb/media/
+MODULE_INSTALLDIR = /lib/modules/$(KERNEL_VERSION)/ubuntu/gspcav1/media/
  MODULE_INSTALLDIR2 = /lib/modules/$(KERNEL_VERSION)/kernel/drivers/media/video/

  default:
diff -Naur gspcav1-20071224/Pixart/pac7311.h 
gspcav1-20071224-PAC7311/Pixart/pac7311.h
--- gspcav1-20071224/Pixart/pac7311.h	2007-05-08 15:54:20.000000000 +0200
+++ gspcav1-20071224-PAC7311/Pixart/pac7311.h	2008-01-05 20:59:02.000000000 +0100
@@ -104,6 +104,7 @@
      return 0;
  }

+/* Looks like sharpness
  static void pac7311_setcontrast(struct usb_spca50x *spca50x)
  {
      __u8 contrast = spca50x->contrast >> 8;
@@ -112,12 +113,23 @@
      pac7311_reg_write(spca50x->dev, 0x11, 0x01);	//load registers to sensor 
(Bit 0, auto clear)
      PDEBUG(0, "contrast = %i", contrast);
  }
+*/
+
+static void pac7311_setcontrast(struct usb_spca50x *spca50x)
+{
+    __u8 contrast = spca50x->contrast >> 8;
+    pac7311_reg_write(spca50x->dev, 0xff, 0x01);
+    pac7311_reg_write(spca50x->dev, 0x10, contrast);
+    pac7311_reg_write(spca50x->dev, 0x11, 0x01);	//load registers to sensor 
(Bit 0, auto clear)
+    PDEBUG(0, "color = %i", contrast);
+}

  static void pac7311_setbrightness(struct usb_spca50x *spca50x)
  {
-    __u8 brightness = (spca50x->brightness >> 8) * -1;
+    PDEBUG(0, "brightness value recieved = %i", spca50x->brightness);
+    __u8 brightness = ((spca50x->brightness >> 8)+1) * -1;
      pac7311_reg_write(spca50x->dev, 0xff, 0x04);
-    //pac7311_reg_write(spca50x->dev, 0x0e, 0x00);
+    pac7311_reg_write(spca50x->dev, 0x0e, 0x00);
      pac7311_reg_write(spca50x->dev, 0x0f, brightness);
      pac7311_reg_write(spca50x->dev, 0x11, 0x01);	//load registers to sensor 
(Bit 0, auto clear)
      PDEBUG(0, "brightness = %i", brightness);
@@ -125,17 +137,21 @@

  static void pac7311_setcolors(struct usb_spca50x *spca50x)
  {
-    __u8 colour = spca50x->colour >> 8;
+    __u8 color = spca50x->colour >> 8;
+	//only for testing
+	/*
      pac7311_reg_write(spca50x->dev, 0xff, 0x01);
-    pac7311_reg_write(spca50x->dev, 0x10, colour);
+    pac7311_reg_write(spca50x->dev, 0x80, color);
      pac7311_reg_write(spca50x->dev, 0x11, 0x01);	//load registers to sensor 
(Bit 0, auto clear)
-    PDEBUG(0, "color = %i", colour);
+    PDEBUG(0, "color = %i", color);
+	*/
+    PDEBUG(0, "pac7311_setcolors called, not implemented, yet! %i", color);
  }

  static int pac7311_init(struct usb_spca50x *spca50x)
  {
      //__u8 id[] = { 0, 0 };
-    pac7311_reg_write(spca50x->dev, 0x78, 0x00);	//Turn on LED
+    pac7311_reg_write(spca50x->dev, 0x78, 0x44);	//Turn on LED

      return 0;
  }
@@ -203,6 +219,7 @@
      pac7311_reg_write(spca50x->dev, 0x2a, 0x0e);
      pac7311_reg_write(spca50x->dev, 0xff, 0x01);
      pac7311_reg_write(spca50x->dev, 0x3e, 0x20);
+    spca50x->qindex = 8;

      return 0;
  }
@@ -298,7 +315,7 @@
      switch (mode) {
          case QCIF:
              pac7311_reg_write(spca50x->dev, 0xff, 0x04);
-            pac7311_reg_write(spca50x->dev, 0x02, 0x03);
+            pac7311_reg_write(spca50x->dev, 0x02, 0x07);
              pac7311_reg_write(spca50x->dev, 0xff, 0x01);
              pac7311_reg_write(spca50x->dev, 0x08, 0x09);
              pac7311_reg_write(spca50x->dev, 0x17, 0x20);
@@ -308,7 +325,7 @@
          break;
          case QSIF:
              pac7311_reg_write(spca50x->dev, 0xff, 0x04);
-            pac7311_reg_write(spca50x->dev, 0x02, 0x03);
+            pac7311_reg_write(spca50x->dev, 0x02, 0x07);
              pac7311_reg_write(spca50x->dev, 0xff, 0x01);
              pac7311_reg_write(spca50x->dev, 0x08, 0x09);
              pac7311_reg_write(spca50x->dev, 0x17, 0x30);
@@ -317,7 +334,7 @@
          break;
          case QPAL:
              pac7311_reg_write(spca50x->dev, 0xff, 0x04);
-            pac7311_reg_write(spca50x->dev, 0x02, 0x03);
+            pac7311_reg_write(spca50x->dev, 0x02, 0x07);
              pac7311_reg_write(spca50x->dev, 0xff, 0x01);
              pac7311_reg_write(spca50x->dev, 0x08, 0x09);
              pac7311_reg_write(spca50x->dev, 0x17, 0x30);
@@ -326,7 +343,7 @@
          break;
          case CIF:
              pac7311_reg_write(spca50x->dev, 0xff, 0x04);
-            pac7311_reg_write(spca50x->dev, 0x02, 0x03);
+            pac7311_reg_write(spca50x->dev, 0x02, 0x07);
              pac7311_reg_write(spca50x->dev, 0xff, 0x01);
              pac7311_reg_write(spca50x->dev, 0x08, 0x09);
              pac7311_reg_write(spca50x->dev, 0x17, 0x30);
@@ -335,7 +352,7 @@
          break;
          case SIF:
              pac7311_reg_write(spca50x->dev, 0xff, 0x04);
-            pac7311_reg_write(spca50x->dev, 0x02, 0x03);
+            pac7311_reg_write(spca50x->dev, 0x02, 0x07);
              pac7311_reg_write(spca50x->dev, 0xff, 0x01);
              pac7311_reg_write(spca50x->dev, 0x08, 0x08);
              pac7311_reg_write(spca50x->dev, 0x17, 0x00);
@@ -344,7 +361,7 @@
          break;
          case PAL:
              pac7311_reg_write(spca50x->dev, 0xff, 0x04);
-            pac7311_reg_write(spca50x->dev, 0x02, 0x03);
+            pac7311_reg_write(spca50x->dev, 0x02, 0x07);
              pac7311_reg_write(spca50x->dev, 0xff, 0x01);
              pac7311_reg_write(spca50x->dev, 0x08, 0x08);
              pac7311_reg_write(spca50x->dev, 0x17, 0x00);
@@ -353,7 +370,7 @@
          break;
          case VGA:
              pac7311_reg_write(spca50x->dev, 0xff, 0x04);
-            pac7311_reg_write(spca50x->dev, 0x02, 0x03);
+            pac7311_reg_write(spca50x->dev, 0x02, 0x07);
              pac7311_reg_write(spca50x->dev, 0xff, 0x01);
              pac7311_reg_write(spca50x->dev, 0x08, 0x08);
              pac7311_reg_write(spca50x->dev, 0x17, 0x00);
@@ -364,8 +381,8 @@

      //start stream
      pac7311_reg_write(spca50x->dev, 0xff, 0x01);
-    pac7311_reg_write(spca50x->dev, 0x78, 0x04);
-    pac7311_reg_write(spca50x->dev, 0x78, 0x05);
+    pac7311_reg_write(spca50x->dev, 0x78, 0x44);
+    pac7311_reg_write(spca50x->dev, 0x78, 0x45);

      return;
  }
@@ -379,7 +396,7 @@
      pac7311_reg_write(spca50x->dev, 0x2a, 0x0e);
      pac7311_reg_write(spca50x->dev, 0xff, 0x01);
      pac7311_reg_write(spca50x->dev, 0x3e, 0x20);
-    pac7311_reg_write(spca50x->dev, 0x78, 0x04);	//Bit_0=start stream, Bit_7=LED
+    pac7311_reg_write(spca50x->dev, 0x78, 0x44);	//Bit_0=start stream, Bit_7=LED
      pac7311_reg_write(spca50x->dev, 0x78, 0x44);	//Bit_0=start stream, Bit_7=LED
      pac7311_reg_write(spca50x->dev, 0x78, 0x44);	//Bit_0=start stream, Bit_7=LED
      return;

Thomas


--
http://www.kaiser-linux.li

-- 
http://www.kaiser-linux.li

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Spca50x-devs mailing list
Spca50x-devs@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/spca50x-devs