[Sumover-dev] [svn commit] r4364 - in vic/branches/mpeg4: video

sumover-dev at cs.ucl.ac.uk sumover-dev at cs.ucl.ac.uk
Sun Jan 25 02:45:14 GMT 2009


Author: douglask
Date: Sun Jan 25 02:44:54 2009
New Revision: 4364

Modified:
   vic/branches/mpeg4/tcl/ui-ctrlmenu.tcl
   vic/branches/mpeg4/tcl/ui-util.tcl
   vic/branches/mpeg4/video/grabber-bttv.cpp
   vic/branches/mpeg4/video/grabber-plx.cpp
   vic/branches/mpeg4/video/grabber-v4l2.cpp
   vic/branches/mpeg4/video/grabber-video4linux.cpp
   vic/branches/mpeg4/video/grabber-win32.cpp
   vic/branches/mpeg4/video/grabber-win32DS.cpp
   vic/branches/mpeg4/video/grabber-xv.cpp
   vic/branches/mpeg4/video/grabber.cpp

Log:
set_size_cif() was incorrectly being used with codecs that are not restricted to CIF & QCIF capture resolutions.

Also, due to widescreen resolutions, set_size_cif() was getting confused in setting outh_ & outw_. It now discriminates based on input height rather than input width. 


Modified: vic/branches/mpeg4/tcl/ui-ctrlmenu.tcl
==============================================================================
--- vic/branches/mpeg4/tcl/ui-ctrlmenu.tcl	(original)
+++ vic/branches/mpeg4/tcl/ui-ctrlmenu.tcl	Sun Jan 25 02:44:54 2009
@@ -638,10 +638,10 @@
 		set fmtList "$fmtList nv nvdct cellb jpeg raw"
 	}
 	if [inList 420 $formats] {
-		set fmtList "$fmtList bvc pvh"
+		set fmtList "$fmtList bvc pvh h261as h264 mpeg4"
 	}
 	if [inList cif $sizes] {
-		set fmtList "$fmtList h261 h261as h263+ h263 mpeg4 h264"
+		set fmtList "$fmtList h261 h263 h263+"
 	}
 	if [inList jpeg $formats] {
 		set fmtList "$fmtList jpeg"

Modified: vic/branches/mpeg4/tcl/ui-util.tcl
==============================================================================
--- vic/branches/mpeg4/tcl/ui-util.tcl	(original)
+++ vic/branches/mpeg4/tcl/ui-util.tcl	Sun Jan 25 02:44:54 2009
@@ -92,7 +92,7 @@
 
 proc isCIF fmt {
 	# only supported CIF format is h.261/3/3+
-	if { $fmt =="h264" || $fmt == "mpeg4" || $fmt == "h261" || $fmt == "h263+" || $fmt == "h263" } {
+	if { $fmt == "h261" || $fmt == "h263" || $fmt == "h263+" } {
 		return 1
 	}
 	return 0

Modified: vic/branches/mpeg4/video/grabber-bttv.cpp
==============================================================================
--- vic/branches/mpeg4/video/grabber-bttv.cpp	(original)
+++ vic/branches/mpeg4/video/grabber-bttv.cpp	Sun Jan 25 02:44:54 2009
@@ -142,6 +142,7 @@
   }
 
   if(!strcmp(cformat, "422")) cformat_ = CF_422;
+  if(!strcmp(cformat, "420")) cformat_ = CF_420;
   if(!strcmp(cformat, "cif")) cformat_ = CF_CIF;
 
   decimate_ =2;
@@ -362,9 +363,12 @@
   case CF_422:
     set_size_422(basewidth_ / decimate_, baseheight_ / decimate_);
     break;
-  case CF_CIF:
+  case CF_420:
     set_size_420(basewidth_ / decimate_, baseheight_ / decimate_);
     break;
+  case CF_CIF:
+    set_size_cif(basewidth_ / decimate_, baseheight_ / decimate_);
+    break;
   }
 
   allocref();

Modified: vic/branches/mpeg4/video/grabber-plx.cpp
==============================================================================
--- vic/branches/mpeg4/video/grabber-plx.cpp	(original)
+++ vic/branches/mpeg4/video/grabber-plx.cpp	Sun Jan 25 02:44:54 2009
@@ -516,7 +516,7 @@
 	capwin_->setsize(w, h);
 	converter_ = RGB_Converter_420::instance();
 	image_ = StandardVideoImage::allocate(capwin_->tkwin(), w, h);
-	set_size_420(w, h);
+	set_size_cif(w, h);
 	allocref();
 }
 

Modified: vic/branches/mpeg4/video/grabber-v4l2.cpp
==============================================================================
--- vic/branches/mpeg4/video/grabber-v4l2.cpp	(original)
+++ vic/branches/mpeg4/video/grabber-v4l2.cpp	Sun Jan 25 02:44:54 2009
@@ -268,7 +268,7 @@
                         continue;
                 }
 
-                if (capability.capabilities & V4L2_CAP_VIDEO_CAPTURE == 0) {
+                if ((capability.capabilities & V4L2_CAP_VIDEO_CAPTURE) == 0) {
                         debug_msg("%s, %s can't capture\n",capability.card,capability.bus_info);
                         v4l2_close(fd);
                         continue;
@@ -368,7 +368,7 @@
                 fmt.fmt.pix.height = test_height[i];
                 fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_YUV420;
                 if (-1 != v4l2_ioctl(fd_, VIDIOC_S_FMT, &fmt) ) {
-                        if (fmt.fmt.pix.height == test_height[i] && fmt.fmt.pix.width == test_width[i] && fmt.fmt.pix.pixelformat == V4L2_PIX_FMT_YUV420) {
+                        if (fmt.fmt.pix.height == test_height[i] && fmt.fmt.pix.width >= test_width[i] && fmt.fmt.pix.pixelformat == V4L2_PIX_FMT_YUV420) {
                                 have_YUV420P = 1;
                                 debug_msg("Device supports V4L2_PIX_FMT_YUV420 capture at %dx%d\n",test_width[i],test_height[i]);
                         } else if (fmt.fmt.pix.pixelformat == V4L2_PIX_FMT_YUV420) {
@@ -380,7 +380,7 @@
                 fmt.fmt.pix.height = test_height[i];
                 fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_YUV422P;
                 if (-1 != v4l2_ioctl(fd_, VIDIOC_S_FMT, &fmt) ) {
-                        if (fmt.fmt.pix.height == test_height[i] && fmt.fmt.pix.width == test_width[i] && fmt.fmt.pix.pixelformat == V4L2_PIX_FMT_YUV422P) {
+                        if (fmt.fmt.pix.height == test_height[i] && fmt.fmt.pix.width >= test_width[i] && fmt.fmt.pix.pixelformat == V4L2_PIX_FMT_YUV422P) {
                                 have_YUV422P = 1;
                                 debug_msg("Device supports V4L2_PIX_FMT_YUV422 capture at %dx%d\n",test_width[i],test_height[i]);
                         } else {
@@ -392,7 +392,7 @@
                 fmt.fmt.pix.height = test_height[i];
                 fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_YUYV;
                 if (-1 != v4l2_ioctl(fd_, VIDIOC_S_FMT, &fmt) ) {
-                        if (fmt.fmt.pix.height == test_height[i] && fmt.fmt.pix.width == test_width[i]) {
+                        if (fmt.fmt.pix.height == test_height[i] && fmt.fmt.pix.width >= test_width[i]) {
                                 have_YUV422 = 1;
                                 debug_msg("Device supports V4L2_PIX_FMT_YUYV (YUV 4:2:2) capture at %dx%d\n",test_width[i],test_height[i]);
                         } else if (fmt.fmt.pix.pixelformat == V4L2_PIX_FMT_YUYV) {
@@ -405,7 +405,7 @@
                 fmt.fmt.pix.height = test_height[i];
                 fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_MJPEG;
                 if (-1 != v4l2_ioctl(fd_, VIDIOC_S_FMT, &fmt) ) {
-                        if (fmt.fmt.pix.height == test_height[i] && fmt.fmt.pix.width == test_width[i] && fmt.fmt.pix.pixelformat == V4L2_PIX_FMT_MJPEG) {
+                        if (fmt.fmt.pix.height == test_height[i] && fmt.fmt.pix.width >= test_width[i] && fmt.fmt.pix.pixelformat == V4L2_PIX_FMT_MJPEG) {
                                 have_MJPEG = 1;
                                 debug_msg("Device supports V4L2_PIX_FMT_MJPEG capture at %dx%d\n",test_width[i],test_height[i]);
                         } else if (fmt.fmt.pix.pixelformat == V4L2_PIX_FMT_MJPEG) {
@@ -417,7 +417,7 @@
                 fmt.fmt.pix.height = test_height[i];
                 fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_JPEG;
                 if (-1 != v4l2_ioctl(fd_, VIDIOC_S_FMT, &fmt) ) {
-                        if (fmt.fmt.pix.height == test_height[i] && fmt.fmt.pix.width == test_width[i] && fmt.fmt.pix.pixelformat == V4L2_PIX_FMT_JPEG) {
+                        if (fmt.fmt.pix.height == test_height[i] && fmt.fmt.pix.width >= test_width[i] && fmt.fmt.pix.pixelformat == V4L2_PIX_FMT_JPEG) {
                                 have_MJPEG = 1;
                                 debug_msg("Device supports V4L2_PIX_FMT_JPEG capture at %dx%d\n",test_width[i],test_height[i]);
                         } else if (fmt.fmt.pix.pixelformat == V4L2_PIX_FMT_JPEG) {
@@ -711,7 +711,7 @@
 
                 tempbuf.type = vimage[0].vidbuf.type;
                 while ((err = v4l2_ioctl(fd_, VIDIOC_DQBUF, &tempbuf)) < 0 &&
-                       (errno == EINTR));
+                       (errno == EINTR)) ;
 
                 if (err < 0) {
                         debug_msg("V4L2: VIDIOC_DQBUF failed: %s\n", strerror(errno));
@@ -892,7 +892,7 @@
                 debug_msg("V4L2: format");
                 switch (cformat_) {
                 case CF_CIF:
-                        set_size_420(width_, height_);
+                        set_size_cif(width_, height_);
                         debug_msg(" cif\n");
                         break;
                 case CF_420:
@@ -944,8 +944,16 @@
                                         if ( (err = v4l2_ioctl(fd_, VIDIOC_S_FMT, &fmt) ) )
                                                 debug_msg("\nV4L2: Failed to set format\n");
 
-                                        if ( ( fmt.fmt.pix.width != (unsigned int)width_ ) ||
-                                                                ( fmt.fmt.pix.height !=  (unsigned int)height_ ) ) {
+                                        if ( fmt.fmt.pix.width > (unsigned int)width_ )
+                                                inw_ = width_ = fmt.fmt.pix.width;
+
+
+                                        if ( ( fmt.fmt.pix.width == (unsigned int)width_ ) ||
+                                                                ( fmt.fmt.pix.height == (unsigned int)height_ ) )  {
+                                                debug_msg("V4L2: setting format: width=%d height=%d\n", fmt.fmt.pix.width, fmt.fmt.pix.height);
+                                                format_ok = 1;
+                                                break;
+                                        } else {
 
                                                 debug_msg("V4L2: failed to set format! requested %dx%d, got %dx%d\n", width_, height_, fmt.fmt.pix.width, fmt.fmt.pix.height);
 
@@ -1027,16 +1035,9 @@
                                                                 format_ok = 1;
                                                         }
                                                         break;
-
                                                 }
-
-                                        } else {
-                                                debug_msg("V4L2: setting format: width=%d height=%d\n", fmt.fmt.pix.width, fmt.fmt.pix.height);
-                                                format_ok = 1;
                                         }
-                                        break;
                                 }
-
                         }
                 }
         }

Modified: vic/branches/mpeg4/video/grabber-video4linux.cpp
==============================================================================
--- vic/branches/mpeg4/video/grabber-video4linux.cpp	(original)
+++ vic/branches/mpeg4/video/grabber-video4linux.cpp	Sun Jan 25 02:44:54 2009
@@ -983,7 +983,7 @@
 
     switch (cformat_) {
     case CF_CIF:
-	set_size_420(width_, height_);
+	set_size_cif(width_, height_);
 	debug_msg(" cif");
 	break;
     case CF_420:

Modified: vic/branches/mpeg4/video/grabber-win32.cpp
==============================================================================
--- vic/branches/mpeg4/video/grabber-win32.cpp	(original)
+++ vic/branches/mpeg4/video/grabber-win32.cpp	Sun Jan 25 02:44:54 2009
@@ -63,7 +63,7 @@
 	Miro_dc20_95,
 	Miro_dc20_NT,
 	AV_Master,
-    Intel_SVR3,
+	Intel_SVR3,
 };
 
 static device_type_e
@@ -100,7 +100,8 @@
 	if (!strncmp(deviceName, "ISVR III", 8)) {
 		debug_msg("Device=ISVR III\n");
 		return (Intel_SVR3);
-    }
+	}
+
 	debug_msg("Device=Generic: %s\n", deviceName);
 	return (Generic);
 }
@@ -209,7 +210,7 @@
 	if (hIC_ == 0)
 		return;
 
-        if (ICDecompress(hIC_, 0, &bihIn_, in, &bihOut_, rgb_) != ICERR_OK)
+	if (ICDecompress(hIC_, 0, &bihIn_, in, &bihOut_, rgb_) != ICERR_OK)
 		debug_msg("ICDecompress failed!\n");
 
 	converter_->convert(rgb_, inw, inh, frm, outw, outh, invert);
@@ -359,7 +360,7 @@
 	u_int			fmtsize_;
 
 	HANDLE			frame_sem_;
-    HANDLE          cb_mutex_;
+	HANDLE			cb_mutex_;
 	LPBYTE			last_frame_;
 	Converter		*converter_;
 	
@@ -378,6 +379,16 @@
 	virtual void setsize();
 };
 
+class Vfw420Grabber : public VfwGrabber 
+{
+ public:
+	Vfw420Grabber(const int dev);
+	~Vfw420Grabber();
+ protected:
+	virtual void start();
+	virtual void setsize();
+};
+
 class Vfw422Grabber : public VfwGrabber 
 {
  public:
@@ -416,14 +427,14 @@
 	char deviceVersion[100] ;
 	
 	for (int index = 0 ; index < n; index++) {
-                if (capGetDriverDescription(index,
+		if (capGetDriverDescription(index,
 					    (LPSTR)deviceName,
 					    sizeof(deviceName),
 					    (LPSTR)deviceVersion,
 					    sizeof(deviceVersion))) {
 			debug_msg("Adding device %d\n", index);
 			devs_[index] = new VfwDevice(strdup(deviceName), index);
-                } else
+		} else
 			devs_[index] = NULL;
 	}
 }
@@ -447,11 +458,11 @@
 		vfwdev_ = index;
 		switch (get_device_type(name)) {
 		case gray_QuickCam_95:
-			attributes_ = "format { 422 420 } size { small cif } port { QuickCam } ";
+			attributes_ = "format { 422 420 cif } size { small cif } port { QuickCam } ";
 			break;
 		case Generic:
 		default:
-			attributes_ = "format { 422 420 } size { large small cif } port { external-in } ";
+			attributes_ = "format { 422 420 cif } size { large small cif } port { external-in } ";
 			break;
 		}
 	} else
@@ -477,6 +488,8 @@
 		TclObject* o = 0;
 		if (strcmp(argv[2], "422") == 0)
 			o = grabber_ = new Vfw422Grabber(vfwdev_);
+		if (strcmp(argv[2], "420") == 0)
+			o = grabber_ = new Vfw420Grabber(vfwdev_);
 		else if (strcmp(argv[2], "cif") == 0)
 			o = grabber_ = new VfwCIFGrabber(vfwdev_);
 		if (o != 0)
@@ -541,6 +554,34 @@
 	debug_msg("~VfwCIFGrabber\n");
 }
 
+void VfwCIFGrabber::setsize()
+{
+	int w = basewidth_ / decimate_;
+	int h = baseheight_ / decimate_;
+	debug_msg("VfwCIFGrabber::setsize: %dx%d\n", w, h);
+	set_size_cif(w, h);
+	allocref();
+}
+
+Vfw420Grabber::Vfw420Grabber(const int dev) : VfwGrabber(dev)
+{
+	debug_msg("Vfw420Grabber\n");
+}
+
+Vfw420Grabber::~Vfw420Grabber()
+{
+	debug_msg("~Vfw420Grabber\n");
+}
+
+void Vfw420Grabber::setsize()
+{
+	int w = basewidth_ / decimate_;
+	int h = baseheight_ / decimate_;
+	debug_msg("Vfw420Grabber::setsize: %dx%d\n", w, h);
+	set_size_420(w, h);
+	allocref();
+}
+
 Vfw422Grabber::Vfw422Grabber(const int dev) : VfwGrabber(dev)
 {
 	debug_msg("Vfw422Grabber\n");
@@ -559,15 +600,6 @@
 	allocref();
 }
 
-void VfwCIFGrabber::setsize()
-{
-	int w = basewidth_ / decimate_;
-	int h = baseheight_ / decimate_;
-	debug_msg("VfwCIFGrabber::setsize: %dx%d\n", w, h);
-	set_size_cif(w, h);
-	allocref();
-}
-
 void VfwGrabber::fps(int f)
 {
 	if (f <= 0)
@@ -617,9 +649,9 @@
 		}
 	}
 
-    /* lock out VideoHandler until everything is set up - cmg */
-    cb_mutex_ = CreateMutex(NULL,FALSE,NULL);
-    WaitForSingleObject(cb_mutex_,INFINITE);
+	/* lock out VideoHandler until everything is set up - cmg */
+	cb_mutex_ = CreateMutex(NULL,FALSE,NULL);
+	WaitForSingleObject(cb_mutex_,INFINITE);
 
 	if ((capwin_ = capCreateCaptureWindow((LPSTR)"Capture Window", WS_POPUP | WS_CAPTION,
 		CW_USEDEFAULT, CW_USEDEFAULT, (basewidth_ / decimate_ + GetSystemMetrics(SM_CXFIXEDFRAME)), 
@@ -684,15 +716,15 @@
 	case Miro_dc20_95:
 	case Miro_dc20_NT:
 	case AV_Master:
-    case Generic:
-  		if (useconfig_) {
+	case Generic:
+		if (useconfig_) {
 			if (caps_.fHasDlgVideoFormat) capDlgVideoFormat(capwin_);
 			if (caps_.fHasDlgVideoSource) capDlgVideoSource(capwin_);
 		}
 		delete [] fmt_;
 		fmtsize_ = capGetVideoFormatSize(capwin_);
 		fmt_ = (LPBITMAPINFOHEADER) new u_char [fmtsize_];
-	    capGetVideoFormat(capwin_, fmt_, fmtsize_);
+		capGetVideoFormat(capwin_, fmt_, fmtsize_);
 		break;
 	case Intel_SVR3:
 		/* the driver does not like to generic query much
@@ -886,9 +918,29 @@
 		converter(new IC_Converter_422(fmt_->biCompression, fmt_->biBitCount, fmt_->biWidth, fmt_->biHeight));
 		break;
 	}
-    /* allow video handler callback to progress */
-    ReleaseMutex(cb_mutex_);
-    Grabber::timeout();
+	/* allow video handler callback to progress */
+	ReleaseMutex(cb_mutex_);
+	Grabber::timeout();
+}
+
+
+void Vfw420Grabber::start()
+{
+	VfwGrabber::start();
+	switch (fmt_->biCompression) {
+	case BI_RGB:
+		converter(new RGB_Converter_420(fmt_->biBitCount, (u_int8_t *)(fmt_ + 1), fmt_->biClrUsed));
+		break;
+	case mmioFOURCC('Y','U','Y','V'):
+		converter(new YUYV_Converter_420());
+		break;
+	default:
+		converter(new IC_Converter_420(fmt_->biCompression, fmt_->biBitCount, fmt_->biWidth, fmt_->biHeight));
+		break;
+	}
+	/* allow video handler callback to progress */
+	ReleaseMutex(cb_mutex_);
+	Grabber::timeout();
 }
 
 void VfwCIFGrabber::start()
@@ -907,31 +959,31 @@
 		    break;
 	    }
 	}
-    /* allow video handler callback to progress */
-    ReleaseMutex(cb_mutex_);
-    Grabber::timeout();
+	/* allow video handler callback to progress */
+	ReleaseMutex(cb_mutex_);
+	Grabber::timeout();
 }
 
 void VfwGrabber::stop()
 {
-    debug_msg("VfwWindow::stop() thread=%x\n", GetCurrentThreadId());
+	debug_msg("VfwWindow::stop() thread=%x\n", GetCurrentThreadId());
 
-    if (cb_mutex_!=NULL) {
-	CloseHandle(cb_mutex_);
-	cb_mutex_=0;
-    } else 
-	return;
-
-    if (capturing_)
-	capCaptureStop(capwin_);
-    /* ensure this won't be called */
-    capSetCallbackOnVideoStream(capwin_, NULL);
-    capturing_ = 0;
-    capture_=0;
-    if (frame_sem_!=0 ) {
-	ReleaseSemaphore(frame_sem_, 1, NULL);
-	CloseHandle(frame_sem_);
-    }
+	if (cb_mutex_!=NULL) {
+		CloseHandle(cb_mutex_);
+		cb_mutex_=0;
+	} else 
+		return;
+
+	if (capturing_)
+		capCaptureStop(capwin_);
+	/* ensure this won't be called */
+	capSetCallbackOnVideoStream(capwin_, NULL);
+	capturing_ = 0;
+	capture_=0;
+	if (frame_sem_!=0 ) {
+		ReleaseSemaphore(frame_sem_, 1, NULL);
+		CloseHandle(frame_sem_);
+	}
 #ifdef NDEF
 	if (caps_.fHasOverlay)
 		capOverlay(capwin_, FALSE);
@@ -1017,11 +1069,11 @@
 	static int not_done = 0;
 
 	VfwGrabber *gp = (VfwGrabber*)capGetUserData(hwnd);
-    /* in case we are not fast enough */
-    if (gp==NULL) return ((LRESULT)TRUE);
+	/* in case we are not fast enough */
+	if (gp==NULL) return ((LRESULT)TRUE);
 
-    /* Block grab code until frame has been copied into last_frame_ (in capture function) */
-    WaitForSingleObject(gp->cb_mutex_,INFINITE);
+	/* Block grab code until frame has been copied into last_frame_ (in capture function) */
+	WaitForSingleObject(gp->cb_mutex_,INFINITE);
 
 #ifdef DEBUG__	
 	debug_msg("VfwGrabber::VideoHandler: thread=%x data=%x flags=%x len=%d time=%d\n",
@@ -1034,8 +1086,8 @@
 	else if (not_done++ % 10 == 0)
 		debug_msg("Frames not ready! %d\n", not_done);
 
-    /* Release to process frame in grab */
-    ReleaseMutex(gp->cb_mutex_);
+	/* Release to process frame in grab */
+	ReleaseMutex(gp->cb_mutex_);
 	return ((LRESULT)TRUE);
 }
 
@@ -1059,13 +1111,13 @@
 		inw_, inh_, outw_, outh_);
 #endif
 
-    /* block the VideoHandler callback code until we've processed frame */
-    WaitForSingleObject(cb_mutex_,INFINITE);
+	/* block the VideoHandler callback code until we've processed frame */
+	WaitForSingleObject(cb_mutex_,INFINITE);
 
-    if (last_frame_ == NULL || capturing_ == 0) {
-        ReleaseMutex(cb_mutex_);
+	if (last_frame_ == NULL || capturing_ == 0) {
+		ReleaseMutex(cb_mutex_);
 		return (FALSE);
-    }
+	}
 
 	converter_->convert((u_int8_t*)last_frame_, basewidth_ / decimate_, baseheight_ / decimate_, frame_, outw_, outh_, TRUE);
 	last_frame_ = NULL;
@@ -1074,7 +1126,7 @@
 	YuvFrame f(media_ts(), frame_, crvec_, outw_, outh_);
 	int rval = (target_->consume(&f));
 
-    /* release block so that VideoHandler can get new frame */
-    ReleaseMutex(cb_mutex_);
-    return rval;
+	/* release block so that VideoHandler can get new frame */
+	ReleaseMutex(cb_mutex_);
+	return rval;
 }

Modified: vic/branches/mpeg4/video/grabber-win32DS.cpp
==============================================================================
--- vic/branches/mpeg4/video/grabber-win32DS.cpp	(original)
+++ vic/branches/mpeg4/video/grabber-win32DS.cpp	Sun Jan 25 02:44:54 2009
@@ -596,7 +596,7 @@
            set_size_420(width_, height_);
            break;
        case CF_422:
-           set_size_cif(width_, height_);
+           set_size_422(width_, height_);
            break;
    }
 
@@ -995,7 +995,7 @@
    
    strcat(attri_, "format { 420 422 cif } size { ");
 	   
-   if (o.minWidth() > (CIF_BASE_WIDTH / 2)) {
+   if (o.minHeight() > (CIF_BASE_HEIGHT / 2)) {
      strcat(attri_, "large");
    } else if (o.maxWidth() < NTSC_BASE_WIDTH) {
      strcat(attri_, "small cif");

Modified: vic/branches/mpeg4/video/grabber-xv.cpp
==============================================================================
--- vic/branches/mpeg4/video/grabber-xv.cpp	(original)
+++ vic/branches/mpeg4/video/grabber-xv.cpp	Sun Jan 25 02:44:54 2009
@@ -361,7 +361,7 @@
 	int h = 2 * 288 / decimate_;
 	capwin_->setsize(w, h);
 	capwin_->converter(RGB_Converter_420::instance());
-	set_size_420(w, h);
+	set_size_cif(w, h);
 	allocref();
 }
 

Modified: vic/branches/mpeg4/video/grabber.cpp
==============================================================================
--- vic/branches/mpeg4/video/grabber.cpp	(original)
+++ vic/branches/mpeg4/video/grabber.cpp	Sun Jan 25 02:44:54 2009
@@ -455,55 +455,49 @@
 	inh_ = h;
 
 	int ispal;
-	switch (w) {
-	case 640:
-		/* for qcam */
+	switch (h) {
+	case 576:
+		/* 4CIF */
+		ispal = 1;
+		outw_ = 704;
+		outh_ = 576;
+		break;
+
+	case 480:
+		/* NTSC */
 		ispal = 0;
-		outw_ = 640;
-		outh_ = 480;
+		outw_ = 704;
+		outh_ = 576;
 		break;
-	case 320:
-		/* 1/2 NTSC */
+
+	case 240:
+		/* 1/4 NTSC */
 		ispal = 0;
 		outw_ = 352;
 		outh_ = 288;
 		break;
 
-	case 160:
+	case 120:
 		/* 1/8 NTSC */
 		ispal = 0;
 		outw_ = 176;
 		outh_ = 144;
 		break;
 
-	case 352:
-		/* 1/2 CIF */
+	case 288:
+		/* 1/4 CIF */
 		ispal = 1;
 		outw_ = 352;
 		outh_ = 288;
 		break;
 
-	case 176:
+	case 144:
 		/* 1/8 CIF */
 		ispal = 1;
 		outw_ = 176;
 		outh_ = 144;
 		break;
 
-	case 384:
-		/* 1/2 PAL */
-		ispal = 1;
-		outw_ = 352;
-		outh_ = 288;
-		break;
-
-	case 192:
-		/* 1/8 PAL */
-		ispal = 1;
-		outw_ = 176;
-		outh_ = 144;
-		break;
-
 	default:
 		/* XXX this shouldn't happen */
 		debug_msg("vic: CIF grabber: bad geometry - trying 420\n");



More information about the Sumover-dev mailing list