[FFmpeg-devel] [PATCH 2/2] tta/x86: add ff_ttafilter_process_dec_{ssse3, sse4}

James Almer jamrial at gmail.com
Wed Feb 12 01:34:25 CET 2014


On 11/02/14 4:00 AM, James Almer wrote:
> On 11/02/14 3:18 AM, Loren Merritt wrote:
>> On Tue, 11 Feb 2014, James Almer wrote:
>>
>>> +    ; Using horizontal add (phaddd) seems to be slower than shuffling stuff around
>>> +    paddd      m2, m3               ; int sum = filter->round +
>>> +                                    ;           filter->dl[0] * filter->qm[0] +
>>> +    punpckhqdq m3, m2, m2           ;           filter->dl[1] * filter->qm[1] +
>>> +    paddd      m2, m3               ;           filter->dl[2] * filter->qm[2] +
>>> +                                    ;           filter->dl[3] * filter->qm[3] +
>>> +    movd       m6, roundd           ;           filter->dl[4] * filter->qm[4] +
>>> +    paddd      m6, m2               ;           filter->dl[5] * filter->qm[5] +
>>> +    pshufd     m2, m2, 0x1          ;           filter->dl[6] * filter->qm[6] +
>>> +    paddd      m6, m2               ;           filter->dl[7] * filter->qm[7];
>>> +
>>> +    psrldq     m4, 4                ; filter->dx[0] = filter->dx[1]; filter->dx[1] = filter->dx[2];
>>> +    pslldq     m5, 12               ; filter->dx[2] = filter->dx[3]; filter->dx[3] = filter->dx[4];
>>> +    por        m4, m5               ;
>>> +
>>> +    psrldq     m0, 4                ; filter->dl[0] = filter->dl[1]; filter->dl[1] = filter->dl[2];
>>> +    pslldq     m2, m1, 12           ; filter->dl[2] = filter->dl[3]; filter->dl[3] = filter->dl[4];
>>> +    por        m0, m2               ;
>>
>> palignr
> 
> Thanks. I was looking for a "rotate double quadword" instruction or similar and 
> couldn't find anything.
> 
>>
>>> +
>>> +    psrad      m5, m1, 30           ; filter->dx[4] = ((filter->dl[4] >> 30) | 1);
>>> +    por        m5, [pd_1224]        ; filter->dx[5] = ((filter->dl[5] >> 30) | 2) & ~1;
>>> +    pand       m5, [pd_n0113]       ; filter->dx[6] = ((filter->dl[6] >> 30) | 2) & ~1;
>>> +                                    ; filter->dx[7] = ((filter->dl[7] >> 30) | 4) & ~3;
>>> +
>>> +    mova       [dlq       ], m0
>>> +    mova       [dxq       ], m4
>>> +    mova       [dxq + 0x10], m5
>>> +    movd       m0, [inq]            ; filter->error = *in;
>>> +    movd       [errorq], m0         ;
>>> +
>>> +    movd       m2, shiftd           ; *in += (sum >> filter->shift);
>>> +    psrad      m6, m2               ;
>>> +    paddd      m0, m6               ;
>>> +    movd       [inq], m0            ;
>>> +
>>> +    psignd     m1, [pd_m1]          ;
>>> +    psrldq     m1, 4                ;
>>> +    pslldq     m0, 12               ; filter->dl[4] = -filter->dl[5];
>>> +    pshufd     m0, m0, 0xf0         ; filter->dl[5] = -filter->dl[6];
>>> +    paddd      m1, m0               ; filter->dl[6] = *in - filter->dl[7];
>>
>> psubd, and eliminate the psignd
>>
> 
> Could you elaborate, please? Doing what you said didn't work.
> The psignd negates the values of dl[4-7], then after shifting them four bytes to 
> the right i sum *in to the two highest-order double words.
> 

Nevermind, got it now.
I'll send a new patchset with some other improvements.

Thanks.


More information about the ffmpeg-devel mailing list