diff options
author | Wim Taymans <wim.taymans@gmail.com> | 2001-03-11 23:14:33 +0000 |
---|---|---|
committer | Wim Taymans <wim.taymans@gmail.com> | 2001-03-11 23:14:33 +0000 |
commit | db744107392dd3428f9b61a706db7a8782daf86b (patch) | |
tree | e182ce41a9466b702f3cadcc412708e1f26b09c5 | |
parent | 5034ebd9955c3e3f6b9b10bc955a5a838523d779 (diff) |
Some more conversion functions.. We should really use Hermes soon..HEAD-20010312-PRE_CAPSNEGO1
Original commit message from CVS:
Some more conversion functions.. We should really use Hermes soon..
-rw-r--r-- | libs/colorspace/rgb2rgb.c | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/libs/colorspace/rgb2rgb.c b/libs/colorspace/rgb2rgb.c index 27bf9a3ab..7459785a8 100644 --- a/libs/colorspace/rgb2rgb.c +++ b/libs/colorspace/rgb2rgb.c @@ -28,6 +28,8 @@ static void gst_colorspace_rgb24_to_rgb32(GstColorSpaceConverter *space, unsigne static void gst_colorspace_rgb32_to_bgr32(GstColorSpaceConverter *space, unsigned char *src, unsigned char *dest); static void gst_colorspace_rgb555_to_rgb565(GstColorSpaceConverter *space, unsigned char *src, unsigned char *dest); static void gst_colorspace_bgr565_to_rgb32(GstColorSpaceConverter *space, unsigned char *src, unsigned char *dest); +static void gst_colorspace_bgr24_to_bgr565(GstColorSpaceConverter *space, unsigned char *src, unsigned char *dest); +static void gst_colorspace_bgr32_to_bgr565(GstColorSpaceConverter *space, unsigned char *src, unsigned char *dest); GstColorSpaceConvertFunction gst_colorspace_rgb2rgb_get_converter(GstColorSpaceConverter *space, GstColorSpaceType src, GstColorSpaceType dest) { switch(src) { @@ -56,6 +58,9 @@ GstColorSpaceConvertFunction gst_colorspace_rgb2rgb_get_converter(GstColorSpaceC case GST_COLORSPACE_BGR24: space->outsize = space->width*space->height*3; return gst_colorspace_rgb_to_rgb_identity; + case GST_COLORSPACE_BGR565: + space->outsize = space->width*space->height*2; + return gst_colorspace_bgr24_to_bgr565; default: break; } @@ -82,6 +87,9 @@ GstColorSpaceConvertFunction gst_colorspace_rgb2rgb_get_converter(GstColorSpaceC case GST_COLORSPACE_BGR32: space->outsize = space->width*space->height*4; return gst_colorspace_rgb_to_rgb_identity; + case GST_COLORSPACE_BGR565: + space->outsize = space->width*space->height*2; + return gst_colorspace_bgr32_to_bgr565; default: break; } @@ -126,7 +134,7 @@ static void gst_colorspace_rgb24_to_bgr24(GstColorSpaceConverter *space, unsigne gint size; gchar temp; - GST_DEBUG (0,"gst_colorspace_rgb24_to_bgr24 %p %p %d\n", src, dest, space->outsize); + GST_DEBUG (0,"gst_colorspace_rgb24_to_bgr24 %p %p %d %d %d\n", src, dest, space->outsize, space->width, space->height); size = space->outsize/3; @@ -149,6 +157,38 @@ static void gst_colorspace_rgb24_to_bgr24(GstColorSpaceConverter *space, unsigne GST_DEBUG (0,"gst_colorspace_rgb24_to_bgr24 end\n"); } +static void gst_colorspace_bgr24_to_bgr565(GstColorSpaceConverter *space, unsigned char *src, unsigned char *dest) +{ + gint size; + guint16 *destptr = (guint16 *)dest; + + GST_DEBUG (0,"gst_colorspace_bgr24_to_bgr565 %p %p %d %d %d\n", src, dest, space->outsize, space->width, space->height); + + size = space->outsize/2; + + while (size--) { + *destptr++ = ((src[2]&0xF8)<<8)|((src[1]&0xFC)<<3)|((src[0]&0xF8)>>3); + src+=3; + } + GST_DEBUG (0,"gst_colorspace_bgr24_to_bgr565 end\n"); +} + +static void gst_colorspace_bgr32_to_bgr565(GstColorSpaceConverter *space, unsigned char *src, unsigned char *dest) +{ + gint size; + guint16 *destptr = (guint16 *)dest; + + GST_DEBUG (0,"gst_colorspace_bgr32_to_bgr565 %p %p %d %d %d\n", src, dest, space->outsize, space->width, space->height); + + size = space->outsize/2; + + while (size--) { + *destptr++ = ((src[2]&0xF8)<<8)|((src[1]&0xFC)<<3)|((src[0]&0xF8)>>3); + src+=4; + } + GST_DEBUG (0,"gst_colorspace_bgr32_to_bgr565 end\n"); +} + static void gst_colorspace_rgb24_to_rgb32(GstColorSpaceConverter *space, unsigned char *src, unsigned char *dest) { gint size; |