Mercurial > libavcodec.hg
annotate alpha/simple_idct_alpha.c @ 10198:78af613fc316 libavcodec
Fix embarassing typo in last commit: Restore mistakenly removed ','.
author | diego |
---|---|
date | Sun, 20 Sep 2009 17:18:59 +0000 |
parents | 72e109759617 |
children | 9e7d38743146 |
rev | line source |
---|---|
744
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
1 /* |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
2 * Simple IDCT (Alpha optimized) |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
3 * |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
4 * Copyright (c) 2001 Michael Niedermayer <michaelni@gmx.at> |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
5 * |
5214 | 6 * based upon some outcommented C code from mpeg2dec (idct_mmx.c |
7 * written by Aaron Holtzman <aholtzma@ess.engr.uvic.ca>) | |
8 * | |
5220 | 9 * Alpha optimizations by Måns Rullgård <mans@mansr.com> |
5214 | 10 * and Falk Hueffner <falk@debian.org> |
11 * | |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3036
diff
changeset
|
12 * This file is part of FFmpeg. |
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3036
diff
changeset
|
13 * |
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3036
diff
changeset
|
14 * FFmpeg is free software; you can redistribute it and/or |
744
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
15 * modify it under the terms of the GNU Lesser General Public |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
16 * License as published by the Free Software Foundation; either |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3036
diff
changeset
|
17 * version 2.1 of the License, or (at your option) any later version. |
744
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
18 * |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3036
diff
changeset
|
19 * FFmpeg is distributed in the hope that it will be useful, |
744
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
22 * Lesser General Public License for more details. |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
23 * |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
24 * You should have received a copy of the GNU Lesser General Public |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3036
diff
changeset
|
25 * License along with FFmpeg; if not, write to the Free Software |
3036
0b546eab515d
Update licensing information: The FSF changed postal address.
diego
parents:
2979
diff
changeset
|
26 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
744
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
27 */ |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
28 |
6763 | 29 #include "libavcodec/dsputil.h" |
744
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
30 #include "asm.h" |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
31 |
897 | 32 extern void (*put_pixels_clamped_axp_p)(const DCTELEM *block, uint8_t *pixels, |
33 int line_size); | |
2967 | 34 extern void (*add_pixels_clamped_axp_p)(const DCTELEM *block, uint8_t *pixels, |
897 | 35 int line_size); |
36 | |
744
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
37 // cos(i * M_PI / 16) * sqrt(2) * (1 << 14) |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
38 // W4 is actually exactly 16384, but using 16383 works around |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
39 // accumulating rounding errors for some encoders |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
40 #define W1 ((int_fast32_t) 22725) |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
41 #define W2 ((int_fast32_t) 21407) |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
42 #define W3 ((int_fast32_t) 19266) |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
43 #define W4 ((int_fast32_t) 16383) |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
44 #define W5 ((int_fast32_t) 12873) |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
45 #define W6 ((int_fast32_t) 8867) |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
46 #define W7 ((int_fast32_t) 4520) |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
47 #define ROW_SHIFT 11 |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
48 #define COL_SHIFT 20 |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
49 |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
50 /* 0: all entries 0, 1: only first entry nonzero, 2: otherwise */ |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
51 static inline int idct_row(DCTELEM *row) |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
52 { |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
53 int_fast32_t a0, a1, a2, a3, b0, b1, b2, b3, t; |
1077 | 54 uint64_t l, r, t2; |
744
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
55 l = ldq(row); |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
56 r = ldq(row + 4); |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
57 |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
58 if (l == 0 && r == 0) |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
59 return 0; |
2967 | 60 |
744
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
61 a0 = W4 * sextw(l) + (1 << (ROW_SHIFT - 1)); |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
62 |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
63 if (((l & ~0xffffUL) | r) == 0) { |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
64 a0 >>= ROW_SHIFT; |
1077 | 65 t2 = (uint16_t) a0; |
66 t2 |= t2 << 16; | |
67 t2 |= t2 << 32; | |
2967 | 68 |
1077 | 69 stq(t2, row); |
70 stq(t2, row + 4); | |
744
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
71 return 1; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
72 } |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
73 |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
74 a1 = a0; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
75 a2 = a0; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
76 a3 = a0; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
77 |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
78 t = extwl(l, 4); /* row[2] */ |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
79 if (t != 0) { |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
80 t = sextw(t); |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
81 a0 += W2 * t; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
82 a1 += W6 * t; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
83 a2 -= W6 * t; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
84 a3 -= W2 * t; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
85 } |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
86 |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
87 t = extwl(r, 0); /* row[4] */ |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
88 if (t != 0) { |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
89 t = sextw(t); |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
90 a0 += W4 * t; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
91 a1 -= W4 * t; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
92 a2 -= W4 * t; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
93 a3 += W4 * t; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
94 } |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
95 |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
96 t = extwl(r, 4); /* row[6] */ |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
97 if (t != 0) { |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
98 t = sextw(t); |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
99 a0 += W6 * t; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
100 a1 -= W2 * t; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
101 a2 += W2 * t; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
102 a3 -= W6 * t; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
103 } |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
104 |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
105 t = extwl(l, 2); /* row[1] */ |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
106 if (t != 0) { |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
107 t = sextw(t); |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
108 b0 = W1 * t; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
109 b1 = W3 * t; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
110 b2 = W5 * t; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
111 b3 = W7 * t; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
112 } else { |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
113 b0 = 0; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
114 b1 = 0; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
115 b2 = 0; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
116 b3 = 0; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
117 } |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
118 |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
119 t = extwl(l, 6); /* row[3] */ |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
120 if (t) { |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
121 t = sextw(t); |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
122 b0 += W3 * t; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
123 b1 -= W7 * t; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
124 b2 -= W1 * t; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
125 b3 -= W5 * t; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
126 } |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
127 |
2967 | 128 |
744
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
129 t = extwl(r, 2); /* row[5] */ |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
130 if (t) { |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
131 t = sextw(t); |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
132 b0 += W5 * t; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
133 b1 -= W1 * t; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
134 b2 += W7 * t; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
135 b3 += W3 * t; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
136 } |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
137 |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
138 t = extwl(r, 6); /* row[7] */ |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
139 if (t) { |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
140 t = sextw(t); |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
141 b0 += W7 * t; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
142 b1 -= W5 * t; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
143 b2 += W3 * t; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
144 b3 -= W1 * t; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
145 } |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
146 |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
147 row[0] = (a0 + b0) >> ROW_SHIFT; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
148 row[1] = (a1 + b1) >> ROW_SHIFT; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
149 row[2] = (a2 + b2) >> ROW_SHIFT; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
150 row[3] = (a3 + b3) >> ROW_SHIFT; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
151 row[4] = (a3 - b3) >> ROW_SHIFT; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
152 row[5] = (a2 - b2) >> ROW_SHIFT; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
153 row[6] = (a1 - b1) >> ROW_SHIFT; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
154 row[7] = (a0 - b0) >> ROW_SHIFT; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
155 |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
156 return 2; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
157 } |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
158 |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
159 static inline void idct_col(DCTELEM *col) |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
160 { |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
161 int_fast32_t a0, a1, a2, a3, b0, b1, b2, b3; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
162 |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
163 col[0] += (1 << (COL_SHIFT - 1)) / W4; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
164 |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
165 a0 = W4 * col[8 * 0]; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
166 a1 = W4 * col[8 * 0]; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
167 a2 = W4 * col[8 * 0]; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
168 a3 = W4 * col[8 * 0]; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
169 |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
170 if (col[8 * 2]) { |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
171 a0 += W2 * col[8 * 2]; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
172 a1 += W6 * col[8 * 2]; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
173 a2 -= W6 * col[8 * 2]; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
174 a3 -= W2 * col[8 * 2]; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
175 } |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
176 |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
177 if (col[8 * 4]) { |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
178 a0 += W4 * col[8 * 4]; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
179 a1 -= W4 * col[8 * 4]; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
180 a2 -= W4 * col[8 * 4]; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
181 a3 += W4 * col[8 * 4]; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
182 } |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
183 |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
184 if (col[8 * 6]) { |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
185 a0 += W6 * col[8 * 6]; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
186 a1 -= W2 * col[8 * 6]; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
187 a2 += W2 * col[8 * 6]; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
188 a3 -= W6 * col[8 * 6]; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
189 } |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
190 |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
191 if (col[8 * 1]) { |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
192 b0 = W1 * col[8 * 1]; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
193 b1 = W3 * col[8 * 1]; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
194 b2 = W5 * col[8 * 1]; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
195 b3 = W7 * col[8 * 1]; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
196 } else { |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
197 b0 = 0; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
198 b1 = 0; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
199 b2 = 0; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
200 b3 = 0; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
201 } |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
202 |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
203 if (col[8 * 3]) { |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
204 b0 += W3 * col[8 * 3]; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
205 b1 -= W7 * col[8 * 3]; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
206 b2 -= W1 * col[8 * 3]; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
207 b3 -= W5 * col[8 * 3]; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
208 } |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
209 |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
210 if (col[8 * 5]) { |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
211 b0 += W5 * col[8 * 5]; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
212 b1 -= W1 * col[8 * 5]; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
213 b2 += W7 * col[8 * 5]; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
214 b3 += W3 * col[8 * 5]; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
215 } |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
216 |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
217 if (col[8 * 7]) { |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
218 b0 += W7 * col[8 * 7]; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
219 b1 -= W5 * col[8 * 7]; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
220 b2 += W3 * col[8 * 7]; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
221 b3 -= W1 * col[8 * 7]; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
222 } |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
223 |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
224 col[8 * 0] = (a0 + b0) >> COL_SHIFT; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
225 col[8 * 7] = (a0 - b0) >> COL_SHIFT; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
226 col[8 * 1] = (a1 + b1) >> COL_SHIFT; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
227 col[8 * 6] = (a1 - b1) >> COL_SHIFT; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
228 col[8 * 2] = (a2 + b2) >> COL_SHIFT; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
229 col[8 * 5] = (a2 - b2) >> COL_SHIFT; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
230 col[8 * 3] = (a3 + b3) >> COL_SHIFT; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
231 col[8 * 4] = (a3 - b3) >> COL_SHIFT; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
232 } |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
233 |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
234 /* If all rows but the first one are zero after row transformation, |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
235 all rows will be identical after column transformation. */ |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
236 static inline void idct_col2(DCTELEM *col) |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
237 { |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
238 int i; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
239 uint64_t l, r; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
240 |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
241 for (i = 0; i < 8; ++i) { |
2765
e44ff53b1c85
Communicate proper aliasing to gcc (needed for 4.1).
mellum
parents:
1077
diff
changeset
|
242 int_fast32_t a0 = col[i] + (1 << (COL_SHIFT - 1)) / W4; |
744
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
243 |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
244 a0 *= W4; |
2765
e44ff53b1c85
Communicate proper aliasing to gcc (needed for 4.1).
mellum
parents:
1077
diff
changeset
|
245 col[i] = a0 >> COL_SHIFT; |
744
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
246 } |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
247 |
2765
e44ff53b1c85
Communicate proper aliasing to gcc (needed for 4.1).
mellum
parents:
1077
diff
changeset
|
248 l = ldq(col + 0 * 4); r = ldq(col + 1 * 4); |
e44ff53b1c85
Communicate proper aliasing to gcc (needed for 4.1).
mellum
parents:
1077
diff
changeset
|
249 stq(l, col + 2 * 4); stq(r, col + 3 * 4); |
e44ff53b1c85
Communicate proper aliasing to gcc (needed for 4.1).
mellum
parents:
1077
diff
changeset
|
250 stq(l, col + 4 * 4); stq(r, col + 5 * 4); |
e44ff53b1c85
Communicate proper aliasing to gcc (needed for 4.1).
mellum
parents:
1077
diff
changeset
|
251 stq(l, col + 6 * 4); stq(r, col + 7 * 4); |
e44ff53b1c85
Communicate proper aliasing to gcc (needed for 4.1).
mellum
parents:
1077
diff
changeset
|
252 stq(l, col + 8 * 4); stq(r, col + 9 * 4); |
e44ff53b1c85
Communicate proper aliasing to gcc (needed for 4.1).
mellum
parents:
1077
diff
changeset
|
253 stq(l, col + 10 * 4); stq(r, col + 11 * 4); |
e44ff53b1c85
Communicate proper aliasing to gcc (needed for 4.1).
mellum
parents:
1077
diff
changeset
|
254 stq(l, col + 12 * 4); stq(r, col + 13 * 4); |
e44ff53b1c85
Communicate proper aliasing to gcc (needed for 4.1).
mellum
parents:
1077
diff
changeset
|
255 stq(l, col + 14 * 4); stq(r, col + 15 * 4); |
744
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
256 } |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
257 |
8621 | 258 void ff_simple_idct_axp(DCTELEM *block) |
744
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
259 { |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
260 |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
261 int i; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
262 int rowsZero = 1; /* all rows except row 0 zero */ |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
263 int rowsConstant = 1; /* all rows consist of a constant value */ |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
264 |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
265 for (i = 0; i < 8; i++) { |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
266 int sparseness = idct_row(block + 8 * i); |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
267 |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
268 if (i > 0 && sparseness > 0) |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
269 rowsZero = 0; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
270 if (sparseness == 2) |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
271 rowsConstant = 0; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
272 } |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
273 |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
274 if (rowsZero) { |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
275 idct_col2(block); |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
276 } else if (rowsConstant) { |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
277 idct_col(block); |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
278 for (i = 0; i < 8; i += 2) { |
2765
e44ff53b1c85
Communicate proper aliasing to gcc (needed for 4.1).
mellum
parents:
1077
diff
changeset
|
279 uint64_t v = (uint16_t) block[0]; |
e44ff53b1c85
Communicate proper aliasing to gcc (needed for 4.1).
mellum
parents:
1077
diff
changeset
|
280 uint64_t w = (uint16_t) block[8]; |
744
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
281 |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
282 v |= v << 16; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
283 w |= w << 16; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
284 v |= v << 32; |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
285 w |= w << 32; |
2765
e44ff53b1c85
Communicate proper aliasing to gcc (needed for 4.1).
mellum
parents:
1077
diff
changeset
|
286 stq(v, block + 0 * 4); |
e44ff53b1c85
Communicate proper aliasing to gcc (needed for 4.1).
mellum
parents:
1077
diff
changeset
|
287 stq(v, block + 1 * 4); |
e44ff53b1c85
Communicate proper aliasing to gcc (needed for 4.1).
mellum
parents:
1077
diff
changeset
|
288 stq(w, block + 2 * 4); |
e44ff53b1c85
Communicate proper aliasing to gcc (needed for 4.1).
mellum
parents:
1077
diff
changeset
|
289 stq(w, block + 3 * 4); |
2979 | 290 block += 4 * 4; |
744
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
291 } |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
292 } else { |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
293 for (i = 0; i < 8; i++) |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
294 idct_col(block + i); |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
295 } |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
296 } |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
297 |
8621 | 298 void ff_simple_idct_put_axp(uint8_t *dest, int line_size, DCTELEM *block) |
744
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
299 { |
8621 | 300 ff_simple_idct_axp(block); |
897 | 301 put_pixels_clamped_axp_p(block, dest, line_size); |
744
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
302 } |
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
303 |
8621 | 304 void ff_simple_idct_add_axp(uint8_t *dest, int line_size, DCTELEM *block) |
744
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
305 { |
8621 | 306 ff_simple_idct_axp(block); |
897 | 307 add_pixels_clamped_axp_p(block, dest, line_size); |
744
2f7da29ede37
Move Alpha optimized IDCT to own file. Based on a patch by Mns
mellum
parents:
diff
changeset
|
308 } |