annotate i386/vp3dsp_mmx.c @ 8246:75ae6859ac73 libavcodec

Trivial, Cosmetics, mostly brace placement changes
author reynaldo
date Tue, 02 Dec 2008 18:25:17 +0000
parents b661cf8690a1
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1866
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
1 /*
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
2 * Copyright (C) 2004 the ffmpeg project
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
3 *
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3036
diff changeset
4 * This file is part of FFmpeg.
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3036
diff changeset
5 *
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3036
diff changeset
6 * FFmpeg is free software; you can redistribute it and/or
1866
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
7 * modify it under the terms of the GNU Lesser General Public
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
8 * 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: 3036
diff changeset
9 * version 2.1 of the License, or (at your option) any later version.
1866
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
10 *
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3036
diff changeset
11 * FFmpeg is distributed in the hope that it will be useful,
1866
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
14 * Lesser General Public License for more details.
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
15 *
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
16 * 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: 3036
diff changeset
17 * License along with FFmpeg; if not, write to the Free Software
3036
0b546eab515d Update licensing information: The FSF changed postal address.
diego
parents: 2967
diff changeset
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
1866
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
19 */
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
20
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
21 /**
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
22 * @file vp3dsp_mmx.c
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
23 * MMX-optimized functions cribbed from the original VP3 source code.
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
24 */
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
25
8032
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
26 #include "libavutil/x86_cpu.h"
6763
f7cbb7733146 Use full path for #includes from another directory.
diego
parents: 5014
diff changeset
27 #include "libavcodec/dsputil.h"
7742
bff9b5fea03f Use ff_pw_8 in MMX/SSE VP3 IDCT
conrad
parents: 6763
diff changeset
28 #include "dsputil_mmx.h"
1866
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
29
7759
892ca48b7d76 Use ff_vp3_idct_data in vp3dsp_mmx.c rather than duplicating it
conrad
parents: 7742
diff changeset
30 extern const uint16_t ff_vp3_idct_data[];
1866
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
31
8032
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
32 // this is off by one or two for some cases when filter_limit is greater than 63
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
33 // in: p0 in mm6, p1 in mm4, p2 in mm2, p3 in mm1
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
34 // out: p1 in mm4, p2 in mm3
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
35 #define VP3_LOOP_FILTER(flim) \
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
36 "movq %%mm6, %%mm7 \n\t" \
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
37 "pand "MANGLE(ff_pb_7 )", %%mm6 \n\t" /* p0&7 */ \
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
38 "psrlw $3, %%mm7 \n\t" \
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
39 "pand "MANGLE(ff_pb_1F)", %%mm7 \n\t" /* p0>>3 */ \
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
40 "movq %%mm2, %%mm3 \n\t" /* mm3 = p2 */ \
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
41 "pxor %%mm4, %%mm2 \n\t" \
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
42 "pand "MANGLE(ff_pb_1 )", %%mm2 \n\t" /* (p2^p1)&1 */ \
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
43 "movq %%mm2, %%mm5 \n\t" \
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
44 "paddb %%mm2, %%mm2 \n\t" \
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
45 "paddb %%mm5, %%mm2 \n\t" /* 3*(p2^p1)&1 */ \
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
46 "paddb %%mm6, %%mm2 \n\t" /* extra bits lost in shifts */ \
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
47 "pcmpeqb %%mm0, %%mm0 \n\t" \
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
48 "pxor %%mm0, %%mm1 \n\t" /* 255 - p3 */ \
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
49 "pavgb %%mm2, %%mm1 \n\t" /* (256 - p3 + extrabits) >> 1 */ \
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
50 "pxor %%mm4, %%mm0 \n\t" /* 255 - p1 */ \
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
51 "pavgb %%mm3, %%mm0 \n\t" /* (256 + p2-p1) >> 1 */ \
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
52 "paddb "MANGLE(ff_pb_3 )", %%mm1 \n\t" \
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
53 "pavgb %%mm0, %%mm1 \n\t" /* 128+2+( p2-p1 - p3) >> 2 */ \
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
54 "pavgb %%mm0, %%mm1 \n\t" /* 128+1+(3*(p2-p1) - p3) >> 3 */ \
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
55 "paddusb %%mm1, %%mm7 \n\t" /* d+128+1 */ \
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
56 "movq "MANGLE(ff_pb_81)", %%mm6 \n\t" \
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
57 "psubusb %%mm7, %%mm6 \n\t" \
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
58 "psubusb "MANGLE(ff_pb_81)", %%mm7 \n\t" \
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
59 \
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
60 "movq "#flim", %%mm5 \n\t" \
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
61 "pminub %%mm5, %%mm6 \n\t" \
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
62 "pminub %%mm5, %%mm7 \n\t" \
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
63 "movq %%mm6, %%mm0 \n\t" \
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
64 "movq %%mm7, %%mm1 \n\t" \
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
65 "paddb %%mm6, %%mm6 \n\t" \
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
66 "paddb %%mm7, %%mm7 \n\t" \
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
67 "pminub %%mm5, %%mm6 \n\t" \
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
68 "pminub %%mm5, %%mm7 \n\t" \
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
69 "psubb %%mm0, %%mm6 \n\t" \
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
70 "psubb %%mm1, %%mm7 \n\t" \
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
71 "paddusb %%mm7, %%mm4 \n\t" \
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
72 "psubusb %%mm6, %%mm4 \n\t" \
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
73 "psubusb %%mm7, %%mm3 \n\t" \
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
74 "paddusb %%mm6, %%mm3 \n\t"
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
75
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
76 #define STORE_4_WORDS(dst0, dst1, dst2, dst3, mm) \
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
77 "movd "#mm", %0 \n\t" \
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
78 "movw %w0, -1"#dst0" \n\t" \
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
79 "psrlq $32, "#mm" \n\t" \
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
80 "shr $16, %0 \n\t" \
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
81 "movw %w0, -1"#dst1" \n\t" \
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
82 "movd "#mm", %0 \n\t" \
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
83 "movw %w0, -1"#dst2" \n\t" \
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
84 "shr $16, %0 \n\t" \
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
85 "movw %w0, -1"#dst3" \n\t"
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
86
8033
b661cf8690a1 VP3 loop filter is mmx2 not mmx
conrad
parents: 8032
diff changeset
87 void ff_vp3_v_loop_filter_mmx2(uint8_t *src, int stride, int *bounding_values)
8032
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
88 {
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
89 __asm__ volatile(
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
90 "movq %0, %%mm6 \n\t"
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
91 "movq %1, %%mm4 \n\t"
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
92 "movq %2, %%mm2 \n\t"
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
93 "movq %3, %%mm1 \n\t"
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
94
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
95 VP3_LOOP_FILTER(%4)
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
96
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
97 "movq %%mm4, %1 \n\t"
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
98 "movq %%mm3, %2 \n\t"
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
99
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
100 : "+m" (*(uint64_t*)(src - 2*stride)),
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
101 "+m" (*(uint64_t*)(src - 1*stride)),
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
102 "+m" (*(uint64_t*)(src + 0*stride)),
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
103 "+m" (*(uint64_t*)(src + 1*stride))
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
104 : "m"(*(uint64_t*)(bounding_values+129))
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
105 );
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
106 }
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
107
8033
b661cf8690a1 VP3 loop filter is mmx2 not mmx
conrad
parents: 8032
diff changeset
108 void ff_vp3_h_loop_filter_mmx2(uint8_t *src, int stride, int *bounding_values)
8032
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
109 {
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
110 x86_reg tmp;
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
111
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
112 __asm__ volatile(
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
113 "movd -2(%1), %%mm6 \n\t"
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
114 "movd -2(%1,%3), %%mm0 \n\t"
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
115 "movd -2(%1,%3,2), %%mm1 \n\t"
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
116 "movd -2(%1,%4), %%mm4 \n\t"
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
117
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
118 TRANSPOSE8x4(%%mm6, %%mm0, %%mm1, %%mm4, -2(%2), -2(%2,%3), -2(%2,%3,2), -2(%2,%4), %%mm2)
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
119 VP3_LOOP_FILTER(%5)
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
120 SBUTTERFLY(%%mm4, %%mm3, %%mm5, bw, q)
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
121
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
122 STORE_4_WORDS((%1), (%1,%3), (%1,%3,2), (%1,%4), %%mm4)
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
123 STORE_4_WORDS((%2), (%2,%3), (%2,%3,2), (%2,%4), %%mm5)
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
124
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
125 : "=&r"(tmp)
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
126 : "r"(src), "r"(src+4*stride), "r"((x86_reg)stride), "r"((x86_reg)3*stride),
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
127 "m"(*(uint64_t*)(bounding_values+129))
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
128 : "memory"
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
129 );
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
130 }
0839f325edb5 MMX VP3 Loop Filter
conrad
parents: 8031
diff changeset
131
1866
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
132 /* from original comments: The Macro does IDct on 4 1-D Dcts */
7877
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
133 #define BeginIDCT() \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
134 "movq "I(3)", %%mm2 \n\t" \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
135 "movq "C(3)", %%mm6 \n\t" \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
136 "movq %%mm2, %%mm4 \n\t" \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
137 "movq "J(5)", %%mm7 \n\t" \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
138 "pmulhw %%mm6, %%mm4 \n\t" /* r4 = c3*i3 - i3 */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
139 "movq "C(5)", %%mm1 \n\t" \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
140 "pmulhw %%mm7, %%mm6 \n\t" /* r6 = c3*i5 - i5 */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
141 "movq %%mm1, %%mm5 \n\t" \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
142 "pmulhw %%mm2, %%mm1 \n\t" /* r1 = c5*i3 - i3 */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
143 "movq "I(1)", %%mm3 \n\t" \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
144 "pmulhw %%mm7, %%mm5 \n\t" /* r5 = c5*i5 - i5 */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
145 "movq "C(1)", %%mm0 \n\t" \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
146 "paddw %%mm2, %%mm4 \n\t" /* r4 = c3*i3 */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
147 "paddw %%mm7, %%mm6 \n\t" /* r6 = c3*i5 */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
148 "paddw %%mm1, %%mm2 \n\t" /* r2 = c5*i3 */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
149 "movq "J(7)", %%mm1 \n\t" \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
150 "paddw %%mm5, %%mm7 \n\t" /* r7 = c5*i5 */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
151 "movq %%mm0, %%mm5 \n\t" /* r5 = c1 */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
152 "pmulhw %%mm3, %%mm0 \n\t" /* r0 = c1*i1 - i1 */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
153 "paddsw %%mm7, %%mm4 \n\t" /* r4 = C = c3*i3 + c5*i5 */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
154 "pmulhw %%mm1, %%mm5 \n\t" /* r5 = c1*i7 - i7 */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
155 "movq "C(7)", %%mm7 \n\t" \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
156 "psubsw %%mm2, %%mm6 \n\t" /* r6 = D = c3*i5 - c5*i3 */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
157 "paddw %%mm3, %%mm0 \n\t" /* r0 = c1*i1 */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
158 "pmulhw %%mm7, %%mm3 \n\t" /* r3 = c7*i1 */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
159 "movq "I(2)", %%mm2 \n\t" \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
160 "pmulhw %%mm1, %%mm7 \n\t" /* r7 = c7*i7 */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
161 "paddw %%mm1, %%mm5 \n\t" /* r5 = c1*i7 */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
162 "movq %%mm2, %%mm1 \n\t" /* r1 = i2 */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
163 "pmulhw "C(2)", %%mm2 \n\t" /* r2 = c2*i2 - i2 */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
164 "psubsw %%mm5, %%mm3 \n\t" /* r3 = B = c7*i1 - c1*i7 */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
165 "movq "J(6)", %%mm5 \n\t" \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
166 "paddsw %%mm7, %%mm0 \n\t" /* r0 = A = c1*i1 + c7*i7 */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
167 "movq %%mm5, %%mm7 \n\t" /* r7 = i6 */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
168 "psubsw %%mm4, %%mm0 \n\t" /* r0 = A - C */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
169 "pmulhw "C(2)", %%mm5 \n\t" /* r5 = c2*i6 - i6 */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
170 "paddw %%mm1, %%mm2 \n\t" /* r2 = c2*i2 */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
171 "pmulhw "C(6)", %%mm1 \n\t" /* r1 = c6*i2 */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
172 "paddsw %%mm4, %%mm4 \n\t" /* r4 = C + C */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
173 "paddsw %%mm0, %%mm4 \n\t" /* r4 = C. = A + C */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
174 "psubsw %%mm6, %%mm3 \n\t" /* r3 = B - D */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
175 "paddw %%mm7, %%mm5 \n\t" /* r5 = c2*i6 */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
176 "paddsw %%mm6, %%mm6 \n\t" /* r6 = D + D */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
177 "pmulhw "C(6)", %%mm7 \n\t" /* r7 = c6*i6 */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
178 "paddsw %%mm3, %%mm6 \n\t" /* r6 = D. = B + D */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
179 "movq %%mm4, "I(1)"\n\t" /* save C. at I(1) */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
180 "psubsw %%mm5, %%mm1 \n\t" /* r1 = H = c6*i2 - c2*i6 */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
181 "movq "C(4)", %%mm4 \n\t" \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
182 "movq %%mm3, %%mm5 \n\t" /* r5 = B - D */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
183 "pmulhw %%mm4, %%mm3 \n\t" /* r3 = (c4 - 1) * (B - D) */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
184 "paddsw %%mm2, %%mm7 \n\t" /* r3 = (c4 - 1) * (B - D) */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
185 "movq %%mm6, "I(2)"\n\t" /* save D. at I(2) */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
186 "movq %%mm0, %%mm2 \n\t" /* r2 = A - C */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
187 "movq "I(0)", %%mm6 \n\t" \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
188 "pmulhw %%mm4, %%mm0 \n\t" /* r0 = (c4 - 1) * (A - C) */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
189 "paddw %%mm3, %%mm5 \n\t" /* r5 = B. = c4 * (B - D) */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
190 "movq "J(4)", %%mm3 \n\t" \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
191 "psubsw %%mm1, %%mm5 \n\t" /* r5 = B.. = B. - H */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
192 "paddw %%mm0, %%mm2 \n\t" /* r0 = A. = c4 * (A - C) */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
193 "psubsw %%mm3, %%mm6 \n\t" /* r6 = i0 - i4 */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
194 "movq %%mm6, %%mm0 \n\t" \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
195 "pmulhw %%mm4, %%mm6 \n\t" /* r6 = (c4 - 1) * (i0 - i4) */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
196 "paddsw %%mm3, %%mm3 \n\t" /* r3 = i4 + i4 */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
197 "paddsw %%mm1, %%mm1 \n\t" /* r1 = H + H */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
198 "paddsw %%mm0, %%mm3 \n\t" /* r3 = i0 + i4 */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
199 "paddsw %%mm5, %%mm1 \n\t" /* r1 = H. = B + H */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
200 "pmulhw %%mm3, %%mm4 \n\t" /* r4 = (c4 - 1) * (i0 + i4) */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
201 "paddsw %%mm0, %%mm6 \n\t" /* r6 = F = c4 * (i0 - i4) */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
202 "psubsw %%mm2, %%mm6 \n\t" /* r6 = F. = F - A. */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
203 "paddsw %%mm2, %%mm2 \n\t" /* r2 = A. + A. */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
204 "movq "I(1)", %%mm0 \n\t" /* r0 = C. */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
205 "paddsw %%mm6, %%mm2 \n\t" /* r2 = A.. = F + A. */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
206 "paddw %%mm3, %%mm4 \n\t" /* r4 = E = c4 * (i0 + i4) */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
207 "psubsw %%mm1, %%mm2 \n\t" /* r2 = R2 = A.. - H. */
1866
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
208
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
209 /* RowIDCT gets ready to transpose */
7877
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
210 #define RowIDCT() \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
211 BeginIDCT() \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
212 "movq "I(2)", %%mm3 \n\t" /* r3 = D. */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
213 "psubsw %%mm7, %%mm4 \n\t" /* r4 = E. = E - G */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
214 "paddsw %%mm1, %%mm1 \n\t" /* r1 = H. + H. */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
215 "paddsw %%mm7, %%mm7 \n\t" /* r7 = G + G */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
216 "paddsw %%mm2, %%mm1 \n\t" /* r1 = R1 = A.. + H. */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
217 "paddsw %%mm4, %%mm7 \n\t" /* r1 = R1 = A.. + H. */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
218 "psubsw %%mm3, %%mm4 \n\t" /* r4 = R4 = E. - D. */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
219 "paddsw %%mm3, %%mm3 \n\t" \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
220 "psubsw %%mm5, %%mm6 \n\t" /* r6 = R6 = F. - B.. */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
221 "paddsw %%mm5, %%mm5 \n\t" \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
222 "paddsw %%mm4, %%mm3 \n\t" /* r3 = R3 = E. + D. */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
223 "paddsw %%mm6, %%mm5 \n\t" /* r5 = R5 = F. + B.. */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
224 "psubsw %%mm0, %%mm7 \n\t" /* r7 = R7 = G. - C. */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
225 "paddsw %%mm0, %%mm0 \n\t" \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
226 "movq %%mm1, "I(1)"\n\t" /* save R1 */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
227 "paddsw %%mm7, %%mm0 \n\t" /* r0 = R0 = G. + C. */
1866
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
228
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
229 /* Column IDCT normalizes and stores final results */
7877
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
230 #define ColumnIDCT() \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
231 BeginIDCT() \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
232 "paddsw "OC_8", %%mm2 \n\t" /* adjust R2 (and R1) for shift */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
233 "paddsw %%mm1, %%mm1 \n\t" /* r1 = H. + H. */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
234 "paddsw %%mm2, %%mm1 \n\t" /* r1 = R1 = A.. + H. */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
235 "psraw $4, %%mm2 \n\t" /* r2 = NR2 */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
236 "psubsw %%mm7, %%mm4 \n\t" /* r4 = E. = E - G */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
237 "psraw $4, %%mm1 \n\t" /* r1 = NR1 */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
238 "movq "I(2)", %%mm3 \n\t" /* r3 = D. */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
239 "paddsw %%mm7, %%mm7 \n\t" /* r7 = G + G */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
240 "movq %%mm2, "I(2)"\n\t" /* store NR2 at I2 */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
241 "paddsw %%mm4, %%mm7 \n\t" /* r7 = G. = E + G */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
242 "movq %%mm1, "I(1)"\n\t" /* store NR1 at I1 */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
243 "psubsw %%mm3, %%mm4 \n\t" /* r4 = R4 = E. - D. */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
244 "paddsw "OC_8", %%mm4 \n\t" /* adjust R4 (and R3) for shift */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
245 "paddsw %%mm3, %%mm3 \n\t" /* r3 = D. + D. */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
246 "paddsw %%mm4, %%mm3 \n\t" /* r3 = R3 = E. + D. */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
247 "psraw $4, %%mm4 \n\t" /* r4 = NR4 */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
248 "psubsw %%mm5, %%mm6 \n\t" /* r6 = R6 = F. - B.. */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
249 "psraw $4, %%mm3 \n\t" /* r3 = NR3 */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
250 "paddsw "OC_8", %%mm6 \n\t" /* adjust R6 (and R5) for shift */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
251 "paddsw %%mm5, %%mm5 \n\t" /* r5 = B.. + B.. */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
252 "paddsw %%mm6, %%mm5 \n\t" /* r5 = R5 = F. + B.. */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
253 "psraw $4, %%mm6 \n\t" /* r6 = NR6 */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
254 "movq %%mm4, "J(4)"\n\t" /* store NR4 at J4 */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
255 "psraw $4, %%mm5 \n\t" /* r5 = NR5 */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
256 "movq %%mm3, "I(3)"\n\t" /* store NR3 at I3 */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
257 "psubsw %%mm0, %%mm7 \n\t" /* r7 = R7 = G. - C. */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
258 "paddsw "OC_8", %%mm7 \n\t" /* adjust R7 (and R0) for shift */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
259 "paddsw %%mm0, %%mm0 \n\t" /* r0 = C. + C. */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
260 "paddsw %%mm7, %%mm0 \n\t" /* r0 = R0 = G. + C. */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
261 "psraw $4, %%mm7 \n\t" /* r7 = NR7 */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
262 "movq %%mm6, "J(6)"\n\t" /* store NR6 at J6 */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
263 "psraw $4, %%mm0 \n\t" /* r0 = NR0 */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
264 "movq %%mm5, "J(5)"\n\t" /* store NR5 at J5 */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
265 "movq %%mm7, "J(7)"\n\t" /* store NR7 at J7 */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
266 "movq %%mm0, "I(0)"\n\t" /* store NR0 at I0 */
1866
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
267
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
268 /* Following macro does two 4x4 transposes in place.
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
269
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
270 At entry (we assume):
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
271
1969
56cb752222cc correct MMX-optimized variant of VP3 IDCT, with comments (thank you
melanson
parents: 1866
diff changeset
272 r0 = a3 a2 a1 a0
56cb752222cc correct MMX-optimized variant of VP3 IDCT, with comments (thank you
melanson
parents: 1866
diff changeset
273 I(1) = b3 b2 b1 b0
56cb752222cc correct MMX-optimized variant of VP3 IDCT, with comments (thank you
melanson
parents: 1866
diff changeset
274 r2 = c3 c2 c1 c0
56cb752222cc correct MMX-optimized variant of VP3 IDCT, with comments (thank you
melanson
parents: 1866
diff changeset
275 r3 = d3 d2 d1 d0
1866
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
276
1969
56cb752222cc correct MMX-optimized variant of VP3 IDCT, with comments (thank you
melanson
parents: 1866
diff changeset
277 r4 = e3 e2 e1 e0
56cb752222cc correct MMX-optimized variant of VP3 IDCT, with comments (thank you
melanson
parents: 1866
diff changeset
278 r5 = f3 f2 f1 f0
56cb752222cc correct MMX-optimized variant of VP3 IDCT, with comments (thank you
melanson
parents: 1866
diff changeset
279 r6 = g3 g2 g1 g0
56cb752222cc correct MMX-optimized variant of VP3 IDCT, with comments (thank you
melanson
parents: 1866
diff changeset
280 r7 = h3 h2 h1 h0
1866
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
281
1969
56cb752222cc correct MMX-optimized variant of VP3 IDCT, with comments (thank you
melanson
parents: 1866
diff changeset
282 At exit, we have:
1866
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
283
1969
56cb752222cc correct MMX-optimized variant of VP3 IDCT, with comments (thank you
melanson
parents: 1866
diff changeset
284 I(0) = d0 c0 b0 a0
56cb752222cc correct MMX-optimized variant of VP3 IDCT, with comments (thank you
melanson
parents: 1866
diff changeset
285 I(1) = d1 c1 b1 a1
56cb752222cc correct MMX-optimized variant of VP3 IDCT, with comments (thank you
melanson
parents: 1866
diff changeset
286 I(2) = d2 c2 b2 a2
56cb752222cc correct MMX-optimized variant of VP3 IDCT, with comments (thank you
melanson
parents: 1866
diff changeset
287 I(3) = d3 c3 b3 a3
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2753
diff changeset
288
1969
56cb752222cc correct MMX-optimized variant of VP3 IDCT, with comments (thank you
melanson
parents: 1866
diff changeset
289 J(4) = h0 g0 f0 e0
56cb752222cc correct MMX-optimized variant of VP3 IDCT, with comments (thank you
melanson
parents: 1866
diff changeset
290 J(5) = h1 g1 f1 e1
56cb752222cc correct MMX-optimized variant of VP3 IDCT, with comments (thank you
melanson
parents: 1866
diff changeset
291 J(6) = h2 g2 f2 e2
56cb752222cc correct MMX-optimized variant of VP3 IDCT, with comments (thank you
melanson
parents: 1866
diff changeset
292 J(7) = h3 g3 f3 e3
1866
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
293
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
294 I(0) I(1) I(2) I(3) is the transpose of r0 I(1) r2 r3.
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
295 J(4) J(5) J(6) J(7) is the transpose of r4 r5 r6 r7.
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
296
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
297 Since r1 is free at entry, we calculate the Js first. */
7877
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
298 #define Transpose() \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
299 "movq %%mm4, %%mm1 \n\t" /* r1 = e3 e2 e1 e0 */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
300 "punpcklwd %%mm5, %%mm4 \n\t" /* r4 = f1 e1 f0 e0 */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
301 "movq %%mm0, "I(0)"\n\t" /* save a3 a2 a1 a0 */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
302 "punpckhwd %%mm5, %%mm1 \n\t" /* r1 = f3 e3 f2 e2 */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
303 "movq %%mm6, %%mm0 \n\t" /* r0 = g3 g2 g1 g0 */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
304 "punpcklwd %%mm7, %%mm6 \n\t" /* r6 = h1 g1 h0 g0 */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
305 "movq %%mm4, %%mm5 \n\t" /* r5 = f1 e1 f0 e0 */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
306 "punpckldq %%mm6, %%mm4 \n\t" /* r4 = h0 g0 f0 e0 = R4 */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
307 "punpckhdq %%mm6, %%mm5 \n\t" /* r5 = h1 g1 f1 e1 = R5 */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
308 "movq %%mm1, %%mm6 \n\t" /* r6 = f3 e3 f2 e2 */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
309 "movq %%mm4, "J(4)"\n\t" \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
310 "punpckhwd %%mm7, %%mm0 \n\t" /* r0 = h3 g3 h2 g2 */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
311 "movq %%mm5, "J(5)"\n\t" \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
312 "punpckhdq %%mm0, %%mm6 \n\t" /* r6 = h3 g3 f3 e3 = R7 */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
313 "movq "I(0)", %%mm4 \n\t" /* r4 = a3 a2 a1 a0 */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
314 "punpckldq %%mm0, %%mm1 \n\t" /* r1 = h2 g2 f2 e2 = R6 */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
315 "movq "I(1)", %%mm5 \n\t" /* r5 = b3 b2 b1 b0 */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
316 "movq %%mm4, %%mm0 \n\t" /* r0 = a3 a2 a1 a0 */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
317 "movq %%mm6, "J(7)"\n\t" \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
318 "punpcklwd %%mm5, %%mm0 \n\t" /* r0 = b1 a1 b0 a0 */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
319 "movq %%mm1, "J(6)"\n\t" \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
320 "punpckhwd %%mm5, %%mm4 \n\t" /* r4 = b3 a3 b2 a2 */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
321 "movq %%mm2, %%mm5 \n\t" /* r5 = c3 c2 c1 c0 */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
322 "punpcklwd %%mm3, %%mm2 \n\t" /* r2 = d1 c1 d0 c0 */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
323 "movq %%mm0, %%mm1 \n\t" /* r1 = b1 a1 b0 a0 */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
324 "punpckldq %%mm2, %%mm0 \n\t" /* r0 = d0 c0 b0 a0 = R0 */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
325 "punpckhdq %%mm2, %%mm1 \n\t" /* r1 = d1 c1 b1 a1 = R1 */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
326 "movq %%mm4, %%mm2 \n\t" /* r2 = b3 a3 b2 a2 */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
327 "movq %%mm0, "I(0)"\n\t" \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
328 "punpckhwd %%mm3, %%mm5 \n\t" /* r5 = d3 c3 d2 c2 */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
329 "movq %%mm1, "I(1)"\n\t" \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
330 "punpckhdq %%mm5, %%mm4 \n\t" /* r4 = d3 c3 b3 a3 = R3 */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
331 "punpckldq %%mm5, %%mm2 \n\t" /* r2 = d2 c2 b2 a2 = R2 */ \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
332 "movq %%mm4, "I(3)"\n\t" \
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
333 "movq %%mm2, "I(2)"\n\t"
1866
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
334
2696
9699d325049d porting the mmx&sse2 (sse2 untested) vp3 idcts to the lavc idct API
michael
parents: 1977
diff changeset
335 void ff_vp3_idct_mmx(int16_t *output_data)
1866
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
336 {
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
337 /* eax = quantized input
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
338 * ebx = dequantizer matrix
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
339 * ecx = IDCT constants
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
340 * M(I) = ecx + MaskOffset(0) + I * 8
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
341 * C(I) = ecx + CosineOffset(32) + (I-1) * 8
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
342 * edx = output
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
343 * r0..r7 = mm0..mm7
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
344 */
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
345
7877
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
346 #define C(x) AV_STRINGIFY(16*(x-1))"(%1)"
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
347 #define OC_8 "%2"
1866
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
348
1969
56cb752222cc correct MMX-optimized variant of VP3 IDCT, with comments (thank you
melanson
parents: 1866
diff changeset
349 /* at this point, function has completed dequantization + dezigzag +
1866
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
350 * partial transposition; now do the idct itself */
7877
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
351 #define I(x) AV_STRINGIFY(16* x )"(%0)"
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
352 #define J(x) AV_STRINGIFY(16*(x-4) + 8)"(%0)"
1866
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
353
8031
eebc7209c47f Convert asm keyword into __asm__.
flameeyes
parents: 7879
diff changeset
354 __asm__ volatile (
7879
e05e021fce72 Cosmetics: reindent
conrad
parents: 7877
diff changeset
355 RowIDCT()
e05e021fce72 Cosmetics: reindent
conrad
parents: 7877
diff changeset
356 Transpose()
1866
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
357
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
358 #undef I
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
359 #undef J
7877
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
360 #define I(x) AV_STRINGIFY(16* x + 64)"(%0)"
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
361 #define J(x) AV_STRINGIFY(16*(x-4) + 72)"(%0)"
1866
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
362
7879
e05e021fce72 Cosmetics: reindent
conrad
parents: 7877
diff changeset
363 RowIDCT()
e05e021fce72 Cosmetics: reindent
conrad
parents: 7877
diff changeset
364 Transpose()
1866
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
365
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
366 #undef I
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
367 #undef J
7877
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
368 #define I(x) AV_STRINGIFY(16*x)"(%0)"
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
369 #define J(x) AV_STRINGIFY(16*x)"(%0)"
1866
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
370
7879
e05e021fce72 Cosmetics: reindent
conrad
parents: 7877
diff changeset
371 ColumnIDCT()
1866
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
372
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
373 #undef I
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
374 #undef J
7877
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
375 #define I(x) AV_STRINGIFY(16*x + 8)"(%0)"
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
376 #define J(x) AV_STRINGIFY(16*x + 8)"(%0)"
1866
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
377
7879
e05e021fce72 Cosmetics: reindent
conrad
parents: 7877
diff changeset
378 ColumnIDCT()
7877
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
379 :: "r"(output_data), "r"(ff_vp3_idct_data), "m"(ff_pw_8)
8759422d660a Rewrite MMX VP3 IDCT in inline asm
conrad
parents: 7759
diff changeset
380 );
1866
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
381 #undef I
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
382 #undef J
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
383
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
384 }
5014
42b99a3aadde better separation of vp3dsp functions from dsputil_mmx.c
aurel
parents: 5010
diff changeset
385
42b99a3aadde better separation of vp3dsp functions from dsputil_mmx.c
aurel
parents: 5010
diff changeset
386 void ff_vp3_idct_put_mmx(uint8_t *dest, int line_size, DCTELEM *block)
42b99a3aadde better separation of vp3dsp functions from dsputil_mmx.c
aurel
parents: 5010
diff changeset
387 {
42b99a3aadde better separation of vp3dsp functions from dsputil_mmx.c
aurel
parents: 5010
diff changeset
388 ff_vp3_idct_mmx(block);
42b99a3aadde better separation of vp3dsp functions from dsputil_mmx.c
aurel
parents: 5010
diff changeset
389 put_signed_pixels_clamped_mmx(block, dest, line_size);
42b99a3aadde better separation of vp3dsp functions from dsputil_mmx.c
aurel
parents: 5010
diff changeset
390 }
42b99a3aadde better separation of vp3dsp functions from dsputil_mmx.c
aurel
parents: 5010
diff changeset
391
42b99a3aadde better separation of vp3dsp functions from dsputil_mmx.c
aurel
parents: 5010
diff changeset
392 void ff_vp3_idct_add_mmx(uint8_t *dest, int line_size, DCTELEM *block)
42b99a3aadde better separation of vp3dsp functions from dsputil_mmx.c
aurel
parents: 5010
diff changeset
393 {
42b99a3aadde better separation of vp3dsp functions from dsputil_mmx.c
aurel
parents: 5010
diff changeset
394 ff_vp3_idct_mmx(block);
42b99a3aadde better separation of vp3dsp functions from dsputil_mmx.c
aurel
parents: 5010
diff changeset
395 add_pixels_clamped_mmx(block, dest, line_size);
42b99a3aadde better separation of vp3dsp functions from dsputil_mmx.c
aurel
parents: 5010
diff changeset
396 }