mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-03 14:08:56 +00:00
Some more conversion functions.. We should really use Hermes soon..
Original commit message from CVS: Some more conversion functions.. We should really use Hermes soon..
This commit is contained in:
parent
5034ebd995
commit
db74410739
1 changed files with 41 additions and 1 deletions
|
@ -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_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_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_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) {
|
GstColorSpaceConvertFunction gst_colorspace_rgb2rgb_get_converter(GstColorSpaceConverter *space, GstColorSpaceType src, GstColorSpaceType dest) {
|
||||||
switch(src) {
|
switch(src) {
|
||||||
|
@ -56,6 +58,9 @@ GstColorSpaceConvertFunction gst_colorspace_rgb2rgb_get_converter(GstColorSpaceC
|
||||||
case GST_COLORSPACE_BGR24:
|
case GST_COLORSPACE_BGR24:
|
||||||
space->outsize = space->width*space->height*3;
|
space->outsize = space->width*space->height*3;
|
||||||
return gst_colorspace_rgb_to_rgb_identity;
|
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:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -82,6 +87,9 @@ GstColorSpaceConvertFunction gst_colorspace_rgb2rgb_get_converter(GstColorSpaceC
|
||||||
case GST_COLORSPACE_BGR32:
|
case GST_COLORSPACE_BGR32:
|
||||||
space->outsize = space->width*space->height*4;
|
space->outsize = space->width*space->height*4;
|
||||||
return gst_colorspace_rgb_to_rgb_identity;
|
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:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -126,7 +134,7 @@ static void gst_colorspace_rgb24_to_bgr24(GstColorSpaceConverter *space, unsigne
|
||||||
gint size;
|
gint size;
|
||||||
gchar temp;
|
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;
|
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");
|
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)
|
static void gst_colorspace_rgb24_to_rgb32(GstColorSpaceConverter *space, unsigned char *src, unsigned char *dest)
|
||||||
{
|
{
|
||||||
gint size;
|
gint size;
|
||||||
|
|
Loading…
Reference in a new issue