From 222cbd6fd0bec2c2e4566a251729f1329e031a22 Mon Sep 17 00:00:00 2001 From: "hans@rhel5-devel.localdomain" Date: Wed, 11 Mar 2009 13:06:14 +0100 Subject: libv4l: Add software cropping from CIF to VGA modes (fix skype) From: Hans de Goede * Add support for software cropping from 352x288 -> 320x240 / 176x144 -> 160x120, so that apps which will only work with vga resolutions like 320x240 (Skype!) will work with cams/drivers which do not support cropping CIF resolutions to VGA resolutions in hardware. This makes all 2.6.27 gspca supported cams, except for the pac7302 which only does 640x480 (and skype wants 320x240), work with skype * The v4lconvert_convert function was becoming a bit of a mess, so split the functionailiy into seperate v4lconvert_convert_pixfmt, v4lconvert_rotate and v4lconvert_crop functions, and make v4lconvert_convert a frontend to these Priority: normal Signed-off-by: Hans de Goede --- v4l2-apps/libv4l/libv4lconvert/libv4lconvert-priv.h | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'v4l2-apps/libv4l/libv4lconvert/libv4lconvert-priv.h') diff --git a/v4l2-apps/libv4l/libv4lconvert/libv4lconvert-priv.h b/v4l2-apps/libv4l/libv4lconvert/libv4lconvert-priv.h index 0c4eff6ce..99ffdec20 100644 --- a/v4l2-apps/libv4l/libv4lconvert/libv4lconvert-priv.h +++ b/v4l2-apps/libv4l/libv4lconvert/libv4lconvert-priv.h @@ -71,7 +71,8 @@ "v4l-convert: error " __VA_ARGS__) /* Card flags */ -#define V4LCONVERT_UPSIDE_DOWN 0x01 +#define V4LCONVERT_ROTATE_90 0x01 +#define V4LCONVERT_ROTATE_180 0x02 /* Pixformat flags */ #define V4LCONVERT_COMPRESSED 0x01 @@ -151,16 +152,10 @@ void v4lconvert_bayer_to_bgr24(const unsigned char *bayer, void v4lconvert_bayer_to_yuv420(const unsigned char *bayer, unsigned char *yuv, int width, int height, unsigned int pixfmt); -void v4lconvert_rotate90_rgbbgr24(const unsigned char *src, unsigned char *dst, - int destwidth, int destheight); +void v4lconvert_rotate(unsigned char *src, unsigned char *dest, + int width, int height, unsigned int pix_fmt, int rotate); -void v4lconvert_rotate90_yuv420(const unsigned char *src, unsigned char *dst, - int destwidth, int destheight); - -void v4lconvert_rotate180_rgbbgr24(const unsigned char *src, unsigned char *dst, - int width, int height); - -void v4lconvert_rotate180_yuv420(const unsigned char *src, unsigned char *dst, - int width, int height); +void v4lconvert_crop(unsigned char *src, unsigned char *dest, + const struct v4l2_format *src_fmt, const struct v4l2_format *dest_fmt); #endif -- cgit v1.2.3 From e4def927f3ed43a4763652a0911f69180e803721 Mon Sep 17 00:00:00 2001 From: "hans@rhel5-devel.localdomain" Date: Wed, 11 Mar 2009 13:08:51 +0100 Subject: libv4l: dont try to allocate large buffers on the stack From: Hans de Goede When conversion requires multiple passes don't alloc the needed temporary buffer on the stack, as some apps (ekiga) use so much stack themselves this causes us to run out of stack space Priority: normal Signed-off-by: Hans de Goede --- v4l2-apps/libv4l/libv4lconvert/libv4lconvert-priv.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'v4l2-apps/libv4l/libv4lconvert/libv4lconvert-priv.h') diff --git a/v4l2-apps/libv4l/libv4lconvert/libv4lconvert-priv.h b/v4l2-apps/libv4l/libv4lconvert/libv4lconvert-priv.h index 99ffdec20..8473ba68f 100644 --- a/v4l2-apps/libv4l/libv4lconvert/libv4lconvert-priv.h +++ b/v4l2-apps/libv4l/libv4lconvert/libv4lconvert-priv.h @@ -86,6 +86,12 @@ struct v4lconvert_data { struct jdec_private *jdec; struct v4l2_frmsizeenum framesizes[V4LCONVERT_MAX_FRAMESIZES]; unsigned int no_framesizes; + int convert_buf_size; + int rotate_buf_size; + int convert_pixfmt_buf_size; + unsigned char *convert_buf; + unsigned char *rotate_buf; + unsigned char *convert_pixfmt_buf; }; struct v4lconvert_flags_info { -- cgit v1.2.3 From 5f90628a20098c6dcde990310eaaabec2cef4694 Mon Sep 17 00:00:00 2001 From: "hans@rhel5-devel.localdomain" Date: Wed, 11 Mar 2009 13:10:27 +0100 Subject: libv4l: add support for converting to YV12 planar From: Hans de Goede Add support for converting to YV12 planar (next to the already supported YU12 / I420) and implement RGB/BGR24 -> YU/YV12 conversion Priority: normal Signed-off-by: Hans de Goede --- .../libv4l/libv4lconvert/libv4lconvert-priv.h | 24 ++++++++++++++-------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'v4l2-apps/libv4l/libv4lconvert/libv4lconvert-priv.h') diff --git a/v4l2-apps/libv4l/libv4lconvert/libv4lconvert-priv.h b/v4l2-apps/libv4l/libv4lconvert/libv4lconvert-priv.h index 8473ba68f..a534ca321 100644 --- a/v4l2-apps/libv4l/libv4lconvert/libv4lconvert-priv.h +++ b/v4l2-apps/libv4l/libv4lconvert/libv4lconvert-priv.h @@ -104,11 +104,14 @@ struct v4lconvert_pixfmt { int flags; }; +void v4lconvert_rgb24_to_yuv420(const unsigned char *src, unsigned char *dest, + const struct v4l2_format *src_fmt, int bgr, int yvu); + void v4lconvert_yuv420_to_rgb24(const unsigned char *src, unsigned char *dst, - int width, int height); + int width, int height, int yvu); void v4lconvert_yuv420_to_bgr24(const unsigned char *src, unsigned char *dst, - int width, int height); + int width, int height, int yvu); void v4lconvert_yuyv_to_rgb24(const unsigned char *src, unsigned char *dst, int width, int height); @@ -117,7 +120,7 @@ void v4lconvert_yuyv_to_bgr24(const unsigned char *src, unsigned char *dst, int width, int height); void v4lconvert_yuyv_to_yuv420(const unsigned char *src, unsigned char *dst, - int width, int height); + int width, int height, int yvu); void v4lconvert_yvyu_to_rgb24(const unsigned char *src, unsigned char *dst, int width, int height); @@ -126,19 +129,22 @@ void v4lconvert_yvyu_to_bgr24(const unsigned char *src, unsigned char *dst, int width, int height); void v4lconvert_yvyu_to_yuv420(const unsigned char *src, unsigned char *dst, - int width, int height); + int width, int height, int yvu); void v4lconvert_swap_rgb(const unsigned char *src, unsigned char *dst, int width, int height); +void v4lconvert_swap_uv(const unsigned char *src, unsigned char *dst, + const struct v4l2_format *src_fmt); + void v4lconvert_spca501_to_yuv420(const unsigned char *src, unsigned char *dst, - int width, int height); + int width, int height, int yvu); void v4lconvert_spca505_to_yuv420(const unsigned char *src, unsigned char *dst, - int width, int height); + int width, int height, int yvu); void v4lconvert_spca508_to_yuv420(const unsigned char *src, unsigned char *dst, - int width, int height); + int width, int height, int yvu); void v4lconvert_decode_spca561(const unsigned char *src, unsigned char *dst, int width, int height); @@ -155,8 +161,8 @@ void v4lconvert_bayer_to_rgb24(const unsigned char *bayer, void v4lconvert_bayer_to_bgr24(const unsigned char *bayer, unsigned char *rgb, int width, int height, unsigned int pixfmt); -void v4lconvert_bayer_to_yuv420(const unsigned char *bayer, - unsigned char *yuv, int width, int height, unsigned int pixfmt); +void v4lconvert_bayer_to_yuv420(const unsigned char *bayer, unsigned char *yuv, + int width, int height, unsigned int src_pixfmt, int yvu); void v4lconvert_rotate(unsigned char *src, unsigned char *dest, int width, int height, unsigned int pix_fmt, int rotate); -- cgit v1.2.3 From 17bb671ca3461d5aacfe3ca34adb4694a3b25949 Mon Sep 17 00:00:00 2001 From: "hans@rhel5-devel.localdomain" Date: Wed, 11 Mar 2009 13:12:08 +0100 Subject: libv4l: avoid try_fmt on UVC cams if possible From: Hans de Goede Avoid the use of try_fmt as much as possible on UVC cams, instead use the results of the enum_framesizes ioctl. This is because: 1) try_fmt actually causes IO with UVC cams making apps which do lot of querying of device capabilities slow (cheese) 2) some buggy cams don't like getting lots of UVC video probes and crash when they do Priority: normal Signed-off-by: Hans de Goede --- v4l2-apps/libv4l/libv4lconvert/libv4lconvert-priv.h | 1 + 1 file changed, 1 insertion(+) (limited to 'v4l2-apps/libv4l/libv4lconvert/libv4lconvert-priv.h') diff --git a/v4l2-apps/libv4l/libv4lconvert/libv4lconvert-priv.h b/v4l2-apps/libv4l/libv4lconvert/libv4lconvert-priv.h index a534ca321..55a5b49be 100644 --- a/v4l2-apps/libv4l/libv4lconvert/libv4lconvert-priv.h +++ b/v4l2-apps/libv4l/libv4lconvert/libv4lconvert-priv.h @@ -73,6 +73,7 @@ /* Card flags */ #define V4LCONVERT_ROTATE_90 0x01 #define V4LCONVERT_ROTATE_180 0x02 +#define V4LCONVERT_IS_UVC 0x04 /* Pixformat flags */ #define V4LCONVERT_COMPRESSED 0x01 -- cgit v1.2.3 From d02d1e3c9f20e691d7d3ff62275d57bfc4766e19 Mon Sep 17 00:00:00 2001 From: "hans@rhel5-devel.localdomain" Date: Wed, 11 Mar 2009 13:16:01 +0100 Subject: libv4l: add UYVY support From: Julien BLACHE Attached is a patch to add UYVY support to libv4lconvert. It's obviously a shameless respin of the YVYU conversion routines :P Tested on a USB Apple iSight, which only supports UYVY. Priority: normal Signed-off-by: Julien BLACHE Signed-off-by: Hans de Goede --- v4l2-apps/libv4l/libv4lconvert/libv4lconvert-priv.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'v4l2-apps/libv4l/libv4lconvert/libv4lconvert-priv.h') diff --git a/v4l2-apps/libv4l/libv4lconvert/libv4lconvert-priv.h b/v4l2-apps/libv4l/libv4lconvert/libv4lconvert-priv.h index 55a5b49be..c268375c8 100644 --- a/v4l2-apps/libv4l/libv4lconvert/libv4lconvert-priv.h +++ b/v4l2-apps/libv4l/libv4lconvert/libv4lconvert-priv.h @@ -132,6 +132,15 @@ void v4lconvert_yvyu_to_bgr24(const unsigned char *src, unsigned char *dst, void v4lconvert_yvyu_to_yuv420(const unsigned char *src, unsigned char *dst, int width, int height, int yvu); +void v4lconvert_uyvy_to_rgb24(const unsigned char *src, unsigned char *dst, + int width, int height); + +void v4lconvert_uyvy_to_bgr24(const unsigned char *src, unsigned char *dst, + int width, int height); + +void v4lconvert_uyvy_to_yuv420(const unsigned char *src, unsigned char *dst, + int width, int height, int yvu); + void v4lconvert_swap_rgb(const unsigned char *src, unsigned char *dst, int width, int height); -- cgit v1.2.3 From d58bea2b9caa5512cbd5136719391cc7055fe410 Mon Sep 17 00:00:00 2001 From: "hans@rhel5-devel.localdomain" Date: Wed, 11 Mar 2009 13:16:22 +0100 Subject: libv4l: remove duplicate v4lconvert_yvyu_to_yuv420 function From: Hans de Goede Remove v4lconvert_yvyu_to_yuv420 function as its functionality is duplicate with v4lconvert_yuyv_to_yuv420 Priority: normal Signed-off-by: Hans de Goede --- v4l2-apps/libv4l/libv4lconvert/libv4lconvert-priv.h | 3 --- 1 file changed, 3 deletions(-) (limited to 'v4l2-apps/libv4l/libv4lconvert/libv4lconvert-priv.h') diff --git a/v4l2-apps/libv4l/libv4lconvert/libv4lconvert-priv.h b/v4l2-apps/libv4l/libv4lconvert/libv4lconvert-priv.h index c268375c8..c8fa705f0 100644 --- a/v4l2-apps/libv4l/libv4lconvert/libv4lconvert-priv.h +++ b/v4l2-apps/libv4l/libv4lconvert/libv4lconvert-priv.h @@ -129,9 +129,6 @@ void v4lconvert_yvyu_to_rgb24(const unsigned char *src, unsigned char *dst, void v4lconvert_yvyu_to_bgr24(const unsigned char *src, unsigned char *dst, int width, int height); -void v4lconvert_yvyu_to_yuv420(const unsigned char *src, unsigned char *dst, - int width, int height, int yvu); - void v4lconvert_uyvy_to_rgb24(const unsigned char *src, unsigned char *dst, int width, int height); -- cgit v1.2.3 From ee232e3e24844fa93b83949e34e6a2cc60f8cdfc Mon Sep 17 00:00:00 2001 From: "hans@rhel5-devel.localdomain" Date: Wed, 11 Mar 2009 13:23:30 +0100 Subject: libv4l: us USB-id's instead of USB product string in upside down dev table From: Hans de Goede Switch to using USB-id's instead of USB product string, as not all devices set a unique product string. This fixes the upside down issues with genius e-messenger 112 cams Priority: normal Signed-off-by: Hans de Goede --- v4l2-apps/libv4l/libv4lconvert/libv4lconvert-priv.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'v4l2-apps/libv4l/libv4lconvert/libv4lconvert-priv.h') diff --git a/v4l2-apps/libv4l/libv4lconvert/libv4lconvert-priv.h b/v4l2-apps/libv4l/libv4lconvert/libv4lconvert-priv.h index c8fa705f0..6bcf2cb26 100644 --- a/v4l2-apps/libv4l/libv4lconvert/libv4lconvert-priv.h +++ b/v4l2-apps/libv4l/libv4lconvert/libv4lconvert-priv.h @@ -96,7 +96,11 @@ struct v4lconvert_data { }; struct v4lconvert_flags_info { - const char *card; + unsigned short vendor_id; + unsigned short product_id; +/* We could also use the USB manufacturer and product strings some devices have + const char *manufacturer; + const char *product; */ int flags; }; -- cgit v1.2.3 From dfc2a74d9ccd7ccf6115a1484ce142468866b296 Mon Sep 17 00:00:00 2001 From: "hans@rhel5-devel.localdomain" Date: Wed, 11 Mar 2009 13:26:09 +0100 Subject: libv4l: add sn9c20x-i420 decoder From: Vasily Khoruzhick Recent sn9c20x driver written by microdia project (http://groups.goolge.com/group/microdia) introduce new output format - sn9c20x-i420. This format is actually scrambled yuv420, so it's very easy and fast to convert it to yuv420. This patch adds sn9c20x-i420 decoder to the libv4l-0.5.7 This decoder is much faster than jpeg one (sn9c20x supports JPEG too): sn9c20x-i420 decoder eats only 10% of 1GHz CPU at 640x480x25fps vs 40% of 1GHz CPU in jpeg at same frame size/rate. This format should be preffered for sn9c20x, because sn9c20x driver supports SBGGR8 too, so it should go before SBGGR8 in supported_src_pixfmts. Priority: normal Signed-off-by: Vasily Khoruzhick Signed-off-by: Hans de Goede Date: Wed, 11 Mar 2009 13:30:03 +0100 Subject: libv4l: Add MR97310A decompression From: Kyle Guinn libv4l: Add MR97310A decompression Priority: normal Signed-off-by: Kyle Guinn Signed-off-by: Hans de Goede --- v4l2-apps/libv4l/libv4lconvert/libv4lconvert-priv.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'v4l2-apps/libv4l/libv4lconvert/libv4lconvert-priv.h') diff --git a/v4l2-apps/libv4l/libv4lconvert/libv4lconvert-priv.h b/v4l2-apps/libv4l/libv4lconvert/libv4lconvert-priv.h index 08a7a7cfa..afe3e0047 100644 --- a/v4l2-apps/libv4l/libv4lconvert/libv4lconvert-priv.h +++ b/v4l2-apps/libv4l/libv4lconvert/libv4lconvert-priv.h @@ -43,6 +43,10 @@ #define V4L2_PIX_FMT_PAC207 v4l2_fourcc('P','2','0','7') #endif +#ifndef V4L2_PIX_FMT_MR97310A +#define V4L2_PIX_FMT_MR97310A v4l2_fourcc('M','3','1','0') +#endif + #ifndef V4L2_PIX_FMT_PJPG #define V4L2_PIX_FMT_PJPG v4l2_fourcc('P', 'J', 'P', 'G') #endif @@ -173,6 +177,9 @@ void v4lconvert_decode_sn9c10x(const unsigned char *src, unsigned char *dst, void v4lconvert_decode_pac207(const unsigned char *src, unsigned char *dst, int width, int height); +void v4lconvert_decode_mr97310a(const unsigned char *src, unsigned char *dst, + int width, int height); + void v4lconvert_bayer_to_rgb24(const unsigned char *bayer, unsigned char *rgb, int width, int height, unsigned int pixfmt); -- cgit v1.2.3 From 9a65e5e90ce0d4be59a49cd3a71d020e00cb3e0c Mon Sep 17 00:00:00 2001 From: "hans@rhel5-devel.localdomain" Date: Wed, 11 Mar 2009 14:06:26 +0100 Subject: libv4l: libv4lconvert support for SQ905C From: Theodore Kilgore Support the decompression used by the SQ905C cameras (0x2770:0x905C) and some other related cameras. There is at the moment no support module for these cameras in streaming mode, but I intend to submit one. This contribution was created in whole by me, based upon code in libgphoto2 which was created in whole by me, and which was licensed for libgphoto2 under the LGPL license. Priority: normal Signed-off-by: Theodore Kilgore Signed-off-by: Hans de Goede --- v4l2-apps/libv4l/libv4lconvert/libv4lconvert-priv.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'v4l2-apps/libv4l/libv4lconvert/libv4lconvert-priv.h') diff --git a/v4l2-apps/libv4l/libv4lconvert/libv4lconvert-priv.h b/v4l2-apps/libv4l/libv4lconvert/libv4lconvert-priv.h index afe3e0047..f3e80e82c 100644 --- a/v4l2-apps/libv4l/libv4lconvert/libv4lconvert-priv.h +++ b/v4l2-apps/libv4l/libv4lconvert/libv4lconvert-priv.h @@ -47,6 +47,10 @@ #define V4L2_PIX_FMT_MR97310A v4l2_fourcc('M','3','1','0') #endif +#ifndef V4L2_PIX_FMT_SQ905C +#define V4L2_PIX_FMT_SQ905C v4l2_fourcc('9', '0', '5', 'C') +#endif + #ifndef V4L2_PIX_FMT_PJPG #define V4L2_PIX_FMT_PJPG v4l2_fourcc('P', 'J', 'P', 'G') #endif @@ -180,6 +184,9 @@ void v4lconvert_decode_pac207(const unsigned char *src, unsigned char *dst, void v4lconvert_decode_mr97310a(const unsigned char *src, unsigned char *dst, int width, int height); +void v4lconvert_decode_sq905c(const unsigned char *src, unsigned char *dst, + int width, int height); + void v4lconvert_bayer_to_rgb24(const unsigned char *bayer, unsigned char *rgb, int width, int height, unsigned int pixfmt); -- cgit v1.2.3 From f689c3bd615386cf4c5238d1b4de1aaf4b58ce69 Mon Sep 17 00:00:00 2001 From: "hans@rhel5-devel.localdomain" Date: Fri, 13 Mar 2009 12:57:33 +0100 Subject: libv4l: add hm12 support for the cx2341x MPEG encoder devices. From: Hans Verkuil Priority: normal Signed-off-by: Hans Verkuil Signed-off-by: Hans de Goede --- v4l2-apps/libv4l/libv4lconvert/libv4lconvert-priv.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'v4l2-apps/libv4l/libv4lconvert/libv4lconvert-priv.h') diff --git a/v4l2-apps/libv4l/libv4lconvert/libv4lconvert-priv.h b/v4l2-apps/libv4l/libv4lconvert/libv4lconvert-priv.h index f3e80e82c..5ce7bde3b 100644 --- a/v4l2-apps/libv4l/libv4lconvert/libv4lconvert-priv.h +++ b/v4l2-apps/libv4l/libv4lconvert/libv4lconvert-priv.h @@ -71,6 +71,10 @@ #define V4L2_PIX_FMT_YVYU v4l2_fourcc('Y', 'V', 'Y', 'U') #endif +#ifndef V4L2_PIX_FMT_HM12 +#define V4L2_PIX_FMT_HM12 v4l2_fourcc('H', 'M', '1', '2') +#endif + #ifndef V4L2_PIX_FMT_SN9C20X_I420 #define V4L2_PIX_FMT_SN9C20X_I420 v4l2_fourcc('S', '9', '2', '0') #endif @@ -196,6 +200,15 @@ void v4lconvert_bayer_to_bgr24(const unsigned char *bayer, void v4lconvert_bayer_to_yuv420(const unsigned char *bayer, unsigned char *yuv, int width, int height, unsigned int src_pixfmt, int yvu); +void v4lconvert_hm12_to_rgb24(const unsigned char *src, + unsigned char *dst, int width, int height); + +void v4lconvert_hm12_to_bgr24(const unsigned char *src, + unsigned char *dst, int width, int height); + +void v4lconvert_hm12_to_yuv420(const unsigned char *src, + unsigned char *dst, int width, int height, int yvu); + void v4lconvert_rotate(unsigned char *src, unsigned char *dest, int width, int height, unsigned int pix_fmt, int rotate); -- cgit v1.2.3