[FFmpeg-devel] [WIP] [PATCH] Convert ff_put_pixels_clamped_mmx() to yasm

Timothy Gu timothygu99 at gmail.com
Fri May 23 06:18:23 CEST 2014


On Wed, May 21, 2014 at 7:07 PM, James Almer <jamrial at gmail.com> wrote:
> On 21/05/14 10:25 PM, Timothy Gu wrote:
>> Also adds some changes:
>> - use macros
>> - pass the +64 as argument to macro instead of add blockq, 64
>> - save some registers by passing memory address to packuswb
>> - add SSE2 version
>>
>> Tricks stolen from ff_put_signed_pixels_clamped_*().
>>
>> Signed-off-by: Timothy Gu <timothygu99 at gmail.com>
>> ---
>> I actually have ff_put_signed_pixels_clamped_mmx() and similar functions
>> converted to yasm long before James submitted his patch, but I forgot
>> about it. When I saw the patch, I was like "Dammit." So here it is, my
>> yasm ff_put_pixels_clamped_mmx(), written something like 2 months ago.
>>
>> I am not happy with the changes of all the files that directly
>> references ff_put_pixels_clamped_mmx(), but I cannot find another way
>> to fix --disable-yasm. Any ideas?
>> ---
>>  libavcodec/dct-test.c           |  6 ++---
>>  libavcodec/x86/cavsdsp.c        |  7 ++---
>>  libavcodec/x86/dsputil.asm      | 45 ++++++++++++++++++++++++++++++++
>>  libavcodec/x86/dsputil_init.c   |  3 ++-
>>  libavcodec/x86/dsputil_mmx.c    | 58 -----------------------------------------
>>  libavcodec/x86/dsputil_x86.h    |  2 ++
>>  libavcodec/x86/idct_mmx_xvid.c  |  2 ++
>>  libavcodec/x86/idct_sse2_xvid.c |  4 ++-
>>  libavcodec/x86/simple_idct.c    |  5 ++--
>>  9 files changed, 64 insertions(+), 68 deletions(-)
>
> The reason i didn't attempt to port this one was because it's mainly used as
> part of other inline asm functions (Like ff_idct_xvid_<opt>_put).

(and simple_idct too)

> This patch is now making said functions depend on both Yasm and inline asm,
> instead of only the latter.

> There's little to no gain with it as is, and in fact it makes builds with
> --disable-yasm lose the optimized xvid idct functions.

That was why I had some misgivings about this patch. However,
personally I think nobody would *ever* use ffmpeg without yasm,
especially not with a compiler that supports gcc-style inline asm.

>
> If we also port all three ff_idct_xvid_<opt> functions and
> ff_add_pixels_clamped_mmx then this will be a good change. Otherwise i
> personally think it's not a good idea to commit this alone.

Timothy


More information about the ffmpeg-devel mailing list