annotate i386/fdct_mmx.c @ 1765:e31754bc5b65 libavcodec

SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
author michael
date Thu, 29 Jan 2004 01:15:25 +0000
parents 07a484280a82
children 12408a3bf741
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
72
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
1 /*
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
2 * MMX optimized forward DCT
429
718a22dc121f license/copyright change
glantau
parents: 72
diff changeset
3 * The gcc porting is Copyright (c) 2001 Fabrice Bellard.
1739
07a484280a82 copyright year update of the files i touched and remembered, things look annoyingly unmaintained otherwise
michael
parents: 1575
diff changeset
4 * cleanup/optimizations are Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at>
1765
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
5 * SSE2 optimization is Copyright (c) 2004 Denes Balatoni.
72
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
6 *
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
7 * from fdctam32.c - AP922 MMX(3D-Now) forward-DCT
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
8 *
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
9 * Intel Application Note AP-922 - fast, precise implementation of DCT
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
10 * http://developer.intel.com/vtune/cbts/appnotes.htm
1765
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
11 *
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
12 * Also of inspiration:
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
13 * a page about fdct at http://www.geocities.com/ssavekar/dct.htm
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
14 * Skal's fdct at http://skal.planet-d.net/coding/dct.html
72
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
15 */
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
16 #include "../common.h"
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
17 #include "mmx.h"
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
18
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
19 #define ATTR_ALIGN(align) __attribute__ ((__aligned__ (align)))
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
20
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
21 //////////////////////////////////////////////////////////////////////
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
22 //
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
23 // constants for the forward DCT
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
24 // -----------------------------
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
25 //
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
26 // Be sure to check that your compiler is aligning all constants to QWORD
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
27 // (8-byte) memory boundaries! Otherwise the unaligned memory access will
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
28 // severely stall MMX execution.
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
29 //
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
30 //////////////////////////////////////////////////////////////////////
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
31
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
32 #define BITS_FRW_ACC 3 //; 2 or 3 for accuracy
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
33 #define SHIFT_FRW_COL BITS_FRW_ACC
635
3e0f62e5eed6 dct cleanup
michaelni
parents: 429
diff changeset
34 #define SHIFT_FRW_ROW (BITS_FRW_ACC + 17 - 3)
72
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
35 #define RND_FRW_ROW (1 << (SHIFT_FRW_ROW-1))
1765
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
36 //#define RND_FRW_COL (1 << (SHIFT_FRW_COL-1))
72
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
37
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
38 //concatenated table, for forward DCT transformation
839
b7e2b8129211 cleanup
michaelni
parents: 687
diff changeset
39 static const int16_t fdct_tg_all_16[] ATTR_ALIGN(8) = {
72
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
40 13036, 13036, 13036, 13036, // tg * (2<<16) + 0.5
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
41 27146, 27146, 27146, 27146, // tg * (2<<16) + 0.5
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
42 -21746, -21746, -21746, -21746, // tg * (2<<16) + 0.5
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
43 };
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
44
839
b7e2b8129211 cleanup
michaelni
parents: 687
diff changeset
45 static const int16_t ocos_4_16[4] ATTR_ALIGN(8) = {
72
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
46 23170, 23170, 23170, 23170, //cos * (2<<15) + 0.5
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
47 };
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
48
1765
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
49 static const long long fdct_one_corr ATTR_ALIGN(8) = 0x0001000100010001LL;
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
50
839
b7e2b8129211 cleanup
michaelni
parents: 687
diff changeset
51 static const long fdct_r_row[2] ATTR_ALIGN(8) = {RND_FRW_ROW, RND_FRW_ROW };
72
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
52
1765
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
53 static const long fdct_r_row_sse2[4] ATTR_ALIGN(16) = {RND_FRW_ROW, RND_FRW_ROW, RND_FRW_ROW, RND_FRW_ROW};
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
54
839
b7e2b8129211 cleanup
michaelni
parents: 687
diff changeset
55 static const int16_t tab_frw_01234567[] ATTR_ALIGN(8) = { // forward_dct coeff table
1575
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
56 16384, 16384, -8867, -21407,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
57 16384, 16384, 21407, 8867,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
58 16384, -16384, 21407, -8867,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
59 -16384, 16384, 8867, -21407,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
60 22725, 19266, -22725, -12873,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
61 12873, 4520, 19266, -4520,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
62 12873, -22725, 19266, -22725,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
63 4520, 19266, 4520, -12873,
72
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
64
1575
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
65 22725, 22725, -12299, -29692,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
66 22725, 22725, 29692, 12299,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
67 22725, -22725, 29692, -12299,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
68 -22725, 22725, 12299, -29692,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
69 31521, 26722, -31521, -17855,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
70 17855, 6270, 26722, -6270,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
71 17855, -31521, 26722, -31521,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
72 6270, 26722, 6270, -17855,
72
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
73
1575
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
74 21407, 21407, -11585, -27969,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
75 21407, 21407, 27969, 11585,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
76 21407, -21407, 27969, -11585,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
77 -21407, 21407, 11585, -27969,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
78 29692, 25172, -29692, -16819,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
79 16819, 5906, 25172, -5906,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
80 16819, -29692, 25172, -29692,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
81 5906, 25172, 5906, -16819,
72
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
82
1575
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
83 19266, 19266, -10426, -25172,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
84 19266, 19266, 25172, 10426,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
85 19266, -19266, 25172, -10426,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
86 -19266, 19266, 10426, -25172,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
87 26722, 22654, -26722, -15137,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
88 15137, 5315, 22654, -5315,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
89 15137, -26722, 22654, -26722,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
90 5315, 22654, 5315, -15137,
72
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
91
1575
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
92 16384, 16384, -8867, -21407,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
93 16384, 16384, 21407, 8867,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
94 16384, -16384, 21407, -8867,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
95 -16384, 16384, 8867, -21407,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
96 22725, 19266, -22725, -12873,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
97 12873, 4520, 19266, -4520,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
98 12873, -22725, 19266, -22725,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
99 4520, 19266, 4520, -12873,
72
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
100
1575
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
101 19266, 19266, -10426, -25172,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
102 19266, 19266, 25172, 10426,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
103 19266, -19266, 25172, -10426,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
104 -19266, 19266, 10426, -25172,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
105 26722, 22654, -26722, -15137,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
106 15137, 5315, 22654, -5315,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
107 15137, -26722, 22654, -26722,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
108 5315, 22654, 5315, -15137,
72
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
109
1575
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
110 21407, 21407, -11585, -27969,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
111 21407, 21407, 27969, 11585,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
112 21407, -21407, 27969, -11585,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
113 -21407, 21407, 11585, -27969,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
114 29692, 25172, -29692, -16819,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
115 16819, 5906, 25172, -5906,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
116 16819, -29692, 25172, -29692,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
117 5906, 25172, 5906, -16819,
72
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
118
1575
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
119 22725, 22725, -12299, -29692,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
120 22725, 22725, 29692, 12299,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
121 22725, -22725, 29692, -12299,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
122 -22725, 22725, 12299, -29692,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
123 31521, 26722, -31521, -17855,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
124 17855, 6270, 26722, -6270,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
125 17855, -31521, 26722, -31521,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
126 6270, 26722, 6270, -17855,
72
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
127 };
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
128
1765
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
129 static const int16_t tab_frw_01234567_sse2[] ATTR_ALIGN(16) = { // forward_dct coeff table
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
130 #define TABLE_SSE2 C4, C4, C1, C3, -C6, -C2, -C1, -C5, \
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
131 C4, C4, C5, C7, C2, C6, C3, -C7, \
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
132 -C4, C4, C7, C3, C6, -C2, C7, -C5, \
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
133 C4, -C4, C5, -C1, C2, -C6, C3, -C1,
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
134 // c1..c7 * cos(pi/4) * 2^15
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
135 #define C1 22725
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
136 #define C2 21407
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
137 #define C3 19266
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
138 #define C4 16384
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
139 #define C5 12873
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
140 #define C6 8867
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
141 #define C7 4520
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
142 TABLE_SSE2
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
143
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
144 #undef C1
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
145 #undef C2
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
146 #undef C3
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
147 #undef C4
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
148 #undef C5
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
149 #undef C6
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
150 #undef C7
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
151 #define C1 31521
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
152 #define C2 29692
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
153 #define C3 26722
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
154 #define C4 22725
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
155 #define C5 17855
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
156 #define C6 12299
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
157 #define C7 6270
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
158 TABLE_SSE2
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
159
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
160 #undef C1
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
161 #undef C2
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
162 #undef C3
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
163 #undef C4
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
164 #undef C5
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
165 #undef C6
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
166 #undef C7
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
167 #define C1 29692
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
168 #define C2 27969
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
169 #define C3 25172
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
170 #define C4 21407
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
171 #define C5 16819
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
172 #define C6 11585
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
173 #define C7 5906
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
174 TABLE_SSE2
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
175
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
176 #undef C1
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
177 #undef C2
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
178 #undef C3
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
179 #undef C4
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
180 #undef C5
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
181 #undef C6
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
182 #undef C7
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
183 #define C1 26722
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
184 #define C2 25172
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
185 #define C3 22654
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
186 #define C4 19266
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
187 #define C5 15137
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
188 #define C6 10426
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
189 #define C7 5315
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
190 TABLE_SSE2
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
191
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
192 #undef C1
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
193 #undef C2
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
194 #undef C3
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
195 #undef C4
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
196 #undef C5
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
197 #undef C6
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
198 #undef C7
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
199 #define C1 22725
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
200 #define C2 21407
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
201 #define C3 19266
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
202 #define C4 16384
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
203 #define C5 12873
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
204 #define C6 8867
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
205 #define C7 4520
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
206 TABLE_SSE2
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
207
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
208 #undef C1
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
209 #undef C2
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
210 #undef C3
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
211 #undef C4
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
212 #undef C5
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
213 #undef C6
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
214 #undef C7
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
215 #define C1 26722
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
216 #define C2 25172
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
217 #define C3 22654
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
218 #define C4 19266
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
219 #define C5 15137
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
220 #define C6 10426
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
221 #define C7 5315
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
222 TABLE_SSE2
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
223
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
224 #undef C1
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
225 #undef C2
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
226 #undef C3
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
227 #undef C4
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
228 #undef C5
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
229 #undef C6
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
230 #undef C7
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
231 #define C1 29692
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
232 #define C2 27969
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
233 #define C3 25172
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
234 #define C4 21407
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
235 #define C5 16819
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
236 #define C6 11585
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
237 #define C7 5906
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
238 TABLE_SSE2
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
239
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
240 #undef C1
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
241 #undef C2
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
242 #undef C3
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
243 #undef C4
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
244 #undef C5
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
245 #undef C6
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
246 #undef C7
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
247 #define C1 31521
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
248 #define C2 29692
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
249 #define C3 26722
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
250 #define C4 22725
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
251 #define C5 17855
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
252 #define C6 12299
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
253 #define C7 6270
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
254 TABLE_SSE2
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
255 };
72
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
256
1564
b6b7d080f1a1 inline -> always_inline (842 -> 690 cpu cycles for dct_quantize() difference for the dct itself should be even bigger)
michael
parents: 839
diff changeset
257 static always_inline void fdct_col(const int16_t *in, int16_t *out, int offset)
72
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
258 {
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
259 movq_m2r(*(in + offset + 1 * 8), mm0);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
260 movq_m2r(*(in + offset + 6 * 8), mm1);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
261 movq_r2r(mm0, mm2);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
262 movq_m2r(*(in + offset + 2 * 8), mm3);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
263 paddsw_r2r(mm1, mm0);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
264 movq_m2r(*(in + offset + 5 * 8), mm4);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
265 psllw_i2r(SHIFT_FRW_COL, mm0);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
266 movq_m2r(*(in + offset + 0 * 8), mm5);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
267 paddsw_r2r(mm3, mm4);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
268 paddsw_m2r(*(in + offset + 7 * 8), mm5);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
269 psllw_i2r(SHIFT_FRW_COL, mm4);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
270 movq_r2r(mm0, mm6);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
271 psubsw_r2r(mm1, mm2);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
272 movq_m2r(*(fdct_tg_all_16 + 4), mm1);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
273 psubsw_r2r(mm4, mm0);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
274 movq_m2r(*(in + offset + 3 * 8), mm7);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
275 pmulhw_r2r(mm0, mm1);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
276 paddsw_m2r(*(in + offset + 4 * 8), mm7);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
277 psllw_i2r(SHIFT_FRW_COL, mm5);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
278 paddsw_r2r(mm4, mm6);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
279 psllw_i2r(SHIFT_FRW_COL, mm7);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
280 movq_r2r(mm5, mm4);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
281 psubsw_r2r(mm7, mm5);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
282 paddsw_r2r(mm5, mm1);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
283 paddsw_r2r(mm7, mm4);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
284 por_m2r(fdct_one_corr, mm1);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
285 psllw_i2r(SHIFT_FRW_COL + 1, mm2);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
286 pmulhw_m2r(*(fdct_tg_all_16 + 4), mm5);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
287 movq_r2r(mm4, mm7);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
288 psubsw_m2r(*(in + offset + 5 * 8), mm3);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
289 psubsw_r2r(mm6, mm4);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
290 movq_r2m(mm1, *(out + offset + 2 * 8));
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
291 paddsw_r2r(mm6, mm7);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
292 movq_m2r(*(in + offset + 3 * 8), mm1);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
293 psllw_i2r(SHIFT_FRW_COL + 1, mm3);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
294 psubsw_m2r(*(in + offset + 4 * 8), mm1);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
295 movq_r2r(mm2, mm6);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
296 movq_r2m(mm4, *(out + offset + 4 * 8));
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
297 paddsw_r2r(mm3, mm2);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
298 pmulhw_m2r(*ocos_4_16, mm2);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
299 psubsw_r2r(mm3, mm6);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
300 pmulhw_m2r(*ocos_4_16, mm6);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
301 psubsw_r2r(mm0, mm5);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
302 por_m2r(fdct_one_corr, mm5);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
303 psllw_i2r(SHIFT_FRW_COL, mm1);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
304 por_m2r(fdct_one_corr, mm2);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
305 movq_r2r(mm1, mm4);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
306 movq_m2r(*(in + offset + 0 * 8), mm3);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
307 paddsw_r2r(mm6, mm1);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
308 psubsw_m2r(*(in + offset + 7 * 8), mm3);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
309 psubsw_r2r(mm6, mm4);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
310 movq_m2r(*(fdct_tg_all_16 + 0), mm0);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
311 psllw_i2r(SHIFT_FRW_COL, mm3);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
312 movq_m2r(*(fdct_tg_all_16 + 8), mm6);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
313 pmulhw_r2r(mm1, mm0);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
314 movq_r2m(mm7, *(out + offset + 0 * 8));
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
315 pmulhw_r2r(mm4, mm6);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
316 movq_r2m(mm5, *(out + offset + 6 * 8));
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
317 movq_r2r(mm3, mm7);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
318 movq_m2r(*(fdct_tg_all_16 + 8), mm5);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
319 psubsw_r2r(mm2, mm7);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
320 paddsw_r2r(mm2, mm3);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
321 pmulhw_r2r(mm7, mm5);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
322 paddsw_r2r(mm3, mm0);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
323 paddsw_r2r(mm4, mm6);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
324 pmulhw_m2r(*(fdct_tg_all_16 + 0), mm3);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
325 por_m2r(fdct_one_corr, mm0);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
326 paddsw_r2r(mm7, mm5);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
327 psubsw_r2r(mm6, mm7);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
328 movq_r2m(mm0, *(out + offset + 1 * 8));
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
329 paddsw_r2r(mm4, mm5);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
330 movq_r2m(mm7, *(out + offset + 3 * 8));
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
331 psubsw_r2r(mm1, mm3);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
332 movq_r2m(mm5, *(out + offset + 5 * 8));
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
333 movq_r2m(mm3, *(out + offset + 7 * 8));
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
334 }
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
335
1765
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
336
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
337 static always_inline void fdct_row_sse2(const int16_t *in, int16_t *out)
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
338 {
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
339 asm volatile(
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
340 ".macro FDCT_ROW_SSE2_H1 i t \n\t"
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
341 "movq \\i(%0), %%xmm2 \n\t"
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
342 "movq \\i+8(%0), %%xmm0 \n\t"
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
343 "movdqa \\t+32(%1), %%xmm3 \n\t"
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
344 "movdqa \\t+48(%1), %%xmm7 \n\t"
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
345 "movdqa \\t(%1), %%xmm4 \n\t"
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
346 "movdqa \\t+16(%1), %%xmm5 \n\t"
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
347 ".endm \n\t"
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
348 ".macro FDCT_ROW_SSE2_H2 i t \n\t"
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
349 "movq \\i(%0), %%xmm2 \n\t"
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
350 "movq \\i+8(%0), %%xmm0 \n\t"
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
351 "movdqa \\t+32(%1), %%xmm3 \n\t"
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
352 "movdqa \\t+48(%1), %%xmm7 \n\t"
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
353 ".endm \n\t"
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
354 ".macro FDCT_ROW_SSE2 i \n\t"
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
355 "movq %%xmm2, %%xmm1 \n\t"
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
356 "pshuflw $27, %%xmm0, %%xmm0 \n\t"
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
357 "paddsw %%xmm0, %%xmm1 \n\t"
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
358 "psubsw %%xmm0, %%xmm2 \n\t"
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
359 "punpckldq %%xmm2, %%xmm1 \n\t"
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
360 "pshufd $78, %%xmm1, %%xmm2 \n\t"
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
361 "pmaddwd %%xmm2, %%xmm3 \n\t"
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
362 "pmaddwd %%xmm1, %%xmm7 \n\t"
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
363 "pmaddwd %%xmm5, %%xmm2 \n\t"
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
364 "pmaddwd %%xmm4, %%xmm1 \n\t"
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
365 "paddd %%xmm7, %%xmm3 \n\t"
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
366 "paddd %%xmm2, %%xmm1 \n\t"
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
367 "paddd %%xmm6, %%xmm3 \n\t"
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
368 "paddd %%xmm6, %%xmm1 \n\t"
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
369 "psrad %3, %%xmm3 \n\t"
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
370 "psrad %3, %%xmm1 \n\t"
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
371 "packssdw %%xmm3, %%xmm1 \n\t"
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
372 "movdqa %%xmm1, \\i(%4) \n\t"
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
373 ".endm \n\t"
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
374 "movdqa (%2), %%xmm6 \n\t"
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
375 "FDCT_ROW_SSE2_H1 0 0 \n\t"
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
376 "FDCT_ROW_SSE2 0 \n\t"
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
377 "FDCT_ROW_SSE2_H2 64 0 \n\t"
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
378 "FDCT_ROW_SSE2 64 \n\t"
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
379
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
380 "FDCT_ROW_SSE2_H1 16 64 \n\t"
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
381 "FDCT_ROW_SSE2 16 \n\t"
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
382 "FDCT_ROW_SSE2_H2 112 64 \n\t"
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
383 "FDCT_ROW_SSE2 112 \n\t"
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
384
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
385 "FDCT_ROW_SSE2_H1 32 128 \n\t"
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
386 "FDCT_ROW_SSE2 32 \n\t"
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
387 "FDCT_ROW_SSE2_H2 96 128 \n\t"
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
388 "FDCT_ROW_SSE2 96 \n\t"
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
389
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
390 "FDCT_ROW_SSE2_H1 48 192 \n\t"
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
391 "FDCT_ROW_SSE2 48 \n\t"
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
392 "FDCT_ROW_SSE2_H2 80 192 \n\t"
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
393 "FDCT_ROW_SSE2 80 \n\t"
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
394 :
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
395 : "r" (in), "r" (tab_frw_01234567_sse2), "r" (fdct_r_row_sse2), "i" (SHIFT_FRW_ROW), "r" (out)
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
396 );
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
397 }
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
398
1570
9a9c14e87ebf optimizing
michael
parents: 1565
diff changeset
399 static always_inline void fdct_row_mmx2(const int16_t *in, int16_t *out, const int16_t *table)
1564
b6b7d080f1a1 inline -> always_inline (842 -> 690 cpu cycles for dct_quantize() difference for the dct itself should be even bigger)
michael
parents: 839
diff changeset
400 {
1565
1a9a63f59849 minor mmx2 optimization if the dct
michael
parents: 1564
diff changeset
401 pshufw_m2r(*(in + 4), mm5, 0x1B);
1a9a63f59849 minor mmx2 optimization if the dct
michael
parents: 1564
diff changeset
402 movq_m2r(*(in + 0), mm0);
1570
9a9c14e87ebf optimizing
michael
parents: 1565
diff changeset
403 movq_r2r(mm0, mm1);
9a9c14e87ebf optimizing
michael
parents: 1565
diff changeset
404 paddsw_r2r(mm5, mm0);
9a9c14e87ebf optimizing
michael
parents: 1565
diff changeset
405 psubsw_r2r(mm5, mm1);
1575
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
406 pshufw_r2r(mm0, mm2, 0x4E);
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
407 pshufw_r2r(mm1, mm3, 0x4E);
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
408 movq_m2r(*(table + 0), mm4);
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
409 movq_m2r(*(table + 4), mm6);
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
410 movq_m2r(*(table + 16), mm5);
1570
9a9c14e87ebf optimizing
michael
parents: 1565
diff changeset
411 movq_m2r(*(table + 20), mm7);
1575
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
412 pmaddwd_r2r(mm0, mm4);
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
413 pmaddwd_r2r(mm1, mm5);
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
414 pmaddwd_r2r(mm2, mm6);
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
415 pmaddwd_r2r(mm3, mm7);
1570
9a9c14e87ebf optimizing
michael
parents: 1565
diff changeset
416 pmaddwd_m2r(*(table + 8), mm0);
1575
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
417 pmaddwd_m2r(*(table + 12), mm2);
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
418 pmaddwd_m2r(*(table + 24), mm1);
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
419 pmaddwd_m2r(*(table + 28), mm3);
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
420 paddd_r2r(mm6, mm4);
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
421 paddd_r2r(mm7, mm5);
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
422 paddd_r2r(mm2, mm0);
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
423 paddd_r2r(mm3, mm1);
1570
9a9c14e87ebf optimizing
michael
parents: 1565
diff changeset
424 movq_m2r(*fdct_r_row, mm7);
1575
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
425 paddd_r2r(mm7, mm4);
1570
9a9c14e87ebf optimizing
michael
parents: 1565
diff changeset
426 paddd_r2r(mm7, mm5);
1575
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
427 paddd_r2r(mm7, mm0);
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
428 paddd_r2r(mm7, mm1);
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
429 psrad_i2r(SHIFT_FRW_ROW, mm4);
1570
9a9c14e87ebf optimizing
michael
parents: 1565
diff changeset
430 psrad_i2r(SHIFT_FRW_ROW, mm5);
1575
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
431 psrad_i2r(SHIFT_FRW_ROW, mm0);
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
432 psrad_i2r(SHIFT_FRW_ROW, mm1);
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
433 packssdw_r2r(mm0, mm4);
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
434 packssdw_r2r(mm1, mm5);
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
435 movq_r2r(mm4, mm2);
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
436 punpcklwd_r2r(mm5, mm4);
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
437 punpckhwd_r2r(mm5, mm2);
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
438 movq_r2m(mm4, *(out + 0));
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
439 movq_r2m(mm2, *(out + 4));
1570
9a9c14e87ebf optimizing
michael
parents: 1565
diff changeset
440 }
9a9c14e87ebf optimizing
michael
parents: 1565
diff changeset
441
9a9c14e87ebf optimizing
michael
parents: 1565
diff changeset
442 static always_inline void fdct_row_mmx(const int16_t *in, int16_t *out, const int16_t *table)
9a9c14e87ebf optimizing
michael
parents: 1565
diff changeset
443 {
1575
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
444 movd_m2r(*(in + 6), mm1);
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
445 punpcklwd_m2r(*(in + 4), mm1);
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
446 movq_r2r(mm1, mm2);
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
447 psrlq_i2r(0x20, mm1);
72
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
448 movq_m2r(*(in + 0), mm0);
1575
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
449 punpcklwd_r2r(mm2, mm1);
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
450 movq_r2r(mm0, mm5);
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
451 paddsw_r2r(mm1, mm0);
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
452 psubsw_r2r(mm1, mm5);
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
453 movq_r2r(mm0, mm1);
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
454 movq_r2r(mm5, mm6);
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
455 punpckldq_r2r(mm5, mm3);
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
456 punpckhdq_r2r(mm3, mm6);
72
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
457 movq_m2r(*(table + 0), mm3);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
458 movq_m2r(*(table + 4), mm4);
1575
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
459 punpckldq_r2r(mm0, mm2);
72
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
460 pmaddwd_r2r(mm0, mm3);
1575
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
461 punpckhdq_r2r(mm2, mm1);
1570
9a9c14e87ebf optimizing
michael
parents: 1565
diff changeset
462 movq_m2r(*(table + 16), mm2);
9a9c14e87ebf optimizing
michael
parents: 1565
diff changeset
463 pmaddwd_r2r(mm1, mm4);
72
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
464 pmaddwd_m2r(*(table + 8), mm0);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
465 movq_m2r(*(table + 20), mm7);
1570
9a9c14e87ebf optimizing
michael
parents: 1565
diff changeset
466 pmaddwd_r2r(mm5, mm2);
72
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
467 paddd_m2r(*fdct_r_row, mm3);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
468 pmaddwd_r2r(mm6, mm7);
1570
9a9c14e87ebf optimizing
michael
parents: 1565
diff changeset
469 pmaddwd_m2r(*(table + 12), mm1);
72
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
470 paddd_r2r(mm4, mm3);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
471 pmaddwd_m2r(*(table + 24), mm5);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
472 pmaddwd_m2r(*(table + 28), mm6);
1570
9a9c14e87ebf optimizing
michael
parents: 1565
diff changeset
473 paddd_r2r(mm7, mm2);
72
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
474 paddd_m2r(*fdct_r_row, mm0);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
475 psrad_i2r(SHIFT_FRW_ROW, mm3);
1570
9a9c14e87ebf optimizing
michael
parents: 1565
diff changeset
476 paddd_m2r(*fdct_r_row, mm2);
9a9c14e87ebf optimizing
michael
parents: 1565
diff changeset
477 paddd_r2r(mm1, mm0);
72
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
478 paddd_m2r(*fdct_r_row, mm5);
1570
9a9c14e87ebf optimizing
michael
parents: 1565
diff changeset
479 psrad_i2r(SHIFT_FRW_ROW, mm2);
72
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
480 paddd_r2r(mm6, mm5);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
481 psrad_i2r(SHIFT_FRW_ROW, mm0);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
482 psrad_i2r(SHIFT_FRW_ROW, mm5);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
483 packssdw_r2r(mm0, mm3);
1570
9a9c14e87ebf optimizing
michael
parents: 1565
diff changeset
484 packssdw_r2r(mm5, mm2);
72
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
485 movq_r2r(mm3, mm6);
1570
9a9c14e87ebf optimizing
michael
parents: 1565
diff changeset
486 punpcklwd_r2r(mm2, mm3);
9a9c14e87ebf optimizing
michael
parents: 1565
diff changeset
487 punpckhwd_r2r(mm2, mm6);
72
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
488 movq_r2m(mm3, *(out + 0));
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
489 movq_r2m(mm6, *(out + 4));
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
490 }
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
491
687
9abb13c21fbe fdct_mmx -> ff_fdct_mmx (renamed to avoid namespace conflict with xvid)
arpi_esp
parents: 635
diff changeset
492 void ff_fdct_mmx(int16_t *block)
72
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
493 {
839
b7e2b8129211 cleanup
michaelni
parents: 687
diff changeset
494 int64_t align_tmp[16] ATTR_ALIGN(8);
b7e2b8129211 cleanup
michaelni
parents: 687
diff changeset
495 int16_t * const block_tmp= (int16_t*)align_tmp;
72
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
496 int16_t *block1, *out;
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
497 const int16_t *table;
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
498 int i;
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
499
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
500 block1 = block_tmp;
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
501 fdct_col(block, block1, 0);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
502 fdct_col(block, block1, 4);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
503
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
504 block1 = block_tmp;
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
505 table = tab_frw_01234567;
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
506 out = block;
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
507 for(i=8;i>0;i--) {
1570
9a9c14e87ebf optimizing
michael
parents: 1565
diff changeset
508 fdct_row_mmx(block1, out, table);
72
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
509 block1 += 8;
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
510 table += 32;
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
511 out += 8;
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
512 }
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
513 }
1565
1a9a63f59849 minor mmx2 optimization if the dct
michael
parents: 1564
diff changeset
514
1a9a63f59849 minor mmx2 optimization if the dct
michael
parents: 1564
diff changeset
515 void ff_fdct_mmx2(int16_t *block)
1a9a63f59849 minor mmx2 optimization if the dct
michael
parents: 1564
diff changeset
516 {
1a9a63f59849 minor mmx2 optimization if the dct
michael
parents: 1564
diff changeset
517 int64_t align_tmp[16] ATTR_ALIGN(8);
1a9a63f59849 minor mmx2 optimization if the dct
michael
parents: 1564
diff changeset
518 int16_t * const block_tmp= (int16_t*)align_tmp;
1a9a63f59849 minor mmx2 optimization if the dct
michael
parents: 1564
diff changeset
519 int16_t *block1, *out;
1a9a63f59849 minor mmx2 optimization if the dct
michael
parents: 1564
diff changeset
520 const int16_t *table;
1a9a63f59849 minor mmx2 optimization if the dct
michael
parents: 1564
diff changeset
521 int i;
1a9a63f59849 minor mmx2 optimization if the dct
michael
parents: 1564
diff changeset
522
1a9a63f59849 minor mmx2 optimization if the dct
michael
parents: 1564
diff changeset
523 block1 = block_tmp;
1a9a63f59849 minor mmx2 optimization if the dct
michael
parents: 1564
diff changeset
524 fdct_col(block, block1, 0);
1a9a63f59849 minor mmx2 optimization if the dct
michael
parents: 1564
diff changeset
525 fdct_col(block, block1, 4);
1a9a63f59849 minor mmx2 optimization if the dct
michael
parents: 1564
diff changeset
526
1a9a63f59849 minor mmx2 optimization if the dct
michael
parents: 1564
diff changeset
527 block1 = block_tmp;
1a9a63f59849 minor mmx2 optimization if the dct
michael
parents: 1564
diff changeset
528 table = tab_frw_01234567;
1a9a63f59849 minor mmx2 optimization if the dct
michael
parents: 1564
diff changeset
529 out = block;
1a9a63f59849 minor mmx2 optimization if the dct
michael
parents: 1564
diff changeset
530 for(i=8;i>0;i--) {
1570
9a9c14e87ebf optimizing
michael
parents: 1565
diff changeset
531 fdct_row_mmx2(block1, out, table);
1565
1a9a63f59849 minor mmx2 optimization if the dct
michael
parents: 1564
diff changeset
532 block1 += 8;
1a9a63f59849 minor mmx2 optimization if the dct
michael
parents: 1564
diff changeset
533 table += 32;
1a9a63f59849 minor mmx2 optimization if the dct
michael
parents: 1564
diff changeset
534 out += 8;
1a9a63f59849 minor mmx2 optimization if the dct
michael
parents: 1564
diff changeset
535 }
1a9a63f59849 minor mmx2 optimization if the dct
michael
parents: 1564
diff changeset
536 }
1765
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
537
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
538 void ff_fdct_sse2(int16_t *block)
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
539 {
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
540 int64_t align_tmp[16] ATTR_ALIGN(8);
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
541 int16_t * const block_tmp= (int16_t*)align_tmp;
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
542 int16_t *block1;
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
543 int i;
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
544
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
545 block1 = block_tmp;
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
546 fdct_col(block, block1, 0);
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
547 fdct_col(block, block1, 4);
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
548
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
549 fdct_row_sse2(block1, block);
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
550 }
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
551