
unsigned short *color32to15(unsigned long *cmapb)
{
    unsigned short i;
    unsigned short *cmapshort = (unsigned short *)malloc(256*sizeof(unsigned short));
    
    //00RRGGBB
    
    for(i=0;i<256;i++)
    {
        unsigned char r = (cmapb[i] >> 16) /8;
        unsigned char g = (cmapb[i] >> 8)  /8;
        unsigned char b = (cmapb[i] >> 0)  /8;
        
        cmapshort[i] = r | (g<<5) | (b<<10);
    }
    
    return(cmapshort);
}
