summaryrefslogtreecommitdiffstats
path: root/postproc
diff options
context:
space:
mode:
authormichael <michael@b3059339-0415-0410-9bf9-f77b7e298cf2>2003-02-15 13:04:17 +0000
committermichael <michael@b3059339-0415-0410-9bf9-f77b7e298cf2>2003-02-15 13:04:17 +0000
commitaf06ee3a7c6d612943c71b5f7a6e61ec1f152fe9 (patch)
tree86f6d430b309d813730997e9735d3d6000515aef /postproc
parentb8d4b4e801e8369a72c2903e722d9bf2429bdfca (diff)
downloadmpv-af06ee3a7c6d612943c71b5f7a6e61ec1f152fe9.tar.bz2
mpv-af06ee3a7c6d612943c71b5f7a6e61ec1f152fe9.tar.xz
simpler & faster
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@9431 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'postproc')
-rw-r--r--postproc/rgb2rgb_template.c44
1 files changed, 15 insertions, 29 deletions
diff --git a/postproc/rgb2rgb_template.c b/postproc/rgb2rgb_template.c
index eb8137045a..e299b0c12e 100644
--- a/postproc/rgb2rgb_template.c
+++ b/postproc/rgb2rgb_template.c
@@ -364,20 +364,9 @@ static inline void RENAME(rgb32to16)(const uint8_t *src, uint8_t *dst, unsigned
#endif
while(s < end)
{
-#ifndef WORDS_BIGENDIAN
- const int b= *s++;
- const int g= *s++;
- const int r= *s++;
-#else
- const int a= *s++; /*skip*/
- const int r= *s++;
- const int g= *s++;
- const int b= *s++;
-#endif
- *d++ = (b>>3) | ((g&0xFC)<<3) | ((r&0xF8)<<8);
-#ifndef WORDS_BIGENDIAN
- s++;
-#endif
+ const int src= *((uint32_t*)s)++;
+ *d++ = ((src&0xFF)>>3) + ((src&0xFC00)>>5) + ((src&0xF80000)>>8);
+// *d++ = ((src>>3)&0x1F) + ((src>>5)&0x7E0) + ((src>>8)&0xF800);
}
}
@@ -437,11 +426,8 @@ static inline void RENAME(rgb32tobgr16)(const uint8_t *src, uint8_t *dst, unsign
#endif
while(s < end)
{
- const int r= *s++;
- const int g= *s++;
- const int b= *s++;
- *d++ = (b>>3) | ((g&0xFC)<<3) | ((r&0xF8)<<8);
- s++;
+ const int src= *((uint32_t*)s)++;
+ *d++ = ((src&0xF8)<<8) + ((src&0xFC00)>>5) + ((src&0xF80000)>>19);
}
}
@@ -501,11 +487,8 @@ static inline void RENAME(rgb32to15)(const uint8_t *src, uint8_t *dst, unsigned
#endif
while(s < end)
{
- const int b= *s++;
- const int g= *s++;
- const int r= *s++;
- *d++ = (b>>3) | ((g&0xF8)<<2) | ((r&0xF8)<<7);
- s++;
+ const int src= *((uint32_t*)s)++;
+ *d++ = ((src&0xFF)>>3) + ((src&0xF800)>>6) + ((src&0xF80000)>>9);
}
}
@@ -565,11 +548,8 @@ static inline void RENAME(rgb32tobgr15)(const uint8_t *src, uint8_t *dst, unsign
#endif
while(s < end)
{
- const int r= *s++;
- const int g= *s++;
- const int b= *s++;
- *d++ = (b>>3) | ((g&0xF8)<<2) | ((r&0xF8)<<7);
- s++;
+ const int src= *((uint32_t*)s)++;
+ *d++ = ((src&0xF8)<<7) + ((src&0xF800)>>6) + ((src&0xF80000)>>19);
}
}
@@ -1187,12 +1167,18 @@ static inline void RENAME(rgb15to32)(const uint8_t *src, uint8_t *dst, unsigned
#endif
while(s < end)
{
+#if 0 //slightly slower on athlon
+ int bgr= *s++;
+ *((uint32_t*)d)++ = ((bgr&0x1F)<<3) + ((bgr&0x3E0)<<6) + ((bgr&0x7C00)<<9);
+#else
+//FIXME this is very likely wrong for bigendian (and the following converters too)
register uint16_t bgr;
bgr = *s++;
*d++ = (bgr&0x1F)<<3;
*d++ = (bgr&0x3E0)>>2;
*d++ = (bgr&0x7C00)>>7;
*d++ = 0;
+#endif
}
}