When running the saLoopBackScale demo (from examples included with http://software-dl.ti.com/dsps/dsps_public_sw/psp/LinuxPSP/DM814x_04_01/04_01_00_06/index_FDS.html), the scaled video is in the top left of the display, and the rest of the display is gray. I am currently trying to determine how to center the scaled video.
In the capture initialization, I see the cropping region and scaled dimensions being configured:
capt.crop.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
capt.crop.c.left = 0;
capt.crop.c.top = 0;
capt.crop.c.width = capt.fmt.fmt.pix.width;
capt.crop.c.height = capt.fmt.fmt.pix.height;
if (ioctl(capt.fd, VIDIOC_S_CROP, &capt.crop)) {
printf("Setting format failed\n");
exit(2);
}
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 = 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;
capt.fmt.fmt.pix.sizeimage = capt.fmt.fmt.pix.bytesperline *
capt.fmt.fmt.pix.height;
ret = ioctl(capt.fd, VIDIOC_S_FMT, &capt.fmt);
if (ret < 0) {
printf("Set Format failed\n");
return -1;
}
However, in setupDisplay(), disp.fmt.fmt.pix.width/height are pulled from the display's native dimensions, rather than the scaled dimensions -- I found this a bit confusing.
When changing these to match the scaled dimensions, I end up with a corrupted image of the desired size, centered in the display. It looks like I've got a line size mismatch, which makes me think the scaled image is going into memory embedded in a 1280x720 region frame or something. Do I need to change some buffer settings on the capture side of things in order for this to work correctly?
/* This is incorrect */
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 *
disp.fmt.fmt.pix.height;
ret = ioctl(disp.fd, VIDIOC_S_FMT, &disp.fmt);
if (ret < 0) {
printf("Set Format failed\n");
return -1;
}
Anyone mind pointing out the correct way to do this, and perhaps the misconceptions I seem to have? I've been over the PSP user guide's sections on positioning the display image a few times without much luck. (http://processors.wiki.ti.com/index.php/DM814X_AM387X_VPSS_Video_Driver_User_Guide#V4L2_IOCTL)
Thank you!