diff options
author | Vitor Sessak <vitor1001@gmail.com> | 2008-10-23 19:13:11 +0000 |
---|---|---|
committer | Vitor Sessak <vitor1001@gmail.com> | 2008-10-23 19:13:11 +0000 |
commit | 522ce9578699c78782e6e6d8fc25808c48577b39 (patch) | |
tree | 89183b7d5d31ae1ef2371d0660e11f3109af0382 /libswscale/rgb2rgb.c | |
parent | b774fdd7a4cf549388013528ce08d4bd490c9d09 (diff) | |
download | ffmpeg-522ce9578699c78782e6e6d8fc25808c48577b39.tar.gz |
Fix broken palette8to*.
Originally committed as revision 27817 to svn://svn.mplayerhq.hu/mplayer/trunk/libswscale
Diffstat (limited to 'libswscale/rgb2rgb.c')
-rw-r--r-- | libswscale/rgb2rgb.c | 71 |
1 files changed, 5 insertions, 66 deletions
diff --git a/libswscale/rgb2rgb.c b/libswscale/rgb2rgb.c index 13388ac85a..b55141264a 100644 --- a/libswscale/rgb2rgb.c +++ b/libswscale/rgb2rgb.c @@ -213,84 +213,23 @@ void sws_rgb2rgb_init(int flags){ } /** - * Palette is assumed to contain BGR32. + * Convert the palette to the same packet 32-bit format as the palette */ -void palette8torgb32(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette) +void palette8topacked32(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette) { long i; -/* - for (i=0; i<num_pixels; i++) - ((unsigned *)dst)[i] = ((unsigned *)palette)[src[i]]; -*/ - - for (i=0; i<num_pixels; i++) - { - #ifdef WORDS_BIGENDIAN - dst[3]= palette[src[i]*4+2]; - dst[2]= palette[src[i]*4+1]; - dst[1]= palette[src[i]*4+0]; - #else - //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? */ - #endif - dst+= 4; - } -} - -void palette8tobgr32(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette) -{ - long i; for (i=0; i<num_pixels; i++) - { - #ifdef WORDS_BIGENDIAN - dst[3]= palette[src[i]*4+0]; - dst[2]= palette[src[i]*4+1]; - dst[1]= palette[src[i]*4+2]; - #else - //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? */ - #endif - - dst+= 4; - } + ((uint32_t *) dst)[i] = ((const uint32_t *) palette)[src[i]]; } /** - * Palette is assumed to contain BGR32. + * Palette format: ABCD -> dst format: ABC */ -void palette8torgb24(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette) +void palette8topacked24(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette) { long i; -/* - Writes 1 byte too much and might cause alignment issues on some architectures? - for (i=0; i<num_pixels; i++) - ((unsigned *)(&dst[i*3])) = ((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; - } -} -void palette8tobgr24(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette) -{ - long i; -/* - Writes 1 byte too much and might cause alignment issues on some architectures? - for (i=0; i<num_pixels; i++) - ((unsigned *)(&dst[i*3])) = ((unsigned *)palette)[src[i]]; -*/ for (i=0; i<num_pixels; i++) { //FIXME slow? |