[FFmpeg-devel] [PATCH] x86: convert DNxHDenc inline asm to yasm

Timothy Gu timothygu99 at gmail.com
Wed Mar 26 20:01:13 CET 2014


On Wed, Mar 26, 2014 at 8:54 AM, Ronald S. Bultje <rsbultje at gmail.com> wrote:
> Hi,
>
> On Tue, Mar 25, 2014 at 11:21 PM, Timothy Gu <timothygu99 at gmail.com> wrote:
>
>> +; void get_pixels_8x4_sym_sse2(int16_t *block, const uint8_t *pixels,
>> +;                              int line_size)
>> +INIT_XMM sse2
>> +cglobal get_pixels_8x4_sym, 3,3,5
>>
>
> cglobal get_pixels_8x4_sym, 3, 3, 5, block, pixels, linesize
>
>
>> +    movsxdifnidn r2,    r2d
>>
>
> Change argument type to intptr_t or ptrdiff_t and remove this instruction.

OK. I saw it in the disassembly of the C version and
libavcodec/x86/dsputilenc.asm. That's why I did this.

>
>
>> +    pxor      m4,       m4
>> +    movq      m0,       [r1]
>>
>
> [blockq]

I used to use the named registers (is that what you call it?), but
then I don't know how to deal with movsxdifnidn. Now I know how the
issue can fixed, sure.

>
>
>> +    add       r1,       r2
>>
>
> add pixelsq, linesizeq
>
>
>> +    movq      m1,       [r1]
>> +    movq      m2,       [r1+r2]
>> +    movq      m3,       [r1+r2*2]
>> +    punpcklbw m0,       m4
>> +    punpcklbw m1,       m4
>> +    punpcklbw m2,       m4
>> +    punpcklbw m3,       m4
>> +    movdqa    [r0    ], m0
>> +    movdqa    [r0+16 ], m1
>> +    movdqa    [r0+32 ], m2
>> +    movdqa    [r0+48 ], m3
>> +    movdqa    [r0+64 ], m3
>> +    movdqa    [r0+80 ], m2
>> +    movdqa    [r0+96 ], m1
>> +    movdqa    [r0+112], m0
>>
>

> We typically use mova (which expands to movdqa for xmm, and to movq for
> mmx; likewise, movh expands to movq for xmm and to movd for mmx), but I
> don't particularly care since you're only using this for xmm, not mmx, so
> ignore this if you don't care.

I'll change it.

Anyways, this is my first asm patch, and I've never seen asm before,
so it takes an awful amount of time to look up every single
instruction, trying to understand how it works like the C version. So
thank you for your instruction on asm.

Timothy


More information about the ffmpeg-devel mailing list