Commit bbacf4e0 authored by alex's avatar alex

fixed palette8to{rgb24,bgr24,rgb32,bgr32}


git-svn-id: file:///var/local/repositories/mplayer/trunk/postproc@7335 b3059339-0415-0410-9bf9-f77b7e298cf2
parent 5cf61a6d
...@@ -265,32 +265,36 @@ void rgb16to15(const uint8_t *src,uint8_t *dst,unsigned src_size) ...@@ -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) void palette8torgb32(const uint8_t *src, uint8_t *dst, unsigned num_pixels, const uint8_t *palette)
{ {
unsigned i; unsigned i;
/*
for(i=0; i<num_pixels; i++) for(i=0; i<num_pixels; i++)
((unsigned *)dst)[i] = ((unsigned *)palette)[ src[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++) for(i=0; i<num_pixels; i++)
{ {
//FIXME slow? //FIXME slow?
dst[0]= palette[ src[i]*4+3 ]; dst[0]= palette[ src[i]*4+2 ];
dst[1]= palette[ src[i]*4+2 ]; dst[1]= palette[ src[i]*4+1 ];
dst[2]= palette[ src[i]*4+1 ]; dst[2]= palette[ src[i]*4+0 ];
dst[3]= palette[ src[i]*4+0 ]; // dst[3]= 0; /* do we need this cleansing? */
dst+= 4; dst+= 4;
} }
} }
#else
void palette8tobgr32(const uint8_t *src, uint8_t *dst, unsigned num_pixels, const uint8_t *palette) void palette8tobgr32(const uint8_t *src, uint8_t *dst, unsigned num_pixels, const uint8_t *palette)
{ {
unsigned i; unsigned i;
for(i=0; i<num_pixels; 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 * Pallete is assumed to contain bgr32
...@@ -306,9 +310,9 @@ void palette8torgb24(const uint8_t *src, uint8_t *dst, unsigned num_pixels, cons ...@@ -306,9 +310,9 @@ void palette8torgb24(const uint8_t *src, uint8_t *dst, unsigned num_pixels, cons
for(i=0; i<num_pixels; i++) for(i=0; i<num_pixels; i++)
{ {
//FIXME slow? //FIXME slow?
dst[0]= palette[ src[i]*4+0 ]; dst[0]= palette[ src[i]*4+2 ];
dst[1]= palette[ src[i]*4+1 ]; dst[1]= palette[ src[i]*4+1 ];
dst[2]= palette[ src[i]*4+2 ]; dst[2]= palette[ src[i]*4+0 ];
dst+= 3; dst+= 3;
} }
} }
...@@ -324,9 +328,9 @@ void palette8tobgr24(const uint8_t *src, uint8_t *dst, unsigned num_pixels, cons ...@@ -324,9 +328,9 @@ void palette8tobgr24(const uint8_t *src, uint8_t *dst, unsigned num_pixels, cons
for(i=0; i<num_pixels; i++) for(i=0; i<num_pixels; i++)
{ {
//FIXME slow? //FIXME slow?
dst[0]= palette[ src[i]*4+3 ]; dst[0]= palette[ src[i]*4+0 ];
dst[1]= palette[ src[i]*4+2 ]; dst[1]= palette[ src[i]*4+1 ];
dst[2]= palette[ src[i]*4+1 ]; dst[2]= palette[ src[i]*4+2 ];
dst+= 3; dst+= 3;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment