Re: [PATCH v2 2/2] libv4lconvert: Support for RGB32 and BGR32 format

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

 



On 8/3/13 12:42 AM, Ricardo Ribalda Delgado wrote:
+	case V4L2_PIX_FMT_RGB32:
+		switch (dest_pix_fmt) {
+		case V4L2_PIX_FMT_RGB24:
+			v4lconvert_rgb32_to_rgb24(src, dest, width, height, 0);
+			break;
+		case V4L2_PIX_FMT_BGR24:
+			v4lconvert_rgb32_to_rgb24(src, dest, width, height, 1);
+			break;
+		case V4L2_PIX_FMT_YUV420:
+			v4lconvert_rgb24_to_yuv420(src, dest, fmt, 0, 0, 4);
+			break;
+		case V4L2_PIX_FMT_YVU420:
+			v4lconvert_rgb24_to_yuv420(src, dest, fmt, 0, 1, 4);
+			break;
+		}
+		if (src_size < (width * height * 4)) {
+			V4LCONVERT_ERR("short rgb32 data frame\n");
+			errno = EPIPE;
+			result = -1;
+		}
+		break;

I have not looked at the whole function but shouldn't this sanity check happen before the actual work? Also aren't you applying the condition here also for rgb24_to_xxx which should have only three bpp?

+	case V4L2_PIX_FMT_BGR32:
+		switch (dest_pix_fmt) {
+		case V4L2_PIX_FMT_RGB24:
+			v4lconvert_rgb32_to_rgb24(src, dest, width, height, 1);
+			break;
+		case V4L2_PIX_FMT_BGR24:
+			v4lconvert_rgb32_to_rgb24(src, dest, width, height, 0);
+			break;
+		case V4L2_PIX_FMT_YUV420:
+			v4lconvert_rgb24_to_yuv420(src, dest, fmt, 1, 0, 4);
+			break;
+		case V4L2_PIX_FMT_YVU420:
+			v4lconvert_rgb24_to_yuv420(src, dest, fmt, 1, 1, 4);
+			break;
+		}
+		if (src_size < (width * height * 4)) {
+			V4LCONVERT_ERR("short bgr32 data frame\n");
+			errno = EPIPE;
+			result = -1;
+		}
+		break;

Same here. And also in the other patch.


--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux