Merge remote-tracking branch 'qatar/master'
[ffmpeg.git] / libavcodec / x86 / mpegvideo_mmx.c
index 3556e1c..6739505 100644 (file)
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include "libavutil/cpu.h"
 #include "libavutil/x86_cpu.h"
 #include "libavcodec/avcodec.h"
 #include "libavcodec/dsputil.h"
 #include "libavcodec/mpegvideo.h"
 #include "dsputil_mmx.h"
 
-extern uint16_t inv_zigzag_direct16[64];
+extern uint16_t ff_inv_zigzag_direct16[64];
 
 
 static void dct_unquantize_h263_intra_mmx(MpegEncContext *s,
@@ -65,7 +66,7 @@ __asm__ volatile(
                 "packssdw %%mm5, %%mm5          \n\t"
                 "psubw %%mm5, %%mm7             \n\t"
                 "pxor %%mm4, %%mm4              \n\t"
-                ASMALIGN(4)
+                ".p2align 4                     \n\t"
                 "1:                             \n\t"
                 "movq (%0, %3), %%mm0           \n\t"
                 "movq 8(%0, %3), %%mm1          \n\t"
@@ -128,7 +129,7 @@ __asm__ volatile(
                 "packssdw %%mm5, %%mm5          \n\t"
                 "psubw %%mm5, %%mm7             \n\t"
                 "pxor %%mm4, %%mm4              \n\t"
-                ASMALIGN(4)
+                ".p2align 4                     \n\t"
                 "1:                             \n\t"
                 "movq (%0, %3), %%mm0           \n\t"
                 "movq 8(%0, %3), %%mm1          \n\t"
@@ -221,7 +222,7 @@ __asm__ volatile(
                 "packssdw %%mm6, %%mm6          \n\t"
                 "packssdw %%mm6, %%mm6          \n\t"
                 "mov %3, %%"REG_a"              \n\t"
-                ASMALIGN(4)
+                ".p2align 4                     \n\t"
                 "1:                             \n\t"
                 "movq (%0, %%"REG_a"), %%mm0    \n\t"
                 "movq 8(%0, %%"REG_a"), %%mm1   \n\t"
@@ -284,7 +285,7 @@ __asm__ volatile(
                 "packssdw %%mm6, %%mm6          \n\t"
                 "packssdw %%mm6, %%mm6          \n\t"
                 "mov %3, %%"REG_a"              \n\t"
-                ASMALIGN(4)
+                ".p2align 4                     \n\t"
                 "1:                             \n\t"
                 "movq (%0, %%"REG_a"), %%mm0    \n\t"
                 "movq 8(%0, %%"REG_a"), %%mm1   \n\t"
@@ -356,7 +357,7 @@ __asm__ volatile(
                 "packssdw %%mm6, %%mm6          \n\t"
                 "packssdw %%mm6, %%mm6          \n\t"
                 "mov %3, %%"REG_a"              \n\t"
-                ASMALIGN(4)
+                ".p2align 4                     \n\t"
                 "1:                             \n\t"
                 "movq (%0, %%"REG_a"), %%mm0    \n\t"
                 "movq 8(%0, %%"REG_a"), %%mm1   \n\t"
@@ -417,7 +418,7 @@ __asm__ volatile(
                 "packssdw %%mm6, %%mm6          \n\t"
                 "packssdw %%mm6, %%mm6          \n\t"
                 "mov %3, %%"REG_a"              \n\t"
-                ASMALIGN(4)
+                ".p2align 4                     \n\t"
                 "1:                             \n\t"
                 "movq (%0, %%"REG_a"), %%mm0    \n\t"
                 "movq 8(%0, %%"REG_a"), %%mm1   \n\t"
@@ -580,6 +581,8 @@ static void  denoise_dct_sse2(MpegEncContext *s, DCTELEM *block){
             " jb 1b                             \n\t"
         : "+r" (block), "+r" (sum), "+r" (offset)
         : "r"(block+64)
+          XMM_CLOBBERS_ONLY("%xmm0", "%xmm1", "%xmm2", "%xmm3",
+                            "%xmm4", "%xmm5", "%xmm6", "%xmm7")
     );
 }
 
@@ -623,11 +626,11 @@ static void  denoise_dct_sse2(MpegEncContext *s, DCTELEM *block){
 #include "mpegvideo_mmx_template.c"
 #endif
 
-void MPV_common_init_mmx(MpegEncContext *s)
+void ff_MPV_common_init_mmx(MpegEncContext *s)
 {
-    int mm_flags = mm_support();
+    int mm_flags = av_get_cpu_flags();
 
-    if (mm_flags & FF_MM_MMX) {
+    if (mm_flags & AV_CPU_FLAG_MMX) {
         const int dct_algo = s->avctx->dct_algo;
 
         s->dct_unquantize_h263_intra = dct_unquantize_h263_intra_mmx;
@@ -638,7 +641,7 @@ void MPV_common_init_mmx(MpegEncContext *s)
             s->dct_unquantize_mpeg2_intra = dct_unquantize_mpeg2_intra_mmx;
         s->dct_unquantize_mpeg2_inter = dct_unquantize_mpeg2_inter_mmx;
 
-        if (mm_flags & FF_MM_SSE2) {
+        if (mm_flags & AV_CPU_FLAG_SSE2) {
             s->denoise_dct= denoise_dct_sse2;
         } else {
                 s->denoise_dct= denoise_dct_mmx;
@@ -646,13 +649,13 @@ void MPV_common_init_mmx(MpegEncContext *s)
 
         if(dct_algo==FF_DCT_AUTO || dct_algo==FF_DCT_MMX){
 #if HAVE_SSSE3
-            if(mm_flags & FF_MM_SSSE3){
+            if(mm_flags & AV_CPU_FLAG_SSSE3){
                 s->dct_quantize= dct_quantize_SSSE3;
             } else
 #endif
-            if(mm_flags & FF_MM_SSE2){
+            if(mm_flags & AV_CPU_FLAG_SSE2){
                 s->dct_quantize= dct_quantize_SSE2;
-            } else if(mm_flags & FF_MM_MMX2){
+            } else if(mm_flags & AV_CPU_FLAG_MMX2){
                 s->dct_quantize= dct_quantize_MMX2;
             } else {
                 s->dct_quantize= dct_quantize_MMX;