2 ;// author : JC Hoelt <jeko@free.fr>
5 ;// 07/01/2001 : Changing FEMMS to EMMS : slower... but run on intel machines
6 ;// 03/01/2001 : WIDTH and HEIGHT are now variable
7 ;// 28/12/2000 : adding comments to the code, suppress some useless lines
8 ;// 27/12/2000 : reducing memory access... improving performance by 20%
9 ;// coefficients are now on 1 byte
10 ;// 22/12/2000 : Changing data structure
11 ;// 16/12/2000 : AT&T version
12 ;// 14/12/2000 : unrolling loop
13 ;// 12/12/2000 : 64 bits memory access
19 .string "pos = %d\n\0"
28 .globl mmx_zoom ;// name of the function to call by C program
29 /* .extern coeffs ;// the transformation buffer */
30 .extern expix1,expix2 ;// the source and destination buffer
31 .extern mmx_zoom_size, zoom_width ;// size of the buffers
33 .extern brutS,brutD,buffratio,precalCoef,prevX,prevY
36 /* faire : a / sqrtperte <=> a >> PERTEDEC*/
56 ;// initialisation du mm7 à zero
59 movl mmx_zoom_size, %ecx
63 ;// esi <- nouvelle position
65 leal (%eax, %ecx, 8),%eax
67 movl (%eax),%edx /* = brutS.px (brutSmypos) */
68 movl 4(%eax),%eax /* = brutS.py */
71 leal (%ebx, %ecx, 8),%ebx
76 addl %edx,%esi /* esi = px */
78 /* eax contient deja brutS.py = le nouveau brutSmypos*/
79 /* ebx pointe sur brutD[myPos] */
84 addl %eax,%edi /* edi = py */
92 andl $15,%eax /* eax = coefh */
94 andl $15,%ebx /* ebx = coefv */
100 /* movd (%eax,%ebx),%mm6*/ /* mm6 = coeffs */
109 imull zoom_width,%edi
110 leal (%esi,%edi),%esi
117 /** apres ce calcul, %esi = pos, %mm6 = coeffs **/
125 ;// recuperation des deux premiers pixels dans mm0 et mm1
126 /* movq (%eax,%esi,4), %mm0 /* b1-v1-r1-a1-b2-v2-r2-a2 */
127 movq %mm0, %mm1 /* b1-v1-r1-a1-b2-v2-r2-a2 */
129 ;// depackage du premier pixel
130 punpcklbw %mm7, %mm0 /* 00-b2-00-v2-00-r2-00-a2 */
132 movq %mm6, %mm5 /* ??-??-??-??-c4-c3-c2-c1 */
133 ;// depackage du 2ieme pixel
134 punpckhbw %mm7, %mm1 /* 00-b1-00-v1-00-r1-00-a1 */
136 ;// extraction des coefficients...
137 punpcklbw %mm5, %mm6 /* c4-c4-c3-c3-c2-c2-c1-c1 */
138 movq %mm6, %mm4 /* c4-c4-c3-c3-c2-c2-c1-c1 */
139 movq %mm6, %mm5 /* c4-c4-c3-c3-c2-c2-c1-c1 */
141 punpcklbw %mm5, %mm6 /* c2-c2-c2-c2-c1-c1-c1-c1 */
142 punpckhbw %mm5, %mm4 /* c4-c4-c4-c4-c3-c3-c3-c3 */
144 movq %mm6, %mm3 /* c2-c2-c2-c2-c1-c1-c1-c1 */
145 punpcklbw %mm7, %mm6 /* 00-c1-00-c1-00-c1-00-c1 */
146 punpckhbw %mm7, %mm3 /* 00-c2-00-c2-00-c2-00-c2 */
148 ;// multiplication des pixels par les coefficients
149 pmullw %mm6, %mm0 /* c1*b2-c1*v2-c1*r2-c1*a2 */
150 pmullw %mm3, %mm1 /* c2*b1-c2*v1-c2*r1-c2*a1 */
153 ;// ...extraction des 2 derniers coefficients
154 movq %mm4, %mm5 /* c4-c4-c4-c4-c3-c3-c3-c3 */
155 punpcklbw %mm7, %mm4 /* 00-c3-00-c3-00-c3-00-c3 */
156 punpckhbw %mm7, %mm5 /* 00-c4-00-c4-00-c4-00-c4 */
158 /* ajouter la longueur de ligne a esi */
161 ;// recuperation des 2 derniers pixels
162 /* movq (%eax,%esi,4), %mm1*/
165 ;// depackage des pixels
169 ;// multiplication pas les coeffs
173 ;// ajout des valeurs obtenues à la valeur finale
177 ;// division par 256 = 16+16+16+16, puis repackage du pixel final
181 ;// passage au suivant
183 ;// enregistrement du resultat
185 /* movd %mm0,(%eax,%ecx,4)*/
188 ;// test de fin du tantque
189 cmpl $0, %ecx ;// 400x300