annotate simple_idct.c @ 254:b4fed8b24e3a libavcodec

gmc bitstream decoding support (the real motion compensation isnt implemnted yet)
author michaelni
date Thu, 07 Mar 2002 13:27:15 +0000
parents 1fe6b64feefb
children 5a8eb5cf9f92
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
49
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
50 /* 8x8 Matrix used to do a trivial (slow) 8 point IDCT */
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
51 static int coeff[64]={
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
52 W4, W4, W4, W4, W4, W4, W4, W4,
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
53 W1, W3, W5, W7,-W7,-W5,-W3,-W1,
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
54 W2, W6,-W6,-W2,-W2,-W6, W6, W2,
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
55 W3,-W7,-W1,-W5, W5, W1, W7,-W3,
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
56 W4,-W4,-W4, W4, W4,-W4,-W4, W4,
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
57 W5,-W1, W7, W3,-W3,-W7, W1,-W5,
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
58 W6,-W2, W2,-W6,-W6, W2,-W2, W6,
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
59 W7,-W5, W3,-W1, W1,-W3, W5,-W7
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
60 };
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
61
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
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
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
66 if( !( ((uint32_t*)row)[0]|((uint32_t*)row)[1] |((uint32_t*)row)[2] |((uint32_t*)row)[3])) {
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
67 /* row[0] = row[1] = row[2] = row[3] = row[4] =
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
68 row[5] = row[6] = row[7] = 0;*/
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
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
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
72 if(!( ((uint32_t*)row)[2] |((uint32_t*)row)[3] )){
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
73 a0 = W4*row[0] + W2*row[2] + (1<<(ROW_SHIFT-1));
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
74 a1 = W4*row[0] + W6*row[2] + (1<<(ROW_SHIFT-1));
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
75 a2 = W4*row[0] - W6*row[2] + (1<<(ROW_SHIFT-1));
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
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
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
78 b0 = W1*row[1] + W3*row[3];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
79 b1 = W3*row[1] - W7*row[3];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
80 b2 = W5*row[1] - W1*row[3];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
81 b3 = W7*row[1] - W5*row[3];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
82 }else{
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
83 a0 = W4*row[0] + W2*row[2] + W4*row[4] + W6*row[6] + (1<<(ROW_SHIFT-1));
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
84 a1 = W4*row[0] + W6*row[2] - W4*row[4] - W2*row[6] + (1<<(ROW_SHIFT-1));
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
85 a2 = W4*row[0] - W6*row[2] - W4*row[4] + W2*row[6] + (1<<(ROW_SHIFT-1));
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
86 a3 = W4*row[0] - W2*row[2] + W4*row[4] - W6*row[6] + (1<<(ROW_SHIFT-1));
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
87
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
88 b0 = W1*row[1] + W3*row[3] + W5*row[5] + W7*row[7];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
89 b1 = W3*row[1] - W7*row[3] - W1*row[5] - W5*row[7];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
90 b2 = W5*row[1] - W1*row[3] + W7*row[5] + W3*row[7];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
91 b3 = W7*row[1] - W5*row[3] + W3*row[5] - W1*row[7];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
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
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
102
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
103 return 1;
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
104 }
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
105
214
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
106 #ifdef ARCH_ALPHA
215
1fe6b64feefb Small simple idct improvement for Alpha by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 214
diff changeset
107 /* 0: all entries 0, 1: only first entry nonzero, 2: otherwise */
214
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
108 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
109 {
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
110 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
111 uint64_t *lrow = (uint64_t *) row;
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
112
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
113 if (lrow[1] == 0) {
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
114 if (lrow[0] == 0)
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
115 return 0;
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
116 if ((lrow[0] & ~0xffffULL) == 0) {
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
117 uint64_t v;
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
118
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
119 a0 = W4 * row[0];
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
120 a0 += 1 << (ROW_SHIFT - 1);
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
121 a0 >>= ROW_SHIFT;
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
122 v = (uint16_t) a0;
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
123 v += v << 16;
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
124 v += v << 32;
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
125 lrow[0] = v;
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
126 lrow[1] = v;
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
127
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
128 return 1;
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
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
132 a0 = W4 * row[0];
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
133 a1 = W4 * row[0];
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
134 a2 = W4 * row[0];
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
135 a3 = W4 * row[0];
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
136
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
137 if (row[2]) {
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
138 a0 += W2 * row[2];
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
139 a1 += W6 * row[2];
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
140 a2 -= W6 * row[2];
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
141 a3 -= W2 * row[2];
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
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
144 if (row[4]) {
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
145 a0 += W4 * row[4];
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
146 a1 -= W4 * row[4];
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
147 a2 -= W4 * row[4];
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
148 a3 += W4 * row[4];
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
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
151 if (row[6]) {
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
152 a0 += W6 * row[6];
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
153 a1 -= W2 * row[6];
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
154 a2 += W2 * row[6];
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
155 a3 -= W6 * row[6];
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
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
158 a0 += 1 << (ROW_SHIFT - 1);
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
159 a1 += 1 << (ROW_SHIFT - 1);
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
160 a2 += 1 << (ROW_SHIFT - 1);
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
161 a3 += 1 << (ROW_SHIFT - 1);
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
162
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
163 if (row[1]) {
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
164 b0 = W1 * row[1];
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
165 b1 = W3 * row[1];
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
166 b2 = W5 * row[1];
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
167 b3 = W7 * row[1];
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
168 } else {
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
169 b0 = 0;
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
170 b1 = 0;
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
171 b2 = 0;
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
172 b3 = 0;
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
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
175 if (row[3]) {
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
176 b0 += W3 * row[3];
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
177 b1 -= W7 * row[3];
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
178 b2 -= W1 * row[3];
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
179 b3 -= W5 * row[3];
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
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
182 if (row[5]) {
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
183 b0 += W5 * row[5];
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
184 b1 -= W1 * row[5];
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
185 b2 += W7 * row[5];
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
186 b3 += W3 * row[5];
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
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
189 if (row[7]) {
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
190 b0 += W7 * row[7];
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
191 b1 -= W5 * row[7];
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
192 b2 += W3 * row[7];
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
193 b3 -= W1 * row[7];
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
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
196 row[0] = (a0 + b0) >> ROW_SHIFT;
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
197 row[1] = (a1 + b1) >> ROW_SHIFT;
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
198 row[2] = (a2 + b2) >> ROW_SHIFT;
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
199 row[3] = (a3 + b3) >> ROW_SHIFT;
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
200 row[4] = (a3 - b3) >> ROW_SHIFT;
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
201 row[5] = (a2 - b2) >> ROW_SHIFT;
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
202 row[6] = (a1 - b1) >> ROW_SHIFT;
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
203 row[7] = (a0 - b0) >> ROW_SHIFT;
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
204
215
1fe6b64feefb Small simple idct improvement for Alpha by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 214
diff changeset
205 return 2;
214
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
206 }
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
207 #else /* not ARCH_ALPHA */
205
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
208 static int inline idctRowCondDC (int16_t * row)
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
209 {
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
210 int a0, a1, a2, a3, b0, b1, b2, b3;
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
211
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
212 if( !( ((uint32_t*)row)[1] |((uint32_t*)row)[2] |((uint32_t*)row)[3]| row[1])) {
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
213 // row[0] = row[1] = row[2] = row[3] = row[4] = row[5] = row[6] = row[7] = row[0]<<3;
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
214 uint16_t temp= row[0]<<3;
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
215 ((uint32_t*)row)[0]=((uint32_t*)row)[1]=
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
216 ((uint32_t*)row)[2]=((uint32_t*)row)[3]= temp + (temp<<16);
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
217 return 0;
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
218 }
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
219
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
220 if(!( ((uint32_t*)row)[2] |((uint32_t*)row)[3] )){
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
221 a0 = W4*row[0] + W2*row[2] + (1<<(ROW_SHIFT-1));
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
222 a1 = W4*row[0] + W6*row[2] + (1<<(ROW_SHIFT-1));
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
223 a2 = W4*row[0] - W6*row[2] + (1<<(ROW_SHIFT-1));
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
224 a3 = W4*row[0] - W2*row[2] + (1<<(ROW_SHIFT-1));
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
225
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
226 b0 = W1*row[1] + W3*row[3];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
227 b1 = W3*row[1] - W7*row[3];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
228 b2 = W5*row[1] - W1*row[3];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
229 b3 = W7*row[1] - W5*row[3];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
230 }else{
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
231 a0 = W4*row[0] + W2*row[2] + W4*row[4] + W6*row[6] + (1<<(ROW_SHIFT-1));
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
232 a1 = W4*row[0] + W6*row[2] - W4*row[4] - W2*row[6] + (1<<(ROW_SHIFT-1));
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
233 a2 = W4*row[0] - W6*row[2] - W4*row[4] + W2*row[6] + (1<<(ROW_SHIFT-1));
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
234 a3 = W4*row[0] - W2*row[2] + W4*row[4] - W6*row[6] + (1<<(ROW_SHIFT-1));
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
235
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
236 b0 = W1*row[1] + W3*row[3] + W5*row[5] + W7*row[7];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
237 b1 = W3*row[1] - W7*row[3] - W1*row[5] - W5*row[7];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
238 b2 = W5*row[1] - W1*row[3] + W7*row[5] + W3*row[7];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
239 b3 = W7*row[1] - W5*row[3] + W3*row[5] - W1*row[7];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
240 }
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
241
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
242 row[0] = (a0 + b0) >> ROW_SHIFT;
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
243 row[7] = (a0 - b0) >> ROW_SHIFT;
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
244 row[1] = (a1 + b1) >> ROW_SHIFT;
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
245 row[6] = (a1 - b1) >> ROW_SHIFT;
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
246 row[2] = (a2 + b2) >> ROW_SHIFT;
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
247 row[5] = (a2 - b2) >> ROW_SHIFT;
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
248 row[3] = (a3 + b3) >> ROW_SHIFT;
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
249 row[4] = (a3 - b3) >> ROW_SHIFT;
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
250
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
251 return 1;
175
bd77d3cbb233 new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff changeset
252 }
214
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
253 #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
254
bd77d3cbb233 new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff changeset
255 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
256 {
205
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
257
175
bd77d3cbb233 new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff changeset
258 /*
bd77d3cbb233 new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff changeset
259 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
260 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
261 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
262 return;
bd77d3cbb233 new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff changeset
263 }*/
205
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
264
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
265 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
266 col[0] += (1<<(COL_SHIFT-1))/W4;
205
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
267 a0 = W4*col[8*0] + W2*col[8*2] + W4*col[8*4] + W6*col[8*6];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
268 a1 = W4*col[8*0] + W6*col[8*2] - W4*col[8*4] - W2*col[8*6];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
269 a2 = W4*col[8*0] - W6*col[8*2] - W4*col[8*4] + W2*col[8*6];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
270 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
271
205
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
272 b0 = W1*col[8*1] + W3*col[8*3] + W5*col[8*5] + W7*col[8*7];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
273 b1 = W3*col[8*1] - W7*col[8*3] - W1*col[8*5] - W5*col[8*7];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
274 b2 = W5*col[8*1] - W1*col[8*3] + W7*col[8*5] + W3*col[8*7];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
275 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
276
bd77d3cbb233 new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff changeset
277 col[8*0] = (a0 + b0) >> COL_SHIFT;
205
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
278 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
279 col[8*1] = (a1 + b1) >> COL_SHIFT;
205
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
280 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
281 col[8*2] = (a2 + b2) >> COL_SHIFT;
205
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
282 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
283 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
284 col[8*4] = (a3 - b3) >> COL_SHIFT;
205
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
285 }
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
286
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
287 static void inline idctSparseCol (int16_t * col)
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
288 {
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
289 int a0, a1, a2, a3, b0, b1, b2, b3;
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
290 col[0] += (1<<(COL_SHIFT-1))/W4;
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
291 a0 = W4*col[8*0];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
292 a1 = W4*col[8*0];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
293 a2 = W4*col[8*0];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
294 a3 = W4*col[8*0];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
295
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
296 if(col[8*2]){
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
297 a0 += + W2*col[8*2];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
298 a1 += + W6*col[8*2];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
299 a2 += - W6*col[8*2];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
300 a3 += - W2*col[8*2];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
301 }
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
302
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
303 if(col[8*4]){
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
304 a0 += + W4*col[8*4];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
305 a1 += - W4*col[8*4];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
306 a2 += - W4*col[8*4];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
307 a3 += + W4*col[8*4];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
308 }
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
309
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
310 if(col[8*6]){
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
311 a0 += + W6*col[8*6];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
312 a1 += - W2*col[8*6];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
313 a2 += + W2*col[8*6];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
314 a3 += - W6*col[8*6];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
315 }
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
316
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
317 if(col[8*1]){
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
318 b0 = W1*col[8*1];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
319 b1 = W3*col[8*1];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
320 b2 = W5*col[8*1];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
321 b3 = W7*col[8*1];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
322 }else{
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
323 b0 =
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
324 b1 =
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
325 b2 =
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
326 b3 = 0;
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
327 }
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
328
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
329 if(col[8*3]){
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
330 b0 += + W3*col[8*3];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
331 b1 += - W7*col[8*3];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
332 b2 += - W1*col[8*3];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
333 b3 += - W5*col[8*3];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
334 }
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
335
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
336 if(col[8*5]){
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
337 b0 += + W5*col[8*5];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
338 b1 += - W1*col[8*5];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
339 b2 += + W7*col[8*5];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
340 b3 += + W3*col[8*5];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
341 }
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
342
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
343 if(col[8*7]){
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
344 b0 += + W7*col[8*7];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
345 b1 += - W5*col[8*7];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
346 b2 += + W3*col[8*7];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
347 b3 += - W1*col[8*7];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
348 }
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
349
214
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
350 #ifndef ARCH_ALPHA
205
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
351 if(!(b0|b1|b2|b3)){
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
352 col[8*0] = (a0) >> COL_SHIFT;
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
353 col[8*7] = (a0) >> COL_SHIFT;
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
354 col[8*1] = (a1) >> COL_SHIFT;
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
355 col[8*6] = (a1) >> COL_SHIFT;
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
356 col[8*2] = (a2) >> COL_SHIFT;
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
357 col[8*5] = (a2) >> COL_SHIFT;
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
358 col[8*3] = (a3) >> COL_SHIFT;
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
359 col[8*4] = (a3) >> COL_SHIFT;
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
360 }else{
214
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
361 #endif
205
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
362 col[8*0] = (a0 + b0) >> COL_SHIFT;
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
363 col[8*7] = (a0 - b0) >> COL_SHIFT;
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
364 col[8*1] = (a1 + b1) >> COL_SHIFT;
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
365 col[8*6] = (a1 - b1) >> COL_SHIFT;
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
366 col[8*2] = (a2 + b2) >> COL_SHIFT;
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
367 col[8*5] = (a2 - b2) >> COL_SHIFT;
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
368 col[8*3] = (a3 + b3) >> COL_SHIFT;
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
369 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
370 #ifndef ARCH_ALPHA
205
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
371 }
214
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
372 #endif
205
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
373 }
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
374
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
375 static void inline idctSparse2Col (int16_t * col)
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
376 {
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
377 int a0, a1, a2, a3, b0, b1, b2, b3;
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
378 col[0] += (1<<(COL_SHIFT-1))/W4;
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
379 a0 = W4*col[8*0];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
380 a1 = W4*col[8*0];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
381 a2 = W4*col[8*0];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
382 a3 = W4*col[8*0];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
383
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
384 if(col[8*2]){
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
385 a0 += + W2*col[8*2];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
386 a1 += + W6*col[8*2];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
387 a2 += - W6*col[8*2];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
388 a3 += - W2*col[8*2];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
389 }
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
390
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
391 if(col[8*4]){
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
392 a0 += + W4*col[8*4];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
393 a1 += - W4*col[8*4];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
394 a2 += - W4*col[8*4];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
395 a3 += + W4*col[8*4];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
396 }
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
397
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
398 if(col[8*6]){
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
399 a0 += + W6*col[8*6];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
400 a1 += - W2*col[8*6];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
401 a2 += + W2*col[8*6];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
402 a3 += - W6*col[8*6];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
403 }
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
404
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
405 if(col[8*1] || 1){
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
406 b0 = W1*col[8*1];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
407 b1 = W3*col[8*1];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
408 b2 = W5*col[8*1];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
409 b3 = W7*col[8*1];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
410 }else{
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
411 b0 =
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
412 b1 =
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
413 b2 =
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
414 b3 = 0;
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
415 }
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
416
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
417 if(col[8*3]){
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
418 b0 += + W3*col[8*3];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
419 b1 += - W7*col[8*3];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
420 b2 += - W1*col[8*3];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
421 b3 += - W5*col[8*3];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
422 }
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
423
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
424 if(col[8*5]){
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
425 b0 += + W5*col[8*5];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
426 b1 += - W1*col[8*5];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
427 b2 += + W7*col[8*5];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
428 b3 += + W3*col[8*5];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
429 }
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
430
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
431 if(col[8*7]){
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
432 b0 += + W7*col[8*7];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
433 b1 += - W5*col[8*7];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
434 b2 += + W3*col[8*7];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
435 b3 += - W1*col[8*7];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
436 }
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
437
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
438 col[8*0] = (a0 + b0) >> COL_SHIFT;
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
439 col[8*7] = (a0 - b0) >> COL_SHIFT;
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
440 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
441 col[8*6] = (a1 - b1) >> COL_SHIFT;
205
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
442 col[8*2] = (a2 + b2) >> COL_SHIFT;
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
443 col[8*5] = (a2 - b2) >> COL_SHIFT;
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
444 col[8*3] = (a3 + b3) >> COL_SHIFT;
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
445 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
446 }
bd77d3cbb233 new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff changeset
447
214
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
448 #ifdef ARCH_ALPHA
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
449 /* 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
450 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
451 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
452 {
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
453 int i;
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
454 uint64_t l, r;
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
455 uint64_t *lcol = (uint64_t *) col;
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
456
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
457 for (i = 0; i < 8; ++i) {
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
458 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
459
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
460 a0 *= W4;
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
461 col[0] = a0 >> COL_SHIFT;
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
462 ++col;
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
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
465 l = lcol[0];
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
466 r = lcol[1];
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
467 lcol[ 2] = l; lcol[ 3] = r;
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
468 lcol[ 4] = l; lcol[ 5] = r;
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
469 lcol[ 6] = l; lcol[ 7] = r;
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
470 lcol[ 8] = l; lcol[ 9] = r;
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
471 lcol[10] = l; lcol[11] = r;
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
472 lcol[12] = l; lcol[13] = r;
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
473 lcol[14] = l; lcol[15] = r;
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
474 }
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
475 #endif
205
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
476
175
bd77d3cbb233 new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff changeset
477 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
478 {
205
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
479
175
bd77d3cbb233 new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff changeset
480 int i;
205
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
481
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
482 #if 0
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
483 int nonZero[8];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
484 int buffer[64];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
485 int nNonZero=0;
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
486
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
487 idctRowCondDC(block);
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
488
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
489 for(i=1; i<8; i++)
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
490 {
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
491 nonZero[nNonZero]=i;
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
492 nNonZero+= idctRowCondZ(block + i*8);
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
493 }
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
494
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
495 if(nNonZero==0)
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
496 {
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
497 for(i=0; i<8; i++)
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
498 {
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
499 block[i ]=
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
500 block[i+8 ]=
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
501 block[i+16]=
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
502 block[i+24]=
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
503 block[i+32]=
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
504 block[i+40]=
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
505 block[i+48]=
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
506 block[i+56]= (W4*block[i] + (1<<(COL_SHIFT-1))) >> COL_SHIFT;
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
507 }
175
bd77d3cbb233 new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff changeset
508 }
205
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
509 else if(nNonZero==1)
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
510 {
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
511 int index= nonZero[0]*8;
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
512 for(i=0; i<8; i++)
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
513 {
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
514 int bias= W4*block[i] + (1<<(COL_SHIFT-1));
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
515 int c= block[i + index];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
516 block[i ]= (c*coeff[index ] + bias) >> COL_SHIFT;
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
517 block[i+8 ]= (c*coeff[index+1] + bias) >> COL_SHIFT;
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
518 block[i+16]= (c*coeff[index+2] + bias) >> COL_SHIFT;
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
519 block[i+24]= (c*coeff[index+3] + bias) >> COL_SHIFT;
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
520 block[i+32]= (c*coeff[index+4] + bias) >> COL_SHIFT;
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
521 block[i+40]= (c*coeff[index+5] + bias) >> COL_SHIFT;
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
522 block[i+48]= (c*coeff[index+6] + bias) >> COL_SHIFT;
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
523 block[i+56]= (c*coeff[index+7] + bias) >> COL_SHIFT;
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
524 }
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
525 }
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
526 /* else if(nNonZero==2)
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
527 {
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
528 int index1= nonZero[0]*8;
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
529 int index2= nonZero[1]*8;
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
530 for(i=0; i<8; i++)
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
531 {
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
532 int bias= W4*block[i] + (1<<(COL_SHIFT-1));
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
533 int c1= block[i + index1];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
534 int c2= block[i + index2];
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
535 block[i ]= (c1*coeff[index1 ] + c2*coeff[index2 ] + bias) >> COL_SHIFT;
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
536 block[i+8 ]= (c1*coeff[index1+1] + c2*coeff[index2+1] + bias) >> COL_SHIFT;
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
537 block[i+16]= (c1*coeff[index1+2] + c2*coeff[index2+2] + bias) >> COL_SHIFT;
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
538 block[i+24]= (c1*coeff[index1+3] + c2*coeff[index2+3] + bias) >> COL_SHIFT;
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
539 block[i+32]= (c1*coeff[index1+4] + c2*coeff[index2+4] + bias) >> COL_SHIFT;
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
540 block[i+40]= (c1*coeff[index1+5] + c2*coeff[index2+5] + bias) >> COL_SHIFT;
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
541 block[i+48]= (c1*coeff[index1+6] + c2*coeff[index2+6] + bias) >> COL_SHIFT;
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
542 block[i+56]= (c1*coeff[index1+7] + c2*coeff[index2+7] + bias) >> COL_SHIFT;
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
543 }
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
544 }*/
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
545 else
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
546 {
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
547 for(i=0; i<8; i++)
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
548 idctSparse2Col(block + i);
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
549 }
214
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
550 #elif defined(ARCH_ALPHA)
215
1fe6b64feefb Small simple idct improvement for Alpha by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 214
diff changeset
551 int rowsZero = 1; /* all rows except row 0 zero */
1fe6b64feefb Small simple idct improvement for Alpha by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 214
diff changeset
552 int rowsConstant = 1; /* all rows consist of a constant value */
214
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
553
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
554 for (i = 0; i < 8; i++) {
215
1fe6b64feefb Small simple idct improvement for Alpha by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 214
diff changeset
555 int sparseness = idctRowCondDC(block + 8 * i);
1fe6b64feefb Small simple idct improvement for Alpha by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 214
diff changeset
556
1fe6b64feefb Small simple idct improvement for Alpha by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 214
diff changeset
557 if (i > 0 && sparseness > 0)
1fe6b64feefb Small simple idct improvement for Alpha by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 214
diff changeset
558 rowsZero = 0;
1fe6b64feefb Small simple idct improvement for Alpha by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 214
diff changeset
559 if (sparseness == 2)
1fe6b64feefb Small simple idct improvement for Alpha by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 214
diff changeset
560 rowsConstant = 0;
214
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
561 }
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
562
215
1fe6b64feefb Small simple idct improvement for Alpha by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 214
diff changeset
563 if (rowsZero) {
1fe6b64feefb Small simple idct improvement for Alpha by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 214
diff changeset
564 idctCol2(block);
1fe6b64feefb Small simple idct improvement for Alpha by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 214
diff changeset
565 } else if (rowsConstant) {
1fe6b64feefb Small simple idct improvement for Alpha by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 214
diff changeset
566 uint64_t *lblock = (uint64_t *) block;
1fe6b64feefb Small simple idct improvement for Alpha by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 214
diff changeset
567
1fe6b64feefb Small simple idct improvement for Alpha by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 214
diff changeset
568 idctSparseCol(block);
1fe6b64feefb Small simple idct improvement for Alpha by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 214
diff changeset
569 for (i = 0; i < 8; i++) {
1fe6b64feefb Small simple idct improvement for Alpha by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 214
diff changeset
570 uint64_t v = (uint16_t) block[i * 8];
1fe6b64feefb Small simple idct improvement for Alpha by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 214
diff changeset
571
1fe6b64feefb Small simple idct improvement for Alpha by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 214
diff changeset
572 v += v << 16;
1fe6b64feefb Small simple idct improvement for Alpha by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 214
diff changeset
573 v += v << 32;
1fe6b64feefb Small simple idct improvement for Alpha by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 214
diff changeset
574 lblock[0] = v;
1fe6b64feefb Small simple idct improvement for Alpha by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 214
diff changeset
575 lblock[1] = v;
1fe6b64feefb Small simple idct improvement for Alpha by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 214
diff changeset
576 lblock += 2;
1fe6b64feefb Small simple idct improvement for Alpha by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 214
diff changeset
577 }
214
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
578 } else {
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
579 for (i = 0; i < 8; i++)
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
580 idctSparseCol(block + i);
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
581 }
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents: 205
diff changeset
582 #else
205
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
583 for(i=0; i<8; i++)
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
584 idctRowCondDC(block + i*8);
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
585
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
586 for(i=0; i<8; i++)
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
587 idctSparseCol(block + i);
ccf36af385f3 (commit by michael)
arpi_esp
parents: 175
diff changeset
588 #endif
175
bd77d3cbb233 new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
diff changeset
589 }