summaryrefslogtreecommitdiffstats
path: root/postproc
diff options
context:
space:
mode:
authornick <nick@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-10-28 11:48:50 +0000
committernick <nick@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-10-28 11:48:50 +0000
commit6beedb448b6e4775cf4f7dcace3c8d7078891ef4 (patch)
treea5ea7701913d86d800d5bb44fe540ee6c1ae0f58 /postproc
parent0049dc0956687e9639a47f4fb110d23f1332a779 (diff)
downloadmpv-6beedb448b6e4775cf4f7dcace3c8d7078891ef4.tar.bz2
mpv-6beedb448b6e4775cf4f7dcace3c8d7078891ef4.tar.xz
mmx optimized 24to32
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@2511 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'postproc')
-rw-r--r--postproc/rgb2rgb.c30
-rw-r--r--postproc/rgb2rgb_template.c30
2 files changed, 56 insertions, 4 deletions
diff --git a/postproc/rgb2rgb.c b/postproc/rgb2rgb.c
index 5c85f1043a..dc5f062f3e 100644
--- a/postproc/rgb2rgb.c
+++ b/postproc/rgb2rgb.c
@@ -3,14 +3,39 @@
#include "rgb2rgb.h"
#include "mmx.h"
-/* TODO: MMX optimization */
-
void rgb24to32(uint8_t *src,uint8_t *dst,uint32_t src_size)
{
uint8_t *dest = dst;
uint8_t *s = src;
uint8_t *end;
+#ifdef HAVE_MMX
+ const uint64_t mask32 = 0x00FFFFFF00FFFFFFULL;
+ uint8_t *mm_end;
+#endif
end = s + src_size;
+#ifdef HAVE_MMX
+ mm_end = (uint8_t*)((((unsigned long)end)/16)*16);
+ __asm __volatile("movq %0, %%mm7"::"m"(mask32):"memory");
+ while(s < mm_end)
+ {
+ __asm __volatile(
+ "movd %1, %%mm0\n\t"
+ "movd 3%1, %%mm1\n\t"
+ "movd 6%1, %%mm2\n\t"
+ "movd 9%1, %%mm3\n\t"
+ "punpckldq %%mm1, %%mm0\n\t"
+ "punpckldq %%mm3, %%mm2\n\t"
+ "pand %%mm7, %%mm0\n\t"
+ "pand %%mm7, %%mm2\n\t"
+ "movq %%mm0, %0\n\t"
+ "movq %%mm2, 8%0"
+ :"=m"(*dest)
+ :"m"(*s)
+ :"memory");
+ dest += 16;
+ s += 12;
+ }
+#endif
while(s < end)
{
*dest++ = *s++;
@@ -20,6 +45,7 @@ void rgb24to32(uint8_t *src,uint8_t *dst,uint32_t src_size)
}
}
+/* TODO: MMX optimization */
void rgb32to24(uint8_t *src,uint8_t *dst,uint32_t src_size)
{
uint8_t *dest = dst;
diff --git a/postproc/rgb2rgb_template.c b/postproc/rgb2rgb_template.c
index 5c85f1043a..dc5f062f3e 100644
--- a/postproc/rgb2rgb_template.c
+++ b/postproc/rgb2rgb_template.c
@@ -3,14 +3,39 @@
#include "rgb2rgb.h"
#include "mmx.h"
-/* TODO: MMX optimization */
-
void rgb24to32(uint8_t *src,uint8_t *dst,uint32_t src_size)
{
uint8_t *dest = dst;
uint8_t *s = src;
uint8_t *end;
+#ifdef HAVE_MMX
+ const uint64_t mask32 = 0x00FFFFFF00FFFFFFULL;
+ uint8_t *mm_end;
+#endif
end = s + src_size;
+#ifdef HAVE_MMX
+ mm_end = (uint8_t*)((((unsigned long)end)/16)*16);
+ __asm __volatile("movq %0, %%mm7"::"m"(mask32):"memory");
+ while(s < mm_end)
+ {
+ __asm __volatile(
+ "movd %1, %%mm0\n\t"
+ "movd 3%1, %%mm1\n\t"
+ "movd 6%1, %%mm2\n\t"
+ "movd 9%1, %%mm3\n\t"
+ "punpckldq %%mm1, %%mm0\n\t"
+ "punpckldq %%mm3, %%mm2\n\t"
+ "pand %%mm7, %%mm0\n\t"
+ "pand %%mm7, %%mm2\n\t"
+ "movq %%mm0, %0\n\t"
+ "movq %%mm2, 8%0"
+ :"=m"(*dest)
+ :"m"(*s)
+ :"memory");
+ dest += 16;
+ s += 12;
+ }
+#endif
while(s < end)
{
*dest++ = *s++;
@@ -20,6 +45,7 @@ void rgb24to32(uint8_t *src,uint8_t *dst,uint32_t src_size)
}
}
+/* TODO: MMX optimization */
void rgb32to24(uint8_t *src,uint8_t *dst,uint32_t src_size)
{
uint8_t *dest = dst;