Mercurial > libavcodec.hg
annotate simple_idct.c @ 214:73df666cacc7 libavcodec
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
| author | nickols_k |
|---|---|
| date | Sun, 20 Jan 2002 14:48:02 +0000 |
| parents | ccf36af385f3 |
| children | 1fe6b64feefb |
| rev | line source |
|---|---|
|
175
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
1 /* |
|
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
2 Copyright (C) 2001 Michael Niedermayer (michaelni@gmx.at) |
|
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
3 |
|
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
4 This program is free software; you can redistribute it and/or modify |
|
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
5 it under the terms of the GNU General Public License as published by |
|
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
6 the Free Software Foundation; either version 2 of the License, or |
|
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
7 (at your option) any later version. |
|
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
8 |
|
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
9 This program is distributed in the hope that it will be useful, |
|
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
10 but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
12 GNU General Public License for more details. |
|
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
13 |
|
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
14 You should have received a copy of the GNU General Public License |
|
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
15 along with this program; if not, write to the Free Software |
|
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
17 */ |
|
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
18 |
|
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
19 /* |
|
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
20 based upon some outcommented c code from mpeg2dec (idct_mmx.c written by Aaron Holtzman <aholtzma@ess.engr.uvic.ca>) |
|
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
21 */ |
|
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
22 |
|
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
23 #include <inttypes.h> |
|
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
24 |
|
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
25 #include "simple_idct.h" |
|
214
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
26 #include "../config.h" |
|
175
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
27 |
|
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
28 #if 0 |
|
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
29 #define W1 2841 /* 2048*sqrt (2)*cos (1*pi/16) */ |
|
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
30 #define W2 2676 /* 2048*sqrt (2)*cos (2*pi/16) */ |
|
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
31 #define W3 2408 /* 2048*sqrt (2)*cos (3*pi/16) */ |
|
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
32 #define W4 2048 /* 2048*sqrt (2)*cos (4*pi/16) */ |
|
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
33 #define W5 1609 /* 2048*sqrt (2)*cos (5*pi/16) */ |
|
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
34 #define W6 1108 /* 2048*sqrt (2)*cos (6*pi/16) */ |
|
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
35 #define W7 565 /* 2048*sqrt (2)*cos (7*pi/16) */ |
|
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
36 #define ROW_SHIFT 8 |
|
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
37 #define COL_SHIFT 17 |
|
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
38 #else |
|
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
39 #define W1 22725 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5 |
|
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
40 #define W2 21407 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5 |
|
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
41 #define W3 19266 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5 |
|
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
42 #define W4 16384 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5 |
|
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
43 #define W5 12873 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5 |
|
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
44 #define W6 8867 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5 |
|
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
45 #define W7 4520 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5 |
|
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
46 #define ROW_SHIFT 11 |
|
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
47 #define COL_SHIFT 20 // 6 |
|
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
48 #endif |
| 205 | 49 |
| 50 /* 8x8 Matrix used to do a trivial (slow) 8 point IDCT */ | |
| 51 static int coeff[64]={ | |
| 52 W4, W4, W4, W4, W4, W4, W4, W4, | |
| 53 W1, W3, W5, W7,-W7,-W5,-W3,-W1, | |
| 54 W2, W6,-W6,-W2,-W2,-W6, W6, W2, | |
| 55 W3,-W7,-W1,-W5, W5, W1, W7,-W3, | |
| 56 W4,-W4,-W4, W4, W4,-W4,-W4, W4, | |
| 57 W5,-W1, W7, W3,-W3,-W7, W1,-W5, | |
| 58 W6,-W2, W2,-W6,-W6, W2,-W2, W6, | |
| 59 W7,-W5, W3,-W1, W1,-W3, W5,-W7 | |
| 60 }; | |
| 61 | |
| 62 static int inline idctRowCondZ (int16_t * row) | |
|
175
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
63 { |
|
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
64 int a0, a1, a2, a3, b0, b1, b2, b3; |
|
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
65 |
| 205 | 66 if( !( ((uint32_t*)row)[0]|((uint32_t*)row)[1] |((uint32_t*)row)[2] |((uint32_t*)row)[3])) { |
| 67 /* row[0] = row[1] = row[2] = row[3] = row[4] = | |
| 68 row[5] = row[6] = row[7] = 0;*/ | |
| 69 return 0; | |
|
175
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
70 } |
|
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
71 |
| 205 | 72 if(!( ((uint32_t*)row)[2] |((uint32_t*)row)[3] )){ |
| 73 a0 = W4*row[0] + W2*row[2] + (1<<(ROW_SHIFT-1)); | |
| 74 a1 = W4*row[0] + W6*row[2] + (1<<(ROW_SHIFT-1)); | |
| 75 a2 = W4*row[0] - W6*row[2] + (1<<(ROW_SHIFT-1)); | |
| 76 a3 = W4*row[0] - W2*row[2] + (1<<(ROW_SHIFT-1)); | |
|
175
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
77 |
| 205 | 78 b0 = W1*row[1] + W3*row[3]; |
| 79 b1 = W3*row[1] - W7*row[3]; | |
| 80 b2 = W5*row[1] - W1*row[3]; | |
| 81 b3 = W7*row[1] - W5*row[3]; | |
| 82 }else{ | |
| 83 a0 = W4*row[0] + W2*row[2] + W4*row[4] + W6*row[6] + (1<<(ROW_SHIFT-1)); | |
| 84 a1 = W4*row[0] + W6*row[2] - W4*row[4] - W2*row[6] + (1<<(ROW_SHIFT-1)); | |
| 85 a2 = W4*row[0] - W6*row[2] - W4*row[4] + W2*row[6] + (1<<(ROW_SHIFT-1)); | |
| 86 a3 = W4*row[0] - W2*row[2] + W4*row[4] - W6*row[6] + (1<<(ROW_SHIFT-1)); | |
| 87 | |
| 88 b0 = W1*row[1] + W3*row[3] + W5*row[5] + W7*row[7]; | |
| 89 b1 = W3*row[1] - W7*row[3] - W1*row[5] - W5*row[7]; | |
| 90 b2 = W5*row[1] - W1*row[3] + W7*row[5] + W3*row[7]; | |
| 91 b3 = W7*row[1] - W5*row[3] + W3*row[5] - W1*row[7]; | |
| 92 } | |
|
175
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
93 |
|
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
94 row[0] = (a0 + b0) >> ROW_SHIFT; |
|
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
95 row[1] = (a1 + b1) >> ROW_SHIFT; |
|
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
96 row[2] = (a2 + b2) >> ROW_SHIFT; |
|
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
97 row[3] = (a3 + b3) >> ROW_SHIFT; |
|
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
98 row[4] = (a3 - b3) >> ROW_SHIFT; |
|
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
99 row[5] = (a2 - b2) >> ROW_SHIFT; |
|
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
100 row[6] = (a1 - b1) >> ROW_SHIFT; |
|
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
101 row[7] = (a0 - b0) >> ROW_SHIFT; |
| 205 | 102 |
| 103 return 1; | |
| 104 } | |
| 105 | |
|
214
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
106 #ifdef ARCH_ALPHA |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
107 static int inline idctRowCondDC(int16_t *row) |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
108 { |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
109 int_fast32_t a0, a1, a2, a3, b0, b1, b2, b3; |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
110 uint64_t *lrow = (uint64_t *) row; |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
111 |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
112 if (lrow[1] == 0) { |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
113 if (lrow[0] == 0) |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
114 return 0; |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
115 if ((lrow[0] & ~0xffffULL) == 0) { |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
116 uint64_t v; |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
117 |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
118 a0 = W4 * row[0]; |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
119 a0 += 1 << (ROW_SHIFT - 1); |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
120 a0 >>= ROW_SHIFT; |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
121 v = (uint16_t) a0; |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
122 v += v << 16; |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
123 v += v << 32; |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
124 lrow[0] = v; |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
125 lrow[1] = v; |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
126 |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
127 return 1; |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
128 } |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
129 } |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
130 |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
131 a0 = W4 * row[0]; |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
132 a1 = W4 * row[0]; |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
133 a2 = W4 * row[0]; |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
134 a3 = W4 * row[0]; |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
135 |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
136 if (row[2]) { |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
137 a0 += W2 * row[2]; |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
138 a1 += W6 * row[2]; |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
139 a2 -= W6 * row[2]; |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
140 a3 -= W2 * row[2]; |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
141 } |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
142 |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
143 if (row[4]) { |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
144 a0 += W4 * row[4]; |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
145 a1 -= W4 * row[4]; |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
146 a2 -= W4 * row[4]; |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
147 a3 += W4 * row[4]; |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
148 } |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
149 |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
150 if (row[6]) { |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
151 a0 += W6 * row[6]; |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
152 a1 -= W2 * row[6]; |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
153 a2 += W2 * row[6]; |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
154 a3 -= W6 * row[6]; |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
155 } |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
156 |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
157 a0 += 1 << (ROW_SHIFT - 1); |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
158 a1 += 1 << (ROW_SHIFT - 1); |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
159 a2 += 1 << (ROW_SHIFT - 1); |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
160 a3 += 1 << (ROW_SHIFT - 1); |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
161 |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
162 if (row[1]) { |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
163 b0 = W1 * row[1]; |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
164 b1 = W3 * row[1]; |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
165 b2 = W5 * row[1]; |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
166 b3 = W7 * row[1]; |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
167 } else { |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
168 b0 = 0; |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
169 b1 = 0; |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
170 b2 = 0; |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
171 b3 = 0; |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
172 } |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
173 |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
174 if (row[3]) { |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
175 b0 += W3 * row[3]; |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
176 b1 -= W7 * row[3]; |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
177 b2 -= W1 * row[3]; |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
178 b3 -= W5 * row[3]; |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
179 } |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
180 |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
181 if (row[5]) { |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
182 b0 += W5 * row[5]; |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
183 b1 -= W1 * row[5]; |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
184 b2 += W7 * row[5]; |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
185 b3 += W3 * row[5]; |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
186 } |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
187 |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
188 if (row[7]) { |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
189 b0 += W7 * row[7]; |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
190 b1 -= W5 * row[7]; |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
191 b2 += W3 * row[7]; |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
192 b3 -= W1 * row[7]; |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
193 } |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
194 |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
195 row[0] = (a0 + b0) >> ROW_SHIFT; |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
196 row[1] = (a1 + b1) >> ROW_SHIFT; |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
197 row[2] = (a2 + b2) >> ROW_SHIFT; |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
198 row[3] = (a3 + b3) >> ROW_SHIFT; |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
199 row[4] = (a3 - b3) >> ROW_SHIFT; |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
200 row[5] = (a2 - b2) >> ROW_SHIFT; |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
201 row[6] = (a1 - b1) >> ROW_SHIFT; |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
202 row[7] = (a0 - b0) >> ROW_SHIFT; |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
203 |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
204 return 1; |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
205 } |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
206 #else /* not ARCH_ALPHA */ |
| 205 | 207 static int inline idctRowCondDC (int16_t * row) |
| 208 { | |
| 209 int a0, a1, a2, a3, b0, b1, b2, b3; | |
| 210 | |
| 211 if( !( ((uint32_t*)row)[1] |((uint32_t*)row)[2] |((uint32_t*)row)[3]| row[1])) { | |
| 212 // row[0] = row[1] = row[2] = row[3] = row[4] = row[5] = row[6] = row[7] = row[0]<<3; | |
| 213 uint16_t temp= row[0]<<3; | |
| 214 ((uint32_t*)row)[0]=((uint32_t*)row)[1]= | |
| 215 ((uint32_t*)row)[2]=((uint32_t*)row)[3]= temp + (temp<<16); | |
| 216 return 0; | |
| 217 } | |
| 218 | |
| 219 if(!( ((uint32_t*)row)[2] |((uint32_t*)row)[3] )){ | |
| 220 a0 = W4*row[0] + W2*row[2] + (1<<(ROW_SHIFT-1)); | |
| 221 a1 = W4*row[0] + W6*row[2] + (1<<(ROW_SHIFT-1)); | |
| 222 a2 = W4*row[0] - W6*row[2] + (1<<(ROW_SHIFT-1)); | |
| 223 a3 = W4*row[0] - W2*row[2] + (1<<(ROW_SHIFT-1)); | |
| 224 | |
| 225 b0 = W1*row[1] + W3*row[3]; | |
| 226 b1 = W3*row[1] - W7*row[3]; | |
| 227 b2 = W5*row[1] - W1*row[3]; | |
| 228 b3 = W7*row[1] - W5*row[3]; | |
| 229 }else{ | |
| 230 a0 = W4*row[0] + W2*row[2] + W4*row[4] + W6*row[6] + (1<<(ROW_SHIFT-1)); | |
| 231 a1 = W4*row[0] + W6*row[2] - W4*row[4] - W2*row[6] + (1<<(ROW_SHIFT-1)); | |
| 232 a2 = W4*row[0] - W6*row[2] - W4*row[4] + W2*row[6] + (1<<(ROW_SHIFT-1)); | |
| 233 a3 = W4*row[0] - W2*row[2] + W4*row[4] - W6*row[6] + (1<<(ROW_SHIFT-1)); | |
| 234 | |
| 235 b0 = W1*row[1] + W3*row[3] + W5*row[5] + W7*row[7]; | |
| 236 b1 = W3*row[1] - W7*row[3] - W1*row[5] - W5*row[7]; | |
| 237 b2 = W5*row[1] - W1*row[3] + W7*row[5] + W3*row[7]; | |
| 238 b3 = W7*row[1] - W5*row[3] + W3*row[5] - W1*row[7]; | |
| 239 } | |
| 240 | |
| 241 row[0] = (a0 + b0) >> ROW_SHIFT; | |
| 242 row[7] = (a0 - b0) >> ROW_SHIFT; | |
| 243 row[1] = (a1 + b1) >> ROW_SHIFT; | |
| 244 row[6] = (a1 - b1) >> ROW_SHIFT; | |
| 245 row[2] = (a2 + b2) >> ROW_SHIFT; | |
| 246 row[5] = (a2 - b2) >> ROW_SHIFT; | |
| 247 row[3] = (a3 + b3) >> ROW_SHIFT; | |
| 248 row[4] = (a3 - b3) >> ROW_SHIFT; | |
| 249 | |
| 250 return 1; | |
|
175
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
251 } |
|
214
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
252 #endif /* not ARCH_ALPHA */ |
|
175
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
253 |
|
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
254 static void inline idctCol (int16_t * col) |
|
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
255 { |
| 205 | 256 |
|
175
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
257 /* |
|
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
258 if( !(col[8*1] | col[8*2] |col[8*3] |col[8*4] |col[8*5] |col[8*6] | col[8*7])) { |
|
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
259 col[8*0] = col[8*1] = col[8*2] = col[8*3] = col[8*4] = |
|
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
260 col[8*5] = col[8*6] = col[8*7] = col[8*0]<<3; |
|
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
261 return; |
|
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
262 }*/ |
| 205 | 263 |
| 264 int a0, a1, a2, a3, b0, b1, b2, b3; | |
|
175
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
265 col[0] += (1<<(COL_SHIFT-1))/W4; |
| 205 | 266 a0 = W4*col[8*0] + W2*col[8*2] + W4*col[8*4] + W6*col[8*6]; |
| 267 a1 = W4*col[8*0] + W6*col[8*2] - W4*col[8*4] - W2*col[8*6]; | |
| 268 a2 = W4*col[8*0] - W6*col[8*2] - W4*col[8*4] + W2*col[8*6]; | |
| 269 a3 = W4*col[8*0] - W2*col[8*2] + W4*col[8*4] - W6*col[8*6]; | |
|
175
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
270 |
| 205 | 271 b0 = W1*col[8*1] + W3*col[8*3] + W5*col[8*5] + W7*col[8*7]; |
| 272 b1 = W3*col[8*1] - W7*col[8*3] - W1*col[8*5] - W5*col[8*7]; | |
| 273 b2 = W5*col[8*1] - W1*col[8*3] + W7*col[8*5] + W3*col[8*7]; | |
| 274 b3 = W7*col[8*1] - W5*col[8*3] + W3*col[8*5] - W1*col[8*7]; | |
|
175
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
275 |
|
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
276 col[8*0] = (a0 + b0) >> COL_SHIFT; |
| 205 | 277 col[8*7] = (a0 - b0) >> COL_SHIFT; |
|
175
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
278 col[8*1] = (a1 + b1) >> COL_SHIFT; |
| 205 | 279 col[8*6] = (a1 - b1) >> COL_SHIFT; |
|
175
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
280 col[8*2] = (a2 + b2) >> COL_SHIFT; |
| 205 | 281 col[8*5] = (a2 - b2) >> COL_SHIFT; |
|
175
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
282 col[8*3] = (a3 + b3) >> COL_SHIFT; |
|
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
283 col[8*4] = (a3 - b3) >> COL_SHIFT; |
| 205 | 284 } |
| 285 | |
| 286 static void inline idctSparseCol (int16_t * col) | |
| 287 { | |
| 288 int a0, a1, a2, a3, b0, b1, b2, b3; | |
| 289 col[0] += (1<<(COL_SHIFT-1))/W4; | |
| 290 a0 = W4*col[8*0]; | |
| 291 a1 = W4*col[8*0]; | |
| 292 a2 = W4*col[8*0]; | |
| 293 a3 = W4*col[8*0]; | |
| 294 | |
| 295 if(col[8*2]){ | |
| 296 a0 += + W2*col[8*2]; | |
| 297 a1 += + W6*col[8*2]; | |
| 298 a2 += - W6*col[8*2]; | |
| 299 a3 += - W2*col[8*2]; | |
| 300 } | |
| 301 | |
| 302 if(col[8*4]){ | |
| 303 a0 += + W4*col[8*4]; | |
| 304 a1 += - W4*col[8*4]; | |
| 305 a2 += - W4*col[8*4]; | |
| 306 a3 += + W4*col[8*4]; | |
| 307 } | |
| 308 | |
| 309 if(col[8*6]){ | |
| 310 a0 += + W6*col[8*6]; | |
| 311 a1 += - W2*col[8*6]; | |
| 312 a2 += + W2*col[8*6]; | |
| 313 a3 += - W6*col[8*6]; | |
| 314 } | |
| 315 | |
| 316 if(col[8*1]){ | |
| 317 b0 = W1*col[8*1]; | |
| 318 b1 = W3*col[8*1]; | |
| 319 b2 = W5*col[8*1]; | |
| 320 b3 = W7*col[8*1]; | |
| 321 }else{ | |
| 322 b0 = | |
| 323 b1 = | |
| 324 b2 = | |
| 325 b3 = 0; | |
| 326 } | |
| 327 | |
| 328 if(col[8*3]){ | |
| 329 b0 += + W3*col[8*3]; | |
| 330 b1 += - W7*col[8*3]; | |
| 331 b2 += - W1*col[8*3]; | |
| 332 b3 += - W5*col[8*3]; | |
| 333 } | |
| 334 | |
| 335 if(col[8*5]){ | |
| 336 b0 += + W5*col[8*5]; | |
| 337 b1 += - W1*col[8*5]; | |
| 338 b2 += + W7*col[8*5]; | |
| 339 b3 += + W3*col[8*5]; | |
| 340 } | |
| 341 | |
| 342 if(col[8*7]){ | |
| 343 b0 += + W7*col[8*7]; | |
| 344 b1 += - W5*col[8*7]; | |
| 345 b2 += + W3*col[8*7]; | |
| 346 b3 += - W1*col[8*7]; | |
| 347 } | |
| 348 | |
|
214
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
349 #ifndef ARCH_ALPHA |
| 205 | 350 if(!(b0|b1|b2|b3)){ |
| 351 col[8*0] = (a0) >> COL_SHIFT; | |
| 352 col[8*7] = (a0) >> COL_SHIFT; | |
| 353 col[8*1] = (a1) >> COL_SHIFT; | |
| 354 col[8*6] = (a1) >> COL_SHIFT; | |
| 355 col[8*2] = (a2) >> COL_SHIFT; | |
| 356 col[8*5] = (a2) >> COL_SHIFT; | |
| 357 col[8*3] = (a3) >> COL_SHIFT; | |
| 358 col[8*4] = (a3) >> COL_SHIFT; | |
| 359 }else{ | |
|
214
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
360 #endif |
| 205 | 361 col[8*0] = (a0 + b0) >> COL_SHIFT; |
| 362 col[8*7] = (a0 - b0) >> COL_SHIFT; | |
| 363 col[8*1] = (a1 + b1) >> COL_SHIFT; | |
| 364 col[8*6] = (a1 - b1) >> COL_SHIFT; | |
| 365 col[8*2] = (a2 + b2) >> COL_SHIFT; | |
| 366 col[8*5] = (a2 - b2) >> COL_SHIFT; | |
| 367 col[8*3] = (a3 + b3) >> COL_SHIFT; | |
| 368 col[8*4] = (a3 - b3) >> COL_SHIFT; | |
|
214
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
369 #ifndef ARCH_ALPHA |
| 205 | 370 } |
|
214
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
371 #endif |
| 205 | 372 } |
| 373 | |
| 374 static void inline idctSparse2Col (int16_t * col) | |
| 375 { | |
| 376 int a0, a1, a2, a3, b0, b1, b2, b3; | |
| 377 col[0] += (1<<(COL_SHIFT-1))/W4; | |
| 378 a0 = W4*col[8*0]; | |
| 379 a1 = W4*col[8*0]; | |
| 380 a2 = W4*col[8*0]; | |
| 381 a3 = W4*col[8*0]; | |
| 382 | |
| 383 if(col[8*2]){ | |
| 384 a0 += + W2*col[8*2]; | |
| 385 a1 += + W6*col[8*2]; | |
| 386 a2 += - W6*col[8*2]; | |
| 387 a3 += - W2*col[8*2]; | |
| 388 } | |
| 389 | |
| 390 if(col[8*4]){ | |
| 391 a0 += + W4*col[8*4]; | |
| 392 a1 += - W4*col[8*4]; | |
| 393 a2 += - W4*col[8*4]; | |
| 394 a3 += + W4*col[8*4]; | |
| 395 } | |
| 396 | |
| 397 if(col[8*6]){ | |
| 398 a0 += + W6*col[8*6]; | |
| 399 a1 += - W2*col[8*6]; | |
| 400 a2 += + W2*col[8*6]; | |
| 401 a3 += - W6*col[8*6]; | |
| 402 } | |
| 403 | |
| 404 if(col[8*1] || 1){ | |
| 405 b0 = W1*col[8*1]; | |
| 406 b1 = W3*col[8*1]; | |
| 407 b2 = W5*col[8*1]; | |
| 408 b3 = W7*col[8*1]; | |
| 409 }else{ | |
| 410 b0 = | |
| 411 b1 = | |
| 412 b2 = | |
| 413 b3 = 0; | |
| 414 } | |
| 415 | |
| 416 if(col[8*3]){ | |
| 417 b0 += + W3*col[8*3]; | |
| 418 b1 += - W7*col[8*3]; | |
| 419 b2 += - W1*col[8*3]; | |
| 420 b3 += - W5*col[8*3]; | |
| 421 } | |
| 422 | |
| 423 if(col[8*5]){ | |
| 424 b0 += + W5*col[8*5]; | |
| 425 b1 += - W1*col[8*5]; | |
| 426 b2 += + W7*col[8*5]; | |
| 427 b3 += + W3*col[8*5]; | |
| 428 } | |
| 429 | |
| 430 if(col[8*7]){ | |
| 431 b0 += + W7*col[8*7]; | |
| 432 b1 += - W5*col[8*7]; | |
| 433 b2 += + W3*col[8*7]; | |
| 434 b3 += - W1*col[8*7]; | |
| 435 } | |
| 436 | |
| 437 col[8*0] = (a0 + b0) >> COL_SHIFT; | |
| 438 col[8*7] = (a0 - b0) >> COL_SHIFT; | |
| 439 col[8*1] = (a1 + b1) >> COL_SHIFT; | |
|
175
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
440 col[8*6] = (a1 - b1) >> COL_SHIFT; |
| 205 | 441 col[8*2] = (a2 + b2) >> COL_SHIFT; |
| 442 col[8*5] = (a2 - b2) >> COL_SHIFT; | |
| 443 col[8*3] = (a3 + b3) >> COL_SHIFT; | |
| 444 col[8*4] = (a3 - b3) >> COL_SHIFT; | |
|
175
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
445 } |
|
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
446 |
|
214
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
447 #ifdef ARCH_ALPHA |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
448 /* If all rows but the first one are zero after row transformation, |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
449 all rows will be identical after column transformation. */ |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
450 static inline void idctCol2(int16_t *col) |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
451 { |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
452 int i; |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
453 uint64_t l, r; |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
454 uint64_t *lcol = (uint64_t *) col; |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
455 |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
456 for (i = 0; i < 8; ++i) { |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
457 int a0 = col[0] + (1 << (COL_SHIFT - 1)) / W4; |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
458 |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
459 a0 *= W4; |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
460 col[0] = a0 >> COL_SHIFT; |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
461 ++col; |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
462 } |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
463 |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
464 l = lcol[0]; |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
465 r = lcol[1]; |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
466 lcol[ 2] = l; lcol[ 3] = r; |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
467 lcol[ 4] = l; lcol[ 5] = r; |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
468 lcol[ 6] = l; lcol[ 7] = r; |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
469 lcol[ 8] = l; lcol[ 9] = r; |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
470 lcol[10] = l; lcol[11] = r; |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
471 lcol[12] = l; lcol[13] = r; |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
472 lcol[14] = l; lcol[15] = r; |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
473 } |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
474 #endif |
| 205 | 475 |
|
175
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
476 void simple_idct (short *block) |
|
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
477 { |
| 205 | 478 |
|
175
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
479 int i; |
| 205 | 480 |
| 481 #if 0 | |
| 482 int nonZero[8]; | |
| 483 int buffer[64]; | |
| 484 int nNonZero=0; | |
| 485 | |
| 486 idctRowCondDC(block); | |
| 487 | |
| 488 for(i=1; i<8; i++) | |
| 489 { | |
| 490 nonZero[nNonZero]=i; | |
| 491 nNonZero+= idctRowCondZ(block + i*8); | |
| 492 } | |
| 493 | |
| 494 if(nNonZero==0) | |
| 495 { | |
| 496 for(i=0; i<8; i++) | |
| 497 { | |
| 498 block[i ]= | |
| 499 block[i+8 ]= | |
| 500 block[i+16]= | |
| 501 block[i+24]= | |
| 502 block[i+32]= | |
| 503 block[i+40]= | |
| 504 block[i+48]= | |
| 505 block[i+56]= (W4*block[i] + (1<<(COL_SHIFT-1))) >> COL_SHIFT; | |
| 506 } | |
|
175
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
507 } |
| 205 | 508 else if(nNonZero==1) |
| 509 { | |
| 510 int index= nonZero[0]*8; | |
| 511 for(i=0; i<8; i++) | |
| 512 { | |
| 513 int bias= W4*block[i] + (1<<(COL_SHIFT-1)); | |
| 514 int c= block[i + index]; | |
| 515 block[i ]= (c*coeff[index ] + bias) >> COL_SHIFT; | |
| 516 block[i+8 ]= (c*coeff[index+1] + bias) >> COL_SHIFT; | |
| 517 block[i+16]= (c*coeff[index+2] + bias) >> COL_SHIFT; | |
| 518 block[i+24]= (c*coeff[index+3] + bias) >> COL_SHIFT; | |
| 519 block[i+32]= (c*coeff[index+4] + bias) >> COL_SHIFT; | |
| 520 block[i+40]= (c*coeff[index+5] + bias) >> COL_SHIFT; | |
| 521 block[i+48]= (c*coeff[index+6] + bias) >> COL_SHIFT; | |
| 522 block[i+56]= (c*coeff[index+7] + bias) >> COL_SHIFT; | |
| 523 } | |
| 524 } | |
| 525 /* else if(nNonZero==2) | |
| 526 { | |
| 527 int index1= nonZero[0]*8; | |
| 528 int index2= nonZero[1]*8; | |
| 529 for(i=0; i<8; i++) | |
| 530 { | |
| 531 int bias= W4*block[i] + (1<<(COL_SHIFT-1)); | |
| 532 int c1= block[i + index1]; | |
| 533 int c2= block[i + index2]; | |
| 534 block[i ]= (c1*coeff[index1 ] + c2*coeff[index2 ] + bias) >> COL_SHIFT; | |
| 535 block[i+8 ]= (c1*coeff[index1+1] + c2*coeff[index2+1] + bias) >> COL_SHIFT; | |
| 536 block[i+16]= (c1*coeff[index1+2] + c2*coeff[index2+2] + bias) >> COL_SHIFT; | |
| 537 block[i+24]= (c1*coeff[index1+3] + c2*coeff[index2+3] + bias) >> COL_SHIFT; | |
| 538 block[i+32]= (c1*coeff[index1+4] + c2*coeff[index2+4] + bias) >> COL_SHIFT; | |
| 539 block[i+40]= (c1*coeff[index1+5] + c2*coeff[index2+5] + bias) >> COL_SHIFT; | |
| 540 block[i+48]= (c1*coeff[index1+6] + c2*coeff[index2+6] + bias) >> COL_SHIFT; | |
| 541 block[i+56]= (c1*coeff[index1+7] + c2*coeff[index2+7] + bias) >> COL_SHIFT; | |
| 542 } | |
| 543 }*/ | |
| 544 else | |
| 545 { | |
| 546 for(i=0; i<8; i++) | |
| 547 idctSparse2Col(block + i); | |
| 548 } | |
|
214
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
549 #elif defined(ARCH_ALPHA) |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
550 int shortcut = 1; |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
551 |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
552 for (i = 0; i < 8; i++) { |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
553 int anynonzero = idctRowCondDC(block + 8 * i); |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
554 if (i > 0 && anynonzero) |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
555 shortcut = 0; |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
556 } |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
557 |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
558 if (shortcut) { |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
559 idctCol2(block); |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
560 } else { |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
561 for (i = 0; i < 8; i++) |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
562 idctSparseCol(block + i); |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
563 } |
|
73df666cacc7
Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
205
diff
changeset
|
564 #else |
| 205 | 565 for(i=0; i<8; i++) |
| 566 idctRowCondDC(block + i*8); | |
| 567 | |
| 568 for(i=0; i<8; i++) | |
| 569 idctSparseCol(block + i); | |
| 570 #endif | |
|
175
bd77d3cbb233
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff
changeset
|
571 } |
