diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2002-09-09 16:18:47 +0000 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2002-09-09 16:18:47 +0000 |
commit | 9780c7ffa3e6c70a3cb2d74463041e197530e711 (patch) | |
tree | 5bdf0ef4506f5a0d8c9dc183d03e978c2cf21bea | |
parent | 0eaec10550bd9a0682db9f7920ed0d86f1450f4b (diff) | |
download | ffmpeg-9780c7ffa3e6c70a3cb2d74463041e197530e711.tar.gz |
fixed palette8to{rgb24,bgr24,rgb32,bgr32}
Originally committed as revision 7335 to svn://svn.mplayerhq.hu/mplayer/trunk/postproc
-rw-r--r-- | postproc/rgb2rgb.c | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/postproc/rgb2rgb.c b/postproc/rgb2rgb.c index 4612f57399..fd50d73a9e 100644 --- a/postproc/rgb2rgb.c +++ b/postproc/rgb2rgb.c @@ -265,32 +265,36 @@ void rgb16to15(const uint8_t *src,uint8_t *dst,unsigned src_size) void palette8torgb32(const uint8_t *src, uint8_t *dst, unsigned num_pixels, const uint8_t *palette) { unsigned i; + +/* for(i=0; i<num_pixels; i++) ((unsigned *)dst)[i] = ((unsigned *)palette)[ src[i] ]; -} +*/ -#if 0 -void palette8tobgr32(const uint8_t *src, uint8_t *dst, unsigned num_pixels, const uint8_t *palette) -{ - unsigned i; for(i=0; i<num_pixels; i++) { //FIXME slow? - dst[0]= palette[ src[i]*4+3 ]; - dst[1]= palette[ src[i]*4+2 ]; - dst[2]= palette[ src[i]*4+1 ]; - dst[3]= palette[ src[i]*4+0 ]; + dst[0]= palette[ src[i]*4+2 ]; + dst[1]= palette[ src[i]*4+1 ]; + dst[2]= palette[ src[i]*4+0 ]; +// dst[3]= 0; /* do we need this cleansing? */ dst+= 4; } } -#else + void palette8tobgr32(const uint8_t *src, uint8_t *dst, unsigned num_pixels, const uint8_t *palette) { unsigned i; for(i=0; i<num_pixels; i++) - ((unsigned *)dst)[i] = bswap_32(((unsigned *)palette)[ src[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]= 0; /* do we need this cleansing? */ + dst+= 4; + } } -#endif /** * Pallete is assumed to contain bgr32 @@ -306,9 +310,9 @@ void palette8torgb24(const uint8_t *src, uint8_t *dst, unsigned num_pixels, cons for(i=0; i<num_pixels; i++) { //FIXME slow? - dst[0]= palette[ src[i]*4+0 ]; + dst[0]= palette[ src[i]*4+2 ]; dst[1]= palette[ src[i]*4+1 ]; - dst[2]= palette[ src[i]*4+2 ]; + dst[2]= palette[ src[i]*4+0 ]; dst+= 3; } } @@ -324,9 +328,9 @@ void palette8tobgr24(const uint8_t *src, uint8_t *dst, unsigned num_pixels, cons for(i=0; i<num_pixels; i++) { //FIXME slow? - dst[0]= palette[ src[i]*4+3 ]; - dst[1]= palette[ src[i]*4+2 ]; - dst[2]= palette[ src[i]*4+1 ]; + dst[0]= palette[ src[i]*4+0 ]; + dst[1]= palette[ src[i]*4+1 ]; + dst[2]= palette[ src[i]*4+2 ]; dst+= 3; } } |