--- ./saLoopBackScale.c.orig 2011-11-15 07:14:56.000000000 -0500 +++ ./saLoopBackScale.c 2012-02-28 09:46:14.026066049 -0500 @@ -89,8 +89,8 @@ /* Define below #def for debug information enable */ #undef SALOOPBACKSCALE_DEBUG -#define SCALED_HEIGHT 480 -#define SCALED_WIDTH 720 +#define SCALED_HEIGHT 360 +#define SCALED_WIDTH 640 /* Structure for storing buffer information */ struct buf_info { @@ -260,17 +260,18 @@ capt.fmt_win.type = V4L2_BUF_TYPE_VIDEO_OVERLAY; capt.fmt_win.fmt.win.w.left = 0; capt.fmt_win.fmt.win.w.top = 0; - capt.fmt_win.fmt.win.w.width = 720; - capt.fmt_win.fmt.win.w.height = 480; + capt.fmt_win.fmt.win.w.width = SCALED_WIDTH; + capt.fmt_win.fmt.win.w.height = SCALED_HEIGHT; if (ioctl(capt.fd, VIDIOC_S_FMT, &capt.fmt_win)) { printf("Setting window failed\n"); exit(2); } - capt.fmt.fmt.pix.bytesperline = capt.fmt.fmt.pix.width * 2; + /* Set up our image format based upon the downscaled image size */ + capt.fmt.fmt.pix.bytesperline = capt.fmt_win.fmt.win.w.width * 2; capt.fmt.fmt.pix.sizeimage = capt.fmt.fmt.pix.bytesperline * - capt.fmt.fmt.pix.height; + capt.fmt_win.fmt.win.w.height; ret = ioctl(capt.fd, VIDIOC_S_FMT, &capt.fmt); if (ret < 0) { printf("Set Format failed\n"); @@ -309,17 +310,9 @@ printf("Get Format failed\n"); return -1; } - /* Set format according to display mode */ - if (capt.dv_preset.preset == V4L2_DV_720P60) { - disp.fmt.fmt.pix.width = 1280; - disp.fmt.fmt.pix.height = 720; - } else if (capt.dv_preset.preset == V4L2_DV_1080P60) { - disp.fmt.fmt.pix.width = 1920; - disp.fmt.fmt.pix.height = 1080; - } else { - disp.fmt.fmt.pix.width = 1920; - disp.fmt.fmt.pix.height = 1080; - } + + disp.fmt.fmt.pix.width = SCALED_WIDTH; + disp.fmt.fmt.pix.height = SCALED_HEIGHT; disp.fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_YUYV; disp.fmt.fmt.pix.bytesperline = disp.fmt.fmt.pix.width * 2; disp.fmt.fmt.pix.sizeimage = disp.fmt.fmt.pix.bytesperline *