[PATCH] YVYU decoding for VC0323

"Claudio Matsuoka" <[email protected]>
Newsgroups gmane.linux.drivers.spca50x.devel
Message-ID <[email protected]>
Hi,

I've got a no-brand camera with a Vimicro 0323 (ID 0ac8:0323), and
gspcav1-20071224 fails to decode its image properly. I've hacked the
driver to display the image correctly by changing the location of
width/height information and the decoding method, but I'm not sure how
to make it coexist with the existing support, since IDs are the same
(perhaps adding a parameter to the module?). Also in this particular
model the sensor seems to be mounted upside-down, so I'll have to add
code to rotate the image somewhere. I don't know if there are other
upside-down cameras around, any advice for the best location to add
such code?

Best regards,
Claudio

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

_______________________________________________
Spca50x-devs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/spca50x-devs
gspcav1-20071224-vc0323.patch (text/x-diff, 1.1 KB)
diff -rud gspcav1-20071224-orig/decoder/gspcadecoder.c gspcav1-20071224/decoder/gspcadecoder.c
--- gspcav1-20071224-orig/decoder/gspcadecoder.c	2007-12-24 11:35:27.000000000 -0200
+++ gspcav1-20071224/decoder/gspcadecoder.c	2008-02-01 11:47:57.000000000 -0200
@@ -2638,9 +2638,9 @@
 	break;
     case JPGV: // Vimicro323
     PDEBUG(3, "Vc323 0x%2X 0x%2X, 0x%2X,0x%2X", myframe->data[0] ,myframe->data[1],myframe->data[2] ,myframe->data[3]);
-	width = (myframe->data[9] << 8) | myframe->data[8];
-	height = (myframe->data[11] << 8) | myframe->data[10];
-	
+	width = ((myframe->data[13] << 8) | myframe->data[12]) >> 1;
+	height = ((myframe->data[15] << 8) | myframe->data[14]) >> 1;
+
 	if (myframe->hdrwidth != width) {
 		PDEBUG(0, "Decoder find WidthxHeight %dx%d", width,height);
 		done = ERR_CORRUPTFRAME;
@@ -2651,9 +2651,9 @@
 	} else {
 		// reset info.dri
 	    myframe->decoder->info.dri = 0;
-	    memcpy(myframe->tmpbuffer, myframe->data +0x280,
+	    memcpy(myframe->tmpbuffer, myframe->data + 0x20 /* +0x280 */,
 		   myframe->scanlength-0x280);
-	    done = jpeg_decode422(myframe, bgr);
+	    done = yvyu_translate(myframe, bgr);
 	    }
 	    }
 	break;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.