1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

palette to bgr24

Originally committed as revision 2698 to svn://svn.mplayerhq.hu/mplayer/trunk/postproc
This commit is contained in:
Michael Niedermayer 2001-11-04 19:50:29 +00:00
parent fcfbc150aa
commit 9ce6584e49
3 changed files with 45 additions and 3 deletions

View File

@ -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] ];
}
}

View File

@ -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

View File

@ -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] ];
}
}