annotate i386/fdct_mmx.c @ 1575:f16ae8e69bd9 libavcodec

reorder table instead of wasting instructions to reorder the input to match the table
author michael
date Sat, 25 Oct 2003 21:59:28 +0000
parents 1396e33a9cb6
children 07a484280a82
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.
72
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
4 *
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
5 * from fdctam32.c - AP922 MMX(3D-Now) forward-DCT
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 * 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
8 * http://developer.intel.com/vtune/cbts/appnotes.htm
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
9 */
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
10 #include "../common.h"
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
11 #include "mmx.h"
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
12
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
13 #define ATTR_ALIGN(align) __attribute__ ((__aligned__ (align)))
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
14
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 //
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
17 // constants for the forward DCT
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 //
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
20 // 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
21 // (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
22 // severely stall MMX execution.
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
23 //
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 #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
27 #define SHIFT_FRW_COL BITS_FRW_ACC
635
3e0f62e5eed6 dct cleanup
michaelni
parents: 429
diff changeset
28 #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
29 //#define RND_FRW_ROW (262144 * (BITS_FRW_ACC - 1)) //; 1 << (SHIFT_FRW_ROW-1)
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
30 #define RND_FRW_ROW (1 << (SHIFT_FRW_ROW-1))
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
31 //#define RND_FRW_COL (2 * (BITS_FRW_ACC - 1)) //; 1 << (SHIFT_FRW_COL-1)
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
32 #define RND_FRW_COL (1 << (SHIFT_FRW_COL-1))
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
33
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
34 //concatenated table, for forward DCT transformation
839
b7e2b8129211 cleanup
michaelni
parents: 687
diff changeset
35 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
36 13036, 13036, 13036, 13036, // tg * (2<<16) + 0.5
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
37 27146, 27146, 27146, 27146, // tg * (2<<16) + 0.5
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
38 -21746, -21746, -21746, -21746, // tg * (2<<16) + 0.5
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
39 };
839
b7e2b8129211 cleanup
michaelni
parents: 687
diff changeset
40 static const int16_t cos_4_16[4] ATTR_ALIGN(8) = {
72
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
41 -19195, -19195, -19195, -19195, //cos * (2<<16) + 0.5
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
42 };
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
43
839
b7e2b8129211 cleanup
michaelni
parents: 687
diff changeset
44 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
45 23170, 23170, 23170, 23170, //cos * (2<<15) + 0.5
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
46 };
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
47
839
b7e2b8129211 cleanup
michaelni
parents: 687
diff changeset
48 static const long long fdct_one_corr ATTR_ALIGN(8) = 0x0001000100010001LL;
b7e2b8129211 cleanup
michaelni
parents: 687
diff changeset
49 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
50
839
b7e2b8129211 cleanup
michaelni
parents: 687
diff changeset
51 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
52 16384, 16384, -8867, -21407,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
53 16384, 16384, 21407, 8867,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
54 16384, -16384, 21407, -8867,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
55 -16384, 16384, 8867, -21407,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
56 22725, 19266, -22725, -12873,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
57 12873, 4520, 19266, -4520,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
58 12873, -22725, 19266, -22725,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
59 4520, 19266, 4520, -12873,
72
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
60
1575
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
61 22725, 22725, -12299, -29692,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
62 22725, 22725, 29692, 12299,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
63 22725, -22725, 29692, -12299,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
64 -22725, 22725, 12299, -29692,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
65 31521, 26722, -31521, -17855,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
66 17855, 6270, 26722, -6270,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
67 17855, -31521, 26722, -31521,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
68 6270, 26722, 6270, -17855,
72
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
69
1575
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
70 21407, 21407, -11585, -27969,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
71 21407, 21407, 27969, 11585,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
72 21407, -21407, 27969, -11585,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
73 -21407, 21407, 11585, -27969,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
74 29692, 25172, -29692, -16819,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
75 16819, 5906, 25172, -5906,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
76 16819, -29692, 25172, -29692,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
77 5906, 25172, 5906, -16819,
72
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
78
1575
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
79 19266, 19266, -10426, -25172,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
80 19266, 19266, 25172, 10426,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
81 19266, -19266, 25172, -10426,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
82 -19266, 19266, 10426, -25172,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
83 26722, 22654, -26722, -15137,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
84 15137, 5315, 22654, -5315,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
85 15137, -26722, 22654, -26722,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
86 5315, 22654, 5315, -15137,
72
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
87
1575
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
88 16384, 16384, -8867, -21407,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
89 16384, 16384, 21407, 8867,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
90 16384, -16384, 21407, -8867,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
91 -16384, 16384, 8867, -21407,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
92 22725, 19266, -22725, -12873,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
93 12873, 4520, 19266, -4520,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
94 12873, -22725, 19266, -22725,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
95 4520, 19266, 4520, -12873,
72
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
96
1575
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
97 19266, 19266, -10426, -25172,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
98 19266, 19266, 25172, 10426,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
99 19266, -19266, 25172, -10426,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
100 -19266, 19266, 10426, -25172,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
101 26722, 22654, -26722, -15137,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
102 15137, 5315, 22654, -5315,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
103 15137, -26722, 22654, -26722,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
104 5315, 22654, 5315, -15137,
72
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
105
1575
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
106 21407, 21407, -11585, -27969,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
107 21407, 21407, 27969, 11585,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
108 21407, -21407, 27969, -11585,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
109 -21407, 21407, 11585, -27969,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
110 29692, 25172, -29692, -16819,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
111 16819, 5906, 25172, -5906,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
112 16819, -29692, 25172, -29692,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
113 5906, 25172, 5906, -16819,
72
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
114
1575
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
115 22725, 22725, -12299, -29692,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
116 22725, 22725, 29692, 12299,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
117 22725, -22725, 29692, -12299,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
118 -22725, 22725, 12299, -29692,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
119 31521, 26722, -31521, -17855,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
120 17855, 6270, 26722, -6270,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
121 17855, -31521, 26722, -31521,
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
122 6270, 26722, 6270, -17855,
72
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
123 };
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
124
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
125
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
126 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
127 {
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
128 movq_m2r(*(in + offset + 1 * 8), mm0);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
129 movq_m2r(*(in + offset + 6 * 8), mm1);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
130 movq_r2r(mm0, mm2);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
131 movq_m2r(*(in + offset + 2 * 8), mm3);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
132 paddsw_r2r(mm1, mm0);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
133 movq_m2r(*(in + offset + 5 * 8), mm4);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
134 psllw_i2r(SHIFT_FRW_COL, mm0);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
135 movq_m2r(*(in + offset + 0 * 8), mm5);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
136 paddsw_r2r(mm3, mm4);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
137 paddsw_m2r(*(in + offset + 7 * 8), mm5);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
138 psllw_i2r(SHIFT_FRW_COL, mm4);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
139 movq_r2r(mm0, mm6);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
140 psubsw_r2r(mm1, mm2);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
141 movq_m2r(*(fdct_tg_all_16 + 4), mm1);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
142 psubsw_r2r(mm4, mm0);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
143 movq_m2r(*(in + offset + 3 * 8), mm7);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
144 pmulhw_r2r(mm0, mm1);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
145 paddsw_m2r(*(in + offset + 4 * 8), mm7);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
146 psllw_i2r(SHIFT_FRW_COL, mm5);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
147 paddsw_r2r(mm4, mm6);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
148 psllw_i2r(SHIFT_FRW_COL, mm7);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
149 movq_r2r(mm5, mm4);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
150 psubsw_r2r(mm7, mm5);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
151 paddsw_r2r(mm5, mm1);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
152 paddsw_r2r(mm7, mm4);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
153 por_m2r(fdct_one_corr, mm1);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
154 psllw_i2r(SHIFT_FRW_COL + 1, mm2);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
155 pmulhw_m2r(*(fdct_tg_all_16 + 4), mm5);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
156 movq_r2r(mm4, mm7);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
157 psubsw_m2r(*(in + offset + 5 * 8), mm3);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
158 psubsw_r2r(mm6, mm4);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
159 movq_r2m(mm1, *(out + offset + 2 * 8));
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
160 paddsw_r2r(mm6, mm7);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
161 movq_m2r(*(in + offset + 3 * 8), mm1);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
162 psllw_i2r(SHIFT_FRW_COL + 1, mm3);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
163 psubsw_m2r(*(in + offset + 4 * 8), mm1);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
164 movq_r2r(mm2, mm6);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
165 movq_r2m(mm4, *(out + offset + 4 * 8));
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
166 paddsw_r2r(mm3, mm2);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
167 pmulhw_m2r(*ocos_4_16, mm2);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
168 psubsw_r2r(mm3, mm6);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
169 pmulhw_m2r(*ocos_4_16, mm6);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
170 psubsw_r2r(mm0, mm5);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
171 por_m2r(fdct_one_corr, mm5);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
172 psllw_i2r(SHIFT_FRW_COL, mm1);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
173 por_m2r(fdct_one_corr, mm2);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
174 movq_r2r(mm1, mm4);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
175 movq_m2r(*(in + offset + 0 * 8), mm3);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
176 paddsw_r2r(mm6, mm1);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
177 psubsw_m2r(*(in + offset + 7 * 8), mm3);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
178 psubsw_r2r(mm6, mm4);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
179 movq_m2r(*(fdct_tg_all_16 + 0), mm0);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
180 psllw_i2r(SHIFT_FRW_COL, mm3);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
181 movq_m2r(*(fdct_tg_all_16 + 8), mm6);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
182 pmulhw_r2r(mm1, mm0);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
183 movq_r2m(mm7, *(out + offset + 0 * 8));
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
184 pmulhw_r2r(mm4, mm6);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
185 movq_r2m(mm5, *(out + offset + 6 * 8));
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
186 movq_r2r(mm3, mm7);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
187 movq_m2r(*(fdct_tg_all_16 + 8), mm5);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
188 psubsw_r2r(mm2, mm7);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
189 paddsw_r2r(mm2, mm3);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
190 pmulhw_r2r(mm7, mm5);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
191 paddsw_r2r(mm3, mm0);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
192 paddsw_r2r(mm4, mm6);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
193 pmulhw_m2r(*(fdct_tg_all_16 + 0), mm3);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
194 por_m2r(fdct_one_corr, mm0);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
195 paddsw_r2r(mm7, mm5);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
196 psubsw_r2r(mm6, mm7);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
197 movq_r2m(mm0, *(out + offset + 1 * 8));
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
198 paddsw_r2r(mm4, mm5);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
199 movq_r2m(mm7, *(out + offset + 3 * 8));
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
200 psubsw_r2r(mm1, mm3);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
201 movq_r2m(mm5, *(out + offset + 5 * 8));
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
202 movq_r2m(mm3, *(out + offset + 7 * 8));
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
203 }
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
204
1570
9a9c14e87ebf optimizing
michael
parents: 1565
diff changeset
205 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
206 {
1565
1a9a63f59849 minor mmx2 optimization if the dct
michael
parents: 1564
diff changeset
207 pshufw_m2r(*(in + 4), mm5, 0x1B);
1a9a63f59849 minor mmx2 optimization if the dct
michael
parents: 1564
diff changeset
208 movq_m2r(*(in + 0), mm0);
1570
9a9c14e87ebf optimizing
michael
parents: 1565
diff changeset
209 movq_r2r(mm0, mm1);
9a9c14e87ebf optimizing
michael
parents: 1565
diff changeset
210 paddsw_r2r(mm5, mm0);
9a9c14e87ebf optimizing
michael
parents: 1565
diff changeset
211 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
212 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
213 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
214 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
215 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
216 movq_m2r(*(table + 16), mm5);
1570
9a9c14e87ebf optimizing
michael
parents: 1565
diff changeset
217 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
218 pmaddwd_r2r(mm0, mm4);
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
219 pmaddwd_r2r(mm1, mm5);
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
220 pmaddwd_r2r(mm2, mm6);
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
221 pmaddwd_r2r(mm3, mm7);
1570
9a9c14e87ebf optimizing
michael
parents: 1565
diff changeset
222 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
223 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
224 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
225 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
226 paddd_r2r(mm6, mm4);
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
227 paddd_r2r(mm7, mm5);
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
228 paddd_r2r(mm2, mm0);
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
229 paddd_r2r(mm3, mm1);
1570
9a9c14e87ebf optimizing
michael
parents: 1565
diff changeset
230 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
231 paddd_r2r(mm7, mm4);
1570
9a9c14e87ebf optimizing
michael
parents: 1565
diff changeset
232 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
233 paddd_r2r(mm7, mm0);
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
234 paddd_r2r(mm7, mm1);
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
235 psrad_i2r(SHIFT_FRW_ROW, mm4);
1570
9a9c14e87ebf optimizing
michael
parents: 1565
diff changeset
236 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
237 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
238 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
239 packssdw_r2r(mm0, mm4);
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
240 packssdw_r2r(mm1, mm5);
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
241 movq_r2r(mm4, mm2);
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
242 punpcklwd_r2r(mm5, mm4);
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
243 punpckhwd_r2r(mm5, mm2);
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
244 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
245 movq_r2m(mm2, *(out + 4));
1570
9a9c14e87ebf optimizing
michael
parents: 1565
diff changeset
246 }
9a9c14e87ebf optimizing
michael
parents: 1565
diff changeset
247
9a9c14e87ebf optimizing
michael
parents: 1565
diff changeset
248 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
249 {
1575
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
250 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
251 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
252 movq_r2r(mm1, mm2);
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
253 psrlq_i2r(0x20, mm1);
72
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
254 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
255 punpcklwd_r2r(mm2, mm1);
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
256 movq_r2r(mm0, mm5);
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
257 paddsw_r2r(mm1, mm0);
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
258 psubsw_r2r(mm1, mm5);
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
259 movq_r2r(mm0, mm1);
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
260 movq_r2r(mm5, mm6);
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
261 punpckldq_r2r(mm5, mm3);
f16ae8e69bd9 reorder table instead of wasting instructions to reorder the input to match the table
michael
parents: 1574
diff changeset
262 punpckhdq_r2r(mm3, mm6);
72
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
263 movq_m2r(*(table + 0), mm3);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
264 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
265 punpckldq_r2r(mm0, mm2);
72
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
266 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
267 punpckhdq_r2r(mm2, mm1);
1570
9a9c14e87ebf optimizing
michael
parents: 1565
diff changeset
268 movq_m2r(*(table + 16), mm2);
9a9c14e87ebf optimizing
michael
parents: 1565
diff changeset
269 pmaddwd_r2r(mm1, mm4);
72
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
270 pmaddwd_m2r(*(table + 8), mm0);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
271 movq_m2r(*(table + 20), mm7);
1570
9a9c14e87ebf optimizing
michael
parents: 1565
diff changeset
272 pmaddwd_r2r(mm5, mm2);
72
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
273 paddd_m2r(*fdct_r_row, mm3);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
274 pmaddwd_r2r(mm6, mm7);
1570
9a9c14e87ebf optimizing
michael
parents: 1565
diff changeset
275 pmaddwd_m2r(*(table + 12), mm1);
72
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
276 paddd_r2r(mm4, mm3);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
277 pmaddwd_m2r(*(table + 24), mm5);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
278 pmaddwd_m2r(*(table + 28), mm6);
1570
9a9c14e87ebf optimizing
michael
parents: 1565
diff changeset
279 paddd_r2r(mm7, mm2);
72
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
280 paddd_m2r(*fdct_r_row, mm0);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
281 psrad_i2r(SHIFT_FRW_ROW, mm3);
1570
9a9c14e87ebf optimizing
michael
parents: 1565
diff changeset
282 paddd_m2r(*fdct_r_row, mm2);
9a9c14e87ebf optimizing
michael
parents: 1565
diff changeset
283 paddd_r2r(mm1, mm0);
72
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
284 paddd_m2r(*fdct_r_row, mm5);
1570
9a9c14e87ebf optimizing
michael
parents: 1565
diff changeset
285 psrad_i2r(SHIFT_FRW_ROW, mm2);
72
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
286 paddd_r2r(mm6, mm5);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
287 psrad_i2r(SHIFT_FRW_ROW, mm0);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
288 psrad_i2r(SHIFT_FRW_ROW, mm5);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
289 packssdw_r2r(mm0, mm3);
1570
9a9c14e87ebf optimizing
michael
parents: 1565
diff changeset
290 packssdw_r2r(mm5, mm2);
72
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
291 movq_r2r(mm3, mm6);
1570
9a9c14e87ebf optimizing
michael
parents: 1565
diff changeset
292 punpcklwd_r2r(mm2, mm3);
9a9c14e87ebf optimizing
michael
parents: 1565
diff changeset
293 punpckhwd_r2r(mm2, mm6);
72
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
294 movq_r2m(mm3, *(out + 0));
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
295 movq_r2m(mm6, *(out + 4));
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
296 }
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
297
687
9abb13c21fbe fdct_mmx -> ff_fdct_mmx (renamed to avoid namespace conflict with xvid)
arpi_esp
parents: 635
diff changeset
298 void ff_fdct_mmx(int16_t *block)
72
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
299 {
839
b7e2b8129211 cleanup
michaelni
parents: 687
diff changeset
300 int64_t align_tmp[16] ATTR_ALIGN(8);
b7e2b8129211 cleanup
michaelni
parents: 687
diff changeset
301 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
302 int16_t *block1, *out;
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
303 const int16_t *table;
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
304 int i;
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
305
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
306 block1 = block_tmp;
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
307 fdct_col(block, block1, 0);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
308 fdct_col(block, block1, 4);
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
309
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
310 block1 = block_tmp;
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
311 table = tab_frw_01234567;
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
312 out = block;
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
313 for(i=8;i>0;i--) {
1570
9a9c14e87ebf optimizing
michael
parents: 1565
diff changeset
314 fdct_row_mmx(block1, out, table);
72
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
315 block1 += 8;
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
316 table += 32;
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
317 out += 8;
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
318 }
3049d6d452a3 suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff changeset
319 }
1565
1a9a63f59849 minor mmx2 optimization if the dct
michael
parents: 1564
diff changeset
320
1a9a63f59849 minor mmx2 optimization if the dct
michael
parents: 1564
diff changeset
321 void ff_fdct_mmx2(int16_t *block)
1a9a63f59849 minor mmx2 optimization if the dct
michael
parents: 1564
diff changeset
322 {
1a9a63f59849 minor mmx2 optimization if the dct
michael
parents: 1564
diff changeset
323 int64_t align_tmp[16] ATTR_ALIGN(8);
1a9a63f59849 minor mmx2 optimization if the dct
michael
parents: 1564
diff changeset
324 int16_t * const block_tmp= (int16_t*)align_tmp;
1a9a63f59849 minor mmx2 optimization if the dct
michael
parents: 1564
diff changeset
325 int16_t *block1, *out;
1a9a63f59849 minor mmx2 optimization if the dct
michael
parents: 1564
diff changeset
326 const int16_t *table;
1a9a63f59849 minor mmx2 optimization if the dct
michael
parents: 1564
diff changeset
327 int i;
1a9a63f59849 minor mmx2 optimization if the dct
michael
parents: 1564
diff changeset
328
1a9a63f59849 minor mmx2 optimization if the dct
michael
parents: 1564
diff changeset
329 block1 = block_tmp;
1a9a63f59849 minor mmx2 optimization if the dct
michael
parents: 1564
diff changeset
330 fdct_col(block, block1, 0);
1a9a63f59849 minor mmx2 optimization if the dct
michael
parents: 1564
diff changeset
331 fdct_col(block, block1, 4);
1a9a63f59849 minor mmx2 optimization if the dct
michael
parents: 1564
diff changeset
332
1a9a63f59849 minor mmx2 optimization if the dct
michael
parents: 1564
diff changeset
333 block1 = block_tmp;
1a9a63f59849 minor mmx2 optimization if the dct
michael
parents: 1564
diff changeset
334 table = tab_frw_01234567;
1a9a63f59849 minor mmx2 optimization if the dct
michael
parents: 1564
diff changeset
335 out = block;
1a9a63f59849 minor mmx2 optimization if the dct
michael
parents: 1564
diff changeset
336 for(i=8;i>0;i--) {
1570
9a9c14e87ebf optimizing
michael
parents: 1565
diff changeset
337 fdct_row_mmx2(block1, out, table);
1565
1a9a63f59849 minor mmx2 optimization if the dct
michael
parents: 1564
diff changeset
338 block1 += 8;
1a9a63f59849 minor mmx2 optimization if the dct
michael
parents: 1564
diff changeset
339 table += 32;
1a9a63f59849 minor mmx2 optimization if the dct
michael
parents: 1564
diff changeset
340 out += 8;
1a9a63f59849 minor mmx2 optimization if the dct
michael
parents: 1564
diff changeset
341 }
1a9a63f59849 minor mmx2 optimization if the dct
michael
parents: 1564
diff changeset
342 }