annotate i386/snowdsp_mmx.c @ 5594:384629ebcb93 libavcodec

avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum (patch for plain mmx support is welcome ...)
author michael
date Sun, 26 Aug 2007 01:11:02 +0000
parents bd015f9ea964
children 9da9e00a04a5
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 *
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3566
diff changeset
5 * This file is part of FFmpeg.
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3566
diff changeset
6 *
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3566
diff changeset
7 * FFmpeg is free software; you can redistribute it and/or
3207
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
8 * 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
9 * License as published by the Free Software Foundation; either
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3566
diff changeset
10 * version 2.1 of the License, or (at your option) any later version.
3207
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
11 *
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3566
diff changeset
12 * FFmpeg is distributed in the hope that it will be useful,
3207
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
13 * 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
14 * 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
15 * Lesser General Public License for more details.
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
16 *
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
17 * You should have received a copy of the GNU Lesser General Public
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3566
diff changeset
18 * License along with FFmpeg; if not, write to the Free Software
3207
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
19 * 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
20 */
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
21
5010
d5ba514e3f4a Add libavcodec to compiler include flags in order to simplify header
diego
parents: 4436
diff changeset
22 #include "avcodec.h"
d5ba514e3f4a Add libavcodec to compiler include flags in order to simplify header
diego
parents: 4436
diff changeset
23 #include "snow.h"
3398
e0927bc44a10 Move REG_* macros from libavcodec/i386/mmx.h to libavutil/x86_cpu.h
lucabe
parents: 3265
diff changeset
24 #include "x86_cpu.h"
3207
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
25
5591
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
26 void ff_snow_horizontal_compose97i_sse2(IDWTELEM *b, int width){
3210
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
27 const int w2= (width+1)>>1;
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
28 // SSE2 code runs faster with pointers aligned on a 32-byte boundary.
5591
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
29 IDWTELEM temp_buf[(width>>1) + 4];
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
30 IDWTELEM * const temp = temp_buf + 4 - (((int)temp_buf & 0xF) >> 2);
3210
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
31 const int w_l= (width>>1);
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
32 const int w_r= w2 - 1;
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
33 int i;
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
34
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
35 { // Lift 0
5591
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
36 IDWTELEM * const ref = b + w2 - 1;
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
37 IDWTELEM b_0 = b[0]; //By allowing the first entry in b[0] to be calculated twice
3210
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
38 // (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
39 // 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
40 // calculate b[0] correctly afterwards.
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 i = 0;
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
43 asm volatile(
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
44 "pcmpeqd %%xmm7, %%xmm7 \n\t"
5591
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
45 "psllw $15, %%xmm7 \n\t"
5593
bd015f9ea964 avoid an overflow in the 1 horizontal lifting step
michael
parents: 5592
diff changeset
46 "psrlw $14, %%xmm7 \n\t"
3210
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
47 ::);
5591
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
48 for(; i<w_l-15; i+=16){
3210
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
49 asm volatile(
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
50 "movdqu (%1), %%xmm1 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
51 "movdqu 16(%1), %%xmm5 \n\t"
5591
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
52 "movdqu 2(%1), %%xmm2 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
53 "movdqu 18(%1), %%xmm6 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
54 "paddw %%xmm1, %%xmm2 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
55 "paddw %%xmm5, %%xmm6 \n\t"
3210
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
56 "movdqa %%xmm2, %%xmm0 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
57 "movdqa %%xmm6, %%xmm4 \n\t"
5593
bd015f9ea964 avoid an overflow in the 1 horizontal lifting step
michael
parents: 5592
diff changeset
58 "psraw $1, %%xmm0 \n\t"
bd015f9ea964 avoid an overflow in the 1 horizontal lifting step
michael
parents: 5592
diff changeset
59 "psraw $1, %%xmm4 \n\t"
5591
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
60 "paddw %%xmm0, %%xmm2 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
61 "paddw %%xmm4, %%xmm6 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
62 "paddw %%xmm7, %%xmm2 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
63 "paddw %%xmm7, %%xmm6 \n\t"
5593
bd015f9ea964 avoid an overflow in the 1 horizontal lifting step
michael
parents: 5592
diff changeset
64 "psraw $2, %%xmm2 \n\t"
bd015f9ea964 avoid an overflow in the 1 horizontal lifting step
michael
parents: 5592
diff changeset
65 "psraw $2, %%xmm6 \n\t"
3210
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
66 "movdqa (%0), %%xmm0 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
67 "movdqa 16(%0), %%xmm4 \n\t"
5591
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
68 "psubw %%xmm2, %%xmm0 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
69 "psubw %%xmm6, %%xmm4 \n\t"
3210
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
70 "movdqa %%xmm0, (%0) \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
71 "movdqa %%xmm4, 16(%0) \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
72 :: "r"(&b[i]), "r"(&ref[i])
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
73 : "memory"
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 }
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
76 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
77 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
78 }
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
79
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
80 { // Lift 1
5591
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
81 IDWTELEM * const dst = b+w2;
3210
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
82
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
83 i = 0;
5591
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
84 for(; (((long)&dst[i]) & 0x1F) && i<w_r; i++){
3210
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
85 dst[i] = dst[i] - (b[i] + b[i + 1]);
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
86 }
5591
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
87 for(; i<w_r-15; i+=16){
3210
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
88 asm volatile(
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
89 "movdqu (%1), %%xmm1 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
90 "movdqu 16(%1), %%xmm5 \n\t"
5591
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
91 "movdqu 2(%1), %%xmm2 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
92 "movdqu 18(%1), %%xmm6 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
93 "paddw %%xmm1, %%xmm2 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
94 "paddw %%xmm5, %%xmm6 \n\t"
3210
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
95 "movdqa (%0), %%xmm0 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
96 "movdqa 16(%0), %%xmm4 \n\t"
5591
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
97 "psubw %%xmm2, %%xmm0 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
98 "psubw %%xmm6, %%xmm4 \n\t"
3210
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
99 "movdqa %%xmm0, (%0) \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
100 "movdqa %%xmm4, 16(%0) \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
101 :: "r"(&dst[i]), "r"(&b[i])
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
102 : "memory"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
103 );
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
104 }
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
105 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
106 }
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
107
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
108 { // Lift 2
5591
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
109 IDWTELEM * const ref = b+w2 - 1;
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
110 IDWTELEM b_0 = b[0];
3210
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
111
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
112 i = 0;
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
113 asm volatile(
5594
384629ebcb93 avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents: 5593
diff changeset
114 "psllw $13, %%xmm7 \n\t"
384629ebcb93 avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents: 5593
diff changeset
115 "pcmpeqw %%xmm6, %%xmm6 \n\t"
384629ebcb93 avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents: 5593
diff changeset
116 "psrlw $13, %%xmm6 \n\t"
384629ebcb93 avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents: 5593
diff changeset
117 "paddw %%xmm7, %%xmm6 \n\t"
3210
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
118 ::);
5591
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
119 for(; i<w_l-15; i+=16){
3210
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
120 asm volatile(
5594
384629ebcb93 avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents: 5593
diff changeset
121 "movdqu (%1), %%xmm0 \n\t"
384629ebcb93 avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents: 5593
diff changeset
122 "movdqu 16(%1), %%xmm4 \n\t"
384629ebcb93 avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents: 5593
diff changeset
123 "movdqu 2(%1), %%xmm1 \n\t"
384629ebcb93 avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents: 5593
diff changeset
124 "movdqu 18(%1), %%xmm5 \n\t" //FIXME try aligned reads and shifts
384629ebcb93 avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents: 5593
diff changeset
125 "paddw %%xmm6, %%xmm0 \n\t"
384629ebcb93 avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents: 5593
diff changeset
126 "paddw %%xmm6, %%xmm4 \n\t"
384629ebcb93 avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents: 5593
diff changeset
127 "paddw %%xmm7, %%xmm1 \n\t"
384629ebcb93 avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents: 5593
diff changeset
128 "paddw %%xmm7, %%xmm5 \n\t"
384629ebcb93 avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents: 5593
diff changeset
129 "pavgw %%xmm1, %%xmm0 \n\t"
384629ebcb93 avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents: 5593
diff changeset
130 "pavgw %%xmm5, %%xmm4 \n\t"
384629ebcb93 avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents: 5593
diff changeset
131 "psubw %%xmm7, %%xmm0 \n\t"
384629ebcb93 avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents: 5593
diff changeset
132 "psubw %%xmm7, %%xmm4 \n\t"
384629ebcb93 avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents: 5593
diff changeset
133 "psraw $1, %%xmm0 \n\t"
384629ebcb93 avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents: 5593
diff changeset
134 "psraw $1, %%xmm4 \n\t"
5555
0790af6d0028 remove idiotc double subtraction from the sse2 code (untested, no sse2 here)
michael
parents: 5554
diff changeset
135 "movdqa (%0), %%xmm1 \n\t"
0790af6d0028 remove idiotc double subtraction from the sse2 code (untested, no sse2 here)
michael
parents: 5554
diff changeset
136 "movdqa 16(%0), %%xmm5 \n\t"
5591
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
137 "paddw %%xmm1, %%xmm0 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
138 "paddw %%xmm5, %%xmm4 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
139 "psraw $2, %%xmm0 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
140 "psraw $2, %%xmm4 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
141 "paddw %%xmm1, %%xmm0 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
142 "paddw %%xmm5, %%xmm4 \n\t"
3210
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
143 "movdqa %%xmm0, (%0) \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
144 "movdqa %%xmm4, 16(%0) \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
145 :: "r"(&b[i]), "r"(&ref[i])
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
146 : "memory"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
147 );
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
148 }
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
149 snow_horizontal_compose_liftS_lead_out(i, b, b, ref, width, w_l);
5555
0790af6d0028 remove idiotc double subtraction from the sse2 code (untested, no sse2 here)
michael
parents: 5554
diff changeset
150 b[0] = b_0 + ((2 * ref[1] + W_BO-1 + 4 * b_0) >> W_BS);
3210
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
151 }
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
152
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
153 { // Lift 3
5591
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
154 IDWTELEM * const src = b+w2;
3210
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
155
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
156 i = 0;
5591
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
157 for(; (((long)&temp[i]) & 0x1F) && i<w_r; i++){
3210
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
158 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
159 }
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
160 for(; i<w_r-7; i+=8){
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
161 asm volatile(
5591
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
162 "movdqu 2(%1), %%xmm2 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
163 "movdqu 18(%1), %%xmm6 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
164 "paddw (%1), %%xmm2 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
165 "paddw 16(%1), %%xmm6 \n\t"
5565
93082c591c8b Change rounding of the horizontal DWT to match the vertical one.
michael
parents: 5563
diff changeset
166 "movdqu (%0), %%xmm0 \n\t"
93082c591c8b Change rounding of the horizontal DWT to match the vertical one.
michael
parents: 5563
diff changeset
167 "movdqu 16(%0), %%xmm4 \n\t"
5591
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
168 "paddw %%xmm2, %%xmm0 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
169 "paddw %%xmm6, %%xmm4 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
170 "psraw $1, %%xmm2 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
171 "psraw $1, %%xmm6 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
172 "paddw %%xmm0, %%xmm2 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
173 "paddw %%xmm4, %%xmm6 \n\t"
3210
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
174 "movdqa %%xmm2, (%2) \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
175 "movdqa %%xmm6, 16(%2) \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
176 :: "r"(&src[i]), "r"(&b[i]), "r"(&temp[i])
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
177 : "memory"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
178 );
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
179 }
5565
93082c591c8b Change rounding of the horizontal DWT to match the vertical one.
michael
parents: 5563
diff changeset
180 snow_horizontal_compose_lift_lead_out(i, temp, src, b, width, w_r, 1, -W_AM, W_AO+1, W_AS);
3210
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
181 }
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
182
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 snow_interleave_line_header(&i, width, b, temp);
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
185
5591
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
186 for (; (i & 0x3E) != 0x3E; i-=2){
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
187 b[i+1] = temp[i>>1];
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
188 b[i] = b[i>>1];
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
189 }
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
190 for (i-=62; i>=0; i-=64){
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
191 asm volatile(
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
192 "movdqa (%1), %%xmm0 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
193 "movdqa 16(%1), %%xmm2 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
194 "movdqa 32(%1), %%xmm4 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
195 "movdqa 48(%1), %%xmm6 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
196 "movdqa (%1), %%xmm1 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
197 "movdqa 16(%1), %%xmm3 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
198 "movdqa 32(%1), %%xmm5 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
199 "movdqa 48(%1), %%xmm7 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
200 "punpcklwd (%2), %%xmm0 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
201 "punpcklwd 16(%2), %%xmm2 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
202 "punpcklwd 32(%2), %%xmm4 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
203 "punpcklwd 48(%2), %%xmm6 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
204 "movdqa %%xmm0, (%0) \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
205 "movdqa %%xmm2, 32(%0) \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
206 "movdqa %%xmm4, 64(%0) \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
207 "movdqa %%xmm6, 96(%0) \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
208 "punpckhwd (%2), %%xmm1 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
209 "punpckhwd 16(%2), %%xmm3 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
210 "punpckhwd 32(%2), %%xmm5 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
211 "punpckhwd 48(%2), %%xmm7 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
212 "movdqa %%xmm1, 16(%0) \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
213 "movdqa %%xmm3, 48(%0) \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
214 "movdqa %%xmm5, 80(%0) \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
215 "movdqa %%xmm7, 112(%0) \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
216 :: "r"(&(b)[i]), "r"(&(b)[i>>1]), "r"(&(temp)[i>>1])
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
217 : "memory"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
218 );
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
219 }
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
220 }
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
221 }
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
222
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
223 void ff_snow_horizontal_compose97i_mmx(IDWTELEM *b, int width){
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
224 const int w2= (width+1)>>1;
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
225 IDWTELEM temp[width >> 1];
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
226 const int w_l= (width>>1);
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
227 const int w_r= w2 - 1;
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
228 int i;
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
229
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
230 { // Lift 0
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
231 IDWTELEM * const ref = b + w2 - 1;
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
232
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
233 i = 1;
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
234 b[0] = b[0] - ((W_DM * 2 * ref[1]+W_DO)>>W_DS);
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
235 asm volatile(
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
236 "pcmpeqw %%mm7, %%mm7 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
237 "psllw $15, %%mm7 \n\t"
5593
bd015f9ea964 avoid an overflow in the 1 horizontal lifting step
michael
parents: 5592
diff changeset
238 "psrlw $14, %%mm7 \n\t"
5591
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
239 ::);
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
240 for(; i<w_l-7; i+=8){
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
241 asm volatile(
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
242 "movq (%1), %%mm2 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
243 "movq 8(%1), %%mm6 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
244 "paddw 2(%1), %%mm2 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
245 "paddw 10(%1), %%mm6 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
246 "movq %%mm2, %%mm0 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
247 "movq %%mm6, %%mm4 \n\t"
5593
bd015f9ea964 avoid an overflow in the 1 horizontal lifting step
michael
parents: 5592
diff changeset
248 "psraw $1, %%mm2 \n\t"
bd015f9ea964 avoid an overflow in the 1 horizontal lifting step
michael
parents: 5592
diff changeset
249 "psraw $1, %%mm6 \n\t"
5591
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
250 "paddw %%mm0, %%mm2 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
251 "paddw %%mm4, %%mm6 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
252 "paddw %%mm7, %%mm2 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
253 "paddw %%mm7, %%mm6 \n\t"
5593
bd015f9ea964 avoid an overflow in the 1 horizontal lifting step
michael
parents: 5592
diff changeset
254 "psraw $2, %%mm2 \n\t"
bd015f9ea964 avoid an overflow in the 1 horizontal lifting step
michael
parents: 5592
diff changeset
255 "psraw $2, %%mm6 \n\t"
5591
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
256 "movq (%0), %%mm0 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
257 "movq 8(%0), %%mm4 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
258 "psubw %%mm2, %%mm0 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
259 "psubw %%mm6, %%mm4 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
260 "movq %%mm0, (%0) \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
261 "movq %%mm4, 8(%0) \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
262 :: "r"(&b[i]), "r"(&ref[i])
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
263 : "memory"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
264 );
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
265 }
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
266 snow_horizontal_compose_lift_lead_out(i, b, b, ref, width, w_l, 0, W_DM, W_DO, W_DS);
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
267 }
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
268
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
269 { // Lift 1
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
270 IDWTELEM * const dst = b+w2;
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
271
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
272 i = 0;
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
273 for(; i<w_r-7; i+=8){
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
274 asm volatile(
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
275 "movq (%1), %%mm2 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
276 "movq 8(%1), %%mm6 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
277 "paddw 2(%1), %%mm2 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
278 "paddw 10(%1), %%mm6 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
279 "movq (%0), %%mm0 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
280 "movq 8(%0), %%mm4 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
281 "psubw %%mm2, %%mm0 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
282 "psubw %%mm6, %%mm4 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
283 "movq %%mm0, (%0) \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
284 "movq %%mm4, 8(%0) \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
285 :: "r"(&dst[i]), "r"(&b[i])
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
286 : "memory"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
287 );
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
288 }
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
289 snow_horizontal_compose_lift_lead_out(i, dst, dst, b, width, w_r, 1, W_CM, W_CO, W_CS);
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
290 }
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
291
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
292 { // Lift 2
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
293 IDWTELEM * const ref = b+w2 - 1;
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
294
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
295 i = 1;
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
296 b[0] = b[0] + (((2 * ref[1] + W_BO) + 4 * b[0]) >> W_BS);
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
297 asm volatile(
5594
384629ebcb93 avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents: 5593
diff changeset
298 "psllw $13, %%mm7 \n\t"
384629ebcb93 avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents: 5593
diff changeset
299 "pcmpeqw %%mm6, %%mm6 \n\t"
384629ebcb93 avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents: 5593
diff changeset
300 "psrlw $13, %%mm6 \n\t"
384629ebcb93 avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents: 5593
diff changeset
301 "paddw %%mm7, %%mm6 \n\t"
5591
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
302 ::);
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
303 for(; i<w_l-7; i+=8){
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
304 asm volatile(
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
305 "movq (%1), %%mm0 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
306 "movq 8(%1), %%mm4 \n\t"
5594
384629ebcb93 avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents: 5593
diff changeset
307 "movq 2(%1), %%mm1 \n\t"
384629ebcb93 avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents: 5593
diff changeset
308 "movq 10(%1), %%mm5 \n\t"
384629ebcb93 avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents: 5593
diff changeset
309 "paddw %%mm6, %%mm0 \n\t"
384629ebcb93 avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents: 5593
diff changeset
310 "paddw %%mm6, %%mm4 \n\t"
384629ebcb93 avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents: 5593
diff changeset
311 "paddw %%mm7, %%mm1 \n\t"
384629ebcb93 avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents: 5593
diff changeset
312 "paddw %%mm7, %%mm5 \n\t"
384629ebcb93 avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents: 5593
diff changeset
313 "pavgw %%mm1, %%mm0 \n\t"
384629ebcb93 avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents: 5593
diff changeset
314 "pavgw %%mm5, %%mm4 \n\t"
384629ebcb93 avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents: 5593
diff changeset
315 "psubw %%mm7, %%mm0 \n\t"
384629ebcb93 avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents: 5593
diff changeset
316 "psubw %%mm7, %%mm4 \n\t"
384629ebcb93 avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents: 5593
diff changeset
317 "psraw $1, %%mm0 \n\t"
384629ebcb93 avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents: 5593
diff changeset
318 "psraw $1, %%mm4 \n\t"
5591
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
319 "movq (%0), %%mm1 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
320 "movq 8(%0), %%mm5 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
321 "paddw %%mm1, %%mm0 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
322 "paddw %%mm5, %%mm4 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
323 "psraw $2, %%mm0 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
324 "psraw $2, %%mm4 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
325 "paddw %%mm1, %%mm0 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
326 "paddw %%mm5, %%mm4 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
327 "movq %%mm0, (%0) \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
328 "movq %%mm4, 8(%0) \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
329 :: "r"(&b[i]), "r"(&ref[i])
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
330 : "memory"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
331 );
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
332 }
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
333 snow_horizontal_compose_liftS_lead_out(i, b, b, ref, width, w_l);
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
334 }
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
335
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
336 { // Lift 3
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
337 IDWTELEM * const src = b+w2;
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
338 i = 0;
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
339
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
340 for(; i<w_r-7; i+=8){
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
341 asm volatile(
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
342 "movq 2(%1), %%mm2 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
343 "movq 10(%1), %%mm6 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
344 "paddw (%1), %%mm2 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
345 "paddw 8(%1), %%mm6 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
346 "movq (%0), %%mm0 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
347 "movq 8(%0), %%mm4 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
348 "paddw %%mm2, %%mm0 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
349 "paddw %%mm6, %%mm4 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
350 "psraw $1, %%mm2 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
351 "psraw $1, %%mm6 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
352 "paddw %%mm0, %%mm2 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
353 "paddw %%mm4, %%mm6 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
354 "movq %%mm2, (%2) \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
355 "movq %%mm6, 8(%2) \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
356 :: "r"(&src[i]), "r"(&b[i]), "r"(&temp[i])
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
357 : "memory"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
358 );
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
359 }
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
360 snow_horizontal_compose_lift_lead_out(i, temp, src, b, width, w_r, 1, -W_AM, W_AO+1, W_AS);
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
361 }
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
362
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
363 {
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
364 snow_interleave_line_header(&i, width, b, temp);
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
365
3210
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
366 for (; (i & 0x1E) != 0x1E; i-=2){
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
367 b[i+1] = temp[i>>1];
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
368 b[i] = b[i>>1];
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
369 }
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
370 for (i-=30; i>=0; i-=32){
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
371 asm volatile(
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
372 "movq (%1), %%mm0 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
373 "movq 8(%1), %%mm2 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
374 "movq 16(%1), %%mm4 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
375 "movq 24(%1), %%mm6 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
376 "movq (%1), %%mm1 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
377 "movq 8(%1), %%mm3 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
378 "movq 16(%1), %%mm5 \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
379 "movq 24(%1), %%mm7 \n\t"
5591
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
380 "punpcklwd (%2), %%mm0 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
381 "punpcklwd 8(%2), %%mm2 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
382 "punpcklwd 16(%2), %%mm4 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
383 "punpcklwd 24(%2), %%mm6 \n\t"
3210
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
384 "movq %%mm0, (%0) \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
385 "movq %%mm2, 16(%0) \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
386 "movq %%mm4, 32(%0) \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
387 "movq %%mm6, 48(%0) \n\t"
5591
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
388 "punpckhwd (%2), %%mm1 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
389 "punpckhwd 8(%2), %%mm3 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
390 "punpckhwd 16(%2), %%mm5 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
391 "punpckhwd 24(%2), %%mm7 \n\t"
3210
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
392 "movq %%mm1, 8(%0) \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
393 "movq %%mm3, 24(%0) \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
394 "movq %%mm5, 40(%0) \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
395 "movq %%mm7, 56(%0) \n\t"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
396 :: "r"(&b[i]), "r"(&b[i>>1]), "r"(&temp[i>>1])
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
397 : "memory"
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
398 );
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
399 }
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
400 }
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
401 }
81cafbc23b8d snow mmx+sse2 optimizations, part 4
corey
parents: 3207
diff changeset
402
3207
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
403 #define snow_vertical_compose_sse2_load_add(op,r,t0,t1,t2,t3)\
5591
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
404 ""op" (%%"r",%%"REG_d",2), %%"t0" \n\t"\
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
405 ""op" 16(%%"r",%%"REG_d",2), %%"t1" \n\t"\
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
406 ""op" 32(%%"r",%%"REG_d",2), %%"t2" \n\t"\
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
407 ""op" 48(%%"r",%%"REG_d",2), %%"t3" \n\t"
3207
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
408
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
409 #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
410 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
411
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
412 #define snow_vertical_compose_sse2_add(r,t0,t1,t2,t3)\
5591
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
413 snow_vertical_compose_sse2_load_add("paddw",r,t0,t1,t2,t3)
3207
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
414
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
415 #define snow_vertical_compose_sse2_sub(s0,s1,s2,s3,t0,t1,t2,t3)\
5591
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
416 "psubw %%"s0", %%"t0" \n\t"\
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
417 "psubw %%"s1", %%"t1" \n\t"\
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
418 "psubw %%"s2", %%"t2" \n\t"\
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
419 "psubw %%"s3", %%"t3" \n\t"
3207
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
420
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
421 #define snow_vertical_compose_sse2_store(w,s0,s1,s2,s3)\
5591
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
422 "movdqa %%"s0", (%%"w",%%"REG_d",2) \n\t"\
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
423 "movdqa %%"s1", 16(%%"w",%%"REG_d",2) \n\t"\
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
424 "movdqa %%"s2", 32(%%"w",%%"REG_d",2) \n\t"\
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
425 "movdqa %%"s3", 48(%%"w",%%"REG_d",2) \n\t"
3207
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
426
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
427 #define snow_vertical_compose_sse2_sra(n,t0,t1,t2,t3)\
5591
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
428 "psraw $"n", %%"t0" \n\t"\
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
429 "psraw $"n", %%"t1" \n\t"\
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
430 "psraw $"n", %%"t2" \n\t"\
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
431 "psraw $"n", %%"t3" \n\t"
3207
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
432
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
433 #define snow_vertical_compose_sse2_r2r_add(s0,s1,s2,s3,t0,t1,t2,t3)\
5591
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
434 "paddw %%"s0", %%"t0" \n\t"\
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
435 "paddw %%"s1", %%"t1" \n\t"\
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
436 "paddw %%"s2", %%"t2" \n\t"\
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
437 "paddw %%"s3", %%"t3" \n\t"
3207
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_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
440 "movdqa %%"s0", %%"t0" \n\t"\
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
441 "movdqa %%"s1", %%"t1" \n\t"\
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
442 "movdqa %%"s2", %%"t2" \n\t"\
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
443 "movdqa %%"s3", %%"t3" \n\t"
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
444
5591
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
445 void ff_snow_vertical_compose97i_sse2(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2, IDWTELEM *b3, IDWTELEM *b4, IDWTELEM *b5, int width){
3207
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
446 long i = width;
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
447
5591
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
448 while(i & 0x1F)
3207
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
449 {
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
450 i--;
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
451 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
452 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
453 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
454 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
455 }
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
456
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
457 asm volatile (
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
458 "jmp 2f \n\t"
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
459 "1: \n\t"
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
460
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
461 "mov %6, %%"REG_a" \n\t"
3566
b63ef6fcbc70 Fix x86 SIMD asm and pic, patch from Martin von Gagern <Martin.vGagern@gmx.net>
lu_zero
parents: 3398
diff changeset
462 "mov %4, %%"REG_S" \n\t"
3207
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
463
3566
b63ef6fcbc70 Fix x86 SIMD asm and pic, patch from Martin von Gagern <Martin.vGagern@gmx.net>
lu_zero
parents: 3398
diff changeset
464 snow_vertical_compose_sse2_load(REG_S,"xmm0","xmm2","xmm4","xmm6")
3207
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
465 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
466 snow_vertical_compose_sse2_move("xmm0","xmm2","xmm4","xmm6","xmm1","xmm3","xmm5","xmm7")
5592
fadffa1e5aef prevent one overflow in the first vertical lifting step
michael
parents: 5591
diff changeset
467 snow_vertical_compose_sse2_sra("1","xmm0","xmm2","xmm4","xmm6")
3207
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
468 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
469
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
470 "pcmpeqd %%xmm1, %%xmm1 \n\t"
5591
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
471 "psllw $15, %%xmm1 \n\t"
5592
fadffa1e5aef prevent one overflow in the first vertical lifting step
michael
parents: 5591
diff changeset
472 "psrlw $14, %%xmm1 \n\t"
3207
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
473 "mov %5, %%"REG_a" \n\t"
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
474
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
475 snow_vertical_compose_sse2_r2r_add("xmm1","xmm1","xmm1","xmm1","xmm0","xmm2","xmm4","xmm6")
5592
fadffa1e5aef prevent one overflow in the first vertical lifting step
michael
parents: 5591
diff changeset
476 snow_vertical_compose_sse2_sra("2","xmm0","xmm2","xmm4","xmm6")
3207
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
477 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
478 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
479 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
480 "mov %3, %%"REG_c" \n\t"
3566
b63ef6fcbc70 Fix x86 SIMD asm and pic, patch from Martin von Gagern <Martin.vGagern@gmx.net>
lu_zero
parents: 3398
diff changeset
481 snow_vertical_compose_sse2_load(REG_S,"xmm0","xmm2","xmm4","xmm6")
3207
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
482 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
483 snow_vertical_compose_sse2_sub("xmm1","xmm3","xmm5","xmm7","xmm0","xmm2","xmm4","xmm6")
3566
b63ef6fcbc70 Fix x86 SIMD asm and pic, patch from Martin von Gagern <Martin.vGagern@gmx.net>
lu_zero
parents: 3398
diff changeset
484 snow_vertical_compose_sse2_store(REG_S,"xmm0","xmm2","xmm4","xmm6")
3207
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
485 "mov %2, %%"REG_a" \n\t"
5594
384629ebcb93 avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents: 5593
diff changeset
486
384629ebcb93 avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents: 5593
diff changeset
487 "pcmpeqw %%xmm7, %%xmm7 \n\t"
384629ebcb93 avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents: 5593
diff changeset
488 "pcmpeqw %%xmm5, %%xmm5 \n\t"
384629ebcb93 avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents: 5593
diff changeset
489 "psllw $15, %%xmm7 \n\t"
384629ebcb93 avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents: 5593
diff changeset
490 "psrlw $13, %%xmm5 \n\t"
384629ebcb93 avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents: 5593
diff changeset
491 "paddw %%xmm7, %%xmm5 \n\t"
384629ebcb93 avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents: 5593
diff changeset
492 snow_vertical_compose_sse2_r2r_add("xmm5","xmm5","xmm5","xmm5","xmm0","xmm2","xmm4","xmm6")
384629ebcb93 avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents: 5593
diff changeset
493 "movq (%%"REG_a",%%"REG_d",2), %%xmm1 \n\t"
384629ebcb93 avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents: 5593
diff changeset
494 "movq 8(%%"REG_a",%%"REG_d",2), %%xmm3 \n\t"
384629ebcb93 avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents: 5593
diff changeset
495 "paddw %%xmm7, %%xmm1 \n\t"
384629ebcb93 avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents: 5593
diff changeset
496 "paddw %%xmm7, %%xmm3 \n\t"
384629ebcb93 avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents: 5593
diff changeset
497 "pavgw %%xmm1, %%xmm0 \n\t"
384629ebcb93 avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents: 5593
diff changeset
498 "pavgw %%xmm3, %%xmm2 \n\t"
384629ebcb93 avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents: 5593
diff changeset
499 "movq 16(%%"REG_a",%%"REG_d",2), %%xmm1 \n\t"
384629ebcb93 avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents: 5593
diff changeset
500 "movq 24(%%"REG_a",%%"REG_d",2), %%xmm3 \n\t"
384629ebcb93 avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents: 5593
diff changeset
501 "paddw %%xmm7, %%xmm1 \n\t"
384629ebcb93 avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents: 5593
diff changeset
502 "paddw %%xmm7, %%xmm3 \n\t"
384629ebcb93 avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents: 5593
diff changeset
503 "pavgw %%xmm1, %%xmm4 \n\t"
384629ebcb93 avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents: 5593
diff changeset
504 "pavgw %%xmm3, %%xmm6 \n\t"
384629ebcb93 avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents: 5593
diff changeset
505 snow_vertical_compose_sse2_sub("xmm7","xmm7","xmm7","xmm7","xmm0","xmm2","xmm4","xmm6")
384629ebcb93 avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents: 5593
diff changeset
506 snow_vertical_compose_sse2_sra("1","xmm0","xmm2","xmm4","xmm6")
5560
2e63bd8e894d Simplify and speedup code, reduce needed headroom by 2 bits in the 3rd
michael
parents: 5559
diff changeset
507 snow_vertical_compose_sse2_add(REG_c,"xmm0","xmm2","xmm4","xmm6")
3207
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
508
3566
b63ef6fcbc70 Fix x86 SIMD asm and pic, patch from Martin von Gagern <Martin.vGagern@gmx.net>
lu_zero
parents: 3398
diff changeset
509 "mov %1, %%"REG_S" \n\t"
3207
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
510
5560
2e63bd8e894d Simplify and speedup code, reduce needed headroom by 2 bits in the 3rd
michael
parents: 5559
diff changeset
511 snow_vertical_compose_sse2_sra("2","xmm0","xmm2","xmm4","xmm6")
3207
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
512 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
513 snow_vertical_compose_sse2_store(REG_c,"xmm0","xmm2","xmm4","xmm6")
3566
b63ef6fcbc70 Fix x86 SIMD asm and pic, patch from Martin von Gagern <Martin.vGagern@gmx.net>
lu_zero
parents: 3398
diff changeset
514 snow_vertical_compose_sse2_add(REG_S,"xmm0","xmm2","xmm4","xmm6")
3207
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
515 snow_vertical_compose_sse2_move("xmm0","xmm2","xmm4","xmm6","xmm1","xmm3","xmm5","xmm7")
5562
0074dd43ae5e Simplify and optimize the 4th vertical lifting step of the SSE2 code (untested)
michael
parents: 5561
diff changeset
516 snow_vertical_compose_sse2_sra("1","xmm0","xmm2","xmm4","xmm6")
3207
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
517 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
518 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
519 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
520
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
521 "2: \n\t"
5591
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
522 "sub $32, %%"REG_d" \n\t"
3207
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
523 "jge 1b \n\t"
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
524 :"+d"(i)
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
525 :
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
526 "m"(b0),"m"(b1),"m"(b2),"m"(b3),"m"(b4),"m"(b5):
3566
b63ef6fcbc70 Fix x86 SIMD asm and pic, patch from Martin von Gagern <Martin.vGagern@gmx.net>
lu_zero
parents: 3398
diff changeset
527 "%"REG_a"","%"REG_S"","%"REG_c"");
3207
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
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
530 #define snow_vertical_compose_mmx_load_add(op,r,t0,t1,t2,t3)\
5591
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
531 ""op" (%%"r",%%"REG_d",2), %%"t0" \n\t"\
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
532 ""op" 8(%%"r",%%"REG_d",2), %%"t1" \n\t"\
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
533 ""op" 16(%%"r",%%"REG_d",2), %%"t2" \n\t"\
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
534 ""op" 24(%%"r",%%"REG_d",2), %%"t3" \n\t"
3207
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
535
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
536 #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
537 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
538
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
539 #define snow_vertical_compose_mmx_add(r,t0,t1,t2,t3)\
5591
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
540 snow_vertical_compose_mmx_load_add("paddw",r,t0,t1,t2,t3)
3207
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
541
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
542 #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
543 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
544
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
545 #define snow_vertical_compose_mmx_store(w,s0,s1,s2,s3)\
5591
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
546 "movq %%"s0", (%%"w",%%"REG_d",2) \n\t"\
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
547 "movq %%"s1", 8(%%"w",%%"REG_d",2) \n\t"\
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
548 "movq %%"s2", 16(%%"w",%%"REG_d",2) \n\t"\
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
549 "movq %%"s3", 24(%%"w",%%"REG_d",2) \n\t"
3207
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
550
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
551 #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
552 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
553
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
554 #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
555 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
556
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
557 #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
558 "movq %%"s0", %%"t0" \n\t"\
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
559 "movq %%"s1", %%"t1" \n\t"\
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
560 "movq %%"s2", %%"t2" \n\t"\
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
561 "movq %%"s3", %%"t3" \n\t"
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
562
5591
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
563 void ff_snow_vertical_compose97i_mmx(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2, IDWTELEM *b3, IDWTELEM *b4, IDWTELEM *b5, int width){
3207
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
564 long i = width;
5591
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
565 while(i & 15)
3207
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
566 {
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
567 i--;
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
568 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
569 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
570 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
571 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
572 }
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 asm volatile(
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
575 "jmp 2f \n\t"
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
576 "1: \n\t"
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
577
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
578 "mov %6, %%"REG_a" \n\t"
3566
b63ef6fcbc70 Fix x86 SIMD asm and pic, patch from Martin von Gagern <Martin.vGagern@gmx.net>
lu_zero
parents: 3398
diff changeset
579 "mov %4, %%"REG_S" \n\t"
3207
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
580
3566
b63ef6fcbc70 Fix x86 SIMD asm and pic, patch from Martin von Gagern <Martin.vGagern@gmx.net>
lu_zero
parents: 3398
diff changeset
581 snow_vertical_compose_mmx_load(REG_S,"mm0","mm2","mm4","mm6")
3207
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
582 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
583 snow_vertical_compose_mmx_move("mm0","mm2","mm4","mm6","mm1","mm3","mm5","mm7")
5592
fadffa1e5aef prevent one overflow in the first vertical lifting step
michael
parents: 5591
diff changeset
584 snow_vertical_compose_mmx_sra("1","mm0","mm2","mm4","mm6")
3207
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
585 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
586
5591
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
587 "pcmpeqw %%mm1, %%mm1 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
588 "psllw $15, %%mm1 \n\t"
5592
fadffa1e5aef prevent one overflow in the first vertical lifting step
michael
parents: 5591
diff changeset
589 "psrlw $14, %%mm1 \n\t"
3207
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
590 "mov %5, %%"REG_a" \n\t"
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
591
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
592 snow_vertical_compose_mmx_r2r_add("mm1","mm1","mm1","mm1","mm0","mm2","mm4","mm6")
5592
fadffa1e5aef prevent one overflow in the first vertical lifting step
michael
parents: 5591
diff changeset
593 snow_vertical_compose_mmx_sra("2","mm0","mm2","mm4","mm6")
3207
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
594 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
595 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
596 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
597 "mov %3, %%"REG_c" \n\t"
3566
b63ef6fcbc70 Fix x86 SIMD asm and pic, patch from Martin von Gagern <Martin.vGagern@gmx.net>
lu_zero
parents: 3398
diff changeset
598 snow_vertical_compose_mmx_load(REG_S,"mm0","mm2","mm4","mm6")
3207
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
599 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
600 snow_vertical_compose_mmx_sub("mm1","mm3","mm5","mm7","mm0","mm2","mm4","mm6")
3566
b63ef6fcbc70 Fix x86 SIMD asm and pic, patch from Martin von Gagern <Martin.vGagern@gmx.net>
lu_zero
parents: 3398
diff changeset
601 snow_vertical_compose_mmx_store(REG_S,"mm0","mm2","mm4","mm6")
3207
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
602 "mov %2, %%"REG_a" \n\t"
5594
384629ebcb93 avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents: 5593
diff changeset
603 "pcmpeqw %%mm7, %%mm7 \n\t"
384629ebcb93 avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents: 5593
diff changeset
604 "pcmpeqw %%mm5, %%mm5 \n\t"
384629ebcb93 avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents: 5593
diff changeset
605 "psllw $15, %%mm7 \n\t"
384629ebcb93 avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents: 5593
diff changeset
606 "psrlw $13, %%mm5 \n\t"
384629ebcb93 avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents: 5593
diff changeset
607 "paddw %%mm7, %%mm5 \n\t"
384629ebcb93 avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents: 5593
diff changeset
608 snow_vertical_compose_mmx_r2r_add("mm5","mm5","mm5","mm5","mm0","mm2","mm4","mm6")
384629ebcb93 avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents: 5593
diff changeset
609 "movq (%%"REG_a",%%"REG_d",2), %%mm1 \n\t"
384629ebcb93 avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents: 5593
diff changeset
610 "movq 8(%%"REG_a",%%"REG_d",2), %%mm3 \n\t"
384629ebcb93 avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents: 5593
diff changeset
611 "paddw %%mm7, %%mm1 \n\t"
384629ebcb93 avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents: 5593
diff changeset
612 "paddw %%mm7, %%mm3 \n\t"
384629ebcb93 avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents: 5593
diff changeset
613 "pavgw %%mm1, %%mm0 \n\t"
384629ebcb93 avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents: 5593
diff changeset
614 "pavgw %%mm3, %%mm2 \n\t"
384629ebcb93 avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents: 5593
diff changeset
615 "movq 16(%%"REG_a",%%"REG_d",2), %%mm1 \n\t"
384629ebcb93 avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents: 5593
diff changeset
616 "movq 24(%%"REG_a",%%"REG_d",2), %%mm3 \n\t"
384629ebcb93 avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents: 5593
diff changeset
617 "paddw %%mm7, %%mm1 \n\t"
384629ebcb93 avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents: 5593
diff changeset
618 "paddw %%mm7, %%mm3 \n\t"
384629ebcb93 avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents: 5593
diff changeset
619 "pavgw %%mm1, %%mm4 \n\t"
384629ebcb93 avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents: 5593
diff changeset
620 "pavgw %%mm3, %%mm6 \n\t"
384629ebcb93 avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents: 5593
diff changeset
621 snow_vertical_compose_sse2_sub("mm7","mm7","mm7","mm7","mm0","mm2","mm4","mm6")
384629ebcb93 avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents: 5593
diff changeset
622 snow_vertical_compose_mmx_sra("1","mm0","mm2","mm4","mm6")
5559
9993d38f59cf simplify, speedup and reduce needed headroom by 2 bits in the 3rd
michael
parents: 5558
diff changeset
623 snow_vertical_compose_mmx_add(REG_c,"mm0","mm2","mm4","mm6")
3207
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
624
3566
b63ef6fcbc70 Fix x86 SIMD asm and pic, patch from Martin von Gagern <Martin.vGagern@gmx.net>
lu_zero
parents: 3398
diff changeset
625 "mov %1, %%"REG_S" \n\t"
3207
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
626
5559
9993d38f59cf simplify, speedup and reduce needed headroom by 2 bits in the 3rd
michael
parents: 5558
diff changeset
627 snow_vertical_compose_mmx_sra("2","mm0","mm2","mm4","mm6")
3207
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
628 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
629 snow_vertical_compose_mmx_store(REG_c,"mm0","mm2","mm4","mm6")
3566
b63ef6fcbc70 Fix x86 SIMD asm and pic, patch from Martin von Gagern <Martin.vGagern@gmx.net>
lu_zero
parents: 3398
diff changeset
630 snow_vertical_compose_mmx_add(REG_S,"mm0","mm2","mm4","mm6")
3207
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
631 snow_vertical_compose_mmx_move("mm0","mm2","mm4","mm6","mm1","mm3","mm5","mm7")
5561
225867be27f7 Simplify and optimize the 4th vertical lifting step of the MMX code
michael
parents: 5560
diff changeset
632 snow_vertical_compose_mmx_sra("1","mm0","mm2","mm4","mm6")
3207
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
633 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
634 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
635 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
636
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
637 "2: \n\t"
5591
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
638 "sub $16, %%"REG_d" \n\t"
3207
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
639 "jge 1b \n\t"
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
640 :"+d"(i)
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
641 :
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
642 "m"(b0),"m"(b1),"m"(b2),"m"(b3),"m"(b4),"m"(b5):
3566
b63ef6fcbc70 Fix x86 SIMD asm and pic, patch from Martin von Gagern <Martin.vGagern@gmx.net>
lu_zero
parents: 3398
diff changeset
643 "%"REG_a"","%"REG_S"","%"REG_c"");
3207
33110c1008a4 Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff changeset
644 }
3211
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
645
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
646 #define snow_inner_add_yblock_sse2_header \
5591
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
647 IDWTELEM * * dst_array = sb->line + src_y;\
3566
b63ef6fcbc70 Fix x86 SIMD asm and pic, patch from Martin von Gagern <Martin.vGagern@gmx.net>
lu_zero
parents: 3398
diff changeset
648 long tmp;\
3211
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
649 asm volatile(\
3566
b63ef6fcbc70 Fix x86 SIMD asm and pic, patch from Martin von Gagern <Martin.vGagern@gmx.net>
lu_zero
parents: 3398
diff changeset
650 "mov %7, %%"REG_c" \n\t"\
b63ef6fcbc70 Fix x86 SIMD asm and pic, patch from Martin von Gagern <Martin.vGagern@gmx.net>
lu_zero
parents: 3398
diff changeset
651 "mov %6, %2 \n\t"\
b63ef6fcbc70 Fix x86 SIMD asm and pic, patch from Martin von Gagern <Martin.vGagern@gmx.net>
lu_zero
parents: 3398
diff changeset
652 "mov %4, %%"REG_S" \n\t"\
3211
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
653 "pxor %%xmm7, %%xmm7 \n\t" /* 0 */\
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
654 "pcmpeqd %%xmm3, %%xmm3 \n\t"\
5591
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
655 "psllw $15, %%xmm3 \n\t"\
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
656 "psrlw $12, %%xmm3 \n\t" /* FRAC_BITS >> 1 */\
3211
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
657 "1: \n\t"\
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
658 "mov %1, %%"REG_D" \n\t"\
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
659 "mov (%%"REG_D"), %%"REG_D" \n\t"\
3566
b63ef6fcbc70 Fix x86 SIMD asm and pic, patch from Martin von Gagern <Martin.vGagern@gmx.net>
lu_zero
parents: 3398
diff changeset
660 "add %3, %%"REG_D" \n\t"
3211
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
661
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
662 #define snow_inner_add_yblock_sse2_start_8(out_reg1, out_reg2, ptr_offset, s_offset)\
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
663 "mov "PTR_SIZE"*"ptr_offset"(%%"REG_a"), %%"REG_d"; \n\t"\
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
664 "movq (%%"REG_d"), %%"out_reg1" \n\t"\
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
665 "movq (%%"REG_d", %%"REG_c"), %%"out_reg2" \n\t"\
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
666 "punpcklbw %%xmm7, %%"out_reg1" \n\t"\
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
667 "punpcklbw %%xmm7, %%"out_reg2" \n\t"\
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
668 "movq "s_offset"(%%"REG_S"), %%xmm0 \n\t"\
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
669 "movq "s_offset"+16(%%"REG_S"), %%xmm4 \n\t"\
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
670 "punpcklbw %%xmm7, %%xmm0 \n\t"\
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
671 "punpcklbw %%xmm7, %%xmm4 \n\t"\
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
672 "pmullw %%xmm0, %%"out_reg1" \n\t"\
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
673 "pmullw %%xmm4, %%"out_reg2" \n\t"
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
674
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
675 #define snow_inner_add_yblock_sse2_start_16(out_reg1, out_reg2, ptr_offset, s_offset)\
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
676 "mov "PTR_SIZE"*"ptr_offset"(%%"REG_a"), %%"REG_d"; \n\t"\
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
677 "movq (%%"REG_d"), %%"out_reg1" \n\t"\
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
678 "movq 8(%%"REG_d"), %%"out_reg2" \n\t"\
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
679 "punpcklbw %%xmm7, %%"out_reg1" \n\t"\
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
680 "punpcklbw %%xmm7, %%"out_reg2" \n\t"\
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
681 "movq "s_offset"(%%"REG_S"), %%xmm0 \n\t"\
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
682 "movq "s_offset"+8(%%"REG_S"), %%xmm4 \n\t"\
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
683 "punpcklbw %%xmm7, %%xmm0 \n\t"\
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
684 "punpcklbw %%xmm7, %%xmm4 \n\t"\
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
685 "pmullw %%xmm0, %%"out_reg1" \n\t"\
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
686 "pmullw %%xmm4, %%"out_reg2" \n\t"
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
687
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
688 #define snow_inner_add_yblock_sse2_accum_8(ptr_offset, s_offset) \
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
689 snow_inner_add_yblock_sse2_start_8("xmm2", "xmm6", ptr_offset, s_offset)\
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
690 "paddusw %%xmm2, %%xmm1 \n\t"\
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
691 "paddusw %%xmm6, %%xmm5 \n\t"
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
692
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
693 #define snow_inner_add_yblock_sse2_accum_16(ptr_offset, s_offset) \
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
694 snow_inner_add_yblock_sse2_start_16("xmm2", "xmm6", ptr_offset, s_offset)\
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
695 "paddusw %%xmm2, %%xmm1 \n\t"\
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
696 "paddusw %%xmm6, %%xmm5 \n\t"
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
697
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
698 #define snow_inner_add_yblock_sse2_end_common1\
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
699 "add $32, %%"REG_S" \n\t"\
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
700 "add %%"REG_c", %0 \n\t"\
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
701 "add %%"REG_c", "PTR_SIZE"*3(%%"REG_a");\n\t"\
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
702 "add %%"REG_c", "PTR_SIZE"*2(%%"REG_a");\n\t"\
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
703 "add %%"REG_c", "PTR_SIZE"*1(%%"REG_a");\n\t"\
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
704 "add %%"REG_c", (%%"REG_a") \n\t"
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
705
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
706 #define snow_inner_add_yblock_sse2_end_common2\
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
707 "jnz 1b \n\t"\
3566
b63ef6fcbc70 Fix x86 SIMD asm and pic, patch from Martin von Gagern <Martin.vGagern@gmx.net>
lu_zero
parents: 3398
diff changeset
708 :"+m"(dst8),"+m"(dst_array),"=&r"(tmp)\
3211
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
709 :\
5591
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
710 "rm"((long)(src_x<<1)),"m"(obmc),"a"(block),"m"((long)b_h),"m"((long)src_stride):\
3566
b63ef6fcbc70 Fix x86 SIMD asm and pic, patch from Martin von Gagern <Martin.vGagern@gmx.net>
lu_zero
parents: 3398
diff changeset
711 "%"REG_c"","%"REG_S"","%"REG_D"","%"REG_d"");
3211
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
712
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
713 #define snow_inner_add_yblock_sse2_end_8\
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
714 "sal $1, %%"REG_c" \n\t"\
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
715 "add $"PTR_SIZE"*2, %1 \n\t"\
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
716 snow_inner_add_yblock_sse2_end_common1\
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
717 "sar $1, %%"REG_c" \n\t"\
3566
b63ef6fcbc70 Fix x86 SIMD asm and pic, patch from Martin von Gagern <Martin.vGagern@gmx.net>
lu_zero
parents: 3398
diff changeset
718 "sub $2, %2 \n\t"\
3211
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
719 snow_inner_add_yblock_sse2_end_common2
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
720
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
721 #define snow_inner_add_yblock_sse2_end_16\
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
722 "add $"PTR_SIZE"*1, %1 \n\t"\
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
723 snow_inner_add_yblock_sse2_end_common1\
3566
b63ef6fcbc70 Fix x86 SIMD asm and pic, patch from Martin von Gagern <Martin.vGagern@gmx.net>
lu_zero
parents: 3398
diff changeset
724 "dec %2 \n\t"\
3211
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
725 snow_inner_add_yblock_sse2_end_common2
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
726
4436
d3e389536b0a Add the const specifier as needed to reduce the number of warnings.
takis
parents: 3947
diff changeset
727 static void inner_add_yblock_bw_8_obmc_16_bh_even_sse2(const uint8_t *obmc, const long obmc_stride, uint8_t * * block, int b_w, long b_h,
3211
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
728 int src_x, int src_y, long src_stride, slice_buffer * sb, int add, uint8_t * dst8){
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
729 snow_inner_add_yblock_sse2_header
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
730 snow_inner_add_yblock_sse2_start_8("xmm1", "xmm5", "3", "0")
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
731 snow_inner_add_yblock_sse2_accum_8("2", "8")
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
732 snow_inner_add_yblock_sse2_accum_8("1", "128")
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
733 snow_inner_add_yblock_sse2_accum_8("0", "136")
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
734
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
735 "mov %0, %%"REG_d" \n\t"
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
736 "movdqa (%%"REG_D"), %%xmm0 \n\t"
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
737 "movdqa %%xmm1, %%xmm2 \n\t"
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
738
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
739 "punpckhwd %%xmm7, %%xmm1 \n\t"
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
740 "punpcklwd %%xmm7, %%xmm2 \n\t"
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
741 "paddd %%xmm2, %%xmm0 \n\t"
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
742 "movdqa 16(%%"REG_D"), %%xmm2 \n\t"
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
743 "paddd %%xmm1, %%xmm2 \n\t"
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
744 "paddd %%xmm3, %%xmm0 \n\t"
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
745 "paddd %%xmm3, %%xmm2 \n\t"
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
746
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
747 "mov %1, %%"REG_D" \n\t"
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
748 "mov "PTR_SIZE"(%%"REG_D"), %%"REG_D";\n\t"
3566
b63ef6fcbc70 Fix x86 SIMD asm and pic, patch from Martin von Gagern <Martin.vGagern@gmx.net>
lu_zero
parents: 3398
diff changeset
749 "add %3, %%"REG_D" \n\t"
3211
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
750
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
751 "movdqa (%%"REG_D"), %%xmm4 \n\t"
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
752 "movdqa %%xmm5, %%xmm6 \n\t"
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
753 "punpckhwd %%xmm7, %%xmm5 \n\t"
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
754 "punpcklwd %%xmm7, %%xmm6 \n\t"
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
755 "paddd %%xmm6, %%xmm4 \n\t"
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
756 "movdqa 16(%%"REG_D"), %%xmm6 \n\t"
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
757 "paddd %%xmm5, %%xmm6 \n\t"
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
758 "paddd %%xmm3, %%xmm4 \n\t"
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
759 "paddd %%xmm3, %%xmm6 \n\t"
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
760
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
761 "psrad $8, %%xmm0 \n\t" /* FRAC_BITS. */
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
762 "psrad $8, %%xmm2 \n\t" /* FRAC_BITS. */
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
763 "packssdw %%xmm2, %%xmm0 \n\t"
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
764 "packuswb %%xmm7, %%xmm0 \n\t"
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
765 "movq %%xmm0, (%%"REG_d") \n\t"
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
766
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
767 "psrad $8, %%xmm4 \n\t" /* FRAC_BITS. */
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
768 "psrad $8, %%xmm6 \n\t" /* FRAC_BITS. */
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
769 "packssdw %%xmm6, %%xmm4 \n\t"
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
770 "packuswb %%xmm7, %%xmm4 \n\t"
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
771 "movq %%xmm4, (%%"REG_d",%%"REG_c");\n\t"
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
772 snow_inner_add_yblock_sse2_end_8
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
773 }
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
774
4436
d3e389536b0a Add the const specifier as needed to reduce the number of warnings.
takis
parents: 3947
diff changeset
775 static void inner_add_yblock_bw_16_obmc_32_sse2(const uint8_t *obmc, const long obmc_stride, uint8_t * * block, int b_w, long b_h,
3211
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
776 int src_x, int src_y, long src_stride, slice_buffer * sb, int add, uint8_t * dst8){
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
777 snow_inner_add_yblock_sse2_header
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
778 snow_inner_add_yblock_sse2_start_16("xmm1", "xmm5", "3", "0")
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
779 snow_inner_add_yblock_sse2_accum_16("2", "16")
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
780 snow_inner_add_yblock_sse2_accum_16("1", "512")
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
781 snow_inner_add_yblock_sse2_accum_16("0", "528")
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
782
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
783 "mov %0, %%"REG_d" \n\t"
5591
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
784 "psrlw $4, %%xmm1 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
785 "psrlw $4, %%xmm5 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
786 "paddw (%%"REG_D"), %%xmm1 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
787 "paddw 16(%%"REG_D"), %%xmm5 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
788 "paddw %%xmm3, %%xmm1 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
789 "paddw %%xmm3, %%xmm5 \n\t"
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
790 "psraw $4, %%xmm1 \n\t" /* FRAC_BITS. */
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
791 "psraw $4, %%xmm5 \n\t" /* FRAC_BITS. */
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
792 "packuswb %%xmm5, %%xmm1 \n\t"
3211
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
793
5591
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
794 "movdqu %%xmm1, (%%"REG_d") \n\t"
3211
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
795
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
796 snow_inner_add_yblock_sse2_end_16
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
797 }
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
798
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
799 #define snow_inner_add_yblock_mmx_header \
5591
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
800 IDWTELEM * * dst_array = sb->line + src_y;\
3566
b63ef6fcbc70 Fix x86 SIMD asm and pic, patch from Martin von Gagern <Martin.vGagern@gmx.net>
lu_zero
parents: 3398
diff changeset
801 long tmp;\
3211
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
802 asm volatile(\
3566
b63ef6fcbc70 Fix x86 SIMD asm and pic, patch from Martin von Gagern <Martin.vGagern@gmx.net>
lu_zero
parents: 3398
diff changeset
803 "mov %7, %%"REG_c" \n\t"\
b63ef6fcbc70 Fix x86 SIMD asm and pic, patch from Martin von Gagern <Martin.vGagern@gmx.net>
lu_zero
parents: 3398
diff changeset
804 "mov %6, %2 \n\t"\
b63ef6fcbc70 Fix x86 SIMD asm and pic, patch from Martin von Gagern <Martin.vGagern@gmx.net>
lu_zero
parents: 3398
diff changeset
805 "mov %4, %%"REG_S" \n\t"\
3211
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
806 "pxor %%mm7, %%mm7 \n\t" /* 0 */\
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
807 "pcmpeqd %%mm3, %%mm3 \n\t"\
5591
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
808 "psllw $15, %%mm3 \n\t"\
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
809 "psrlw $12, %%mm3 \n\t" /* FRAC_BITS >> 1 */\
3211
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
810 "1: \n\t"\
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
811 "mov %1, %%"REG_D" \n\t"\
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
812 "mov (%%"REG_D"), %%"REG_D" \n\t"\
3566
b63ef6fcbc70 Fix x86 SIMD asm and pic, patch from Martin von Gagern <Martin.vGagern@gmx.net>
lu_zero
parents: 3398
diff changeset
813 "add %3, %%"REG_D" \n\t"
3211
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
814
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
815 #define snow_inner_add_yblock_mmx_start(out_reg1, out_reg2, ptr_offset, s_offset, d_offset)\
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
816 "mov "PTR_SIZE"*"ptr_offset"(%%"REG_a"), %%"REG_d"; \n\t"\
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
817 "movd "d_offset"(%%"REG_d"), %%"out_reg1" \n\t"\
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
818 "movd "d_offset"+4(%%"REG_d"), %%"out_reg2" \n\t"\
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
819 "punpcklbw %%mm7, %%"out_reg1" \n\t"\
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
820 "punpcklbw %%mm7, %%"out_reg2" \n\t"\
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
821 "movd "s_offset"(%%"REG_S"), %%mm0 \n\t"\
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
822 "movd "s_offset"+4(%%"REG_S"), %%mm4 \n\t"\
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
823 "punpcklbw %%mm7, %%mm0 \n\t"\
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
824 "punpcklbw %%mm7, %%mm4 \n\t"\
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
825 "pmullw %%mm0, %%"out_reg1" \n\t"\
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
826 "pmullw %%mm4, %%"out_reg2" \n\t"
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
827
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
828 #define snow_inner_add_yblock_mmx_accum(ptr_offset, s_offset, d_offset) \
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
829 snow_inner_add_yblock_mmx_start("mm2", "mm6", ptr_offset, s_offset, d_offset)\
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
830 "paddusw %%mm2, %%mm1 \n\t"\
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
831 "paddusw %%mm6, %%mm5 \n\t"
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
832
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
833 #define snow_inner_add_yblock_mmx_mix(read_offset, write_offset)\
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
834 "mov %0, %%"REG_d" \n\t"\
5591
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
835 "psrlw $4, %%mm1 \n\t"\
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
836 "psrlw $4, %%mm5 \n\t"\
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
837 "paddw "read_offset"(%%"REG_D"), %%mm1 \n\t"\
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
838 "paddw "read_offset"+8(%%"REG_D"), %%mm5 \n\t"\
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
839 "paddw %%mm3, %%mm1 \n\t"\
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
840 "paddw %%mm3, %%mm5 \n\t"\
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
841 "psraw $4, %%mm1 \n\t"\
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
842 "psraw $4, %%mm5 \n\t"\
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
843 "packuswb %%mm5, %%mm1 \n\t"\
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
844 "movq %%mm1, "write_offset"(%%"REG_d") \n\t"
3211
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
845
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
846 #define snow_inner_add_yblock_mmx_end(s_step)\
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
847 "add $"s_step", %%"REG_S" \n\t"\
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
848 "add %%"REG_c", "PTR_SIZE"*3(%%"REG_a");\n\t"\
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
849 "add %%"REG_c", "PTR_SIZE"*2(%%"REG_a");\n\t"\
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
850 "add %%"REG_c", "PTR_SIZE"*1(%%"REG_a");\n\t"\
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
851 "add %%"REG_c", (%%"REG_a") \n\t"\
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
852 "add $"PTR_SIZE"*1, %1 \n\t"\
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
853 "add %%"REG_c", %0 \n\t"\
3566
b63ef6fcbc70 Fix x86 SIMD asm and pic, patch from Martin von Gagern <Martin.vGagern@gmx.net>
lu_zero
parents: 3398
diff changeset
854 "dec %2 \n\t"\
3211
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
855 "jnz 1b \n\t"\
3566
b63ef6fcbc70 Fix x86 SIMD asm and pic, patch from Martin von Gagern <Martin.vGagern@gmx.net>
lu_zero
parents: 3398
diff changeset
856 :"+m"(dst8),"+m"(dst_array),"=&r"(tmp)\
3211
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
857 :\
5591
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
858 "rm"((long)(src_x<<1)),"m"(obmc),"a"(block),"m"((long)b_h),"m"((long)src_stride):\
3566
b63ef6fcbc70 Fix x86 SIMD asm and pic, patch from Martin von Gagern <Martin.vGagern@gmx.net>
lu_zero
parents: 3398
diff changeset
859 "%"REG_c"","%"REG_S"","%"REG_D"","%"REG_d"");
3211
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
860
4436
d3e389536b0a Add the const specifier as needed to reduce the number of warnings.
takis
parents: 3947
diff changeset
861 static void inner_add_yblock_bw_8_obmc_16_mmx(const uint8_t *obmc, const long obmc_stride, uint8_t * * block, int b_w, long b_h,
3211
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
862 int src_x, int src_y, long src_stride, slice_buffer * sb, int add, uint8_t * dst8){
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
863 snow_inner_add_yblock_mmx_header
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
864 snow_inner_add_yblock_mmx_start("mm1", "mm5", "3", "0", "0")
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
865 snow_inner_add_yblock_mmx_accum("2", "8", "0")
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
866 snow_inner_add_yblock_mmx_accum("1", "128", "0")
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
867 snow_inner_add_yblock_mmx_accum("0", "136", "0")
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
868 snow_inner_add_yblock_mmx_mix("0", "0")
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
869 snow_inner_add_yblock_mmx_end("16")
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
870 }
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
871
4436
d3e389536b0a Add the const specifier as needed to reduce the number of warnings.
takis
parents: 3947
diff changeset
872 static void inner_add_yblock_bw_16_obmc_32_mmx(const uint8_t *obmc, const long obmc_stride, uint8_t * * block, int b_w, long b_h,
3211
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
873 int src_x, int src_y, long src_stride, slice_buffer * sb, int add, uint8_t * dst8){
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
874 snow_inner_add_yblock_mmx_header
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
875 snow_inner_add_yblock_mmx_start("mm1", "mm5", "3", "0", "0")
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
876 snow_inner_add_yblock_mmx_accum("2", "16", "0")
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
877 snow_inner_add_yblock_mmx_accum("1", "512", "0")
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
878 snow_inner_add_yblock_mmx_accum("0", "528", "0")
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
879 snow_inner_add_yblock_mmx_mix("0", "0")
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
880
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
881 snow_inner_add_yblock_mmx_start("mm1", "mm5", "3", "8", "8")
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
882 snow_inner_add_yblock_mmx_accum("2", "24", "8")
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
883 snow_inner_add_yblock_mmx_accum("1", "520", "8")
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
884 snow_inner_add_yblock_mmx_accum("0", "536", "8")
5591
642588a60570 update mmx code to latest snow changes
michael
parents: 5565
diff changeset
885 snow_inner_add_yblock_mmx_mix("16", "8")
3211
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
886 snow_inner_add_yblock_mmx_end("32")
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
887 }
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
888
4436
d3e389536b0a Add the const specifier as needed to reduce the number of warnings.
takis
parents: 3947
diff changeset
889 void ff_snow_inner_add_yblock_sse2(const uint8_t *obmc, const int obmc_stride, uint8_t * * block, int b_w, int b_h,
3211
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
890 int src_x, int src_y, int src_stride, slice_buffer * sb, int add, uint8_t * dst8){
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
891
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
892 if (b_w == 16)
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
893 inner_add_yblock_bw_16_obmc_32_sse2(obmc, obmc_stride, block, b_w, b_h, src_x,src_y, src_stride, sb, add, dst8);
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
894 else if (b_w == 8 && obmc_stride == 16) {
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
895 if (!(b_h & 1))
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
896 inner_add_yblock_bw_8_obmc_16_bh_even_sse2(obmc, obmc_stride, block, b_w, b_h, src_x,src_y, src_stride, sb, add, dst8);
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
897 else
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
898 inner_add_yblock_bw_8_obmc_16_mmx(obmc, obmc_stride, block, b_w, b_h, src_x,src_y, src_stride, sb, add, dst8);
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
899 } else
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
900 ff_snow_inner_add_yblock(obmc, obmc_stride, block, b_w, b_h, src_x,src_y, src_stride, sb, add, dst8);
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
901 }
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
902
4436
d3e389536b0a Add the const specifier as needed to reduce the number of warnings.
takis
parents: 3947
diff changeset
903 void ff_snow_inner_add_yblock_mmx(const uint8_t *obmc, const int obmc_stride, uint8_t * * block, int b_w, int b_h,
3211
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
904 int src_x, int src_y, int src_stride, slice_buffer * sb, int add, uint8_t * dst8){
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
905 if (b_w == 16)
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
906 inner_add_yblock_bw_16_obmc_32_mmx(obmc, obmc_stride, block, b_w, b_h, src_x,src_y, src_stride, sb, add, dst8);
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
907 else if (b_w == 8 && obmc_stride == 16)
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
908 inner_add_yblock_bw_8_obmc_16_mmx(obmc, obmc_stride, block, b_w, b_h, src_x,src_y, src_stride, sb, add, dst8);
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
909 else
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
910 ff_snow_inner_add_yblock(obmc, obmc_stride, block, b_w, b_h, src_x,src_y, src_stride, sb, add, dst8);
b77b5e7072d6 add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents: 3210
diff changeset
911 }