[FFmpeg-devel] [PATCH]Simplify mlp_filter_channel_x86()

Carl Eugen Hoyos cehoyos at ag.or.at
Thu Feb 19 16:25:29 CET 2015


Hi!

Attached patch by Francisco Blas Izquierdo Riera fixes a compilation 
error in mlpdsp_init.c with -fstack-check and some gcc compilers (I 
reproduced the issue with gcc 4.7.3) by simplifying the code.
I ran some benchmarks with a very large thd file, 'time' confirms 
the results of '-benchmark'.
Without patch (2280552):
bench: utime=104.153s
bench: utime=104.474s
bench: utime=107.211s
bench: utime=106.201s
bench: utime=106.988s
bench: utime=105.138s
bench: utime=107.025s
bench: utime=106.362s
bench: utime=106.535s
bench: utime=105.900s

With the patch attached:
bench: utime=103.092s
bench: utime=104.824s
bench: utime=103.058s
bench: utime=102.612s
bench: utime=102.803s
bench: utime=104.796s
bench: utime=104.040s
bench: utime=102.880s
bench: utime=102.487s
bench: utime=102.277s

See also https://bugs.gentoo.org/show_bug.cgi?id=471756

Please comment, Carl Eugen

$ make libavcodec/x86/mlpdsp_init.o
libavcodec/x86/mlpdsp_init.c: In function ‘mlp_filter_channel_x86’:
libavcodec/x86/mlpdsp_init.c:142:5: error: can’t find a register in 
class ‘GENERAL_REGS’ while reloading ‘asm’
libavcodec/x86/mlpdsp_init.c:142:5: error: ‘asm’ operand has impossible 
constraints

-------------- next part --------------
diff --git a/libavcodec/x86/mlpdsp_init.c b/libavcodec/x86/mlpdsp_init.c
index dc0bc58..6cba4f5 100644
--- a/libavcodec/x86/mlpdsp_init.c
+++ b/libavcodec/x86/mlpdsp_init.c
@@ -78,12 +78,6 @@ static const void * const iirtable[5] = { &ff_mlp_iirorder_0, &ff_mlp_iirorder_1
     "imul                 %%rdx, %%rax\n\t" \
     "add                  %%rax, %%rsi\n\t"
 
-#define FIRMULREG(label, offset, firc)\
-    LABEL_MANGLE(label)":       \n\t" \
-    "movslq "#offset"(%0), %%rax\n\t" \
-    "imul        %"#firc", %%rax\n\t" \
-    "add            %%rax, %%rsi\n\t"
-
 #define CLEAR_ACCUM                   \
     "xor            %%rsi, %%rsi\n\t"
 
@@ -103,9 +97,6 @@ static const void * const iirtable[5] = { &ff_mlp_iirorder_0, &ff_mlp_iirorder_1
     "add                %%eax , %%esi\n\t" \
     "adc                %%edx , %%ecx\n\t"
 
-#define FIRMULREG(label, offset, firc)  \
-    MLPMUL(label, #offset, "0", "0")
-
 #define CLEAR_ACCUM                  \
     "xor           %%esi, %%esi\n\t" \
     "xor           %%ecx, %%ecx\n\t"
@@ -148,9 +139,9 @@ static void mlp_filter_channel_x86(int32_t *state, const int32_t *coeff,
         FIRMUL   (ff_mlp_firorder_6, 0x14   )
         FIRMUL   (ff_mlp_firorder_5, 0x10   )
         FIRMUL   (ff_mlp_firorder_4, 0x0c   )
-        FIRMULREG(ff_mlp_firorder_3, 0x08,10)
-        FIRMULREG(ff_mlp_firorder_2, 0x04, 9)
-        FIRMULREG(ff_mlp_firorder_1, 0x00, 8)
+        FIRMUL   (ff_mlp_firorder_3, 0x08   )
+        FIRMUL   (ff_mlp_firorder_2, 0x04   )
+        FIRMUL   (ff_mlp_firorder_1, 0x00   )
         LABEL_MANGLE(ff_mlp_firorder_0)":\n\t"
         "jmp  *%6                     \n\t"
         IIRMUL   (ff_mlp_iirorder_4, 0x0c   )
@@ -177,9 +168,6 @@ static void mlp_filter_channel_x86(int32_t *state, const int32_t *coeff,
           /* 3*/"+r"(blocksize)
         : /* 4*/"r"((x86_reg)mask), /* 5*/"r"(firjump),
           /* 6*/"r"(iirjump)      , /* 7*/"c"(filter_shift)
-        , /* 8*/"r"((int64_t)coeff[0])
-        , /* 9*/"r"((int64_t)coeff[1])
-        , /*10*/"r"((int64_t)coeff[2])
         : "rax", "rdx", "rsi"
 #else /* ARCH_X86_32 */
           /* 3*/"+m"(blocksize)


More information about the ffmpeg-devel mailing list