1 .file "scale_line_22_yuv_mmx.S"
8 MSG: .ascii "scale_line_22_yuv_mmx: %d %d\n"
13 #if !defined(__MINGW32__) && !defined(__CYGWIN__)
15 .globl pixops_scale_line_22_yuv_mmx
16 .type pixops_scale_line_22_yuv_mmx,@function
17 pixops_scale_line_22_yuv_mmx:
21 .globl _pixops_scale_line_22_yuv_mmx
22 _pixops_scale_line_22_yuv_mmx:
29 * p (dest): 12(%ebp) %esi
50 * int x_scaled -24(%ebp)
57 /* Initialize variables */
58 movl 36(%ebp),%eax # destx
60 movl 32(%ebp),%ebx # x
61 movl 12(%ebp),%esi # dest
63 cmpl 28(%ebp),%esi # dest == dest_end ?
70 /* For the body of this loop, %mm0, %mm1, %mm2, %mm3 hold the 4 adjoining
71 * points we are interpolating between, as:
79 * Load current values from pixel 1
81 movl %ebx, %edx # x_scaled = x ...
82 sarl $15, %edx # >> 16
83 andl $-2, %edx # x_scaled *= channels
84 movl %edx, -24(%ebp) # save x_scaled
86 movl 16(%ebp), %edi # get src0
87 movzbl (%edi,%edx), %ecx # current y = src0[ x_scaled ]
89 andl $-4, %edx # x_aligned
91 movl 36(%ebp), %eax # uv_index = dest_x ...
92 andl $1, %eax # ( dest_x & 1 ) ...
94 addl %eax, %edx # x_aligned += uv_index
95 movl %edx, -20(%ebp) # save x_aligned
97 movzbl 1(%edi,%edx), %eax # uv = src0[ x_aligned + 1 ]
98 shll $8, %eax # position uv
99 orl %eax, %ecx # store uv
101 movd %ecx, %mm0 # move to mmx0
104 /* this is the next x, not simply x_scaled again */
105 movl %ebx, %edx # x_scaled = x ...
106 addl 24(%ebp), %edx # + x_step
107 sarl $15, %edx # >> 16
108 andl $-2, %edx # x_scaled *= channels
109 movl %edx, -16(%ebp) # save next x_scaled
111 movzbl (%edi,%edx), %ecx # next y = src0[ x_scaled ]
112 orl %eax, %ecx # store uv
114 movd %ecx, %mm1 # move to mmx1
117 movl 20(%ebp), %edi # get src1
118 movl -24(%ebp), %edx # restore x_scaled
119 movzbl (%edi,%edx), %ecx # current y = src1[ x_scaled ]
121 movl -20(%ebp), %edx # restore x_aligned
122 movzbl 1(%edi,%edx), %eax # uv = src1[ x_aligned + 1 ]
123 shll $8, %eax # position uv
124 orl %eax, %ecx # store uv
126 movd %ecx, %mm2 # move to mmx2
129 movl -16(%ebp), %edx # restore next x_scaled
130 movzbl (%edi,%edx), %ecx # next y = src0[ x_scaled ]
131 orl %eax, %ecx # store uv
133 movd %ecx, %mm3 # move to mmx3
136 /* short *pixel_weights = weights + ((x >> (SCALE_SHIFT - SUBSAMPLE_BITS)) & SUBSAMPLE_MASK) * n_x * n_y
139 movl 8(%ebp), %edi # get weights pointer
144 /* At this point, %edi holds weights. Load the 4 weights into
145 * %mm4,%mm5,%mm6,%mm7, multiply and accumulate.
147 movq (%edi,%eax), %mm4
149 movq 8(%edi,%eax), %mm5
151 movq 16(%edi,%eax), %mm6
153 movq 24(%edi,%eax), %mm7
160 /* %mm7 holds the accumulated sum. Compute (C + 0x80) / 256
163 movl $0x80808080, %eax
169 /* Pack into %eax and store result
174 movb %al, 0(%esi) # dest[ 0 ] = y
176 movb %al, 1(%esi) # dest[ 1 ] = uv
178 addl $2, %esi # dest += 2
180 cmpl %esi,28(%ebp) # if dest == dest_end
183 addl 24(%ebp), %ebx # x += x_step
184 addl $1, 36(%ebp) # dest_x++