[Sumover-dev] [svn commit] r4341 - vic/branches/mpeg4/video

sumover-dev at cs.ucl.ac.uk sumover-dev at cs.ucl.ac.uk
Mon Dec 15 08:24:17 GMT 2008


Author: douglask
Date: Mon Dec 15 08:24:13 2008
New Revision: 4341

Modified:
   vic/branches/mpeg4/video/grabber-v4l2.cpp

Log:
Add V4L2 capture support for 720x480, 360x240 and 180x120 NTSC based resolutions


Modified: vic/branches/mpeg4/video/grabber-v4l2.cpp
==============================================================================
--- vic/branches/mpeg4/video/grabber-v4l2.cpp	(original)
+++ vic/branches/mpeg4/video/grabber-v4l2.cpp	Mon Dec 15 08:24:13 2008
@@ -79,8 +79,10 @@
 
 #define PAL_BT601_WIDTH   720
 #define PAL_BT601_HEIGHT  576
-#define VGA_WIDTH  640
-#define VGA_HEIGHT 480
+#define NTSC_BT601_WIDTH  720
+#define NTSC_BT601_HEIGHT 480
+#define VGA_WIDTH   640
+#define VGA_HEIGHT  480
 #define CIF_WIDTH   352
 #define CIF_HEIGHT  288
 
@@ -88,9 +90,10 @@
 #define CF_420 1
 #define CF_CIF 2
 
-#define CS_VC        0 /* 4CIF (704x576), CIF (352x288), QCIF (176x144) */
-#define CS_VGA       1 /* VGA (640x480), 1/4 VGA (320x240), 1/16 VGA (160x120) */
-#define CS_BT601_PAL 2 /* ITU-R Recommendation BT.601 720x576 (plus 360x288 & 180x144) */
+#define CS_VC         0 /* 4CIF (704x576), CIF (352x288), QCIF (176x144) */
+#define CS_VGA        1 /* VGA (640x480), 1/4 VGA (320x240), 1/16 VGA (160x120) */
+#define CS_BT601_NTSC 2 /* ITU-R Recommendation BT.601 720x480 (plus 360x240 & 180x120) */
+#define CS_BT601_PAL  3 /* ITU-R Recommendation BT.601 720x576 (plus 360x288 & 180x144) */
 
 /* YUV Byte order */
 #define BYTE_ORDER_YUYV 0
@@ -332,7 +335,6 @@
 
 V4l2Grabber::V4l2Grabber(const char *cformat, const char *dev)
 {
-
         fd_ = open(dev, O_RDWR);
         if (fd_ < 0) {
                 perror("open");
@@ -365,8 +367,8 @@
         fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
         v4l2_ioctl(fd_, VIDIOC_G_FMT, &fmt);
 
-        unsigned int test_width[] =  {CIF_WIDTH,  PAL_BT601_WIDTH/2,  VGA_WIDTH/2,  0};
-        unsigned int test_height[] = {CIF_HEIGHT, PAL_BT601_HEIGHT/2, VGA_HEIGHT/2, 0};
+        unsigned int test_width[] =  {CIF_WIDTH,  PAL_BT601_WIDTH/2,  NTSC_BT601_WIDTH/2,  VGA_WIDTH/2,  0};
+        unsigned int test_height[] = {CIF_HEIGHT, PAL_BT601_HEIGHT/2, NTSC_BT601_HEIGHT/2, VGA_HEIGHT/2, 0};
         for (unsigned int i = 0; test_width[i] != 0; i++) {
                 fmt.fmt.pix.width = test_width[i];
                 fmt.fmt.pix.height = test_height[i];
@@ -1215,6 +1217,12 @@
                                                                 capture_standard = CS_VGA;
                                                                 break;
                                                         case CS_VGA :
+                                                                debug_msg("V4L2: trying ITU-R BT.601 NTSC resolution ...\n");
+                                                                width_ = NTSC_BT601_WIDTH;
+                                                                height_ = NTSC_BT601_HEIGHT;
+                                                                capture_standard = CS_BT601_NTSC;
+                                                                break;
+                                                        case CS_BT601_NTSC :
                                                                 debug_msg("V4L2: trying ITU-R BT.601 PAL resolution ...\n");
                                                                 width_ = PAL_BT601_WIDTH;
                                                                 height_ = PAL_BT601_HEIGHT;
@@ -1235,6 +1243,12 @@
                                                                 capture_standard = CS_VGA;
                                                                 break;
                                                         case CS_VGA :
+                                                                debug_msg("V4L2: trying 1/4 ITU-R BT.601 NTSC resolution ...\n");
+                                                                width_ = NTSC_BT601_WIDTH / 2;
+                                                                height_ = NTSC_BT601_HEIGHT / 2;
+                                                                capture_standard = CS_BT601_NTSC;
+                                                                break;
+                                                        case CS_BT601_NTSC :
                                                                 debug_msg("V4L2: trying 1/4 ITU-R BT.601 PAL resolution ...\n");
                                                                 width_ = PAL_BT601_WIDTH / 2;
                                                                 height_ = PAL_BT601_HEIGHT / 2;
@@ -1255,6 +1269,12 @@
                                                                 capture_standard = CS_VGA;
                                                                 break;
                                                         case CS_VGA :
+                                                                debug_msg("V4L2: trying 1/16 ITU-R BT.601 NTSC resolution ...\n");
+                                                                width_ = NTSC_BT601_WIDTH / 4;
+                                                                height_ = NTSC_BT601_HEIGHT / 4;
+                                                                capture_standard = CS_BT601_NTSC;
+                                                                break;
+                                                        case CS_BT601_NTSC :
                                                                 debug_msg("V4L2: trying 1/16 ITU-R BT.601 PAL resolution ...\n");
                                                                 width_ = PAL_BT601_WIDTH / 4;
                                                                 height_ = PAL_BT601_HEIGHT / 4;



More information about the Sumover-dev mailing list