summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2009-01-05 12:34:18 +0000
committerSebastian Dröge <slomo@circular-chaos.org>2009-01-05 12:34:18 +0000
commit9ebb543b503d475f364a49cc1f6905a82646f466 (patch)
tree271b38703f3ed526461f59d78e46e4adba78f687
parent751555b5c3839b19274565ef65c6189c494a6924 (diff)
gst/bayer/gstbayer2rgb.c: Fix color offset calculation for 24bpp. Fixes bug #566613.
Original commit message from CVS: Patch by: Sascha Hauer <s dot hauer at pengutronix dot de> Luotao Fu <l dot fu at pengutronix dot de> * gst/bayer/gstbayer2rgb.c: (get_pix_offset), (gst_bayer2rgb_set_caps): Fix color offset calculation for 24bpp. Fixes bug #566613.
-rw-r--r--ChangeLog9
-rw-r--r--gst/bayer/gstbayer2rgb.c27
2 files changed, 24 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index ff9d01643..67cd12941 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
2009-01-05 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+ Patch by: Sascha Hauer <s dot hauer at pengutronix dot de>
+ Luotao Fu <l dot fu at pengutronix dot de>
+
+ * gst/bayer/gstbayer2rgb.c: (get_pix_offset),
+ (gst_bayer2rgb_set_caps):
+ Fix color offset calculation for 24bpp. Fixes bug #566613.
+
+2009-01-05 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
Patch by: vanista <vanista at gmail dot com>
* gst/mpegtsmux/mpegtsmux.c: (mpegtsmux_create_stream):
diff --git a/gst/bayer/gstbayer2rgb.c b/gst/bayer/gstbayer2rgb.c
index cbaa799c9..ec2dadb1a 100644
--- a/gst/bayer/gstbayer2rgb.c
+++ b/gst/bayer/gstbayer2rgb.c
@@ -231,19 +231,21 @@ gst_bayer2rgb_get_property (GObject * object, guint prop_id,
/* Routine to convert colormask value into relative byte offset */
static int
-get_pix_offset (int offset)
+get_pix_offset (int mask, int bpp)
{
- switch (offset) {
+ int bpp32 = (bpp / 8) - 3;
+
+ switch (mask) {
case 255:
- return 3;
+ return 2 + bpp32;
case 65280:
- return 2;
+ return 1 + bpp32;
case 16711680:
- return 1;
+ return 0 + bpp32;
case -16777216:
return 0;
default:
- GST_ERROR ("Invalid color mask 0x%08x", offset);
+ GST_ERROR ("Invalid color mask 0x%08x", mask);
return -1;
}
}
@@ -254,7 +256,7 @@ gst_bayer2rgb_set_caps (GstBaseTransform * base, GstCaps * incaps,
{
GstBayer2RGB *filter = GST_BAYER2RGB (base);
GstStructure *structure;
- int val;
+ int val, bpp;
GST_DEBUG ("in caps %" GST_PTR_FORMAT " out caps %" GST_PTR_FORMAT, incaps,
outcaps);
@@ -267,14 +269,14 @@ gst_bayer2rgb_set_caps (GstBaseTransform * base, GstCaps * incaps,
/* To cater for different RGB formats, we need to set params for later */
structure = gst_caps_get_structure (outcaps, 0);
- gst_structure_get_int (structure, "bpp", &val);
- filter->pixsize = val / 8;
+ gst_structure_get_int (structure, "bpp", &bpp);
+ filter->pixsize = bpp / 8;
gst_structure_get_int (structure, "red_mask", &val);
- filter->r_off = get_pix_offset (val);
+ filter->r_off = get_pix_offset (val, bpp);
gst_structure_get_int (structure, "green_mask", &val);
- filter->g_off = get_pix_offset (val);
+ filter->g_off = get_pix_offset (val, bpp);
gst_structure_get_int (structure, "blue_mask", &val);
- filter->b_off = get_pix_offset (val);
+ filter->b_off = get_pix_offset (val, bpp);
return TRUE;
}
@@ -516,6 +518,7 @@ corner (uint8_t * input, uint8_t * output, int x, int y,
break;
}
}
+
static void
do_corners (uint8_t * input, uint8_t * output, GstBayer2RGB * filter)
{