MIYASAKA Masaru | a2e6a9d | 2006-02-04 00:00:00 +0000 | [diff] [blame] | 1 | ; |
DRC | 72130be | 2014-05-09 20:14:26 +0000 | [diff] [blame] | 2 | ; jfdctflt.asm - floating-point FDCT (SSE) |
MIYASAKA Masaru | a2e6a9d | 2006-02-04 00:00:00 +0000 | [diff] [blame] | 3 | ; |
Pierre Ossman | 018fc42 | 2009-03-09 13:31:56 +0000 | [diff] [blame] | 4 | ; Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB |
| 5 | ; |
| 6 | ; Based on |
MIYASAKA Masaru | a2e6a9d | 2006-02-04 00:00:00 +0000 | [diff] [blame] | 7 | ; x86 SIMD extension for IJG JPEG library |
| 8 | ; Copyright (C) 1999-2006, MIYASAKA Masaru. |
| 9 | ; For conditions of distribution and use, see copyright notice in jsimdext.inc |
| 10 | ; |
| 11 | ; This file should be assembled with NASM (Netwide Assembler), |
| 12 | ; can *not* be assembled with Microsoft's MASM or any compatible |
| 13 | ; assembler (including Borland's Turbo Assembler). |
| 14 | ; NASM is available from http://nasm.sourceforge.net/ or |
| 15 | ; http://sourceforge.net/project/showfiles.php?group_id=6208 |
| 16 | ; |
| 17 | ; This file contains a floating-point implementation of the forward DCT |
| 18 | ; (Discrete Cosine Transform). The following code is based directly on |
| 19 | ; the IJG's original jfdctflt.c; see the jfdctflt.c for more details. |
| 20 | ; |
MIYASAKA Masaru | a2e6a9d | 2006-02-04 00:00:00 +0000 | [diff] [blame] | 21 | ; [TAB8] |
| 22 | |
Pierre Ossman | 3a65ef4 | 2009-03-16 13:34:18 +0000 | [diff] [blame] | 23 | %include "jsimdext.inc" |
| 24 | %include "jdct.inc" |
MIYASAKA Masaru | a2e6a9d | 2006-02-04 00:00:00 +0000 | [diff] [blame] | 25 | |
| 26 | ; -------------------------------------------------------------------------- |
| 27 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 28 | %macro unpcklps2 2 ; %1=(0 1 2 3) / %2=(4 5 6 7) => %1=(0 1 4 5) |
| 29 | shufps %1,%2,0x44 |
MIYASAKA Masaru | a2e6a9d | 2006-02-04 00:00:00 +0000 | [diff] [blame] | 30 | %endmacro |
| 31 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 32 | %macro unpckhps2 2 ; %1=(0 1 2 3) / %2=(4 5 6 7) => %1=(2 3 6 7) |
| 33 | shufps %1,%2,0xEE |
MIYASAKA Masaru | a2e6a9d | 2006-02-04 00:00:00 +0000 | [diff] [blame] | 34 | %endmacro |
| 35 | |
| 36 | ; -------------------------------------------------------------------------- |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 37 | SECTION SEG_CONST |
MIYASAKA Masaru | a2e6a9d | 2006-02-04 00:00:00 +0000 | [diff] [blame] | 38 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 39 | alignz 16 |
| 40 | global EXTN(jconst_fdct_float_sse) |
MIYASAKA Masaru | a2e6a9d | 2006-02-04 00:00:00 +0000 | [diff] [blame] | 41 | |
| 42 | EXTN(jconst_fdct_float_sse): |
| 43 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 44 | PD_0_382 times 4 dd 0.382683432365089771728460 |
| 45 | PD_0_707 times 4 dd 0.707106781186547524400844 |
| 46 | PD_0_541 times 4 dd 0.541196100146196984399723 |
| 47 | PD_1_306 times 4 dd 1.306562964876376527856643 |
MIYASAKA Masaru | a2e6a9d | 2006-02-04 00:00:00 +0000 | [diff] [blame] | 48 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 49 | alignz 16 |
MIYASAKA Masaru | a2e6a9d | 2006-02-04 00:00:00 +0000 | [diff] [blame] | 50 | |
| 51 | ; -------------------------------------------------------------------------- |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 52 | SECTION SEG_TEXT |
| 53 | BITS 32 |
MIYASAKA Masaru | a2e6a9d | 2006-02-04 00:00:00 +0000 | [diff] [blame] | 54 | ; |
| 55 | ; Perform the forward DCT on one block of samples. |
| 56 | ; |
| 57 | ; GLOBAL(void) |
DRC | bd49803 | 2016-02-19 08:53:33 -0600 | [diff] [blame] | 58 | ; jsimd_fdct_float_sse (FAST_FLOAT *data) |
MIYASAKA Masaru | a2e6a9d | 2006-02-04 00:00:00 +0000 | [diff] [blame] | 59 | ; |
| 60 | |
DRC | bd49803 | 2016-02-19 08:53:33 -0600 | [diff] [blame] | 61 | %define data(b) (b)+8 ; FAST_FLOAT *data |
MIYASAKA Masaru | a2e6a9d | 2006-02-04 00:00:00 +0000 | [diff] [blame] | 62 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 63 | %define original_ebp ebp+0 |
| 64 | %define wk(i) ebp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] |
| 65 | %define WK_NUM 2 |
MIYASAKA Masaru | a2e6a9d | 2006-02-04 00:00:00 +0000 | [diff] [blame] | 66 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 67 | align 16 |
| 68 | global EXTN(jsimd_fdct_float_sse) |
MIYASAKA Masaru | a2e6a9d | 2006-02-04 00:00:00 +0000 | [diff] [blame] | 69 | |
Pierre Ossman | 018fc42 | 2009-03-09 13:31:56 +0000 | [diff] [blame] | 70 | EXTN(jsimd_fdct_float_sse): |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 71 | push ebp |
| 72 | mov eax,esp ; eax = original ebp |
| 73 | sub esp, byte 4 |
| 74 | and esp, byte (-SIZEOF_XMMWORD) ; align to 128 bits |
| 75 | mov [esp],eax |
| 76 | mov ebp,esp ; ebp = aligned ebp |
| 77 | lea esp, [wk(0)] |
| 78 | pushpic ebx |
| 79 | ; push ecx ; need not be preserved |
| 80 | ; push edx ; need not be preserved |
| 81 | ; push esi ; unused |
| 82 | ; push edi ; unused |
MIYASAKA Masaru | a2e6a9d | 2006-02-04 00:00:00 +0000 | [diff] [blame] | 83 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 84 | get_GOT ebx ; get GOT address |
MIYASAKA Masaru | a2e6a9d | 2006-02-04 00:00:00 +0000 | [diff] [blame] | 85 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 86 | ; ---- Pass 1: process rows. |
MIYASAKA Masaru | a2e6a9d | 2006-02-04 00:00:00 +0000 | [diff] [blame] | 87 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 88 | mov edx, POINTER [data(eax)] ; (FAST_FLOAT *) |
| 89 | mov ecx, DCTSIZE/4 |
| 90 | alignx 16,7 |
MIYASAKA Masaru | a2e6a9d | 2006-02-04 00:00:00 +0000 | [diff] [blame] | 91 | .rowloop: |
| 92 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 93 | movaps xmm0, XMMWORD [XMMBLOCK(2,0,edx,SIZEOF_FAST_FLOAT)] |
| 94 | movaps xmm1, XMMWORD [XMMBLOCK(3,0,edx,SIZEOF_FAST_FLOAT)] |
| 95 | movaps xmm2, XMMWORD [XMMBLOCK(2,1,edx,SIZEOF_FAST_FLOAT)] |
| 96 | movaps xmm3, XMMWORD [XMMBLOCK(3,1,edx,SIZEOF_FAST_FLOAT)] |
MIYASAKA Masaru | a2e6a9d | 2006-02-04 00:00:00 +0000 | [diff] [blame] | 97 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 98 | ; xmm0=(20 21 22 23), xmm2=(24 25 26 27) |
| 99 | ; xmm1=(30 31 32 33), xmm3=(34 35 36 37) |
MIYASAKA Masaru | a2e6a9d | 2006-02-04 00:00:00 +0000 | [diff] [blame] | 100 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 101 | movaps xmm4,xmm0 ; transpose coefficients(phase 1) |
| 102 | unpcklps xmm0,xmm1 ; xmm0=(20 30 21 31) |
| 103 | unpckhps xmm4,xmm1 ; xmm4=(22 32 23 33) |
| 104 | movaps xmm5,xmm2 ; transpose coefficients(phase 1) |
| 105 | unpcklps xmm2,xmm3 ; xmm2=(24 34 25 35) |
| 106 | unpckhps xmm5,xmm3 ; xmm5=(26 36 27 37) |
MIYASAKA Masaru | a2e6a9d | 2006-02-04 00:00:00 +0000 | [diff] [blame] | 107 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 108 | movaps xmm6, XMMWORD [XMMBLOCK(0,0,edx,SIZEOF_FAST_FLOAT)] |
| 109 | movaps xmm7, XMMWORD [XMMBLOCK(1,0,edx,SIZEOF_FAST_FLOAT)] |
| 110 | movaps xmm1, XMMWORD [XMMBLOCK(0,1,edx,SIZEOF_FAST_FLOAT)] |
| 111 | movaps xmm3, XMMWORD [XMMBLOCK(1,1,edx,SIZEOF_FAST_FLOAT)] |
MIYASAKA Masaru | a2e6a9d | 2006-02-04 00:00:00 +0000 | [diff] [blame] | 112 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 113 | ; xmm6=(00 01 02 03), xmm1=(04 05 06 07) |
| 114 | ; xmm7=(10 11 12 13), xmm3=(14 15 16 17) |
MIYASAKA Masaru | a2e6a9d | 2006-02-04 00:00:00 +0000 | [diff] [blame] | 115 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 116 | movaps XMMWORD [wk(0)], xmm4 ; wk(0)=(22 32 23 33) |
| 117 | movaps XMMWORD [wk(1)], xmm2 ; wk(1)=(24 34 25 35) |
MIYASAKA Masaru | a2e6a9d | 2006-02-04 00:00:00 +0000 | [diff] [blame] | 118 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 119 | movaps xmm4,xmm6 ; transpose coefficients(phase 1) |
| 120 | unpcklps xmm6,xmm7 ; xmm6=(00 10 01 11) |
| 121 | unpckhps xmm4,xmm7 ; xmm4=(02 12 03 13) |
| 122 | movaps xmm2,xmm1 ; transpose coefficients(phase 1) |
| 123 | unpcklps xmm1,xmm3 ; xmm1=(04 14 05 15) |
| 124 | unpckhps xmm2,xmm3 ; xmm2=(06 16 07 17) |
MIYASAKA Masaru | a2e6a9d | 2006-02-04 00:00:00 +0000 | [diff] [blame] | 125 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 126 | movaps xmm7,xmm6 ; transpose coefficients(phase 2) |
| 127 | unpcklps2 xmm6,xmm0 ; xmm6=(00 10 20 30)=data0 |
| 128 | unpckhps2 xmm7,xmm0 ; xmm7=(01 11 21 31)=data1 |
| 129 | movaps xmm3,xmm2 ; transpose coefficients(phase 2) |
| 130 | unpcklps2 xmm2,xmm5 ; xmm2=(06 16 26 36)=data6 |
| 131 | unpckhps2 xmm3,xmm5 ; xmm3=(07 17 27 37)=data7 |
MIYASAKA Masaru | a2e6a9d | 2006-02-04 00:00:00 +0000 | [diff] [blame] | 132 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 133 | movaps xmm0,xmm7 |
| 134 | movaps xmm5,xmm6 |
| 135 | subps xmm7,xmm2 ; xmm7=data1-data6=tmp6 |
| 136 | subps xmm6,xmm3 ; xmm6=data0-data7=tmp7 |
| 137 | addps xmm0,xmm2 ; xmm0=data1+data6=tmp1 |
| 138 | addps xmm5,xmm3 ; xmm5=data0+data7=tmp0 |
MIYASAKA Masaru | a2e6a9d | 2006-02-04 00:00:00 +0000 | [diff] [blame] | 139 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 140 | movaps xmm2, XMMWORD [wk(0)] ; xmm2=(22 32 23 33) |
| 141 | movaps xmm3, XMMWORD [wk(1)] ; xmm3=(24 34 25 35) |
| 142 | movaps XMMWORD [wk(0)], xmm7 ; wk(0)=tmp6 |
| 143 | movaps XMMWORD [wk(1)], xmm6 ; wk(1)=tmp7 |
MIYASAKA Masaru | a2e6a9d | 2006-02-04 00:00:00 +0000 | [diff] [blame] | 144 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 145 | movaps xmm7,xmm4 ; transpose coefficients(phase 2) |
| 146 | unpcklps2 xmm4,xmm2 ; xmm4=(02 12 22 32)=data2 |
| 147 | unpckhps2 xmm7,xmm2 ; xmm7=(03 13 23 33)=data3 |
| 148 | movaps xmm6,xmm1 ; transpose coefficients(phase 2) |
| 149 | unpcklps2 xmm1,xmm3 ; xmm1=(04 14 24 34)=data4 |
| 150 | unpckhps2 xmm6,xmm3 ; xmm6=(05 15 25 35)=data5 |
MIYASAKA Masaru | a2e6a9d | 2006-02-04 00:00:00 +0000 | [diff] [blame] | 151 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 152 | movaps xmm2,xmm7 |
| 153 | movaps xmm3,xmm4 |
| 154 | addps xmm7,xmm1 ; xmm7=data3+data4=tmp3 |
| 155 | addps xmm4,xmm6 ; xmm4=data2+data5=tmp2 |
| 156 | subps xmm2,xmm1 ; xmm2=data3-data4=tmp4 |
| 157 | subps xmm3,xmm6 ; xmm3=data2-data5=tmp5 |
MIYASAKA Masaru | a2e6a9d | 2006-02-04 00:00:00 +0000 | [diff] [blame] | 158 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 159 | ; -- Even part |
MIYASAKA Masaru | a2e6a9d | 2006-02-04 00:00:00 +0000 | [diff] [blame] | 160 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 161 | movaps xmm1,xmm5 |
| 162 | movaps xmm6,xmm0 |
| 163 | subps xmm5,xmm7 ; xmm5=tmp13 |
| 164 | subps xmm0,xmm4 ; xmm0=tmp12 |
| 165 | addps xmm1,xmm7 ; xmm1=tmp10 |
| 166 | addps xmm6,xmm4 ; xmm6=tmp11 |
MIYASAKA Masaru | a2e6a9d | 2006-02-04 00:00:00 +0000 | [diff] [blame] | 167 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 168 | addps xmm0,xmm5 |
| 169 | mulps xmm0,[GOTOFF(ebx,PD_0_707)] ; xmm0=z1 |
MIYASAKA Masaru | a2e6a9d | 2006-02-04 00:00:00 +0000 | [diff] [blame] | 170 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 171 | movaps xmm7,xmm1 |
| 172 | movaps xmm4,xmm5 |
| 173 | subps xmm1,xmm6 ; xmm1=data4 |
| 174 | subps xmm5,xmm0 ; xmm5=data6 |
| 175 | addps xmm7,xmm6 ; xmm7=data0 |
| 176 | addps xmm4,xmm0 ; xmm4=data2 |
MIYASAKA Masaru | a2e6a9d | 2006-02-04 00:00:00 +0000 | [diff] [blame] | 177 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 178 | movaps XMMWORD [XMMBLOCK(0,1,edx,SIZEOF_FAST_FLOAT)], xmm1 |
| 179 | movaps XMMWORD [XMMBLOCK(2,1,edx,SIZEOF_FAST_FLOAT)], xmm5 |
| 180 | movaps XMMWORD [XMMBLOCK(0,0,edx,SIZEOF_FAST_FLOAT)], xmm7 |
| 181 | movaps XMMWORD [XMMBLOCK(2,0,edx,SIZEOF_FAST_FLOAT)], xmm4 |
MIYASAKA Masaru | a2e6a9d | 2006-02-04 00:00:00 +0000 | [diff] [blame] | 182 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 183 | ; -- Odd part |
MIYASAKA Masaru | a2e6a9d | 2006-02-04 00:00:00 +0000 | [diff] [blame] | 184 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 185 | movaps xmm6, XMMWORD [wk(0)] ; xmm6=tmp6 |
| 186 | movaps xmm0, XMMWORD [wk(1)] ; xmm0=tmp7 |
MIYASAKA Masaru | a2e6a9d | 2006-02-04 00:00:00 +0000 | [diff] [blame] | 187 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 188 | addps xmm2,xmm3 ; xmm2=tmp10 |
| 189 | addps xmm3,xmm6 ; xmm3=tmp11 |
| 190 | addps xmm6,xmm0 ; xmm6=tmp12, xmm0=tmp7 |
MIYASAKA Masaru | a2e6a9d | 2006-02-04 00:00:00 +0000 | [diff] [blame] | 191 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 192 | mulps xmm3,[GOTOFF(ebx,PD_0_707)] ; xmm3=z3 |
MIYASAKA Masaru | a2e6a9d | 2006-02-04 00:00:00 +0000 | [diff] [blame] | 193 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 194 | movaps xmm1,xmm2 ; xmm1=tmp10 |
| 195 | subps xmm2,xmm6 |
| 196 | mulps xmm2,[GOTOFF(ebx,PD_0_382)] ; xmm2=z5 |
| 197 | mulps xmm1,[GOTOFF(ebx,PD_0_541)] ; xmm1=MULTIPLY(tmp10,FIX_0_541196) |
| 198 | mulps xmm6,[GOTOFF(ebx,PD_1_306)] ; xmm6=MULTIPLY(tmp12,FIX_1_306562) |
| 199 | addps xmm1,xmm2 ; xmm1=z2 |
| 200 | addps xmm6,xmm2 ; xmm6=z4 |
MIYASAKA Masaru | a2e6a9d | 2006-02-04 00:00:00 +0000 | [diff] [blame] | 201 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 202 | movaps xmm5,xmm0 |
| 203 | subps xmm0,xmm3 ; xmm0=z13 |
| 204 | addps xmm5,xmm3 ; xmm5=z11 |
MIYASAKA Masaru | a2e6a9d | 2006-02-04 00:00:00 +0000 | [diff] [blame] | 205 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 206 | movaps xmm7,xmm0 |
| 207 | movaps xmm4,xmm5 |
| 208 | subps xmm0,xmm1 ; xmm0=data3 |
| 209 | subps xmm5,xmm6 ; xmm5=data7 |
| 210 | addps xmm7,xmm1 ; xmm7=data5 |
| 211 | addps xmm4,xmm6 ; xmm4=data1 |
MIYASAKA Masaru | a2e6a9d | 2006-02-04 00:00:00 +0000 | [diff] [blame] | 212 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 213 | movaps XMMWORD [XMMBLOCK(3,0,edx,SIZEOF_FAST_FLOAT)], xmm0 |
| 214 | movaps XMMWORD [XMMBLOCK(3,1,edx,SIZEOF_FAST_FLOAT)], xmm5 |
| 215 | movaps XMMWORD [XMMBLOCK(1,1,edx,SIZEOF_FAST_FLOAT)], xmm7 |
| 216 | movaps XMMWORD [XMMBLOCK(1,0,edx,SIZEOF_FAST_FLOAT)], xmm4 |
MIYASAKA Masaru | a2e6a9d | 2006-02-04 00:00:00 +0000 | [diff] [blame] | 217 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 218 | add edx, 4*DCTSIZE*SIZEOF_FAST_FLOAT |
| 219 | dec ecx |
| 220 | jnz near .rowloop |
MIYASAKA Masaru | a2e6a9d | 2006-02-04 00:00:00 +0000 | [diff] [blame] | 221 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 222 | ; ---- Pass 2: process columns. |
MIYASAKA Masaru | a2e6a9d | 2006-02-04 00:00:00 +0000 | [diff] [blame] | 223 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 224 | mov edx, POINTER [data(eax)] ; (FAST_FLOAT *) |
| 225 | mov ecx, DCTSIZE/4 |
| 226 | alignx 16,7 |
MIYASAKA Masaru | a2e6a9d | 2006-02-04 00:00:00 +0000 | [diff] [blame] | 227 | .columnloop: |
| 228 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 229 | movaps xmm0, XMMWORD [XMMBLOCK(2,0,edx,SIZEOF_FAST_FLOAT)] |
| 230 | movaps xmm1, XMMWORD [XMMBLOCK(3,0,edx,SIZEOF_FAST_FLOAT)] |
| 231 | movaps xmm2, XMMWORD [XMMBLOCK(6,0,edx,SIZEOF_FAST_FLOAT)] |
| 232 | movaps xmm3, XMMWORD [XMMBLOCK(7,0,edx,SIZEOF_FAST_FLOAT)] |
MIYASAKA Masaru | a2e6a9d | 2006-02-04 00:00:00 +0000 | [diff] [blame] | 233 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 234 | ; xmm0=(02 12 22 32), xmm2=(42 52 62 72) |
| 235 | ; xmm1=(03 13 23 33), xmm3=(43 53 63 73) |
MIYASAKA Masaru | a2e6a9d | 2006-02-04 00:00:00 +0000 | [diff] [blame] | 236 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 237 | movaps xmm4,xmm0 ; transpose coefficients(phase 1) |
| 238 | unpcklps xmm0,xmm1 ; xmm0=(02 03 12 13) |
| 239 | unpckhps xmm4,xmm1 ; xmm4=(22 23 32 33) |
| 240 | movaps xmm5,xmm2 ; transpose coefficients(phase 1) |
| 241 | unpcklps xmm2,xmm3 ; xmm2=(42 43 52 53) |
| 242 | unpckhps xmm5,xmm3 ; xmm5=(62 63 72 73) |
MIYASAKA Masaru | a2e6a9d | 2006-02-04 00:00:00 +0000 | [diff] [blame] | 243 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 244 | movaps xmm6, XMMWORD [XMMBLOCK(0,0,edx,SIZEOF_FAST_FLOAT)] |
| 245 | movaps xmm7, XMMWORD [XMMBLOCK(1,0,edx,SIZEOF_FAST_FLOAT)] |
| 246 | movaps xmm1, XMMWORD [XMMBLOCK(4,0,edx,SIZEOF_FAST_FLOAT)] |
| 247 | movaps xmm3, XMMWORD [XMMBLOCK(5,0,edx,SIZEOF_FAST_FLOAT)] |
MIYASAKA Masaru | a2e6a9d | 2006-02-04 00:00:00 +0000 | [diff] [blame] | 248 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 249 | ; xmm6=(00 10 20 30), xmm1=(40 50 60 70) |
| 250 | ; xmm7=(01 11 21 31), xmm3=(41 51 61 71) |
MIYASAKA Masaru | a2e6a9d | 2006-02-04 00:00:00 +0000 | [diff] [blame] | 251 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 252 | movaps XMMWORD [wk(0)], xmm4 ; wk(0)=(22 23 32 33) |
| 253 | movaps XMMWORD [wk(1)], xmm2 ; wk(1)=(42 43 52 53) |
MIYASAKA Masaru | a2e6a9d | 2006-02-04 00:00:00 +0000 | [diff] [blame] | 254 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 255 | movaps xmm4,xmm6 ; transpose coefficients(phase 1) |
| 256 | unpcklps xmm6,xmm7 ; xmm6=(00 01 10 11) |
| 257 | unpckhps xmm4,xmm7 ; xmm4=(20 21 30 31) |
| 258 | movaps xmm2,xmm1 ; transpose coefficients(phase 1) |
| 259 | unpcklps xmm1,xmm3 ; xmm1=(40 41 50 51) |
| 260 | unpckhps xmm2,xmm3 ; xmm2=(60 61 70 71) |
MIYASAKA Masaru | a2e6a9d | 2006-02-04 00:00:00 +0000 | [diff] [blame] | 261 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 262 | movaps xmm7,xmm6 ; transpose coefficients(phase 2) |
| 263 | unpcklps2 xmm6,xmm0 ; xmm6=(00 01 02 03)=data0 |
| 264 | unpckhps2 xmm7,xmm0 ; xmm7=(10 11 12 13)=data1 |
| 265 | movaps xmm3,xmm2 ; transpose coefficients(phase 2) |
| 266 | unpcklps2 xmm2,xmm5 ; xmm2=(60 61 62 63)=data6 |
| 267 | unpckhps2 xmm3,xmm5 ; xmm3=(70 71 72 73)=data7 |
MIYASAKA Masaru | a2e6a9d | 2006-02-04 00:00:00 +0000 | [diff] [blame] | 268 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 269 | movaps xmm0,xmm7 |
| 270 | movaps xmm5,xmm6 |
| 271 | subps xmm7,xmm2 ; xmm7=data1-data6=tmp6 |
| 272 | subps xmm6,xmm3 ; xmm6=data0-data7=tmp7 |
| 273 | addps xmm0,xmm2 ; xmm0=data1+data6=tmp1 |
| 274 | addps xmm5,xmm3 ; xmm5=data0+data7=tmp0 |
MIYASAKA Masaru | a2e6a9d | 2006-02-04 00:00:00 +0000 | [diff] [blame] | 275 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 276 | movaps xmm2, XMMWORD [wk(0)] ; xmm2=(22 23 32 33) |
| 277 | movaps xmm3, XMMWORD [wk(1)] ; xmm3=(42 43 52 53) |
| 278 | movaps XMMWORD [wk(0)], xmm7 ; wk(0)=tmp6 |
| 279 | movaps XMMWORD [wk(1)], xmm6 ; wk(1)=tmp7 |
MIYASAKA Masaru | a2e6a9d | 2006-02-04 00:00:00 +0000 | [diff] [blame] | 280 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 281 | movaps xmm7,xmm4 ; transpose coefficients(phase 2) |
| 282 | unpcklps2 xmm4,xmm2 ; xmm4=(20 21 22 23)=data2 |
| 283 | unpckhps2 xmm7,xmm2 ; xmm7=(30 31 32 33)=data3 |
| 284 | movaps xmm6,xmm1 ; transpose coefficients(phase 2) |
| 285 | unpcklps2 xmm1,xmm3 ; xmm1=(40 41 42 43)=data4 |
| 286 | unpckhps2 xmm6,xmm3 ; xmm6=(50 51 52 53)=data5 |
MIYASAKA Masaru | a2e6a9d | 2006-02-04 00:00:00 +0000 | [diff] [blame] | 287 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 288 | movaps xmm2,xmm7 |
| 289 | movaps xmm3,xmm4 |
| 290 | addps xmm7,xmm1 ; xmm7=data3+data4=tmp3 |
| 291 | addps xmm4,xmm6 ; xmm4=data2+data5=tmp2 |
| 292 | subps xmm2,xmm1 ; xmm2=data3-data4=tmp4 |
| 293 | subps xmm3,xmm6 ; xmm3=data2-data5=tmp5 |
MIYASAKA Masaru | a2e6a9d | 2006-02-04 00:00:00 +0000 | [diff] [blame] | 294 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 295 | ; -- Even part |
MIYASAKA Masaru | a2e6a9d | 2006-02-04 00:00:00 +0000 | [diff] [blame] | 296 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 297 | movaps xmm1,xmm5 |
| 298 | movaps xmm6,xmm0 |
| 299 | subps xmm5,xmm7 ; xmm5=tmp13 |
| 300 | subps xmm0,xmm4 ; xmm0=tmp12 |
| 301 | addps xmm1,xmm7 ; xmm1=tmp10 |
| 302 | addps xmm6,xmm4 ; xmm6=tmp11 |
MIYASAKA Masaru | a2e6a9d | 2006-02-04 00:00:00 +0000 | [diff] [blame] | 303 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 304 | addps xmm0,xmm5 |
| 305 | mulps xmm0,[GOTOFF(ebx,PD_0_707)] ; xmm0=z1 |
MIYASAKA Masaru | a2e6a9d | 2006-02-04 00:00:00 +0000 | [diff] [blame] | 306 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 307 | movaps xmm7,xmm1 |
| 308 | movaps xmm4,xmm5 |
| 309 | subps xmm1,xmm6 ; xmm1=data4 |
| 310 | subps xmm5,xmm0 ; xmm5=data6 |
| 311 | addps xmm7,xmm6 ; xmm7=data0 |
| 312 | addps xmm4,xmm0 ; xmm4=data2 |
MIYASAKA Masaru | a2e6a9d | 2006-02-04 00:00:00 +0000 | [diff] [blame] | 313 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 314 | movaps XMMWORD [XMMBLOCK(4,0,edx,SIZEOF_FAST_FLOAT)], xmm1 |
| 315 | movaps XMMWORD [XMMBLOCK(6,0,edx,SIZEOF_FAST_FLOAT)], xmm5 |
| 316 | movaps XMMWORD [XMMBLOCK(0,0,edx,SIZEOF_FAST_FLOAT)], xmm7 |
| 317 | movaps XMMWORD [XMMBLOCK(2,0,edx,SIZEOF_FAST_FLOAT)], xmm4 |
MIYASAKA Masaru | a2e6a9d | 2006-02-04 00:00:00 +0000 | [diff] [blame] | 318 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 319 | ; -- Odd part |
MIYASAKA Masaru | a2e6a9d | 2006-02-04 00:00:00 +0000 | [diff] [blame] | 320 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 321 | movaps xmm6, XMMWORD [wk(0)] ; xmm6=tmp6 |
| 322 | movaps xmm0, XMMWORD [wk(1)] ; xmm0=tmp7 |
MIYASAKA Masaru | a2e6a9d | 2006-02-04 00:00:00 +0000 | [diff] [blame] | 323 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 324 | addps xmm2,xmm3 ; xmm2=tmp10 |
| 325 | addps xmm3,xmm6 ; xmm3=tmp11 |
| 326 | addps xmm6,xmm0 ; xmm6=tmp12, xmm0=tmp7 |
MIYASAKA Masaru | a2e6a9d | 2006-02-04 00:00:00 +0000 | [diff] [blame] | 327 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 328 | mulps xmm3,[GOTOFF(ebx,PD_0_707)] ; xmm3=z3 |
MIYASAKA Masaru | a2e6a9d | 2006-02-04 00:00:00 +0000 | [diff] [blame] | 329 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 330 | movaps xmm1,xmm2 ; xmm1=tmp10 |
| 331 | subps xmm2,xmm6 |
| 332 | mulps xmm2,[GOTOFF(ebx,PD_0_382)] ; xmm2=z5 |
| 333 | mulps xmm1,[GOTOFF(ebx,PD_0_541)] ; xmm1=MULTIPLY(tmp10,FIX_0_541196) |
| 334 | mulps xmm6,[GOTOFF(ebx,PD_1_306)] ; xmm6=MULTIPLY(tmp12,FIX_1_306562) |
| 335 | addps xmm1,xmm2 ; xmm1=z2 |
| 336 | addps xmm6,xmm2 ; xmm6=z4 |
MIYASAKA Masaru | a2e6a9d | 2006-02-04 00:00:00 +0000 | [diff] [blame] | 337 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 338 | movaps xmm5,xmm0 |
| 339 | subps xmm0,xmm3 ; xmm0=z13 |
| 340 | addps xmm5,xmm3 ; xmm5=z11 |
MIYASAKA Masaru | a2e6a9d | 2006-02-04 00:00:00 +0000 | [diff] [blame] | 341 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 342 | movaps xmm7,xmm0 |
| 343 | movaps xmm4,xmm5 |
| 344 | subps xmm0,xmm1 ; xmm0=data3 |
| 345 | subps xmm5,xmm6 ; xmm5=data7 |
| 346 | addps xmm7,xmm1 ; xmm7=data5 |
| 347 | addps xmm4,xmm6 ; xmm4=data1 |
MIYASAKA Masaru | a2e6a9d | 2006-02-04 00:00:00 +0000 | [diff] [blame] | 348 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 349 | movaps XMMWORD [XMMBLOCK(3,0,edx,SIZEOF_FAST_FLOAT)], xmm0 |
| 350 | movaps XMMWORD [XMMBLOCK(7,0,edx,SIZEOF_FAST_FLOAT)], xmm5 |
| 351 | movaps XMMWORD [XMMBLOCK(5,0,edx,SIZEOF_FAST_FLOAT)], xmm7 |
| 352 | movaps XMMWORD [XMMBLOCK(1,0,edx,SIZEOF_FAST_FLOAT)], xmm4 |
MIYASAKA Masaru | a2e6a9d | 2006-02-04 00:00:00 +0000 | [diff] [blame] | 353 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 354 | add edx, byte 4*SIZEOF_FAST_FLOAT |
| 355 | dec ecx |
| 356 | jnz near .columnloop |
MIYASAKA Masaru | a2e6a9d | 2006-02-04 00:00:00 +0000 | [diff] [blame] | 357 | |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 358 | ; pop edi ; unused |
| 359 | ; pop esi ; unused |
| 360 | ; pop edx ; need not be preserved |
| 361 | ; pop ecx ; need not be preserved |
| 362 | poppic ebx |
| 363 | mov esp,ebp ; esp <- aligned ebp |
| 364 | pop esp ; esp <- original ebp |
| 365 | pop ebp |
| 366 | ret |
MIYASAKA Masaru | a2e6a9d | 2006-02-04 00:00:00 +0000 | [diff] [blame] | 367 | |
DRC | 132b5fd | 2009-10-08 09:04:56 +0000 | [diff] [blame] | 368 | ; For some reason, the OS X linker does not honor the request to align the |
| 369 | ; segment unless we do this. |
DRC | e5eaf37 | 2014-05-09 18:00:32 +0000 | [diff] [blame] | 370 | align 16 |