]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/fft.c
add assert to clarify that we know what we are doing
[ffmpeg] / libavcodec / fft.c
index f7fd4de6ab99c97e4bc798247ce6c6552f0ec285..1306abd69b82ae6c7519a4518e4ae5548ac8e511 100644 (file)
@@ -14,7 +14,7 @@
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 /**
@@ -57,12 +57,12 @@ int ff_fft_init(FFTContext *s, int nbits, int inverse)
     s->exptab1 = NULL;
 
     /* compute constant table for HAVE_SSE version */
-#if (defined(HAVE_MMX) && defined(HAVE_BUILTIN_VECTOR)) || defined(HAVE_ALTIVEC)
+#if (defined(HAVE_MMX) && (defined(HAVE_BUILTIN_VECTOR) || defined(HAVE_MM3DNOW))) || defined(HAVE_ALTIVEC)
     {
         int has_vectors = 0;
 
 #if defined(HAVE_MMX)
-        has_vectors = mm_support() & MM_SSE;
+        has_vectors = mm_support() & (MM_3DNOW | MM_3DNOWEXT | MM_SSE | MM_SSE2);
 #endif
 #if defined(HAVE_ALTIVEC) && !defined(ALTIVEC_USE_REFERENCE_C_CODE)
         has_vectors = mm_support() & MM_ALTIVEC;
@@ -94,8 +94,24 @@ int ff_fft_init(FFTContext *s, int nbits, int inverse)
             } while (nblocks != 0);
             av_freep(&s->exptab);
 #if defined(HAVE_MMX)
-            s->fft_calc = ff_fft_calc_sse;
-#else
+#ifdef HAVE_MM3DNOW
+            if (has_vectors & MM_3DNOWEXT)
+                /* 3DNowEx for Athlon(XP) */
+                s->fft_calc = ff_fft_calc_3dn2;
+            else if (has_vectors & MM_3DNOW)
+                /* 3DNow! for K6-2/3 */
+                s->fft_calc = ff_fft_calc_3dn;
+#endif
+#ifdef HAVE_BUILTIN_VECTOR
+            if (has_vectors & MM_SSE2)
+                /* SSE for P4/K8 */
+                s->fft_calc = ff_fft_calc_sse;
+            else if ((has_vectors & MM_SSE) &&
+                     s->fft_calc == ff_fft_calc_c)
+                /* SSE for P3 */
+                s->fft_calc = ff_fft_calc_sse;
+#endif
+#else /* HAVE_MMX */
             s->fft_calc = ff_fft_calc_altivec;
 #endif
         }
@@ -149,8 +165,8 @@ int ff_fft_init(FFTContext *s, int nbits, int inverse)
 void ff_fft_calc_c(FFTContext *s, FFTComplex *z)
 {
     int ln = s->nbits;
-    int        j, np, np2;
-    int        nblocks, nloops;
+    int j, np, np2;
+    int nblocks, nloops;
     register FFTComplex *p, *q;
     FFTComplex *exptab = s->exptab;
     int l;