[FFmpeg-devel] [PATCH] avfilter/vf_noise: remove special code for widths not multiple of 8

Paul B Mahol onemda at gmail.com
Thu Sep 12 15:41:56 CEST 2013


It is not required, as linesize should be aligned to 32.

Signed-off-by: Paul B Mahol <onemda at gmail.com>
---
 libavfilter/vf_noise.c | 21 ++++-----------------
 1 file changed, 4 insertions(+), 17 deletions(-)

diff --git a/libavfilter/vf_noise.c b/libavfilter/vf_noise.c
index 9fd2a67..a6d829e 100644
--- a/libavfilter/vf_noise.c
+++ b/libavfilter/vf_noise.c
@@ -218,7 +218,6 @@ static void line_noise_mmx(uint8_t *dst, const uint8_t *src,
                            int8_t *noise, int len, int shift)
 {
 #if HAVE_MMX_INLINE
-    x86_reg mmx_len= len&(~7);
     noise+=shift;
 
     __asm__ volatile(
@@ -236,11 +235,9 @@ static void line_noise_mmx(uint8_t *dst, const uint8_t *src,
             "movq %%mm0, (%2, %%"REG_a")     \n\t"
             "add $8, %%"REG_a"               \n\t"
             " js 1b                          \n\t"
-            :: "r" (src+mmx_len), "r" (noise+mmx_len), "r" (dst+mmx_len), "g" (-mmx_len)
+            :: "r" (src+len), "r" (noise+len), "r" (dst+len), "g" (-len)
             : "%"REG_a
     );
-    if (mmx_len!=len)
-        line_noise_c(dst+mmx_len, src+mmx_len, noise+mmx_len, len-mmx_len, 0);
 #endif
 }
 
@@ -248,7 +245,6 @@ static void line_noise_mmxext(uint8_t *dst, const uint8_t *src,
                               int8_t *noise, int len, int shift)
 {
 #if HAVE_MMXEXT_INLINE
-    x86_reg mmx_len= len&(~7);
     noise+=shift;
 
     __asm__ volatile(
@@ -266,11 +262,9 @@ static void line_noise_mmxext(uint8_t *dst, const uint8_t *src,
             "movntq %%mm0, (%2, %%"REG_a")    \n\t"
             "add $8, %%"REG_a"                \n\t"
             " js 1b                           \n\t"
-            :: "r" (src+mmx_len), "r" (noise+mmx_len), "r" (dst+mmx_len), "g" (-mmx_len)
+            :: "r" (src+len), "r" (noise+len), "r" (dst+len), "g" (-len)
             : "%"REG_a
             );
-    if (mmx_len != len)
-        line_noise_c(dst+mmx_len, src+mmx_len, noise+mmx_len, len-mmx_len, 0);
 #endif
 }
 
@@ -290,8 +284,6 @@ static inline void line_noise_avg_mmx(uint8_t *dst, const uint8_t *src,
                                       int len, int8_t **shift)
 {
 #if HAVE_MMX_INLINE
-    x86_reg mmx_len= len&(~7);
-
     __asm__ volatile(
             "mov %5, %%"REG_a"              \n\t"
             ASMALIGN(4)
@@ -318,15 +310,10 @@ static inline void line_noise_avg_mmx(uint8_t *dst, const uint8_t *src,
             "movq %%mm1, (%4, %%"REG_a")    \n\t"
             "add $8, %%"REG_a"              \n\t"
             " js 1b                         \n\t"
-            :: "r" (src+mmx_len), "r" (shift[0]+mmx_len), "r" (shift[1]+mmx_len), "r" (shift[2]+mmx_len),
-               "r" (dst+mmx_len), "g" (-mmx_len)
+            :: "r" (src+len), "r" (shift[0]+len), "r" (shift[1]+len), "r" (shift[2]+len),
+               "r" (dst+len), "g" (-len)
             : "%"REG_a
         );
-
-    if (mmx_len != len){
-        int8_t *shift2[3]={shift[0]+mmx_len, shift[1]+mmx_len, shift[2]+mmx_len};
-        line_noise_avg_c(dst+mmx_len, src+mmx_len, len-mmx_len, shift2);
-    }
 #endif
 }
 
-- 
1.7.11.2



More information about the ffmpeg-devel mailing list