[Ffmpeg-cvslog] CVS: ffmpeg/libavcodec/i386 fft_sse.c,1.6,1.7

Guillaume Poirier CVS gpoirier
Sun Mar 5 21:25:21 CET 2006


Update of /cvsroot/ffmpeg/ffmpeg/libavcodec/i386
In directory mail:/var2/tmp/cvs-serv16059/i386

Modified Files:
	fft_sse.c 
Log Message:
use xorps instead of mulps to toggle the sign of a float, as suggested by Software Optimization Guide for AMD64 Processors.
Patch by Zuxy Meng < zuxy POIS meng AH  gmail POIS com > OKed by Michael
Original thread:
Date: Mar 5, 2006 8:15 PM
Subject: [Ffmpeg-devel] [PATCH] Little optimization to fft_sse.c


Index: fft_sse.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/i386/fft_sse.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- fft_sse.c	12 Jan 2006 22:43:17 -0000	1.6
+++ fft_sse.c	5 Mar 2006 20:25:18 -0000	1.7
@@ -23,14 +23,14 @@
 
 #include <xmmintrin.h>
 
-static const float p1p1p1m1[4] __attribute__((aligned(16))) =
-    { 1.0, 1.0, 1.0, -1.0 };
+static const int p1p1p1m1[4] __attribute__((aligned(16))) =
+    { 0, 0, 0, 1 << 31 };
 
-static const float p1p1m1p1[4] __attribute__((aligned(16))) =
-    { 1.0, 1.0, -1.0, 1.0 };
+static const int p1p1m1p1[4] __attribute__((aligned(16))) =
+    { 0, 0, 1 << 31, 0 };
 
-static const float p1p1m1m1[4] __attribute__((aligned(16))) =
-    { 1.0, 1.0, -1.0, -1.0 };
+static const int p1p1m1m1[4] __attribute__((aligned(16))) =
+    { 0, 0, 1 << 31, 1 << 31 };
 
 #if 0
 static void print_v4sf(const char *str, __m128 a)
@@ -58,7 +58,6 @@
 
         r = (__m128 *)&z[0];
         c1 = *(__m128 *)p1p1m1m1;
-        c2 = *(__m128 *)p1p1p1m1;
         if (s->inverse)
             c2 = *(__m128 *)p1p1m1p1;
         else
@@ -68,19 +67,20 @@
         do {
             a = r[0];
             b = _mm_shuffle_ps(a, a, _MM_SHUFFLE(1, 0, 3, 2));
-            a = _mm_mul_ps(a, c1);
+            a = _mm_xor_ps(a, c1);
             /* do the pass 0 butterfly */
             a = _mm_add_ps(a, b);
 
             a1 = r[1];
             b = _mm_shuffle_ps(a1, a1, _MM_SHUFFLE(1, 0, 3, 2));
-            a1 = _mm_mul_ps(a1, c1);
+            a1 = _mm_xor_ps(a1, c1);
             /* do the pass 0 butterfly */
             b = _mm_add_ps(a1, b);
 
             /* multiply third by -i */
+            /* by toggling the sign bit */
             b = _mm_shuffle_ps(b, b, _MM_SHUFFLE(2, 3, 1, 0));
-            b = _mm_mul_ps(b, c2);
+            b = _mm_xor_ps(b, c2);
 
             /* do the pass 1 butterfly */
             r[0] = _mm_add_ps(a, b);





More information about the ffmpeg-cvslog mailing list