summaryrefslogtreecommitdiff
path: root/v4l2-apps
diff options
context:
space:
mode:
authorhans@rhel5-devel.localdomain <hans@rhel5-devel.localdomain>2009-03-11 13:26:35 +0100
committerhans@rhel5-devel.localdomain <hans@rhel5-devel.localdomain>2009-03-11 13:26:35 +0100
commit2da5c1631758ea1e4645a2ea01006bcc460ec70c (patch)
treefa5325c2610a386a6b32e953dac87067dc433dad /v4l2-apps
parentdfc2a74d9ccd7ccf6115a1484ce142468866b296 (diff)
downloadmediapointer-dvb-s2-2da5c1631758ea1e4645a2ea01006bcc460ec70c.tar.gz
mediapointer-dvb-s2-2da5c1631758ea1e4645a2ea01006bcc460ec70c.tar.bz2
libv4l: remove some code duplication in bayer handling
From: Hans de Goede <hdegoede@redhat.com> remove some code duplication in bayer handling Priority: normal Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'v4l2-apps')
-rw-r--r--v4l2-apps/libv4l/libv4lconvert/libv4lconvert.c44
1 files changed, 15 insertions, 29 deletions
diff --git a/v4l2-apps/libv4l/libv4lconvert/libv4lconvert.c b/v4l2-apps/libv4l/libv4lconvert/libv4lconvert.c
index 43c25ec94..3c51b6c53 100644
--- a/v4l2-apps/libv4l/libv4lconvert/libv4lconvert.c
+++ b/v4l2-apps/libv4l/libv4lconvert/libv4lconvert.c
@@ -553,26 +553,6 @@ static int v4lconvert_convert_pixfmt(struct v4lconvert_data *data,
}
break;
- case V4L2_PIX_FMT_SBGGR8:
- case V4L2_PIX_FMT_SGBRG8:
- case V4L2_PIX_FMT_SGRBG8:
- case V4L2_PIX_FMT_SRGGB8:
- switch (dest_pix_fmt) {
- case V4L2_PIX_FMT_RGB24:
- v4lconvert_bayer_to_rgb24(src, dest, width, height, src_pix_fmt);
- break;
- case V4L2_PIX_FMT_BGR24:
- v4lconvert_bayer_to_bgr24(src, dest, width, height, src_pix_fmt);
- break;
- case V4L2_PIX_FMT_YUV420:
- v4lconvert_bayer_to_yuv420(src, dest, width, height, src_pix_fmt, 0);
- break;
- case V4L2_PIX_FMT_YVU420:
- v4lconvert_bayer_to_yuv420(src, dest, width, height, src_pix_fmt, 1);
- break;
- }
- break;
-
/* Custom cam specific YUV formats */
case V4L2_PIX_FMT_SPCA501:
case V4L2_PIX_FMT_SPCA505:
@@ -628,7 +608,6 @@ static int v4lconvert_convert_pixfmt(struct v4lconvert_data *data,
case V4L2_PIX_FMT_PAC207:
{
unsigned char *tmpbuf;
- unsigned int bayer_fmt = 0;
tmpbuf = v4lconvert_alloc_buffer(data, width * height,
&data->convert_pixfmt_buf, &data->convert_pixfmt_buf_size);
@@ -638,34 +617,41 @@ static int v4lconvert_convert_pixfmt(struct v4lconvert_data *data,
switch (src_pix_fmt) {
case V4L2_PIX_FMT_SPCA561:
v4lconvert_decode_spca561(src, tmpbuf, width, height);
- bayer_fmt = V4L2_PIX_FMT_SGBRG8;
+ src_pix_fmt = V4L2_PIX_FMT_SGBRG8;
break;
case V4L2_PIX_FMT_SN9C10X:
v4lconvert_decode_sn9c10x(src, tmpbuf, width, height);
- bayer_fmt = V4L2_PIX_FMT_SBGGR8;
+ src_pix_fmt = V4L2_PIX_FMT_SBGGR8;
break;
case V4L2_PIX_FMT_PAC207:
v4lconvert_decode_pac207(src, tmpbuf, width, height);
- bayer_fmt = V4L2_PIX_FMT_SBGGR8;
+ src_pix_fmt = V4L2_PIX_FMT_SBGGR8;
break;
}
+ src = tmpbuf;
+ /* Deliberate fall through to raw bayer fmt code! */
+ }
+ /* Raw bayer formats */
+ case V4L2_PIX_FMT_SBGGR8:
+ case V4L2_PIX_FMT_SGBRG8:
+ case V4L2_PIX_FMT_SGRBG8:
+ case V4L2_PIX_FMT_SRGGB8:
switch (dest_pix_fmt) {
case V4L2_PIX_FMT_RGB24:
- v4lconvert_bayer_to_rgb24(tmpbuf, dest, width, height, bayer_fmt);
+ v4lconvert_bayer_to_rgb24(src, dest, width, height, src_pix_fmt);
break;
case V4L2_PIX_FMT_BGR24:
- v4lconvert_bayer_to_bgr24(tmpbuf, dest, width, height, bayer_fmt);
+ v4lconvert_bayer_to_bgr24(src, dest, width, height, src_pix_fmt);
break;
case V4L2_PIX_FMT_YUV420:
- v4lconvert_bayer_to_yuv420(tmpbuf, dest, width, height, bayer_fmt, 0);
+ v4lconvert_bayer_to_yuv420(src, dest, width, height, src_pix_fmt, 0);
break;
case V4L2_PIX_FMT_YVU420:
- v4lconvert_bayer_to_yuv420(tmpbuf, dest, width, height, bayer_fmt, 1);
+ v4lconvert_bayer_to_yuv420(src, dest, width, height, src_pix_fmt, 1);
break;
}
break;
- }
case V4L2_PIX_FMT_RGB24:
switch (dest_pix_fmt) {