annotate i386/idct_sse2_xvid.c @ 6829:97e57c7986fd libavcodec

Cosmetics: rename variable
author vitor
date Sat, 17 May 2008 14:39:47 +0000
parents f7cbb7733146
children 29bce9b314ec
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6601
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
1 /*
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
2 * XVID MPEG-4 VIDEO CODEC
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
3 * - SSE2 inverse discrete cosine transform -
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
4 *
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
5 * Copyright(C) 2003 Pascal Massimino <skal@planet-d.net>
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
6 *
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
7 * Conversion to gcc syntax with modifications
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
8 * by Alexander Strange <astrange@ithinksw.com>
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
9 *
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
10 * Originally from dct/x86_asm/fdct_sse2_skal.asm in Xvid.
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
11 *
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
12 * This file is part of FFmpeg.
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
13 *
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
14 * Vertical pass is an implementation of the scheme:
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
15 * Loeffler C., Ligtenberg A., and Moschytz C.S.:
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
16 * Practical Fast 1D DCT Algorithm with Eleven Multiplications,
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
17 * Proc. ICASSP 1989, 988-991.
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
18 *
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
19 * Horizontal pass is a double 4x4 vector/matrix multiplication,
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
20 * (see also Intel's Application Note 922:
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
21 * http://developer.intel.com/vtune/cbts/strmsimd/922down.htm
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
22 * Copyright (C) 1999 Intel Corporation)
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
23 *
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
24 * More details at http://skal.planet-d.net/coding/dct.html
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
25 *
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
26 * FFmpeg is free software; you can redistribute it and/or
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
27 * modify it under the terms of the GNU Lesser General Public
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
28 * License as published by the Free Software Foundation; either
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
29 * version 2.1 of the License, or (at your option) any later version.
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
30 *
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
31 * FFmpeg is distributed in the hope that it will be useful,
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
32 * but WITHOUT ANY WARRANTY; without even the implied warranty of
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
33 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
34 * Lesser General Public License for more details.
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
35 *
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
36 * You should have received a copy of the GNU Lesser General Public License
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
37 * along with FFmpeg; if not, write to the Free Software Foundation,
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
38 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
39 */
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
40
6763
f7cbb7733146 Use full path for #includes from another directory.
diego
parents: 6601
diff changeset
41 #include "libavcodec/dsputil.h"
6601
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
42
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
43 /*!
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
44 * @file idct_sse2_xvid.c
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
45 * @brief SSE2 idct compatible with xvidmmx
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
46 */
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
47
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
48 #define X8(x) x,x,x,x,x,x,x,x
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
49
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
50 #define ROW_SHIFT 11
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
51 #define COL_SHIFT 6
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
52
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
53 DECLARE_ASM_CONST(16, int16_t, tan1[]) = {X8(13036)}; // tan( pi/16)
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
54 DECLARE_ASM_CONST(16, int16_t, tan2[]) = {X8(27146)}; // tan(2pi/16) = sqrt(2)-1
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
55 DECLARE_ASM_CONST(16, int16_t, tan3[]) = {X8(43790)}; // tan(3pi/16)-1
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
56 DECLARE_ASM_CONST(16, int16_t, sqrt2[])= {X8(23170)}; // 0.5/sqrt(2)
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
57 DECLARE_ASM_CONST(8, uint8_t, m127[]) = {X8(127)};
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
58
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
59 DECLARE_ASM_CONST(16, int16_t, iTab1[]) = {
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
60 0x4000, 0x539f, 0xc000, 0xac61, 0x4000, 0xdd5d, 0x4000, 0xdd5d,
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
61 0x4000, 0x22a3, 0x4000, 0x22a3, 0xc000, 0x539f, 0x4000, 0xac61,
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
62 0x3249, 0x11a8, 0x4b42, 0xee58, 0x11a8, 0x4b42, 0x11a8, 0xcdb7,
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
63 0x58c5, 0x4b42, 0xa73b, 0xcdb7, 0x3249, 0xa73b, 0x4b42, 0xa73b
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
64 };
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
65
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
66 DECLARE_ASM_CONST(16, int16_t, iTab2[]) = {
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
67 0x58c5, 0x73fc, 0xa73b, 0x8c04, 0x58c5, 0xcff5, 0x58c5, 0xcff5,
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
68 0x58c5, 0x300b, 0x58c5, 0x300b, 0xa73b, 0x73fc, 0x58c5, 0x8c04,
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
69 0x45bf, 0x187e, 0x6862, 0xe782, 0x187e, 0x6862, 0x187e, 0xba41,
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
70 0x7b21, 0x6862, 0x84df, 0xba41, 0x45bf, 0x84df, 0x6862, 0x84df
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
71 };
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
72
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
73 DECLARE_ASM_CONST(16, int16_t, iTab3[]) = {
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
74 0x539f, 0x6d41, 0xac61, 0x92bf, 0x539f, 0xd2bf, 0x539f, 0xd2bf,
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
75 0x539f, 0x2d41, 0x539f, 0x2d41, 0xac61, 0x6d41, 0x539f, 0x92bf,
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
76 0x41b3, 0x1712, 0x6254, 0xe8ee, 0x1712, 0x6254, 0x1712, 0xbe4d,
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
77 0x73fc, 0x6254, 0x8c04, 0xbe4d, 0x41b3, 0x8c04, 0x6254, 0x8c04
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
78 };
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
79
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
80 DECLARE_ASM_CONST(16, int16_t, iTab4[]) = {
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
81 0x4b42, 0x6254, 0xb4be, 0x9dac, 0x4b42, 0xd746, 0x4b42, 0xd746,
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
82 0x4b42, 0x28ba, 0x4b42, 0x28ba, 0xb4be, 0x6254, 0x4b42, 0x9dac,
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
83 0x3b21, 0x14c3, 0x587e, 0xeb3d, 0x14c3, 0x587e, 0x14c3, 0xc4df,
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
84 0x6862, 0x587e, 0x979e, 0xc4df, 0x3b21, 0x979e, 0x587e, 0x979e
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
85 };
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
86
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
87 DECLARE_ASM_CONST(16, int32_t, walkenIdctRounders[]) = {
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
88 65536, 65536, 65536, 65536,
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
89 3597, 3597, 3597, 3597,
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
90 2260, 2260, 2260, 2260,
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
91 1203, 1203, 1203, 1203,
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
92 120, 120, 120, 120,
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
93 512, 512, 512, 512
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
94 };
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
95
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
96 // Temporary storage before the column pass
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
97 #define ROW1 "%%xmm6"
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
98 #define ROW3 "%%xmm4"
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
99 #define ROW5 "%%xmm5"
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
100 #define ROW7 "%%xmm7"
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
101
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
102 #define CLEAR_ODD(r) "pxor "r","r" \n\t"
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
103 #define PUT_ODD(dst) "pshufhw $0x1B, %%xmm2, "dst" \n\t"
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
104
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
105 #ifdef ARCH_X86_64
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
106
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
107 # define ROW0 "%%xmm8"
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
108 # define REG0 ROW0
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
109 # define ROW2 "%%xmm9"
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
110 # define REG2 ROW2
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
111 # define ROW4 "%%xmm10"
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
112 # define REG4 ROW4
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
113 # define ROW6 "%%xmm11"
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
114 # define REG6 ROW6
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
115 # define CLEAR_EVEN(r) CLEAR_ODD(r)
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
116 # define PUT_EVEN(dst) PUT_ODD(dst)
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
117 # define XMMS "%%xmm12"
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
118 # define MOV_32_ONLY "#"
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
119 # define SREG2 REG2
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
120 # define TAN3 "%%xmm13"
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
121 # define TAN1 "%%xmm14"
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
122
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
123 #else
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
124
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
125 # define ROW0 "(%0)"
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
126 # define REG0 "%%xmm4"
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
127 # define ROW2 "2*16(%0)"
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
128 # define REG2 "%%xmm4"
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
129 # define ROW4 "4*16(%0)"
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
130 # define REG4 "%%xmm6"
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
131 # define ROW6 "6*16(%0)"
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
132 # define REG6 "%%xmm6"
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
133 # define CLEAR_EVEN(r)
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
134 # define PUT_EVEN(dst) \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
135 "pshufhw $0x1B, %%xmm2, %%xmm2 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
136 "movdqa %%xmm2, "dst" \n\t"
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
137 # define XMMS "%%xmm2"
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
138 # define MOV_32_ONLY "movdqa "
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
139 # define SREG2 "%%xmm7"
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
140 # define TAN3 "%%xmm0"
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
141 # define TAN1 "%%xmm2"
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
142
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
143 #endif
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
144
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
145 #define ROUND(x) "paddd "MANGLE(x)
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
146
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
147 #define JZ(reg, to) \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
148 "testl "reg","reg" \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
149 "jz "to" \n\t"
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
150
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
151 #define JNZ(reg, to) \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
152 "testl "reg","reg" \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
153 "jnz "to" \n\t"
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
154
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
155 #define TEST_ONE_ROW(src, reg, clear) \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
156 clear \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
157 "movq "src", %%mm1 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
158 "por 8+"src", %%mm1 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
159 "paddusb %%mm0, %%mm1 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
160 "pmovmskb %%mm1, "reg" \n\t"
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
161
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
162 #define TEST_TWO_ROWS(row1, row2, reg1, reg2, clear1, clear2) \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
163 clear1 \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
164 clear2 \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
165 "movq "row1", %%mm1 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
166 "por 8+"row1", %%mm1 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
167 "movq "row2", %%mm2 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
168 "por 8+"row2", %%mm2 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
169 "paddusb %%mm0, %%mm1 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
170 "paddusb %%mm0, %%mm2 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
171 "pmovmskb %%mm1, "reg1" \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
172 "pmovmskb %%mm2, "reg2" \n\t"
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
173
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
174 ///IDCT pass on rows.
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
175 #define iMTX_MULT(src, table, rounder, put) \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
176 "movdqa "src", %%xmm3 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
177 "movdqa %%xmm3, %%xmm0 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
178 "pshufd $0x11, %%xmm3, %%xmm1 \n\t" /* 4602 */ \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
179 "punpcklqdq %%xmm0, %%xmm0 \n\t" /* 0246 */ \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
180 "pmaddwd "table", %%xmm0 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
181 "pmaddwd 16+"table", %%xmm1 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
182 "pshufd $0xBB, %%xmm3, %%xmm2 \n\t" /* 5713 */ \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
183 "punpckhqdq %%xmm3, %%xmm3 \n\t" /* 1357 */ \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
184 "pmaddwd 32+"table", %%xmm2 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
185 "pmaddwd 48+"table", %%xmm3 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
186 "paddd %%xmm1, %%xmm0 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
187 "paddd %%xmm3, %%xmm2 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
188 rounder", %%xmm0 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
189 "movdqa %%xmm2, %%xmm3 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
190 "paddd %%xmm0, %%xmm2 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
191 "psubd %%xmm3, %%xmm0 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
192 "psrad $11, %%xmm2 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
193 "psrad $11, %%xmm0 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
194 "packssdw %%xmm0, %%xmm2 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
195 put \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
196 "1: \n\t"
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
197
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
198 #define iLLM_HEAD \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
199 "movdqa "MANGLE(tan3)", "TAN3" \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
200 "movdqa "MANGLE(tan1)", "TAN1" \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
201
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
202 ///IDCT pass on columns.
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
203 #define iLLM_PASS(dct) \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
204 "movdqa "TAN3", %%xmm1 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
205 "movdqa "TAN1", %%xmm3 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
206 "pmulhw %%xmm4, "TAN3" \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
207 "pmulhw %%xmm5, %%xmm1 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
208 "paddsw %%xmm4, "TAN3" \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
209 "paddsw %%xmm5, %%xmm1 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
210 "psubsw %%xmm5, "TAN3" \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
211 "paddsw %%xmm4, %%xmm1 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
212 "pmulhw %%xmm7, %%xmm3 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
213 "pmulhw %%xmm6, "TAN1" \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
214 "paddsw %%xmm6, %%xmm3 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
215 "psubsw %%xmm7, "TAN1" \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
216 "movdqa %%xmm3, %%xmm7 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
217 "movdqa "TAN1", %%xmm6 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
218 "psubsw %%xmm1, %%xmm3 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
219 "psubsw "TAN3", "TAN1" \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
220 "paddsw %%xmm7, %%xmm1 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
221 "paddsw %%xmm6, "TAN3" \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
222 "movdqa %%xmm3, %%xmm6 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
223 "psubsw "TAN3", %%xmm3 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
224 "paddsw %%xmm6, "TAN3" \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
225 "movdqa "MANGLE(sqrt2)", %%xmm4 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
226 "pmulhw %%xmm4, %%xmm3 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
227 "pmulhw %%xmm4, "TAN3" \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
228 "paddsw "TAN3", "TAN3" \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
229 "paddsw %%xmm3, %%xmm3 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
230 "movdqa "MANGLE(tan2)", %%xmm7 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
231 MOV_32_ONLY ROW2", "REG2" \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
232 MOV_32_ONLY ROW6", "REG6" \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
233 "movdqa %%xmm7, %%xmm5 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
234 "pmulhw "REG6", %%xmm7 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
235 "pmulhw "REG2", %%xmm5 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
236 "paddsw "REG2", %%xmm7 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
237 "psubsw "REG6", %%xmm5 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
238 MOV_32_ONLY ROW0", "REG0" \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
239 MOV_32_ONLY ROW4", "REG4" \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
240 MOV_32_ONLY" "TAN1", (%0) \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
241 "movdqa "REG0", "XMMS" \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
242 "psubsw "REG4", "REG0" \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
243 "paddsw "XMMS", "REG4" \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
244 "movdqa "REG4", "XMMS" \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
245 "psubsw %%xmm7, "REG4" \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
246 "paddsw "XMMS", %%xmm7 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
247 "movdqa "REG0", "XMMS" \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
248 "psubsw %%xmm5, "REG0" \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
249 "paddsw "XMMS", %%xmm5 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
250 "movdqa %%xmm5, "XMMS" \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
251 "psubsw "TAN3", %%xmm5 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
252 "paddsw "XMMS", "TAN3" \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
253 "movdqa "REG0", "XMMS" \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
254 "psubsw %%xmm3, "REG0" \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
255 "paddsw "XMMS", %%xmm3 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
256 MOV_32_ONLY" (%0), "TAN1" \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
257 "psraw $6, %%xmm5 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
258 "psraw $6, "REG0" \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
259 "psraw $6, "TAN3" \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
260 "psraw $6, %%xmm3 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
261 "movdqa "TAN3", 1*16("dct") \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
262 "movdqa %%xmm3, 2*16("dct") \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
263 "movdqa "REG0", 5*16("dct") \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
264 "movdqa %%xmm5, 6*16("dct") \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
265 "movdqa %%xmm7, %%xmm0 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
266 "movdqa "REG4", %%xmm4 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
267 "psubsw %%xmm1, %%xmm7 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
268 "psubsw "TAN1", "REG4" \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
269 "paddsw %%xmm0, %%xmm1 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
270 "paddsw %%xmm4, "TAN1" \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
271 "psraw $6, %%xmm1 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
272 "psraw $6, %%xmm7 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
273 "psraw $6, "TAN1" \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
274 "psraw $6, "REG4" \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
275 "movdqa %%xmm1, ("dct") \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
276 "movdqa "TAN1", 3*16("dct") \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
277 "movdqa "REG4", 4*16("dct") \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
278 "movdqa %%xmm7, 7*16("dct") \n\t"
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
279
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
280 ///IDCT pass on columns, assuming rows 4-7 are zero.
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
281 #define iLLM_PASS_SPARSE(dct) \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
282 "pmulhw %%xmm4, "TAN3" \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
283 "paddsw %%xmm4, "TAN3" \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
284 "movdqa %%xmm6, %%xmm3 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
285 "pmulhw %%xmm6, "TAN1" \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
286 "movdqa %%xmm4, %%xmm1 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
287 "psubsw %%xmm1, %%xmm3 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
288 "paddsw %%xmm6, %%xmm1 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
289 "movdqa "TAN1", %%xmm6 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
290 "psubsw "TAN3", "TAN1" \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
291 "paddsw %%xmm6, "TAN3" \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
292 "movdqa %%xmm3, %%xmm6 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
293 "psubsw "TAN3", %%xmm3 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
294 "paddsw %%xmm6, "TAN3" \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
295 "movdqa "MANGLE(sqrt2)", %%xmm4 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
296 "pmulhw %%xmm4, %%xmm3 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
297 "pmulhw %%xmm4, "TAN3" \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
298 "paddsw "TAN3", "TAN3" \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
299 "paddsw %%xmm3, %%xmm3 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
300 "movdqa "MANGLE(tan2)", %%xmm5 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
301 MOV_32_ONLY ROW2", "SREG2" \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
302 "pmulhw "SREG2", %%xmm5 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
303 MOV_32_ONLY ROW0", "REG0" \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
304 "movdqa "REG0", %%xmm6 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
305 "psubsw "SREG2", %%xmm6 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
306 "paddsw "REG0", "SREG2" \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
307 MOV_32_ONLY" "TAN1", (%0) \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
308 "movdqa "REG0", "XMMS" \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
309 "psubsw %%xmm5, "REG0" \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
310 "paddsw "XMMS", %%xmm5 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
311 "movdqa %%xmm5, "XMMS" \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
312 "psubsw "TAN3", %%xmm5 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
313 "paddsw "XMMS", "TAN3" \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
314 "movdqa "REG0", "XMMS" \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
315 "psubsw %%xmm3, "REG0" \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
316 "paddsw "XMMS", %%xmm3 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
317 MOV_32_ONLY" (%0), "TAN1" \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
318 "psraw $6, %%xmm5 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
319 "psraw $6, "REG0" \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
320 "psraw $6, "TAN3" \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
321 "psraw $6, %%xmm3 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
322 "movdqa "TAN3", 1*16("dct") \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
323 "movdqa %%xmm3, 2*16("dct") \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
324 "movdqa "REG0", 5*16("dct") \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
325 "movdqa %%xmm5, 6*16("dct") \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
326 "movdqa "SREG2", %%xmm0 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
327 "movdqa %%xmm6, %%xmm4 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
328 "psubsw %%xmm1, "SREG2" \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
329 "psubsw "TAN1", %%xmm6 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
330 "paddsw %%xmm0, %%xmm1 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
331 "paddsw %%xmm4, "TAN1" \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
332 "psraw $6, %%xmm1 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
333 "psraw $6, "SREG2" \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
334 "psraw $6, "TAN1" \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
335 "psraw $6, %%xmm6 \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
336 "movdqa %%xmm1, ("dct") \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
337 "movdqa "TAN1", 3*16("dct") \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
338 "movdqa %%xmm6, 4*16("dct") \n\t" \
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
339 "movdqa "SREG2", 7*16("dct") \n\t"
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
340
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
341 inline void ff_idct_xvid_sse2(short *block)
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
342 {
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
343 asm volatile(
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
344 "movq "MANGLE(m127)", %%mm0 \n\t"
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
345 iMTX_MULT("(%0)", MANGLE(iTab1), ROUND(walkenIdctRounders), PUT_EVEN(ROW0))
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
346 iMTX_MULT("1*16(%0)", MANGLE(iTab2), ROUND(walkenIdctRounders+1*16), PUT_ODD(ROW1))
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
347 iMTX_MULT("2*16(%0)", MANGLE(iTab3), ROUND(walkenIdctRounders+2*16), PUT_EVEN(ROW2))
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
348
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
349 TEST_TWO_ROWS("3*16(%0)", "4*16(%0)", "%%eax", "%%ecx", CLEAR_ODD(ROW3), CLEAR_EVEN(ROW4))
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
350 JZ("%%eax", "1f")
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
351 iMTX_MULT("3*16(%0)", MANGLE(iTab4), ROUND(walkenIdctRounders+3*16), PUT_ODD(ROW3))
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
352
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
353 TEST_TWO_ROWS("5*16(%0)", "6*16(%0)", "%%eax", "%%edx", CLEAR_ODD(ROW5), CLEAR_EVEN(ROW6))
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
354 TEST_ONE_ROW("7*16(%0)", "%%esi", CLEAR_ODD(ROW7))
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
355 iLLM_HEAD
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
356 ASMALIGN(4)
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
357 JNZ("%%ecx", "2f")
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
358 JNZ("%%eax", "3f")
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
359 JNZ("%%edx", "4f")
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
360 JNZ("%%esi", "5f")
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
361 iLLM_PASS_SPARSE("%0")
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
362 "jmp 6f \n\t"
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
363 "2: \n\t"
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
364 iMTX_MULT("4*16(%0)", MANGLE(iTab1), "#", PUT_EVEN(ROW4))
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
365 "3: \n\t"
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
366 iMTX_MULT("5*16(%0)", MANGLE(iTab4), ROUND(walkenIdctRounders+4*16), PUT_ODD(ROW5))
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
367 JZ("%%edx", "1f")
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
368 "4: \n\t"
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
369 iMTX_MULT("6*16(%0)", MANGLE(iTab3), ROUND(walkenIdctRounders+5*16), PUT_EVEN(ROW6))
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
370 JZ("%%esi", "1f")
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
371 "5: \n\t"
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
372 iMTX_MULT("7*16(%0)", MANGLE(iTab2), ROUND(walkenIdctRounders+5*16), PUT_ODD(ROW7))
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
373 #ifndef ARCH_X86_64
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
374 iLLM_HEAD
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
375 #endif
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
376 iLLM_PASS("%0")
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
377 "6: \n\t"
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
378 : "+r"(block)
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
379 :
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
380 : "%eax", "%ecx", "%edx", "%esi", "memory");
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
381 }
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
382
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
383 void ff_idct_xvid_sse2_put(uint8_t *dest, int line_size, short *block)
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
384 {
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
385 ff_idct_xvid_sse2(block);
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
386 put_pixels_clamped_mmx(block, dest, line_size);
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
387 }
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
388
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
389 void ff_idct_xvid_sse2_add(uint8_t *dest, int line_size, short *block)
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
390 {
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
391 ff_idct_xvid_sse2(block);
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
392 add_pixels_clamped_mmx(block, dest, line_size);
f76581c16848 Add a new xvid-style IDCT using SSE2.
astrange
parents:
diff changeset
393 }