[FFmpeg-cvslog] x86util: add and use RSHIFT/LSHIFT macros

Christophe Gisquet git at videolan.org
Sun Jun 15 13:31:54 CEST 2014


ffmpeg | branch: master | Christophe Gisquet <christophe.gisquet at gmail.com> | Sun Jun 15 01:05:03 2014 +0200| [91076128185e96725af18e1b532c6060e7f0c150] | committer: Michael Niedermayer

x86util: add and use RSHIFT/LSHIFT macros

Those macros take a byte number as shift argument, as this argument
differs between MMX and SSE2 instructions.

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=91076128185e96725af18e1b532c6060e7f0c150
---

 libavcodec/x86/huffyuvdsp.asm |   16 ----------------
 libavfilter/x86/vf_yadif.asm  |   15 +++------------
 libavfilter/x86/yadif-10.asm  |   22 ++++------------------
 libavfilter/x86/yadif-16.asm  |   38 ++++----------------------------------
 libavutil/x86/x86util.asm     |   16 ++++++++++++++++
 5 files changed, 27 insertions(+), 80 deletions(-)

diff --git a/libavcodec/x86/huffyuvdsp.asm b/libavcodec/x86/huffyuvdsp.asm
index d13c08a..cc48556 100644
--- a/libavcodec/x86/huffyuvdsp.asm
+++ b/libavcodec/x86/huffyuvdsp.asm
@@ -34,22 +34,6 @@ SECTION_TEXT
 ; void ff_add_hfyu_median_pred_mmxext(uint8_t *dst, const uint8_t *top,
 ;                                     const uint8_t *diff, int w,
 ;                                     int *left, int *left_top)
-%macro LSHIFT 2
-%if mmsize > 8
-    pslldq  %1, %2
-%else
-    psllq   %1, 8*(%2)
-%endif
-%endmacro
-
-%macro RSHIFT 2
-%if mmsize > 8
-    psrldq  %1, %2
-%else
-    psrlq   %1, 8*(%2)
-%endif
-%endmacro
-
 %macro HFYU_MEDIAN 0
 cglobal add_hfyu_median_pred, 6,6,8, dst, top, diff, w, left, left_top
     movu    m0, [topq]
diff --git a/libavfilter/x86/vf_yadif.asm b/libavfilter/x86/vf_yadif.asm
index 4b80bf3..a29620c 100644
--- a/libavfilter/x86/vf_yadif.asm
+++ b/libavfilter/x86/vf_yadif.asm
@@ -39,11 +39,7 @@ SECTION .text
     pavgb     m5, m3
     pand      m4, [pb_1]
     psubusb   m5, m4
-%if mmsize == 16
-    psrldq    m5, 1
-%else
-    psrlq     m5, 8
-%endif
+    RSHIFT    m5, 1
     punpcklbw m5, m7
     mova      m4, m2
     psubusb   m2, m3
@@ -51,13 +47,8 @@ SECTION .text
     pmaxub    m2, m3
     mova      m3, m2
     mova      m4, m2
-%if mmsize == 16
-    psrldq    m3, 1
-    psrldq    m4, 2
-%else
-    psrlq     m3, 8
-    psrlq     m4, 16
-%endif
+    RSHIFT    m3, 1
+    RSHIFT    m4, 2
     punpcklbw m2, m7
     punpcklbw m3, m7
     punpcklbw m4, m7
diff --git a/libavfilter/x86/yadif-10.asm b/libavfilter/x86/yadif-10.asm
index 9a6385a..1b01709 100644
--- a/libavfilter/x86/yadif-10.asm
+++ b/libavfilter/x86/yadif-10.asm
@@ -59,24 +59,15 @@ SECTION .text
     pavgw     m5, m3
     pand      m4, [pw_1]
     psubusw   m5, m4
-%if mmsize == 16
-    psrldq    m5, 2
-%else
-    psrlq     m5, 16
-%endif
+    RSHIFT    m5, 2
     mova      m4, m2
     psubusw   m2, m3
     psubusw   m3, m4
     PMAXUW    m2, m3
     mova      m3, m2
     mova      m4, m2
-%if mmsize == 16
-    psrldq    m3, 2
-    psrldq    m4, 4
-%else
-    psrlq     m3, 16
-    psrlq     m4, 32
-%endif
+    RSHIFT    m3, 2
+    RSHIFT    m4, 4
     paddw     m2, m3
     paddw     m2, m4
 %endmacro
@@ -174,13 +165,8 @@ SECTION .text
     psubusw      m2, m3
     psubusw      m3, m4
     PMAXUW       m2, m3
-%if mmsize == 16
     mova         m3, m2
-    psrldq       m3, 4
-%else
-    mova         m3, m2
-    psrlq        m3, 32
-%endif
+    RSHIFT       m3, 4
     paddw        m0, m2
     paddw        m0, m3
     psubw        m0, [pw_1]
diff --git a/libavfilter/x86/yadif-16.asm b/libavfilter/x86/yadif-16.asm
index d6dcd3a..a65da89 100644
--- a/libavfilter/x86/yadif-16.asm
+++ b/libavfilter/x86/yadif-16.asm
@@ -33,22 +33,6 @@ pd_8000: times 4 dd 0x8000
 
 SECTION .text
 
-%macro PIXSHIFT1 1
-%if cpuflag(sse2)
-    psrldq %1, 2
-%else
-    psrlq %1, 16
-%endif
-%endmacro
-
-%macro PIXSHIFT2 1
-%if cpuflag(sse2)
-    psrldq %1, 4
-%else
-    psrlq %1, 32
-%endif
-%endmacro
-
 %macro PABS 2
 %if cpuflag(ssse3)
     pabsd %1, %1
@@ -112,11 +96,7 @@ SECTION .text
     pavgw     m5, m3
     pand      m4, [pw_1]
     psubusw   m5, m4
-%if mmsize == 16
-    psrldq    m5, 2
-%else
-    psrlq     m5, 16
-%endif
+    RSHIFT    m5, 2
     punpcklwd m5, m7
     mova      m4, m2
     psubusw   m2, m3
@@ -124,13 +104,8 @@ SECTION .text
     PMAXUW    m2, m3
     mova      m3, m2
     mova      m4, m2
-%if mmsize == 16
-    psrldq    m3, 2
-    psrldq    m4, 4
-%else
-    psrlq     m3, 16
-    psrlq     m4, 32
-%endif
+    RSHIFT    m3, 2
+    RSHIFT    m4, 4
     punpcklwd m2, m7
     punpcklwd m3, m7
     punpcklwd m4, m7
@@ -234,13 +209,8 @@ SECTION .text
     psubusw      m2, m3
     psubusw      m3, m4
     PMAXUW       m2, m3
-%if mmsize == 16
     mova         m3, m2
-    psrldq       m3, 4
-%else
-    mova         m3, m2
-    psrlq        m3, 32
-%endif
+    RSHIFT       m3, 4
     punpcklwd    m2, m7
     punpcklwd    m3, m7
     paddd        m0, m2
diff --git a/libavutil/x86/x86util.asm b/libavutil/x86/x86util.asm
index 1064e9a..9fb4778 100644
--- a/libavutil/x86/x86util.asm
+++ b/libavutil/x86/x86util.asm
@@ -743,3 +743,19 @@ PMA_EMU PMADCSWD, pmadcswd, pmaddwd, paddd
         addps   %1, %4
     %endif
 %endmacro
+
+%macro LSHIFT 2
+%if mmsize > 8
+    pslldq  %1, %2
+%else
+    psllq   %1, 8*(%2)
+%endif
+%endmacro
+
+%macro RSHIFT 2
+%if mmsize > 8
+    psrldq  %1, %2
+%else
+    psrlq   %1, 8*(%2)
+%endif
+%endmacro



More information about the ffmpeg-cvslog mailing list