summaryrefslogtreecommitdiffstats
path: root/postproc/rgb2rgb.c
diff options
context:
space:
mode:
authormichael <michael@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-11-04 19:50:29 +0000
committermichael <michael@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-11-04 19:50:29 +0000
commit57bfcdc19ded565836dbf06f24bef7f0bbd32fe1 (patch)
tree64e5bbda48dae2f2890e3dfad256cf80daf7dabd /postproc/rgb2rgb.c
parent533e296eeee817f20cddd5688204c6992c3b2333 (diff)
downloadmpv-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
Diffstat (limited to 'postproc/rgb2rgb.c')
-rw-r--r--postproc/rgb2rgb.c23
1 files changed, 22 insertions, 1 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
+}