annotate i386/snowdsp_mmx.c @ 3210:81cafbc23b8d libavcodec

snow mmx+sse2 optimizations, part 4 Patch by Robert Edele, yartrebo <<at>> earthlink <<dot>> net
author corey
date Tue, 21 Mar 2006 21:51:07 +0000
parents 33110c1008a4
children b77b5e7072d6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3207
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
1 /*
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
2 * MMX and SSE2 optimized snow DSP utils
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
3 * Copyright (c) 2005-2006 Robert Edele <yartrebo@earthlink.net>
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
4 *
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
5 * This library is free software; you can redistribute it and/or
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
6 * modify it under the terms of the GNU Lesser General Public
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
7 * License as published by the Free Software Foundation; either
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
8 * version 2 of the License, or (at your option) any later version.
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
9 *
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
10 * This library is distributed in the hope that it will be useful,
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
13 * Lesser General Public License for more details.
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
14 *
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
15 * You should have received a copy of the GNU Lesser General Public
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
16 * License along with this library; if not, write to the Free Software
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
18 */
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
19
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
20 #include "../avcodec.h"
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
21 #include "../snow.h"
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
22 #include "mmx.h"
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
23
3210
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
24 static void always_inline snow_interleave_line_header(int * i, int width, DWTELEM * low, DWTELEM * high){
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
25 (*i) = (width) - 2;
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
26
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
27 if (width & 1){
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
28 low[(*i)+1] = low[((*i)+1)>>1];
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
29 (*i)--;
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
30 }
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
31 }
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
32
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
33 static void always_inline snow_horizontal_compose_lift_lead_out(int i, DWTELEM * dst, DWTELEM * src, DWTELEM * ref, int width, int w, int lift_high, int mul, int add, int shift){
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
34 for(; i<w; i++){
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
35 dst[i] = src[i] - ((mul * (ref[i] + ref[i + 1]) + add) >> shift);
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
36 }
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
37
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
38 if((width^lift_high)&1){
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
39 dst[w] = src[w] - ((mul * 2 * ref[w] + add) >> shift);
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
40 }
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
41 }
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
42
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
43 static void always_inline snow_horizontal_compose_liftS_lead_out(int i, DWTELEM * dst, DWTELEM * src, DWTELEM * ref, int width, int w){
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
44 for(; i<w; i++){
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
45 dst[i] = src[i] - (((-(ref[i] + ref[(i+1)])+W_BO) - 4 * src[i]) >> W_BS);
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
46 }
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
47
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
48 if(width&1){
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
49 dst[w] = src[w] - (((-2 * ref[w] + W_BO) - 4 * src[w]) >> W_BS);
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
50 }
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
51 }
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
52
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
53 void ff_snow_horizontal_compose97i_sse2(DWTELEM *b, int width){
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
54 const int w2= (width+1)>>1;
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
55 // SSE2 code runs faster with pointers aligned on a 32-byte boundary.
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
56 DWTELEM temp_buf[(width>>1) + 4];
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
57 DWTELEM * const temp = temp_buf + 4 - (((int)temp_buf & 0xF) >> 2);
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
58 const int w_l= (width>>1);
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
59 const int w_r= w2 - 1;
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
60 int i;
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
61
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
62 { // Lift 0
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
63 DWTELEM * const ref = b + w2 - 1;
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
64 DWTELEM b_0 = b[0]; //By allowing the first entry in b[0] to be calculated twice
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
65 // (the first time erroneously), we allow the SSE2 code to run an extra pass.
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
66 // The savings in code and time are well worth having to store this value and
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
67 // calculate b[0] correctly afterwards.
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
68
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
69 i = 0;
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
70 asm volatile(
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
71 "pcmpeqd %%xmm7, %%xmm7 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
72 "pslld $31, %%xmm7 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
73 "psrld $29, %%xmm7 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
74 ::);
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
75 for(; i<w_l-7; i+=8){
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
76 asm volatile(
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
77 "movdqu (%1), %%xmm1 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
78 "movdqu 16(%1), %%xmm5 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
79 "movdqu 4(%1), %%xmm2 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
80 "movdqu 20(%1), %%xmm6 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
81 "paddd %%xmm1, %%xmm2 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
82 "paddd %%xmm5, %%xmm6 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
83 "movdqa %%xmm2, %%xmm0 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
84 "movdqa %%xmm6, %%xmm4 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
85 "paddd %%xmm2, %%xmm2 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
86 "paddd %%xmm6, %%xmm6 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
87 "paddd %%xmm0, %%xmm2 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
88 "paddd %%xmm4, %%xmm6 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
89 "paddd %%xmm7, %%xmm2 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
90 "paddd %%xmm7, %%xmm6 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
91 "psrad $3, %%xmm2 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
92 "psrad $3, %%xmm6 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
93 "movdqa (%0), %%xmm0 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
94 "movdqa 16(%0), %%xmm4 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
95 "psubd %%xmm2, %%xmm0 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
96 "psubd %%xmm6, %%xmm4 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
97 "movdqa %%xmm0, (%0) \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
98 "movdqa %%xmm4, 16(%0) \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
99 :: "r"(&b[i]), "r"(&ref[i])
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
100 : "memory"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
101 );
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
102 }
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
103 snow_horizontal_compose_lift_lead_out(i, b, b, ref, width, w_l, 0, W_DM, W_DO, W_DS);
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
104 b[0] = b_0 - ((W_DM * 2 * ref[1]+W_DO)>>W_DS);
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
105 }
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
106
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
107 { // Lift 1
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
108 DWTELEM * const dst = b+w2;
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
109
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
110 i = 0;
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
111 for(; (((long)&dst[i]) & 0xF) && i<w_r; i++){
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
112 dst[i] = dst[i] - (b[i] + b[i + 1]);
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
113 }
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
114 for(; i<w_r-7; i+=8){
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
115 asm volatile(
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
116 "movdqu (%1), %%xmm1 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
117 "movdqu 16(%1), %%xmm5 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
118 "movdqu 4(%1), %%xmm2 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
119 "movdqu 20(%1), %%xmm6 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
120 "paddd %%xmm1, %%xmm2 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
121 "paddd %%xmm5, %%xmm6 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
122 "movdqa (%0), %%xmm0 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
123 "movdqa 16(%0), %%xmm4 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
124 "psubd %%xmm2, %%xmm0 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
125 "psubd %%xmm6, %%xmm4 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
126 "movdqa %%xmm0, (%0) \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
127 "movdqa %%xmm4, 16(%0) \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
128 :: "r"(&dst[i]), "r"(&b[i])
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
129 : "memory"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
130 );
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
131 }
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
132 snow_horizontal_compose_lift_lead_out(i, dst, dst, b, width, w_r, 1, W_CM, W_CO, W_CS);
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
133 }
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
134
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
135 { // Lift 2
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
136 DWTELEM * const ref = b+w2 - 1;
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
137 DWTELEM b_0 = b[0];
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
138
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
139 i = 0;
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
140 asm volatile(
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
141 "pslld $1, %%xmm7 \n\t" /* xmm7 already holds a '4' from 2 lifts ago. */
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
142 ::);
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
143 for(; i<w_l-7; i+=8){
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
144 asm volatile(
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
145 "movdqu (%1), %%xmm1 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
146 "movdqu 16(%1), %%xmm5 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
147 "movdqu 4(%1), %%xmm0 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
148 "movdqu 20(%1), %%xmm4 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
149 "paddd %%xmm1, %%xmm0 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
150 "paddd %%xmm5, %%xmm4 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
151 "movdqa %%xmm7, %%xmm1 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
152 "movdqa %%xmm7, %%xmm5 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
153 "psubd %%xmm0, %%xmm1 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
154 "psubd %%xmm4, %%xmm5 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
155 "movdqa (%0), %%xmm0 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
156 "movdqa 16(%0), %%xmm4 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
157 "pslld $2, %%xmm0 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
158 "pslld $2, %%xmm4 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
159 "psubd %%xmm0, %%xmm1 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
160 "psubd %%xmm4, %%xmm5 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
161 "psrad $4, %%xmm1 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
162 "psrad $4, %%xmm5 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
163 "movdqa (%0), %%xmm0 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
164 "movdqa 16(%0), %%xmm4 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
165 "psubd %%xmm1, %%xmm0 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
166 "psubd %%xmm5, %%xmm4 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
167 "movdqa %%xmm0, (%0) \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
168 "movdqa %%xmm4, 16(%0) \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
169 :: "r"(&b[i]), "r"(&ref[i])
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
170 : "memory"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
171 );
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
172 }
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
173 snow_horizontal_compose_liftS_lead_out(i, b, b, ref, width, w_l);
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
174 b[0] = b_0 - (((-2 * ref[1] + W_BO) - 4 * b_0) >> W_BS);
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
175 }
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
176
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
177 { // Lift 3
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
178 DWTELEM * const src = b+w2;
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
179
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
180 i = 0;
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
181 for(; (((long)&temp[i]) & 0xF) && i<w_r; i++){
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
182 temp[i] = src[i] - ((-W_AM*(b[i] + b[i+1]))>>W_AS);
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
183 }
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
184 for(; i<w_r-7; i+=8){
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
185 asm volatile(
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
186 "movdqu 4(%1), %%xmm2 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
187 "movdqu 20(%1), %%xmm6 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
188 "paddd (%1), %%xmm2 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
189 "paddd 16(%1), %%xmm6 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
190 "movdqa %%xmm2, %%xmm0 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
191 "movdqa %%xmm6, %%xmm4 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
192 "pslld $2, %%xmm2 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
193 "pslld $2, %%xmm6 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
194 "psubd %%xmm2, %%xmm0 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
195 "psubd %%xmm6, %%xmm4 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
196 "psrad $1, %%xmm0 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
197 "psrad $1, %%xmm4 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
198 "movdqu (%0), %%xmm2 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
199 "movdqu 16(%0), %%xmm6 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
200 "psubd %%xmm0, %%xmm2 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
201 "psubd %%xmm4, %%xmm6 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
202 "movdqa %%xmm2, (%2) \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
203 "movdqa %%xmm6, 16(%2) \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
204 :: "r"(&src[i]), "r"(&b[i]), "r"(&temp[i])
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
205 : "memory"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
206 );
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
207 }
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
208 snow_horizontal_compose_lift_lead_out(i, temp, src, b, width, w_r, 1, -W_AM, W_AO, W_AS);
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
209 }
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
210
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
211 {
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
212 snow_interleave_line_header(&i, width, b, temp);
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
213
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
214 for (; (i & 0x1E) != 0x1E; i-=2){
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
215 b[i+1] = temp[i>>1];
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
216 b[i] = b[i>>1];
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
217 }
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
218 for (i-=30; i>=0; i-=32){
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
219 asm volatile(
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
220 "movdqa (%1), %%xmm0 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
221 "movdqa 16(%1), %%xmm2 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
222 "movdqa 32(%1), %%xmm4 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
223 "movdqa 48(%1), %%xmm6 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
224 "movdqa (%1), %%xmm1 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
225 "movdqa 16(%1), %%xmm3 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
226 "movdqa 32(%1), %%xmm5 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
227 "movdqa 48(%1), %%xmm7 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
228 "punpckldq (%2), %%xmm0 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
229 "punpckldq 16(%2), %%xmm2 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
230 "punpckldq 32(%2), %%xmm4 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
231 "punpckldq 48(%2), %%xmm6 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
232 "movdqa %%xmm0, (%0) \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
233 "movdqa %%xmm2, 32(%0) \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
234 "movdqa %%xmm4, 64(%0) \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
235 "movdqa %%xmm6, 96(%0) \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
236 "punpckhdq (%2), %%xmm1 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
237 "punpckhdq 16(%2), %%xmm3 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
238 "punpckhdq 32(%2), %%xmm5 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
239 "punpckhdq 48(%2), %%xmm7 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
240 "movdqa %%xmm1, 16(%0) \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
241 "movdqa %%xmm3, 48(%0) \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
242 "movdqa %%xmm5, 80(%0) \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
243 "movdqa %%xmm7, 112(%0) \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
244 :: "r"(&(b)[i]), "r"(&(b)[i>>1]), "r"(&(temp)[i>>1])
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
245 : "memory"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
246 );
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
247 }
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
248 }
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
249 }
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
250
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
251 void ff_snow_horizontal_compose97i_mmx(DWTELEM *b, int width){
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
252 const int w2= (width+1)>>1;
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
253 DWTELEM temp[width >> 1];
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
254 const int w_l= (width>>1);
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
255 const int w_r= w2 - 1;
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
256 int i;
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
257
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
258 { // Lift 0
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
259 DWTELEM * const ref = b + w2 - 1;
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
260
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
261 i = 1;
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
262 b[0] = b[0] - ((W_DM * 2 * ref[1]+W_DO)>>W_DS);
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
263 asm volatile(
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
264 "pcmpeqd %%mm7, %%mm7 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
265 "pslld $31, %%mm7 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
266 "psrld $29, %%mm7 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
267 ::);
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
268 for(; i<w_l-3; i+=4){
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
269 asm volatile(
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
270 "movq (%1), %%mm2 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
271 "movq 8(%1), %%mm6 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
272 "paddd 4(%1), %%mm2 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
273 "paddd 12(%1), %%mm6 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
274 "movq %%mm2, %%mm0 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
275 "movq %%mm6, %%mm4 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
276 "paddd %%mm2, %%mm2 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
277 "paddd %%mm6, %%mm6 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
278 "paddd %%mm0, %%mm2 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
279 "paddd %%mm4, %%mm6 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
280 "paddd %%mm7, %%mm2 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
281 "paddd %%mm7, %%mm6 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
282 "psrad $3, %%mm2 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
283 "psrad $3, %%mm6 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
284 "movq (%0), %%mm0 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
285 "movq 8(%0), %%mm4 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
286 "psubd %%mm2, %%mm0 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
287 "psubd %%mm6, %%mm4 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
288 "movq %%mm0, (%0) \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
289 "movq %%mm4, 8(%0) \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
290 :: "r"(&b[i]), "r"(&ref[i])
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
291 : "memory"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
292 );
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
293 }
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
294 snow_horizontal_compose_lift_lead_out(i, b, b, ref, width, w_l, 0, W_DM, W_DO, W_DS);
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
295 }
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
296
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
297 { // Lift 1
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
298 DWTELEM * const dst = b+w2;
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
299
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
300 i = 0;
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
301 for(; i<w_r-3; i+=4){
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
302 asm volatile(
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
303 "movq (%1), %%mm2 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
304 "movq 8(%1), %%mm6 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
305 "paddd 4(%1), %%mm2 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
306 "paddd 12(%1), %%mm6 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
307 "movq (%0), %%mm0 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
308 "movq 8(%0), %%mm4 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
309 "psubd %%mm2, %%mm0 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
310 "psubd %%mm6, %%mm4 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
311 "movq %%mm0, (%0) \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
312 "movq %%mm4, 8(%0) \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
313 :: "r"(&dst[i]), "r"(&b[i])
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
314 : "memory"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
315 );
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
316 }
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
317 snow_horizontal_compose_lift_lead_out(i, dst, dst, b, width, w_r, 1, W_CM, W_CO, W_CS);
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
318 }
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
319
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
320 { // Lift 2
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
321 DWTELEM * const ref = b+w2 - 1;
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
322
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
323 i = 1;
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
324 b[0] = b[0] - (((-2 * ref[1] + W_BO) - 4 * b[0]) >> W_BS);
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
325 asm volatile(
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
326 "pslld $1, %%mm7 \n\t" /* xmm7 already holds a '4' from 2 lifts ago. */
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
327 ::);
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
328 for(; i<w_l-3; i+=4){
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
329 asm volatile(
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
330 "movq (%1), %%mm0 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
331 "movq 8(%1), %%mm4 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
332 "paddd 4(%1), %%mm0 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
333 "paddd 12(%1), %%mm4 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
334 "movq %%mm7, %%mm1 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
335 "movq %%mm7, %%mm5 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
336 "psubd %%mm0, %%mm1 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
337 "psubd %%mm4, %%mm5 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
338 "movq (%0), %%mm0 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
339 "movq 8(%0), %%mm4 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
340 "pslld $2, %%mm0 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
341 "pslld $2, %%mm4 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
342 "psubd %%mm0, %%mm1 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
343 "psubd %%mm4, %%mm5 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
344 "psrad $4, %%mm1 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
345 "psrad $4, %%mm5 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
346 "movq (%0), %%mm0 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
347 "movq 8(%0), %%mm4 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
348 "psubd %%mm1, %%mm0 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
349 "psubd %%mm5, %%mm4 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
350 "movq %%mm0, (%0) \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
351 "movq %%mm4, 8(%0) \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
352 :: "r"(&b[i]), "r"(&ref[i])
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
353 : "memory"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
354 );
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
355 }
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
356 snow_horizontal_compose_liftS_lead_out(i, b, b, ref, width, w_l);
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
357 }
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
358
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
359 { // Lift 3
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
360 DWTELEM * const src = b+w2;
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
361 i = 0;
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
362
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
363 for(; i<w_r-3; i+=4){
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
364 asm volatile(
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
365 "movq 4(%1), %%mm2 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
366 "movq 12(%1), %%mm6 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
367 "paddd (%1), %%mm2 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
368 "paddd 8(%1), %%mm6 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
369 "movq %%mm2, %%mm0 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
370 "movq %%mm6, %%mm4 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
371 "pslld $2, %%mm2 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
372 "pslld $2, %%mm6 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
373 "psubd %%mm2, %%mm0 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
374 "psubd %%mm6, %%mm4 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
375 "psrad $1, %%mm0 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
376 "psrad $1, %%mm4 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
377 "movq (%0), %%mm2 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
378 "movq 8(%0), %%mm6 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
379 "psubd %%mm0, %%mm2 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
380 "psubd %%mm4, %%mm6 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
381 "movq %%mm2, (%2) \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
382 "movq %%mm6, 8(%2) \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
383 :: "r"(&src[i]), "r"(&b[i]), "r"(&temp[i])
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
384 : "memory"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
385 );
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
386 }
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
387 snow_horizontal_compose_lift_lead_out(i, temp, src, b, width, w_r, 1, -W_AM, W_AO, W_AS);
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
388 }
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
389
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
390 {
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
391 snow_interleave_line_header(&i, width, b, temp);
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
392
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
393 for (; (i & 0xE) != 0xE; i-=2){
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
394 b[i+1] = temp[i>>1];
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
395 b[i] = b[i>>1];
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
396 }
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
397 for (i-=14; i>=0; i-=16){
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
398 asm volatile(
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
399 "movq (%1), %%mm0 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
400 "movq 8(%1), %%mm2 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
401 "movq 16(%1), %%mm4 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
402 "movq 24(%1), %%mm6 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
403 "movq (%1), %%mm1 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
404 "movq 8(%1), %%mm3 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
405 "movq 16(%1), %%mm5 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
406 "movq 24(%1), %%mm7 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
407 "punpckldq (%2), %%mm0 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
408 "punpckldq 8(%2), %%mm2 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
409 "punpckldq 16(%2), %%mm4 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
410 "punpckldq 24(%2), %%mm6 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
411 "movq %%mm0, (%0) \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
412 "movq %%mm2, 16(%0) \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
413 "movq %%mm4, 32(%0) \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
414 "movq %%mm6, 48(%0) \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
415 "punpckhdq (%2), %%mm1 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
416 "punpckhdq 8(%2), %%mm3 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
417 "punpckhdq 16(%2), %%mm5 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
418 "punpckhdq 24(%2), %%mm7 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
419 "movq %%mm1, 8(%0) \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
420 "movq %%mm3, 24(%0) \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
421 "movq %%mm5, 40(%0) \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
422 "movq %%mm7, 56(%0) \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
423 :: "r"(&b[i]), "r"(&b[i>>1]), "r"(&temp[i>>1])
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
424 : "memory"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
425 );
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
426 }
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
427 }
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
428 }
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
429
3207
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
430 #define snow_vertical_compose_sse2_load_add(op,r,t0,t1,t2,t3)\
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
431 ""op" (%%"r",%%"REG_d",4), %%"t0" \n\t"\
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
432 ""op" 16(%%"r",%%"REG_d",4), %%"t1" \n\t"\
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
433 ""op" 32(%%"r",%%"REG_d",4), %%"t2" \n\t"\
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
434 ""op" 48(%%"r",%%"REG_d",4), %%"t3" \n\t"
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
435
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
436 #define snow_vertical_compose_sse2_load(r,t0,t1,t2,t3)\
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
437 snow_vertical_compose_sse2_load_add("movdqa",r,t0,t1,t2,t3)
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
438
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
439 #define snow_vertical_compose_sse2_add(r,t0,t1,t2,t3)\
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
440 snow_vertical_compose_sse2_load_add("paddd",r,t0,t1,t2,t3)
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
441
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
442 #define snow_vertical_compose_sse2_sub(s0,s1,s2,s3,t0,t1,t2,t3)\
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
443 "psubd %%"s0", %%"t0" \n\t"\
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
444 "psubd %%"s1", %%"t1" \n\t"\
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
445 "psubd %%"s2", %%"t2" \n\t"\
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
446 "psubd %%"s3", %%"t3" \n\t"
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
447
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
448 #define snow_vertical_compose_sse2_store(w,s0,s1,s2,s3)\
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
449 "movdqa %%"s0", (%%"w",%%"REG_d",4) \n\t"\
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
450 "movdqa %%"s1", 16(%%"w",%%"REG_d",4) \n\t"\
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
451 "movdqa %%"s2", 32(%%"w",%%"REG_d",4) \n\t"\
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
452 "movdqa %%"s3", 48(%%"w",%%"REG_d",4) \n\t"
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
453
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
454 #define snow_vertical_compose_sse2_sra(n,t0,t1,t2,t3)\
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
455 "psrad $"n", %%"t0" \n\t"\
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
456 "psrad $"n", %%"t1" \n\t"\
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
457 "psrad $"n", %%"t2" \n\t"\
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
458 "psrad $"n", %%"t3" \n\t"
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
459
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
460 #define snow_vertical_compose_sse2_r2r_add(s0,s1,s2,s3,t0,t1,t2,t3)\
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
461 "paddd %%"s0", %%"t0" \n\t"\
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
462 "paddd %%"s1", %%"t1" \n\t"\
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
463 "paddd %%"s2", %%"t2" \n\t"\
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
464 "paddd %%"s3", %%"t3" \n\t"
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
465
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
466 #define snow_vertical_compose_sse2_sll(n,t0,t1,t2,t3)\
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
467 "pslld $"n", %%"t0" \n\t"\
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
468 "pslld $"n", %%"t1" \n\t"\
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
469 "pslld $"n", %%"t2" \n\t"\
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
470 "pslld $"n", %%"t3" \n\t"
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
471
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
472 #define snow_vertical_compose_sse2_move(s0,s1,s2,s3,t0,t1,t2,t3)\
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
473 "movdqa %%"s0", %%"t0" \n\t"\
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
474 "movdqa %%"s1", %%"t1" \n\t"\
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
475 "movdqa %%"s2", %%"t2" \n\t"\
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
476 "movdqa %%"s3", %%"t3" \n\t"
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
477
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
478 void ff_snow_vertical_compose97i_sse2(DWTELEM *b0, DWTELEM *b1, DWTELEM *b2, DWTELEM *b3, DWTELEM *b4, DWTELEM *b5, int width){
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
479 long i = width;
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
480
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
481 while(i & 0xF)
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
482 {
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
483 i--;
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
484 b4[i] -= (W_DM*(b3[i] + b5[i])+W_DO)>>W_DS;
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
485 b3[i] -= (W_CM*(b2[i] + b4[i])+W_CO)>>W_CS;
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
486 b2[i] += (W_BM*(b1[i] + b3[i])+4*b2[i]+W_BO)>>W_BS;
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
487 b1[i] += (W_AM*(b0[i] + b2[i])+W_AO)>>W_AS;
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
488 }
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
489
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
490 asm volatile (
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
491 "jmp 2f \n\t"
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
492 "1: \n\t"
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
493
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
494 "mov %6, %%"REG_a" \n\t"
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
495 "mov %4, %%"REG_b" \n\t"
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
496
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
497 snow_vertical_compose_sse2_load(REG_b,"xmm0","xmm2","xmm4","xmm6")
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
498 snow_vertical_compose_sse2_add(REG_a,"xmm0","xmm2","xmm4","xmm6")
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
499 snow_vertical_compose_sse2_move("xmm0","xmm2","xmm4","xmm6","xmm1","xmm3","xmm5","xmm7")
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
500 snow_vertical_compose_sse2_sll("1","xmm0","xmm2","xmm4","xmm6")\
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
501 snow_vertical_compose_sse2_r2r_add("xmm1","xmm3","xmm5","xmm7","xmm0","xmm2","xmm4","xmm6")
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
502
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
503 "pcmpeqd %%xmm1, %%xmm1 \n\t"
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
504 "pslld $31, %%xmm1 \n\t"
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
505 "psrld $29, %%xmm1 \n\t"
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
506 "mov %5, %%"REG_a" \n\t"
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
507
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
508 snow_vertical_compose_sse2_r2r_add("xmm1","xmm1","xmm1","xmm1","xmm0","xmm2","xmm4","xmm6")
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
509 snow_vertical_compose_sse2_sra("3","xmm0","xmm2","xmm4","xmm6")
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
510 snow_vertical_compose_sse2_load(REG_a,"xmm1","xmm3","xmm5","xmm7")
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
511 snow_vertical_compose_sse2_sub("xmm0","xmm2","xmm4","xmm6","xmm1","xmm3","xmm5","xmm7")
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
512 snow_vertical_compose_sse2_store(REG_a,"xmm1","xmm3","xmm5","xmm7")
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
513 "mov %3, %%"REG_c" \n\t"
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
514 snow_vertical_compose_sse2_load(REG_b,"xmm0","xmm2","xmm4","xmm6")
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
515 snow_vertical_compose_sse2_add(REG_c,"xmm1","xmm3","xmm5","xmm7")
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
516 snow_vertical_compose_sse2_sub("xmm1","xmm3","xmm5","xmm7","xmm0","xmm2","xmm4","xmm6")
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
517 snow_vertical_compose_sse2_store(REG_b,"xmm0","xmm2","xmm4","xmm6")
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
518 "mov %2, %%"REG_a" \n\t"
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
519 snow_vertical_compose_sse2_load(REG_c,"xmm1","xmm3","xmm5","xmm7")
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
520 snow_vertical_compose_sse2_add(REG_a,"xmm0","xmm2","xmm4","xmm6")
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
521 snow_vertical_compose_sse2_sll("2","xmm1","xmm3","xmm5","xmm7")\
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
522 snow_vertical_compose_sse2_r2r_add("xmm1","xmm3","xmm5","xmm7","xmm0","xmm2","xmm4","xmm6")
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
523
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
524 "pcmpeqd %%xmm1, %%xmm1 \n\t"
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
525 "pslld $31, %%xmm1 \n\t"
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
526 "psrld $28, %%xmm1 \n\t"
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
527 "mov %1, %%"REG_b" \n\t"
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
528
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
529 snow_vertical_compose_sse2_r2r_add("xmm1","xmm1","xmm1","xmm1","xmm0","xmm2","xmm4","xmm6")
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
530 snow_vertical_compose_sse2_sra("4","xmm0","xmm2","xmm4","xmm6")
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
531 snow_vertical_compose_sse2_add(REG_c,"xmm0","xmm2","xmm4","xmm6")
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
532 snow_vertical_compose_sse2_store(REG_c,"xmm0","xmm2","xmm4","xmm6")
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
533 snow_vertical_compose_sse2_add(REG_b,"xmm0","xmm2","xmm4","xmm6")
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
534 snow_vertical_compose_sse2_move("xmm0","xmm2","xmm4","xmm6","xmm1","xmm3","xmm5","xmm7")
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
535 snow_vertical_compose_sse2_sll("1","xmm0","xmm2","xmm4","xmm6")\
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
536 snow_vertical_compose_sse2_r2r_add("xmm1","xmm3","xmm5","xmm7","xmm0","xmm2","xmm4","xmm6")
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
537 snow_vertical_compose_sse2_sra("1","xmm0","xmm2","xmm4","xmm6")
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
538 snow_vertical_compose_sse2_add(REG_a,"xmm0","xmm2","xmm4","xmm6")
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
539 snow_vertical_compose_sse2_store(REG_a,"xmm0","xmm2","xmm4","xmm6")
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
540
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
541 "2: \n\t"
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
542 "sub $16, %%"REG_d" \n\t"
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
543 "jge 1b \n\t"
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
544 :"+d"(i)
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
545 :
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
546 "m"(b0),"m"(b1),"m"(b2),"m"(b3),"m"(b4),"m"(b5):
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
547 "%"REG_a"","%"REG_b"","%"REG_c"");
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
548 }
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
549
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
550 #define snow_vertical_compose_mmx_load_add(op,r,t0,t1,t2,t3)\
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
551 ""op" (%%"r",%%"REG_d",4), %%"t0" \n\t"\
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
552 ""op" 8(%%"r",%%"REG_d",4), %%"t1" \n\t"\
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
553 ""op" 16(%%"r",%%"REG_d",4), %%"t2" \n\t"\
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
554 ""op" 24(%%"r",%%"REG_d",4), %%"t3" \n\t"
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
555
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
556 #define snow_vertical_compose_mmx_load(r,t0,t1,t2,t3)\
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
557 snow_vertical_compose_mmx_load_add("movq",r,t0,t1,t2,t3)
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
558
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
559 #define snow_vertical_compose_mmx_add(r,t0,t1,t2,t3)\
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
560 snow_vertical_compose_mmx_load_add("paddd",r,t0,t1,t2,t3)
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
561
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
562 #define snow_vertical_compose_mmx_sub(s0,s1,s2,s3,t0,t1,t2,t3)\
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
563 snow_vertical_compose_sse2_sub(s0,s1,s2,s3,t0,t1,t2,t3)
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
564
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
565 #define snow_vertical_compose_mmx_store(w,s0,s1,s2,s3)\
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
566 "movq %%"s0", (%%"w",%%"REG_d",4) \n\t"\
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
567 "movq %%"s1", 8(%%"w",%%"REG_d",4) \n\t"\
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
568 "movq %%"s2", 16(%%"w",%%"REG_d",4) \n\t"\
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
569 "movq %%"s3", 24(%%"w",%%"REG_d",4) \n\t"
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
570
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
571 #define snow_vertical_compose_mmx_sra(n,t0,t1,t2,t3)\
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
572 snow_vertical_compose_sse2_sra(n,t0,t1,t2,t3)
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
573
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
574 #define snow_vertical_compose_mmx_r2r_add(s0,s1,s2,s3,t0,t1,t2,t3)\
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
575 snow_vertical_compose_sse2_r2r_add(s0,s1,s2,s3,t0,t1,t2,t3)
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
576
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
577 #define snow_vertical_compose_mmx_sll(n,t0,t1,t2,t3)\
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
578 snow_vertical_compose_sse2_sll(n,t0,t1,t2,t3)
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
579
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
580 #define snow_vertical_compose_mmx_move(s0,s1,s2,s3,t0,t1,t2,t3)\
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
581 "movq %%"s0", %%"t0" \n\t"\
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
582 "movq %%"s1", %%"t1" \n\t"\
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
583 "movq %%"s2", %%"t2" \n\t"\
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
584 "movq %%"s3", %%"t3" \n\t"
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
585
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
586 void ff_snow_vertical_compose97i_mmx(DWTELEM *b0, DWTELEM *b1, DWTELEM *b2, DWTELEM *b3, DWTELEM *b4, DWTELEM *b5, int width){
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
587 long i = width;
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
588 while(i & 0x7)
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
589 {
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
590 i--;
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
591 b4[i] -= (W_DM*(b3[i] + b5[i])+W_DO)>>W_DS;
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
592 b3[i] -= (W_CM*(b2[i] + b4[i])+W_CO)>>W_CS;
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
593 b2[i] += (W_BM*(b1[i] + b3[i])+4*b2[i]+W_BO)>>W_BS;
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
594 b1[i] += (W_AM*(b0[i] + b2[i])+W_AO)>>W_AS;
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
595 }
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
596
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
597 asm volatile(
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
598 "jmp 2f \n\t"
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
599 "1: \n\t"
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
600
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
601 "mov %6, %%"REG_a" \n\t"
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
602 "mov %4, %%"REG_b" \n\t"
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
603
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
604 snow_vertical_compose_mmx_load(REG_b,"mm0","mm2","mm4","mm6")
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
605 snow_vertical_compose_mmx_add(REG_a,"mm0","mm2","mm4","mm6")
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
606 snow_vertical_compose_mmx_move("mm0","mm2","mm4","mm6","mm1","mm3","mm5","mm7")
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
607 snow_vertical_compose_mmx_sll("1","mm0","mm2","mm4","mm6")
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
608 snow_vertical_compose_mmx_r2r_add("mm1","mm3","mm5","mm7","mm0","mm2","mm4","mm6")
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
609
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
610 "pcmpeqd %%mm1, %%mm1 \n\t"
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
611 "pslld $31, %%mm1 \n\t"
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
612 "psrld $29, %%mm1 \n\t"
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
613 "mov %5, %%"REG_a" \n\t"
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
614
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
615 snow_vertical_compose_mmx_r2r_add("mm1","mm1","mm1","mm1","mm0","mm2","mm4","mm6")
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
616 snow_vertical_compose_mmx_sra("3","mm0","mm2","mm4","mm6")
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
617 snow_vertical_compose_mmx_load(REG_a,"mm1","mm3","mm5","mm7")
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
618 snow_vertical_compose_mmx_sub("mm0","mm2","mm4","mm6","mm1","mm3","mm5","mm7")
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
619 snow_vertical_compose_mmx_store(REG_a,"mm1","mm3","mm5","mm7")
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
620 "mov %3, %%"REG_c" \n\t"
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
621 snow_vertical_compose_mmx_load(REG_b,"mm0","mm2","mm4","mm6")
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
622 snow_vertical_compose_mmx_add(REG_c,"mm1","mm3","mm5","mm7")
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
623 snow_vertical_compose_mmx_sub("mm1","mm3","mm5","mm7","mm0","mm2","mm4","mm6")
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
624 snow_vertical_compose_mmx_store(REG_b,"mm0","mm2","mm4","mm6")
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
625 "mov %2, %%"REG_a" \n\t"
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
626 snow_vertical_compose_mmx_load(REG_c,"mm1","mm3","mm5","mm7")
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
627 snow_vertical_compose_mmx_add(REG_a,"mm0","mm2","mm4","mm6")
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
628 snow_vertical_compose_mmx_sll("2","mm1","mm3","mm5","mm7")
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
629 snow_vertical_compose_mmx_r2r_add("mm1","mm3","mm5","mm7","mm0","mm2","mm4","mm6")
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
630
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
631 "pcmpeqd %%mm1, %%mm1 \n\t"
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
632 "pslld $31, %%mm1 \n\t"
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
633 "psrld $28, %%mm1 \n\t"
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
634 "mov %1, %%"REG_b" \n\t"
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
635
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
636 snow_vertical_compose_mmx_r2r_add("mm1","mm1","mm1","mm1","mm0","mm2","mm4","mm6")
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
637 snow_vertical_compose_mmx_sra("4","mm0","mm2","mm4","mm6")
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
638 snow_vertical_compose_mmx_add(REG_c,"mm0","mm2","mm4","mm6")
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
639 snow_vertical_compose_mmx_store(REG_c,"mm0","mm2","mm4","mm6")
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
640 snow_vertical_compose_mmx_add(REG_b,"mm0","mm2","mm4","mm6")
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
641 snow_vertical_compose_mmx_move("mm0","mm2","mm4","mm6","mm1","mm3","mm5","mm7")
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
642 snow_vertical_compose_mmx_sll("1","mm0","mm2","mm4","mm6")
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
643 snow_vertical_compose_mmx_r2r_add("mm1","mm3","mm5","mm7","mm0","mm2","mm4","mm6")
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
644 snow_vertical_compose_mmx_sra("1","mm0","mm2","mm4","mm6")
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
645 snow_vertical_compose_mmx_add(REG_a,"mm0","mm2","mm4","mm6")
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
646 snow_vertical_compose_mmx_store(REG_a,"mm0","mm2","mm4","mm6")
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
647
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
648 "2: \n\t"
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
649 "sub $8, %%"REG_d" \n\t"
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
650 "jge 1b \n\t"
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
651 :"+d"(i)
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
652 :
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
653 "m"(b0),"m"(b1),"m"(b2),"m"(b3),"m"(b4),"m"(b5):
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
654 "%"REG_a"","%"REG_b"","%"REG_c"");
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
655 }