Statistics
| Branch: | Revision:

ffmpeg / libavcodec / simple_idct.c @ bc45bca3

History | View | Annotate | Download (14.3 KB)

1
/*
2
 * Simple IDCT
3
 *
4
 * Copyright (c) 2001 Michael Niedermayer <michaelni@gmx.at>
5
 *
6
 * This library is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU Lesser General Public
8
 * License as published by the Free Software Foundation; either
9
 * version 2 of the License, or (at your option) any later version.
10
 *
11
 * This library is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
 * Lesser General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU Lesser General Public
17
 * License along with this library; if not, write to the Free Software
18
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
 */
20
/*
21
  based upon some outcommented c code from mpeg2dec (idct_mmx.c
22
  written by Aaron Holtzman <aholtzma@ess.engr.uvic.ca>) 
23
 */
24
#include "avcodec.h"
25

    
26
#include "simple_idct.h"
27

    
28
#if 0
29
#define W1 2841 /* 2048*sqrt (2)*cos (1*pi/16) */
30
#define W2 2676 /* 2048*sqrt (2)*cos (2*pi/16) */
31
#define W3 2408 /* 2048*sqrt (2)*cos (3*pi/16) */
32
#define W4 2048 /* 2048*sqrt (2)*cos (4*pi/16) */
33
#define W5 1609 /* 2048*sqrt (2)*cos (5*pi/16) */
34
#define W6 1108 /* 2048*sqrt (2)*cos (6*pi/16) */
35
#define W7 565  /* 2048*sqrt (2)*cos (7*pi/16) */
36
#define ROW_SHIFT 8
37
#define COL_SHIFT 17
38
#else
39
#define W1  22725  //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
40
#define W2  21407  //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
41
#define W3  19266  //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
42
#define W4  16383  //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
43
#define W5  12873  //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
44
#define W6  8867   //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
45
#define W7  4520   //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
46
#define ROW_SHIFT 11
47
#define COL_SHIFT 20 // 6
48
#endif
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 inline int idctRowCondZ (int16_t * row)
63
{
64
        int a0, a1, a2, a3, b0, b1, b2, b3;
65

    
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;
70
        }
71

    
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));
77

    
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
        }
93

    
94
        row[0] = (a0 + b0) >> ROW_SHIFT;
95
        row[1] = (a1 + b1) >> ROW_SHIFT;
96
        row[2] = (a2 + b2) >> ROW_SHIFT;
97
        row[3] = (a3 + b3) >> ROW_SHIFT;
98
        row[4] = (a3 - b3) >> ROW_SHIFT;
99
        row[5] = (a2 - b2) >> ROW_SHIFT;
100
        row[6] = (a1 - b1) >> ROW_SHIFT;
101
        row[7] = (a0 - b0) >> ROW_SHIFT;
102
        
103
        return 1;
104
}
105

    
106
#ifdef ARCH_ALPHA
107
/* 0: all entries 0, 1: only first entry nonzero, 2: otherwise  */
108
static inline int idctRowCondDC(int16_t *row)
109
{
110
        int_fast32_t a0, a1, a2, a3, b0, b1, b2, b3;
111
        uint64_t *lrow = (uint64_t *) row;
112

    
113
        if (lrow[1] == 0) {
114
                if (lrow[0] == 0)
115
                        return 0;
116
                if ((lrow[0] & ~0xffffULL) == 0) {
117
                        uint64_t v;
118

    
119
                        a0 = W4 * row[0];
120
                        a0 += 1 << (ROW_SHIFT - 1);
121
                        a0 >>= ROW_SHIFT;
122
                        v = (uint16_t) a0;
123
                        v += v << 16;
124
                        v += v << 32;
125
                        lrow[0] = v;
126
                        lrow[1] = v;
127

    
128
                        return 1;
129
                }
130
        }
131

    
132
        a0 = W4 * row[0];
133
        a1 = W4 * row[0];
134
        a2 = W4 * row[0];
135
        a3 = W4 * row[0];
136

    
137
        if (row[2]) {
138
                a0 += W2 * row[2];
139
                a1 += W6 * row[2];
140
                a2 -= W6 * row[2];
141
                a3 -= W2 * row[2];
142
        }
143

    
144
        if (row[4]) {
145
                a0 += W4 * row[4];
146
                a1 -= W4 * row[4];
147
                a2 -= W4 * row[4];
148
                a3 += W4 * row[4];
149
        }
150

    
151
        if (row[6]) {
152
                a0 += W6 * row[6];
153
                a1 -= W2 * row[6];
154
                a2 += W2 * row[6];
155
                a3 -= W6 * row[6];
156
        }
157

    
158
        a0 += 1 << (ROW_SHIFT - 1);
159
        a1 += 1 << (ROW_SHIFT - 1);
160
        a2 += 1 << (ROW_SHIFT - 1);
161
        a3 += 1 << (ROW_SHIFT - 1);
162

    
163
        if (row[1]) {
164
                b0 = W1 * row[1];
165
                b1 = W3 * row[1];
166
                b2 = W5 * row[1];
167
                b3 = W7 * row[1];
168
        } else {
169
                b0 = 0;
170
                b1 = 0;
171
                b2 = 0;
172
                b3 = 0;
173
        }
174

    
175
        if (row[3]) {
176
                b0 += W3 * row[3];
177
                b1 -= W7 * row[3];
178
                b2 -= W1 * row[3];
179
                b3 -= W5 * row[3];
180
        }
181

    
182
        if (row[5]) {
183
                b0 += W5 * row[5];
184
                b1 -= W1 * row[5];
185
                b2 += W7 * row[5];
186
                b3 += W3 * row[5];
187
        }
188

    
189
        if (row[7]) {
190
                b0 += W7 * row[7];
191
                b1 -= W5 * row[7];
192
                b2 += W3 * row[7];
193
                b3 -= W1 * row[7];
194
        }
195

    
196
        row[0] = (a0 + b0) >> ROW_SHIFT;
197
        row[1] = (a1 + b1) >> ROW_SHIFT;
198
        row[2] = (a2 + b2) >> ROW_SHIFT;
199
        row[3] = (a3 + b3) >> ROW_SHIFT;
200
        row[4] = (a3 - b3) >> ROW_SHIFT;
201
        row[5] = (a2 - b2) >> ROW_SHIFT;
202
        row[6] = (a1 - b1) >> ROW_SHIFT;
203
        row[7] = (a0 - b0) >> ROW_SHIFT;
204

    
205
        return 2;
206
}
207
#else  /* not ARCH_ALPHA */
208
static inline int idctRowCondDC (int16_t * row)
209
{
210
        int a0, a1, a2, a3, b0, b1, b2, b3;
211

    
212
        if( !( ((uint32_t*)row)[1] |((uint32_t*)row)[2] |((uint32_t*)row)[3]| row[1])) {
213
//                row[0] = row[1] = row[2] = row[3] = row[4] = row[5] = row[6] = row[7] = row[0]<<3;
214
                uint16_t temp= row[0]<<3;
215
                ((uint32_t*)row)[0]=((uint32_t*)row)[1]=
216
                ((uint32_t*)row)[2]=((uint32_t*)row)[3]= temp + (temp<<16);
217
                return 0;
218
        }
219

    
220
        if(!( ((uint32_t*)row)[2] |((uint32_t*)row)[3] )){
221
                a0 = W4*row[0] + W2*row[2] + (1<<(ROW_SHIFT-1));
222
                a1 = W4*row[0] + W6*row[2] + (1<<(ROW_SHIFT-1));
223
                a2 = W4*row[0] - W6*row[2] + (1<<(ROW_SHIFT-1));
224
                a3 = W4*row[0] - W2*row[2] + (1<<(ROW_SHIFT-1));
225

    
226
                b0 = W1*row[1] + W3*row[3];
227
                b1 = W3*row[1] - W7*row[3];
228
                b2 = W5*row[1] - W1*row[3];
229
                b3 = W7*row[1] - W5*row[3];
230
        }else{
231
                a0 = W4*row[0] + W2*row[2] + W4*row[4] + W6*row[6] + (1<<(ROW_SHIFT-1));
232
                a1 = W4*row[0] + W6*row[2] - W4*row[4] - W2*row[6] + (1<<(ROW_SHIFT-1));
233
                a2 = W4*row[0] - W6*row[2] - W4*row[4] + W2*row[6] + (1<<(ROW_SHIFT-1));
234
                a3 = W4*row[0] - W2*row[2] + W4*row[4] - W6*row[6] + (1<<(ROW_SHIFT-1));
235

    
236
                b0 = W1*row[1] + W3*row[3] + W5*row[5] + W7*row[7];
237
                b1 = W3*row[1] - W7*row[3] - W1*row[5] - W5*row[7];
238
                b2 = W5*row[1] - W1*row[3] + W7*row[5] + W3*row[7];
239
                b3 = W7*row[1] - W5*row[3] + W3*row[5] - W1*row[7];
240
        }
241

    
242
        row[0] = (a0 + b0) >> ROW_SHIFT;
243
        row[7] = (a0 - b0) >> ROW_SHIFT;
244
        row[1] = (a1 + b1) >> ROW_SHIFT;
245
        row[6] = (a1 - b1) >> ROW_SHIFT;
246
        row[2] = (a2 + b2) >> ROW_SHIFT;
247
        row[5] = (a2 - b2) >> ROW_SHIFT;
248
        row[3] = (a3 + b3) >> ROW_SHIFT;
249
        row[4] = (a3 - b3) >> ROW_SHIFT;
250
        
251
        return 1;
252
}
253
#endif /* not ARCH_ALPHA */
254

    
255
static inline void idctCol (int16_t * col)
256
{
257

    
258
/*
259
        if( !(col[8*1] | col[8*2] |col[8*3] |col[8*4] |col[8*5] |col[8*6] | col[8*7])) {
260
                col[8*0] = col[8*1] = col[8*2] = col[8*3] = col[8*4] =
261
                        col[8*5] = col[8*6] = col[8*7] = col[8*0]<<3;
262
                return;
263
        }*/
264

    
265
        int a0, a1, a2, a3, b0, b1, b2, b3;
266
        col[0] += (1<<(COL_SHIFT-1))/W4;
267
        a0 = W4*col[8*0] + W2*col[8*2] + W4*col[8*4] + W6*col[8*6];
268
        a1 = W4*col[8*0] + W6*col[8*2] - W4*col[8*4] - W2*col[8*6];
269
        a2 = W4*col[8*0] - W6*col[8*2] - W4*col[8*4] + W2*col[8*6];
270
        a3 = W4*col[8*0] - W2*col[8*2] + W4*col[8*4] - W6*col[8*6];
271

    
272
        b0 = W1*col[8*1] + W3*col[8*3] + W5*col[8*5] + W7*col[8*7];
273
        b1 = W3*col[8*1] - W7*col[8*3] - W1*col[8*5] - W5*col[8*7];
274
        b2 = W5*col[8*1] - W1*col[8*3] + W7*col[8*5] + W3*col[8*7];
275
        b3 = W7*col[8*1] - W5*col[8*3] + W3*col[8*5] - W1*col[8*7];
276

    
277
        col[8*0] = (a0 + b0) >> COL_SHIFT;
278
        col[8*7] = (a0 - b0) >> COL_SHIFT;
279
        col[8*1] = (a1 + b1) >> COL_SHIFT;
280
        col[8*6] = (a1 - b1) >> COL_SHIFT;
281
        col[8*2] = (a2 + b2) >> COL_SHIFT;
282
        col[8*5] = (a2 - b2) >> COL_SHIFT;
283
        col[8*3] = (a3 + b3) >> COL_SHIFT;
284
        col[8*4] = (a3 - b3) >> COL_SHIFT;
285
}
286

    
287
static inline void idctSparseCol (int16_t * col)
288
{
289
        int a0, a1, a2, a3, b0, b1, b2, b3;
290
        col[0] += (1<<(COL_SHIFT-1))/W4;
291
        a0 = W4*col[8*0];
292
        a1 = W4*col[8*0];
293
        a2 = W4*col[8*0];
294
        a3 = W4*col[8*0];
295

    
296
        if(col[8*2]){
297
                a0 +=  + W2*col[8*2];
298
                a1 +=  + W6*col[8*2];
299
                a2 +=  - W6*col[8*2];
300
                a3 +=  - W2*col[8*2];
301
        }
302

    
303
        if(col[8*4]){
304
                a0 += + W4*col[8*4];
305
                a1 += - W4*col[8*4];
306
                a2 += - W4*col[8*4];
307
                a3 += + W4*col[8*4];
308
        }
309

    
310
        if(col[8*6]){
311
                a0 += + W6*col[8*6];
312
                a1 += - W2*col[8*6];
313
                a2 += + W2*col[8*6];
314
                a3 += - W6*col[8*6];
315
        }
316

    
317
        if(col[8*1]){
318
                b0 = W1*col[8*1];
319
                b1 = W3*col[8*1];
320
                b2 = W5*col[8*1];
321
                b3 = W7*col[8*1];
322
        }else{
323
                b0 = 
324
                b1 = 
325
                b2 = 
326
                b3 = 0;
327
        }
328

    
329
        if(col[8*3]){
330
                b0 += + W3*col[8*3];
331
                b1 += - W7*col[8*3];
332
                b2 += - W1*col[8*3];
333
                b3 += - W5*col[8*3];
334
        }
335

    
336
        if(col[8*5]){
337
                b0 += + W5*col[8*5];
338
                b1 += - W1*col[8*5];
339
                b2 += + W7*col[8*5];
340
                b3 += + W3*col[8*5];
341
        }
342

    
343
        if(col[8*7]){
344
                b0 += + W7*col[8*7];
345
                b1 += - W5*col[8*7];
346
                b2 += + W3*col[8*7];
347
                b3 += - W1*col[8*7];
348
        }
349

    
350
#ifndef ARCH_ALPHA
351
        if(!(b0|b1|b2|b3)){
352
                col[8*0] = (a0) >> COL_SHIFT;
353
                col[8*7] = (a0) >> COL_SHIFT;
354
                col[8*1] = (a1) >> COL_SHIFT;
355
                col[8*6] = (a1) >> COL_SHIFT;
356
                col[8*2] = (a2) >> COL_SHIFT;
357
                col[8*5] = (a2) >> COL_SHIFT;
358
                col[8*3] = (a3) >> COL_SHIFT;
359
                col[8*4] = (a3) >> COL_SHIFT;
360
        }else{
361
#endif
362
                col[8*0] = (a0 + b0) >> COL_SHIFT;
363
                col[8*7] = (a0 - b0) >> COL_SHIFT;
364
                col[8*1] = (a1 + b1) >> COL_SHIFT;
365
                col[8*6] = (a1 - b1) >> COL_SHIFT;
366
                col[8*2] = (a2 + b2) >> COL_SHIFT;
367
                col[8*5] = (a2 - b2) >> COL_SHIFT;
368
                col[8*3] = (a3 + b3) >> COL_SHIFT;
369
                col[8*4] = (a3 - b3) >> COL_SHIFT;
370
#ifndef ARCH_ALPHA
371
        }
372
#endif
373
}
374

    
375
static inline void idctSparse2Col (int16_t * col)
376
{
377
        int a0, a1, a2, a3, b0, b1, b2, b3;
378
        col[0] += (1<<(COL_SHIFT-1))/W4;
379
        a0 = W4*col[8*0];
380
        a1 = W4*col[8*0];
381
        a2 = W4*col[8*0];
382
        a3 = W4*col[8*0];
383

    
384
        if(col[8*2]){
385
                a0 +=  + W2*col[8*2];
386
                a1 +=  + W6*col[8*2];
387
                a2 +=  - W6*col[8*2];
388
                a3 +=  - W2*col[8*2];
389
        }
390

    
391
        if(col[8*4]){
392
                a0 += + W4*col[8*4];
393
                a1 += - W4*col[8*4];
394
                a2 += - W4*col[8*4];
395
                a3 += + W4*col[8*4];
396
        }
397

    
398
        if(col[8*6]){
399
                a0 += + W6*col[8*6];
400
                a1 += - W2*col[8*6];
401
                a2 += + W2*col[8*6];
402
                a3 += - W6*col[8*6];
403
        }
404

    
405
        if(col[8*1] || 1){
406
                b0 = W1*col[8*1];
407
                b1 = W3*col[8*1];
408
                b2 = W5*col[8*1];
409
                b3 = W7*col[8*1];
410
        }else{
411
                b0 = 
412
                b1 = 
413
                b2 = 
414
                b3 = 0;
415
        }
416

    
417
        if(col[8*3]){
418
                b0 += + W3*col[8*3];
419
                b1 += - W7*col[8*3];
420
                b2 += - W1*col[8*3];
421
                b3 += - W5*col[8*3];
422
        }
423

    
424
        if(col[8*5]){
425
                b0 += + W5*col[8*5];
426
                b1 += - W1*col[8*5];
427
                b2 += + W7*col[8*5];
428
                b3 += + W3*col[8*5];
429
        }
430

    
431
        if(col[8*7]){
432
                b0 += + W7*col[8*7];
433
                b1 += - W5*col[8*7];
434
                b2 += + W3*col[8*7];
435
                b3 += - W1*col[8*7];
436
        }
437

    
438
        col[8*0] = (a0 + b0) >> COL_SHIFT;
439
        col[8*7] = (a0 - b0) >> COL_SHIFT;
440
        col[8*1] = (a1 + b1) >> COL_SHIFT;
441
        col[8*6] = (a1 - b1) >> COL_SHIFT;
442
        col[8*2] = (a2 + b2) >> COL_SHIFT;
443
        col[8*5] = (a2 - b2) >> COL_SHIFT;
444
        col[8*3] = (a3 + b3) >> COL_SHIFT;
445
        col[8*4] = (a3 - b3) >> COL_SHIFT;
446
}
447

    
448
#ifdef ARCH_ALPHA
449
/* If all rows but the first one are zero after row transformation,
450
   all rows will be identical after column transformation.  */
451
static inline void idctCol2(int16_t *col)
452
{
453
        int i;
454
        uint64_t l, r;
455
        uint64_t *lcol = (uint64_t *) col;
456

    
457
        for (i = 0; i < 8; ++i) {
458
                int a0 = col[0] + (1 << (COL_SHIFT - 1)) / W4;
459

    
460
                a0 *= W4;
461
                col[0] = a0 >> COL_SHIFT;
462
                ++col;
463
        }
464

    
465
        l = lcol[0];
466
        r = lcol[1];
467
        lcol[ 2] = l; lcol[ 3] = r;
468
        lcol[ 4] = l; lcol[ 5] = r;
469
        lcol[ 6] = l; lcol[ 7] = r;
470
        lcol[ 8] = l; lcol[ 9] = r;
471
        lcol[10] = l; lcol[11] = r;
472
        lcol[12] = l; lcol[13] = r;
473
        lcol[14] = l; lcol[15] = r;
474
}
475
#endif
476

    
477
void simple_idct (short *block)
478
{
479

    
480
        int i;
481
        
482
#if 0
483
        int nonZero[8];
484
        int buffer[64];
485
        int nNonZero=0;
486
        
487
        idctRowCondDC(block);
488
        
489
        for(i=1; i<8; i++)
490
        {
491
                nonZero[nNonZero]=i;
492
                nNonZero+= idctRowCondZ(block + i*8);
493
        }
494
        
495
        if(nNonZero==0)
496
        {
497
                for(i=0; i<8; i++)
498
                {
499
                        block[i   ]=
500
                        block[i+8 ]=
501
                        block[i+16]=
502
                        block[i+24]=
503
                        block[i+32]=
504
                        block[i+40]=
505
                        block[i+48]=
506
                        block[i+56]= (W4*block[i] + (1<<(COL_SHIFT-1))) >> COL_SHIFT;
507
                }        
508
        }
509
        else if(nNonZero==1)
510
        {
511
                int index= nonZero[0]*8;
512
                for(i=0; i<8; i++)
513
                {
514
                        int bias= W4*block[i] + (1<<(COL_SHIFT-1));
515
                        int c= block[i + index];
516
                        block[i   ]= (c*coeff[index  ] + bias) >> COL_SHIFT;
517
                        block[i+8 ]= (c*coeff[index+1] + bias) >> COL_SHIFT;
518
                        block[i+16]= (c*coeff[index+2] + bias) >> COL_SHIFT;
519
                        block[i+24]= (c*coeff[index+3] + bias) >> COL_SHIFT;
520
                        block[i+32]= (c*coeff[index+4] + bias) >> COL_SHIFT;
521
                        block[i+40]= (c*coeff[index+5] + bias) >> COL_SHIFT;
522
                        block[i+48]= (c*coeff[index+6] + bias) >> COL_SHIFT;
523
                        block[i+56]= (c*coeff[index+7] + bias) >> COL_SHIFT;
524
                }        
525
        }
526
/*        else if(nNonZero==2)
527
        {
528
                int index1= nonZero[0]*8;
529
                int index2= nonZero[1]*8;
530
                for(i=0; i<8; i++)
531
                {
532
                        int bias= W4*block[i] + (1<<(COL_SHIFT-1));
533
                        int c1= block[i + index1];
534
                        int c2= block[i + index2];
535
                        block[i   ]= (c1*coeff[index1  ] + c2*coeff[index2  ] + bias) >> COL_SHIFT;
536
                        block[i+8 ]= (c1*coeff[index1+1] + c2*coeff[index2+1] + bias) >> COL_SHIFT;
537
                        block[i+16]= (c1*coeff[index1+2] + c2*coeff[index2+2] + bias) >> COL_SHIFT;
538
                        block[i+24]= (c1*coeff[index1+3] + c2*coeff[index2+3] + bias) >> COL_SHIFT;
539
                        block[i+32]= (c1*coeff[index1+4] + c2*coeff[index2+4] + bias) >> COL_SHIFT;
540
                        block[i+40]= (c1*coeff[index1+5] + c2*coeff[index2+5] + bias) >> COL_SHIFT;
541
                        block[i+48]= (c1*coeff[index1+6] + c2*coeff[index2+6] + bias) >> COL_SHIFT;
542
                        block[i+56]= (c1*coeff[index1+7] + c2*coeff[index2+7] + bias) >> COL_SHIFT;
543
                }        
544
        }*/
545
        else
546
        {
547
                for(i=0; i<8; i++)
548
                        idctSparse2Col(block + i);
549
        }
550
#elif defined(ARCH_ALPHA)
551
        int rowsZero = 1;       /* all rows except row 0 zero */
552
        int rowsConstant = 1;        /* all rows consist of a constant value */
553

    
554
        for (i = 0; i < 8; i++) {
555
                int sparseness = idctRowCondDC(block + 8 * i);
556

    
557
                if (i > 0 && sparseness > 0)
558
                        rowsZero = 0;
559
                if (sparseness == 2)
560
                        rowsConstant = 0;
561
        }
562

    
563
        if (rowsZero) {
564
                idctCol2(block);
565
        } else if (rowsConstant) {
566
                uint64_t *lblock = (uint64_t *) block;
567

    
568
                idctSparseCol(block);
569
                for (i = 0; i < 8; i++) {
570
                        uint64_t v = (uint16_t) block[i * 8];
571

    
572
                        v += v << 16;
573
                        v += v << 32;
574
                        lblock[0] = v;
575
                        lblock[1] = v;
576
                        lblock += 2;
577
                }
578
        } else {
579
                for (i = 0; i < 8; i++)
580
                        idctSparseCol(block + i);
581
        }
582
#else
583
        for(i=0; i<8; i++)
584
                idctRowCondDC(block + i*8);
585
        
586
        for(i=0; i<8; i++)
587
                idctSparseCol(block + i);
588
#endif
589
}
590

    
591
#undef COL_SHIFT