Re: Quailty of VIC image with bttv

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On Fri, 9 Mar 2001, Juan J. Sierralta P. wrote:

>    This is pretty normal, since the default capture size on VIC is CIF
> (352x288), remember that for bttv when capturing at more than half the
> full resolution (320x240 for NTSC) BTTV gives interlaced frames, that's
> the reason for the grainy effect.
>    The solution is to capture at 320x240 and add borders to make the
> image CIF compliant, I made a patch for that problem some time ago, but
> since our server crashed last week I'm unable to retrieve that for now :(

Many thanks for the pointer. Steve and I played around with the VIC code
today and included is a small patch to vic that sets the bttv grab to
320x240, but uses the 352x288 image for CIF. Since we do not fully
understand the makeup of YUV, we played with the numbers to get it to work
for us.

The patch is more of an example than an actual implementation as we just
wanted to see if this would fix our problem. The result was a definite
YES, problem solved! The quality of picture for our VIC tests was
significantly better when the grabs to bttv were set to 320x240.

>    Anyone interested on that patch, please start polling me the next week ;)
>    Note that this problem does not appear on PAL sources .....

I certainly would be insterested in a more formal (correct :) patch to
VIC.

> Juanjo...

Many thanks for the idea,
JES
--
James B. MacLean        macleajb@xxxxxxxxxxx
Department of Education http://www.ednet.ns.ca/~macleajb
Nova Scotia, Canada
B3M 4B2

--- grabber-video4linux.cpp	Mon Mar 12 14:58:17 2001
+++ grabber-video4linux.fix	Mon Mar 12 14:57:33 2001
@@ -15,6 +15,9 @@
      Added support for NTSC/PAL/SECAM video norm selection. (14/10/99)
      by Jean-Marc Orliaguet <jmo@xxxxxxxxxxxxxxxxxxxx>
 
+     Modified bttv grab to only get 320x240 to stop interlacing . (12/03/01)
+     by Steve Muise <muisesg@xxxxxxxxxxx> and James MacLean <macleajb@xxxxxxxxxxx>
+
    ========================================================================= */
 
 #include <stdio.h>
@@ -633,6 +713,10 @@
     char *s, *y,*u,*v;
     unsigned int a, *srca;
 
+    int width_2, height_2;
+    width_2 = 320;
+    height_2 = 240;
+
     srca = (unsigned int *)src;
 
     s = src;
@@ -640,21 +724,26 @@
     u = y + width_ * height_;
     v = u + width_ * height_ / 4;
 
+// fprintf(stderr, "W=%d,H=%d,BYTE=%d\n", width_, height_, byteorder_);
     switch (byteorder_) {
     case BYTE_ORDER_YUYV:
-	for (a1 = height_; a1 > 0; a1 -= 2) {
-        	for (b = width_; b > 0; b -= 2) {
+	for (a1 = height_2; a1 > 0; a1 -= 2) {
+        	for (b = width_2; b > 0; b -= 2) {
                 	a = *(srca++);
                 	*(y++) = a & 0xff; a >>= 8;
                 	*(u++) = a & 0xff; a >>= 8;
                 	*(y++) = a & 0xff; a >>= 8;
                 	*(v++) = a & 0xff;
+
         	}
-        	for (b = width_; b > 0; b -= 2) {
-                	a = *(srca++); 
+y+=32;u+=8;v+=8;
+        	for (b = width_2; b > 0; b -= 2) {
+               	a = *(srca++); 
                 	*(y++) = a & 0xff; a >>= 16;
                 	*(y++) = a & 0xff;
         	}
+y+=32;u+=8;v+=8;
+
     	}
         break;
 
@@ -724,7 +813,6 @@
     height_ = CIF_HEIGHT *2  / decimate_;
 
     v4lformat_=VIDEO_PALETTE_YUV422;
-
     switch (cformat_) {
     case CF_CIF:
         set_size_411(width_, height_);
@@ -752,6 +840,12 @@
 	gb_odd.format  = v4lformat_;
 	gb_odd.width   = width_;
 	gb_odd.height  = height_;
+#if 1
+	gb_even.width  = 320;
+	gb_even.height = 240;
+	gb_odd.width   = 320;
+	gb_odd.height  = 240;
+#endif
     } else {
 	memset(&win,0,sizeof(win));
 	win.width  = width_;

[Index of Archives]     [Linux DVB]     [Video Disk Recorder]     [Asterisk]     [Photo]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Free Photo Albums]     [Fedora Users]     [Fedora Women]     [ALSA Users]     [ALSA Devel]     [Linux USB]

Powered by Linux