Mercurial > mplayer.hg
changeset 7334:d5bd28edf486
fixed palette8to{rgb24,bgr24,rgb32,bgr32}
author | alex |
---|---|
date | Mon, 09 Sep 2002 16:18:47 +0000 |
parents | e7ddd1923b67 |
children | 8db0cba91b6c |
files | postproc/rgb2rgb.c |
diffstat | 1 files changed, 22 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/postproc/rgb2rgb.c Mon Sep 09 16:13:51 2002 +0000 +++ b/postproc/rgb2rgb.c Mon Sep 09 16:18:47 2002 +0000 @@ -265,32 +265,36 @@ 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] ]; +*/ + + for(i=0; i<num_pixels; i++) + { + //FIXME slow? + 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; + } } -#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+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; } } -#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] ]); -} -#endif /** * Pallete is assumed to contain bgr32 @@ -306,9 +310,9 @@ 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 @@ 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; } }