[gst-devel] patch

Jens Thiele karme at unforgettable.com
Sun Feb 25 00:04:55 CET 2001


attached a patch
to have a 
bgr565_to_rgb32
converter
-------------- next part --------------
Index: rgb2rgb.c
===================================================================
RCS file: /cvsroot/gstreamer/gstreamer/libs/colorspace/rgb2rgb.c,v
retrieving revision 1.7
diff -r1.7 rgb2rgb.c
28a29
> static void gst_colorspace_bgr565_to_rgb32(GstColorSpaceConverter *space, unsigned char *src, unsigned char *dest); 
95a97,107
>       break;
>     case GST_COLORSPACE_BGR565:
>       space->insize = space->width*space->height*2;
>       switch(dest) {
>         case GST_COLORSPACE_RGB32 :
> 	  space->outsize = space->width*space->height*4;
> 	  return gst_colorspace_bgr565_to_rgb32;
>         default:
> 	  break;
>       };
>       break;
185a198,221
> 
> static void gst_colorspace_bgr565_to_rgb32(GstColorSpaceConverter *space, unsigned char *src, unsigned char *dest)
> {
>   gint size;
>   guint16 *srcptr = (guint16 *)src;
>   guint32 *destptr = (guint32 *)dest;
>   size = space->outsize >> 2;
>   
>   g_assert (src != dest); /* todo */
>   while (size--) {
>     /* in detail I do this 
>     red=(unsigned char)(*srcptr)&0x1f;
>     green=(unsigned char)(((*srcptr)&0x07E0)>>5);
>     blue=(unsigned char)(((*srcptr)&0xf800)>>11);
>     *destptr++ = (((guint32)blue) << 3) 
>       | (((guint32)green) << (8+2)) 
>       | (((guint32)red) << (16+3)); 
>     */
>     *destptr++ = (((*srcptr)&0xf800)>>8)|(((*srcptr)&0x07E0)<<5)|(((*srcptr)&0x1f)<<19);
>     srcptr++;
>   }
> }
> 
> 


More information about the gstreamer-devel mailing list