From a63e58c8101caacfc5f82b66de79e794adf0ca3a Mon Sep 17 00:00:00 2001 From: "hans@localhost.localdomain" Date: Thu, 7 Aug 2008 19:34:10 +0200 Subject: libv4l: add support for fixing upside down images to libv4lconvert From: Hans de Goede Add support to libv4lconvert to flipping the image for upside down mounted sensors, libv4lconvert will do this automatically if the webcam sets a flag in its query_fmt reply indicating that this is necessary, this fixes the upside down image on Philips SPC200NC images Priority: normal Signed-off-by: Hans de Goede --- v4l2-apps/lib/libv4l/libv4lconvert/libv4lconvert-priv.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'v4l2-apps/lib/libv4l/libv4lconvert/libv4lconvert-priv.h') diff --git a/v4l2-apps/lib/libv4l/libv4lconvert/libv4lconvert-priv.h b/v4l2-apps/lib/libv4l/libv4lconvert/libv4lconvert-priv.h index bdf847186..7d8fcc568 100644 --- a/v4l2-apps/lib/libv4l/libv4lconvert/libv4lconvert-priv.h +++ b/v4l2-apps/lib/libv4l/libv4lconvert/libv4lconvert-priv.h @@ -55,6 +55,10 @@ #define V4L2_PIX_FMT_SRGGB8 v4l2_fourcc('R','G','G','B') #endif +#ifndef V4L2_FMT_FLAG_UPSIDEDOWN +#define V4L2_FMT_FLAG_UPSIDEDOWN 0x0002 +#endif + #define V4LCONVERT_ERROR_MSG_SIZE 256 #define V4LCONVERT_ERR(...) \ @@ -65,6 +69,7 @@ struct v4lconvert_data { int fd; int supported_src_formats; /* bitfield */ + int format_needs_flip; /* bitfield */ unsigned int no_formats; char error_msg[V4LCONVERT_ERROR_MSG_SIZE]; struct jdec_private *jdec; @@ -107,4 +112,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_flip_rgbbgr24(const unsigned char *src, unsigned char *dst, + int width, int height); + +void v4lconvert_flip_yuv420(const unsigned char *src, unsigned char *dst, + int width, int height); + #endif -- cgit v1.2.3 From 974d503f1d6934082aa2d8cd5f06b266726a144e Mon Sep 17 00:00:00 2001 From: "hans@localhost.localdomain" Date: Sun, 17 Aug 2008 20:13:01 +0200 Subject: libv4l: adjust upside down sensor support for kernel changes From: Hans de Goede libv4l: adjust upside down sensor support for kernel changes Priority: normal Signed-off-by: Hans de Goede --- v4l2-apps/lib/libv4l/libv4lconvert/libv4lconvert-priv.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'v4l2-apps/lib/libv4l/libv4lconvert/libv4lconvert-priv.h') diff --git a/v4l2-apps/lib/libv4l/libv4lconvert/libv4lconvert-priv.h b/v4l2-apps/lib/libv4l/libv4lconvert/libv4lconvert-priv.h index 7d8fcc568..0943d7a59 100644 --- a/v4l2-apps/lib/libv4l/libv4lconvert/libv4lconvert-priv.h +++ b/v4l2-apps/lib/libv4l/libv4lconvert/libv4lconvert-priv.h @@ -55,8 +55,8 @@ #define V4L2_PIX_FMT_SRGGB8 v4l2_fourcc('R','G','G','B') #endif -#ifndef V4L2_FMT_FLAG_UPSIDEDOWN -#define V4L2_FMT_FLAG_UPSIDEDOWN 0x0002 +#ifndef V4L2_CAP_SENSOR_UPSIDE_DOWN +#define V4L2_CAP_SENSOR_UPSIDE_DOWN 0x10000000 #endif #define V4LCONVERT_ERROR_MSG_SIZE 256 @@ -69,7 +69,7 @@ struct v4lconvert_data { int fd; int supported_src_formats; /* bitfield */ - int format_needs_flip; /* bitfield */ + unsigned int capabilities; unsigned int no_formats; char error_msg[V4LCONVERT_ERROR_MSG_SIZE]; struct jdec_private *jdec; -- cgit v1.2.3 From a15825844ed72e4b0f13e10de4b7dd0ce31846ac Mon Sep 17 00:00:00 2001 From: "hans@localhost.localdomain" Date: Fri, 22 Aug 2008 23:23:50 +0200 Subject: libv4l: add support for Pixart custom JPEG format From: Hans de Goede libv4l: add support for Pixart custom JPEG format Priority: normal Signed-off-by: Hans de Goede --- v4l2-apps/lib/libv4l/libv4lconvert/libv4lconvert-priv.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'v4l2-apps/lib/libv4l/libv4lconvert/libv4lconvert-priv.h') diff --git a/v4l2-apps/lib/libv4l/libv4lconvert/libv4lconvert-priv.h b/v4l2-apps/lib/libv4l/libv4lconvert/libv4lconvert-priv.h index 0943d7a59..cd0a781c7 100644 --- a/v4l2-apps/lib/libv4l/libv4lconvert/libv4lconvert-priv.h +++ b/v4l2-apps/lib/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_PJPG +#define V4L2_PIX_FMT_PJPG v4l2_fourcc('P', 'J', 'P', 'G') +#endif + #ifndef V4L2_PIX_FMT_SGBRG8 #define V4L2_PIX_FMT_SGBRG8 v4l2_fourcc('G','B','R','G') #endif @@ -112,10 +116,16 @@ 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_flip_rgbbgr24(const unsigned char *src, unsigned char *dst, +void v4lconvert_rotate90_rgbbgr24(const unsigned char *src, unsigned char *dst, + int destwidth, int destheight); + +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_flip_yuv420(const unsigned char *src, unsigned char *dst, +void v4lconvert_rotate180_yuv420(const unsigned char *src, unsigned char *dst, int width, int height); #endif -- cgit v1.2.3 From 3c90fa3fdd5124cd269e5ac1798f10c3c3cf34d1 Mon Sep 17 00:00:00 2001 From: "hans@localhost.localdomain" Date: Tue, 26 Aug 2008 12:55:08 +0200 Subject: libv4l: Fully handle upside down cam detection in userspace From: Hans de Goede libv4l: Fully handle upside down cam detection in userspace Priority: normal Signed-off-by: Hans de Goede --- v4l2-apps/lib/libv4l/libv4lconvert/libv4lconvert-priv.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'v4l2-apps/lib/libv4l/libv4lconvert/libv4lconvert-priv.h') diff --git a/v4l2-apps/lib/libv4l/libv4lconvert/libv4lconvert-priv.h b/v4l2-apps/lib/libv4l/libv4lconvert/libv4lconvert-priv.h index cd0a781c7..915c33283 100644 --- a/v4l2-apps/lib/libv4l/libv4lconvert/libv4lconvert-priv.h +++ b/v4l2-apps/lib/libv4l/libv4lconvert/libv4lconvert-priv.h @@ -59,26 +59,27 @@ #define V4L2_PIX_FMT_SRGGB8 v4l2_fourcc('R','G','G','B') #endif -#ifndef V4L2_CAP_SENSOR_UPSIDE_DOWN -#define V4L2_CAP_SENSOR_UPSIDE_DOWN 0x10000000 -#endif - #define V4LCONVERT_ERROR_MSG_SIZE 256 #define V4LCONVERT_ERR(...) \ snprintf(data->error_msg, V4LCONVERT_ERROR_MSG_SIZE, \ "v4l-convert: error " __VA_ARGS__) +#define V4LCONVERT_UPSIDE_DOWN 0x01 struct v4lconvert_data { int fd; + int flags; /* bitfield */ int supported_src_formats; /* bitfield */ - unsigned int capabilities; unsigned int no_formats; char error_msg[V4LCONVERT_ERROR_MSG_SIZE]; struct jdec_private *jdec; }; +struct v4lconvert_flags_info { + const char *card; + int flags; +}; void v4lconvert_yuv420_to_rgb24(const unsigned char *src, unsigned char *dst, int width, int height); -- cgit v1.2.3