Date: Sun, 9 Jan 2011 00:31:13 +0100 From: Luigi Rizzo <rizzo@iet.unipi.it> To: Hans Petter Selasky <hselasky@c2i.net>, hselasky@freebsd.org Cc: freebsd-multimedia@freebsd.org Subject: libv4l1 bug in RGB24/32 formats Message-ID: <20110108233113.GB80865@onelab2.iet.unipi.it> In-Reply-To: <201101090010.57118.hselasky@c2i.net> References: <201101081841.10690.hselasky@c2i.net> <20110108231704.GA80865@onelab2.iet.unipi.it> <201101090010.57118.hselasky@c2i.net>
next in thread | previous in thread | raw e-mail | index | archive | help
--VbJkn9YxBvnuCH5J Content-Type: text/plain; charset=us-ascii Content-Disposition: inline I noticed that a couple of my webcams, when used with libv4l, claim to return RGB24 data but red and blue are swapped. Looking at the code in /usr/ports/multimedia/libv4l/work/v4l-utils-0.8.1/lib/libv4l1/libv4l1.c it seems that the two routines that do conversion format incorrectly map RGB* to BGR* . The attached patch fixes the problem, I think it could be committed to the port. I am not sure if the code modified by the patch was inserted deliberately (one mistake may happen, but two complementary ones are really unlikely). cheers luigi --VbJkn9YxBvnuCH5J Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=patch-v4l1-luigi --- lib/libv4l1/libv4l1.c.orig 2011-01-09 02:13:49.000000000 +0100 +++ lib/libv4l1/libv4l1.c 2011-01-09 02:14:23.000000000 +0100 @@ -87,9 +87,9 @@ case VIDEO_PALETTE_RGB565: return V4L2_PIX_FMT_RGB565; case VIDEO_PALETTE_RGB24: - return V4L2_PIX_FMT_BGR24; + return V4L2_PIX_FMT_RGB24; case VIDEO_PALETTE_RGB32: - return V4L2_PIX_FMT_BGR32; + return V4L2_PIX_FMT_RGB32; case VIDEO_PALETTE_YUYV: return V4L2_PIX_FMT_YUYV; case VIDEO_PALETTE_YUV422: @@ -118,9 +118,9 @@ return VIDEO_PALETTE_RGB555; case V4L2_PIX_FMT_RGB565: return VIDEO_PALETTE_RGB565; - case V4L2_PIX_FMT_BGR24: + case V4L2_PIX_FMT_RGB24: return VIDEO_PALETTE_RGB24; - case V4L2_PIX_FMT_BGR32: + case V4L2_PIX_FMT_RGB32: return VIDEO_PALETTE_RGB32; case V4L2_PIX_FMT_YUYV: return VIDEO_PALETTE_YUYV; --VbJkn9YxBvnuCH5J--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110108233113.GB80865>