palette to bgr24

Originally committed as revision 2698 to svn://svn.mplayerhq.hu/mplayer/trunk/postproc
pull/126/head
Michael Niedermayer 24 years ago
parent fcfbc150aa
commit 9ce6584e49
  1. 23
      postproc/rgb2rgb.c
  2. 2
      postproc/rgb2rgb.h
  3. 23
      postproc/rgb2rgb_template.c

@ -181,6 +181,27 @@ void palette8torgb32(uint8_t *src, uint8_t *dst, int src_size, uint8_t *palette)
((uint32_t *)dst)[i] = ((uint32_t *)palette)[ src[i] ];
}
/**
* Pallete is assumed to contain bgr32
*/
void palette8torgb24(uint8_t *src, uint8_t *dst, int src_size, uint8_t *palette)
{
int i;
/*
writes 1 byte o much and might cause alignment issues on some architectures?
for(i=0; i<src_size; i++)
((uint32_t *)(&dst[i*3])) = ((uint32_t *)palette)[ src[i] ];
*/
for(i=0; i<src_size; i++)
{
//FIXME slow?
dst[0]= palette[ src[i]*4+0 ];
dst[1]= palette[ src[i]*4+1 ];
dst[2]= palette[ src[i]*4+2 ];
dst+= 3;
}
}
void rgb32to16(uint8_t *src, uint8_t *dst, int src_size)
{
int i;
@ -226,4 +247,4 @@ void palette8torgb15(uint8_t *src, uint8_t *dst, int src_size, uint8_t *palette)
int i;
for(i=0; i<src_size; i++)
((uint16_t *)dst)[i] = ((uint16_t *)palette)[ src[i] ];
}
}

@ -16,6 +16,6 @@ void rgb32to15(uint8_t *src, uint8_t *dst, int src_size);
void palette8torgb32(uint8_t *src, uint8_t *dst, int src_size, uint8_t *palette);
void palette8torgb16(uint8_t *src, uint8_t *dst, int src_size, uint8_t *palette);
void palette8torgb15(uint8_t *src, uint8_t *dst, int src_size, uint8_t *palette);
void palette8torgb24(uint8_t *src, uint8_t *dst, int src_size, uint8_t *palette);
#endif

@ -181,6 +181,27 @@ void palette8torgb32(uint8_t *src, uint8_t *dst, int src_size, uint8_t *palette)
((uint32_t *)dst)[i] = ((uint32_t *)palette)[ src[i] ];
}
/**
* Pallete is assumed to contain bgr32
*/
void palette8torgb24(uint8_t *src, uint8_t *dst, int src_size, uint8_t *palette)
{
int i;
/*
writes 1 byte o much and might cause alignment issues on some architectures?
for(i=0; i<src_size; i++)
((uint32_t *)(&dst[i*3])) = ((uint32_t *)palette)[ src[i] ];
*/
for(i=0; i<src_size; i++)
{
//FIXME slow?
dst[0]= palette[ src[i]*4+0 ];
dst[1]= palette[ src[i]*4+1 ];
dst[2]= palette[ src[i]*4+2 ];
dst+= 3;
}
}
void rgb32to16(uint8_t *src, uint8_t *dst, int src_size)
{
int i;
@ -226,4 +247,4 @@ void palette8torgb15(uint8_t *src, uint8_t *dst, int src_size, uint8_t *palette)
int i;
for(i=0; i<src_size; i++)
((uint16_t *)dst)[i] = ((uint16_t *)palette)[ src[i] ];
}
}

Loading…
Cancel
Save