[FFmpeg-devel] port mplayer eq filter to libavfilter

William Yu genwillyu
Tue Dec 7 03:00:26 CET 2010


2010/12/4 Michael Niedermayer <michaelni at gmx.at>:
> 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
>

Thanks for your help. I optimizing it.
Should i revert assembly code to original mplayer code
before i can finding out a better way?

>
>>
>>
>> > + ? ? ? ?"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
>
> [...]
> --
> Michael ? ? GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Republics decline into democracies and democracies degenerate into
> despotisms. -- Aristotle
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (GNU/Linux)
>
> iEYEARECAAYFAkz6YeIACgkQYR7HhwQLD6sVcACcDeUq2XO3qfAQ7Y+OzhKhKaEO
> Z0MAmwTyzIT+bO8t71uBENsEuYTtfhd8
> =kVkQ
> -----END PGP SIGNATURE-----
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at mplayerhq.hu
> https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-devel
>



More information about the ffmpeg-devel mailing list