[FFmpeg-devel] port mplayer eq filter to libavfilter

Ronald S. Bultje rsbultje
Sat Dec 4 22:01:35 CET 2010


Hi,

On Sat, Dec 4, 2010 at 10:44 AM, Michael Niedermayer <michaelni at gmx.at> wrote:
> On Fri, Dec 03, 2010 at 02:47:58AM +0100, Michael Niedermayer wrote:
> [...]
>>
>> > +
>> > + ? ?__asm__ volatile (
>> > + ? ? ? ?"movd %3, %%mm3 \n\t"
>> > + ? ? ? ?"movd %4, %%mm4 \n\t"
>> > + ? ? ? ?"punpcklwd %%mm3, %%mm3 \n\t"
>> > + ? ? ? ?"punpcklwd %%mm4, %%mm4 \n\t"
>> > + ? ? ? ?"punpckldq %%mm3, %%mm3 \n\t"
>> > + ? ? ? ?"punpckldq %%mm4, %%mm4 \n\t"
>> > + ? ? ? ?"1: \n\t"
>> > + ? ? ? ?"pxor %%mm0, %%mm0 \n\t"
>> > + ? ? ? ?"mov %2, %%"REG_c" \n\t"
>> > + ? ? ? ?"sar $3, %%"REG_c" \n\t"
>> > + ? ? ? ?"2: \n\t"
>> > + ? ? ? ?"movq (%0), %%mm1 \n\t"
>>
>> > + ? ? ? ?"movq %%mm1, %%mm2 \n\t"
>>
>> have you benchmarked changeing this one from mplayer?
>
> note, you can trivially benchmark code by putting START/STOP_TIMER around
> code that you want to benchmark
>
>
>>
>>
>> > + ? ? ? ?"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"
>> > + ? ? ? ?"movq %%mm1, (%0) \n\t"
>> > + ? ? ? ?"add $8, %0 \n\t"
>> > + ? ? ? ?"dec %%"REG_c" \n\t"
>> > + ? ? ? ?"jnz 2b \n\t"
>> > + ? ? ? ?"mov %2, %%"REG_c" \n\t"
>> > + ? ? ? ?"and $7, %%"REG_c" \n\t"
>> > + ? ? ? ?"je 5f \n\t"
>> > + ? ? ? ?"3: \n\t"
>> > + ? ? ? ?"movzb (%0), %%"REG_a" \n\t"
>> > + ? ? ? ?"imul %4, %%"REG_a" \n\t"
>> > + ? ? ? ?"sar $12, %%"REG_a" \n\t"
>> > + ? ? ? ?"add %3, %%"REG_a" \n\t"
>> > + ? ? ? ?"mov %%"REG_a", %%"REG_d" \n\t"
>> > + ? ? ? ?"and $768, %%"REG_a" \n\t"
>> > + ? ? ? ?"je 4f \n\t"
>> > + ? ? ? ?"mov %%"REG_d", %%"REG_a" \n\t"
>> > + ? ? ? ?"neg %%"REG_a" \n\t"
>> > + ? ? ? ?"sar $31, %%"REG_a" \n\t"
>> > + ? ? ? ?"mov %%"REG_a", %%"REG_d" \n\t"
>> > + ? ? ? ?"4: \n\t"
>> > + ? ? ? ?"movb %%dl, (%0) \n\t"
>> > + ? ? ? ?"inc %0 \n\t"
>> > + ? ? ? ?"dec %%"REG_a" \n\t"
>> > + ? ? ? ?"jnz 3b \n\t"
>> > + ? ? ? ?"5: \n\t"
>> > + ? ? ? ?"add %5, %0 \n\t"
>> > + ? ? ? ?"dec"OPSIZE " %1 \n\t"
>> > + ? ? ? ?"jnz 1b \n\t"
>>
>> > + ? ? ? ?: "+r" (line), "+m" (h)
>> > + ? ? ? ?: "r" (w), "r" (brightness), "r" (contrast), "m" (step)
>> > + ? ? ? ?: "%"REG_c, "%"REG_d, "%"REG_a, "memory"
>>
>> this has some potential to fail on some x86_32 compilers
>
> if it does fail it can likely be solved by putting the code under #if HAVE_7REGS

Given that the code did not compile under x86-64, I think he tested on
x86-32 and thus it should be ok. I can test on OSX if you're scared,
but that's what FATE is for no? :-).

Ronald



More information about the ffmpeg-devel mailing list