On 21/01/15 5:08 PM, arwa arif wrote: > diff --git a/libavfilter/x86/Makefile b/libavfilter/x86/Makefile > index b93154e..8222e3f 100644 > --- a/libavfilter/x86/Makefile > +++ b/libavfilter/x86/Makefile > @@ -1,3 +1,4 @@ > +OBJS-$(CONFIG_EQ_FILTER) += x86/vf_eq.o > OBJS-$(CONFIG_FSPP_FILTER) += x86/vf_fspp.o > OBJS-$(CONFIG_GRADFUN_FILTER) += x86/vf_gradfun_init.o > OBJS-$(CONFIG_HQDN3D_FILTER) += x86/vf_hqdn3d_init.o > diff --git a/libavfilter/x86/vf_eq.c b/libavfilter/x86/vf_eq.c > new file mode 100644 > index 0000000..3396c33 > --- /dev/null > +++ b/libavfilter/x86/vf_eq.c > @@ -0,0 +1,94 @@ > +/* > + * > + * Original MPlayer filters by Richard Felker. > + * > + * This file is part of FFmpeg. > + * > + * FFmpeg is free software; you can redistribute it and/or modify > + * it under the terms of the GNU General Public License as published by > + * the Free Software Foundation; either version 2 of the License, or > + * (at your option) any later version. > + * > + * FFmpeg is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > + * GNU General Public License for more details. > + * > + * You should have received a copy of the GNU General Public License along > + * with FFmpeg; if not, write to the Free Software Foundation, Inc., > + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. > + */ > + > +#include "libavutil/attributes.h" > +#include "libavutil/cpu.h" > +#include "libavutil/mem.h" > +#include "libavutil/x86/asm.h" > +#include "libavfilter/vf_eq.h" > + > +#if HAVE_MMX && HAVE_6REGS
Again, "HAVE_MMX_INLINE && HAVE_6REGS". Otherwise, compilation will fail with compilers like msvc where HAVE_MMX is true but HAVE_MMX_INLINE isn't. > +static void process_MMX(EQParameters *param, uint8_t *dst, int dst_stride, > + uint8_t *src, int src_stride, int w, int h) > +{ > + int i; > + int pel; > + int dstep = dst_stride - w; > + int sstep = src_stride - w; > + short brvec[4]; > + short contvec[4]; > + > + brvec[0] = brvec[1] = brvec[2] = brvec[3] = param->b; > + contvec[0] = contvec[1] = contvec[2] = contvec[3] = param->c; > + > + while (h--) { > + __asm__ volatile ( > + "movq (%5), %%mm3 \n\t" > + "movq (%6), %%mm4 \n\t" > + "pxor %%mm0, %%mm0 \n\t" > + "movl %4, %%eax \n\t" > + //ASMALIGN(4) ".p2align 4 \n\t", or copy the define line for ASMALIGN() from libavfilter/libmpcodecs/mp_image.h to libavutil/x86/asm.h and uncomment this line. > + "1: \n\t" > + "movq (%0), %%mm1 \n\t" > + "movq (%0), %%mm2 \n\t" > + "punpcklbw %%mm0, %%mm1\n\t" > + "punpckhbw %%mm0, %%mm2\n\t" > + "psllw $4, %%mm1 \n\t" > + "psllw $4, %%mm2 \n\t" > + "pmulhw %%mm4, %%mm1 \n\t" > + "pmulhw %%mm4, %%mm2 \n\t" > + "paddw %%mm3, %%mm1 \n\t" > + "paddw %%mm3, %%mm2 \n\t" > + "packuswb %%mm2, %%mm1 \n\t" > + "add $8, %0 \n\t" > + "movq %%mm1, (%1) \n\t" > + "add $8, %1 \n\t" > + "decl %%eax \n\t" > + "jnz 1b \n\t" > + : "=r" (src), "=r" (dst) > + : "0" (src), "1" (dst), "r" (w>>3), "r" (brvec), "r" > (contvec) > + : "%eax" > + ); > + > + for (i = w&7; i; i--) { > + pel = ((*src++ * param->c) >> 12) + param->b; > + if (pel & 768) > + pel = (-pel) >> 31; > + *dst++ = pel; > + } > + > + src += sstep; > + dst += dstep; > + } > + __asm__ volatile ( "emms \n\t" ::: "memory" ); > +} > +#endif > + > +av_cold void ff_eq_init_x86(EQContext *eq) > +{ > +#if HAVE_MMX_INLINE Check for HAVE_6REGS here as well. > + int cpu_flags = av_get_cpu_flags(); > + > + if (cpu_flags & AV_CPU_FLAG_MMX) { > + eq->process = process_MMX; > + } > +#endif > +} _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel