diff options
author | michael <michael@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2001-11-04 19:50:29 +0000 |
---|---|---|
committer | michael <michael@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2001-11-04 19:50:29 +0000 |
commit | 57bfcdc19ded565836dbf06f24bef7f0bbd32fe1 (patch) | |
tree | 64e5bbda48dae2f2890e3dfad256cf80daf7dabd | |
parent | 533e296eeee817f20cddd5688204c6992c3b2333 (diff) | |
download | mpv-57bfcdc19ded565836dbf06f24bef7f0bbd32fe1.tar.bz2 mpv-57bfcdc19ded565836dbf06f24bef7f0bbd32fe1.tar.xz |
palette to bgr24
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@2698 b3059339-0415-0410-9bf9-f77b7e298cf2
-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 +} |