[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gstreamer-cvs
Subject:    [gst-cvs] gst-plugins-bad: colorspace: Add support for RGB15 and
From:       slomo () kemper ! freedesktop ! org (Sebastian Dröge)
Date:       2010-10-31 22:46:45
Message-ID: 20101031224645.5BCC010056 () kemper ! freedesktop ! org
[Download RAW message or body]

Module: gst-plugins-bad
Branch: master
Commit: e8186a45a1cc0b0b16af426162b59c52d9bb77a6
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-bad/commit/?id=e8186a45a1cc0b0b16af426162b59c52d9bb77a6


Author: Sebastian Dröge <sebastian.droege@collabora.co.uk>
Date:   Sun Oct 31 23:46:27 2010 +0100

colorspace: Add support for RGB15 and BGR15

---

 gst/colorspace/colorspace.c    |   58 ++++++++++++++++++++++++++++++++++++++-
 gst/colorspace/gstcolorspace.c |    1 +
 2 files changed, 57 insertions(+), 2 deletions(-)

diff --git a/gst/colorspace/colorspace.c b/gst/colorspace/colorspace.c
index 98a8f82..a20f5e2 100644
--- a/gst/colorspace/colorspace.c
+++ b/gst/colorspace/colorspace.c
@@ -595,6 +595,60 @@ putline_BGR16 (ColorspaceConvert * convert, guint8 * dest, const \
guint8 * src,  }
 
 static void
+getline_RGB15 (ColorspaceConvert * convert, guint8 * dest, const guint8 * src,
+    int j)
+{
+  int i;
+  const guint16 *srcline = (const guint16 *) FRAME_GET_LINE (src, 0, j);
+  for (i = 0; i < convert->width; i++) {
+    dest[i * 4 + 0] = 0xff;
+    dest[i * 4 + 1] = ((srcline[i] >> 10) & 0x1f) << 3;
+    dest[i * 4 + 2] = ((srcline[i] >> 5) & 0x1f) << 3;
+    dest[i * 4 + 3] = ((srcline[i]) & 0x1f) << 3;
+  }
+}
+
+static void
+putline_RGB15 (ColorspaceConvert * convert, guint8 * dest, const guint8 * src,
+    int j)
+{
+  int i;
+  guint16 *destline = (guint16 *) FRAME_GET_LINE (dest, 0, j);
+  for (i = 0; i < convert->width; i++) {
+    destline[i] =
+        ((src[i * 4 + 1] >> 3) << 10) | ((src[i * 4 +
+                2] >> 3) << 5) | (src[i * 4 + 3] >> 3);
+  }
+}
+
+static void
+getline_BGR15 (ColorspaceConvert * convert, guint8 * dest, const guint8 * src,
+    int j)
+{
+  int i;
+  const guint16 *srcline = (const guint16 *) FRAME_GET_LINE (src, 0, j);
+  for (i = 0; i < convert->width; i++) {
+    dest[i * 4 + 0] = 0xff;
+    dest[i * 4 + 3] = ((srcline[i] >> 10) & 0x1f) << 3;
+    dest[i * 4 + 2] = ((srcline[i] >> 5) & 0x1f) << 3;
+    dest[i * 4 + 1] = ((srcline[i]) & 0x1f) << 3;
+  }
+}
+
+static void
+putline_BGR15 (ColorspaceConvert * convert, guint8 * dest, const guint8 * src,
+    int j)
+{
+  int i;
+  guint16 *destline = (guint16 *) FRAME_GET_LINE (dest, 0, j);
+  for (i = 0; i < convert->width; i++) {
+    destline[i] =
+        ((src[i * 4 + 3] >> 3) << 10) | ((src[i * 4 +
+                2] >> 3) << 5) | (src[i * 4 + 1] >> 3);
+  }
+}
+
+static void
 getline_BGRA (ColorspaceConvert * convert, guint8 * dest, const guint8 * src,
     int j)
 {
@@ -836,8 +890,8 @@ static const ColorspaceLine lines[] = {
   {GST_VIDEO_FORMAT_Y16, getline_Y16, putline_Y16},
   {GST_VIDEO_FORMAT_RGB16, getline_RGB16, putline_RGB16},
   {GST_VIDEO_FORMAT_BGR16, getline_BGR16, putline_BGR16},
-  //{GST_VIDEO_FORMAT_RGB15, getline_RGB15, putline_RGB15},
-  //{GST_VIDEO_FORMAT_BGR15, getline_BGR15, putline_BGR15},
+  {GST_VIDEO_FORMAT_RGB15, getline_RGB15, putline_RGB15},
+  {GST_VIDEO_FORMAT_BGR15, getline_BGR15, putline_BGR15},
   {GST_VIDEO_FORMAT_UYVP, getline_UYVP, putline_UYVP},
   {GST_VIDEO_FORMAT_A420, getline_A420, putline_A420}
 };
diff --git a/gst/colorspace/gstcolorspace.c b/gst/colorspace/gstcolorspace.c
index a4e9493..dd2e03d 100644
--- a/gst/colorspace/gstcolorspace.c
+++ b/gst/colorspace/gstcolorspace.c
@@ -61,6 +61,7 @@ GST_DEBUG_CATEGORY (colorspace_performance);
   GST_VIDEO_CAPS_RGB_16";"						\
   GST_VIDEO_CAPS_BGR_16";"						\
   GST_VIDEO_CAPS_RGB_15";"						\
+  GST_VIDEO_CAPS_BGR_15";"						\
   "video/x-raw-rgb, bpp = (int)8, depth = (int)8, "                     \
       "width = "GST_VIDEO_SIZE_RANGE" , "		                \
       "height = " GST_VIDEO_SIZE_RANGE ", "                             \



------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev

_______________________________________________
gstreamer-cvs mailing list
gstreamer-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gstreamer-cvs


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic