diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2001-11-04 19:50:29 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2001-11-04 19:50:29 +0000 |
commit | 9ce6584e496b5a4a33edaefe32921d6eb0e56f37 (patch) | |
tree | dd459e8cd816b54d38da6a23f55eb6d344be8f88 | |
parent | fcfbc150aa65b3a575186cb2e721dd6008d74c12 (diff) | |
download | ffmpeg-9ce6584e496b5a4a33edaefe32921d6eb0e56f37.tar.gz |
palette to bgr24
Originally committed as revision 2698 to svn://svn.mplayerhq.hu/mplayer/trunk/postproc
-rw-r--r-- | postproc/rgb2rgb.c | 23 | ||||
-rw-r--r-- | postproc/rgb2rgb.h | 2 | ||||
-rw-r--r-- | postproc/rgb2rgb_template.c | 23 |
3 files changed, 45 insertions, 3 deletions
diff --git a/postproc/rgb2rgb.c b/postproc/rgb2rgb.c index f83d565dbb..923837a134 100644 --- a/postproc/rgb2rgb.c +++ b/postproc/rgb2rgb.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] ]; -}
\ No newline at end of file +} diff --git a/postproc/rgb2rgb.h b/postproc/rgb2rgb.h index db6aff5f80..0f7c8141a0 100644 --- a/postproc/rgb2rgb.h +++ b/postproc/rgb2rgb.h @@ -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 diff --git a/postproc/rgb2rgb_template.c b/postproc/rgb2rgb_template.c index f83d565dbb..923837a134 100644 --- a/postproc/rgb2rgb_template.c +++ b/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] ]; -}
\ No newline at end of file +} |