* modules/*: sanitization of the modules description strings.
[vlc.git] / modules / codec / mpeg_video / idct / idct.c
1 /*****************************************************************************
2  * idct.c : C IDCT module
3  *****************************************************************************
4  * Copyright (C) 1999-2001 VideoLAN
5  * $Id: idct.c,v 1.3 2003/03/30 18:14:36 gbazin Exp $
6  *
7  * Author: GaĆ«l Hendryckx <jimmy@via.ecp.fr>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  * 
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
22  *****************************************************************************/
23
24 /*****************************************************************************
25  * Preamble
26  *****************************************************************************/
27 #include <stdlib.h>
28 #include <string.h>
29
30 #include <vlc/vlc.h>
31
32 #include "idct.h"
33 #include "block_c.h"
34
35 static int Open( vlc_object_t *p_this );
36
37 /*****************************************************************************
38  * Module descriptor
39  *****************************************************************************/
40 vlc_module_begin();
41     set_description( _("IDCT") );
42     set_capability( "idct", 50 );
43     add_shortcut( "c" );
44     set_callbacks( Open, NULL );
45 vlc_module_end();
46
47 /* Following functions are local */
48
49 /*****************************************************************************
50  * NormScan : Unused in this IDCT
51  *****************************************************************************/
52 static void NormScan( u8 ppi_scan[2][64] )
53 {
54 }
55
56 /*****************************************************************************
57  * IDCT : IDCT function for normal matrices
58  *****************************************************************************/
59 static inline void IDCT( dctelem_t * p_block )
60 {
61     int32_t tmp0, tmp1, tmp2, tmp3;
62     int32_t tmp10, tmp11, tmp12, tmp13;
63     int32_t z1, z2, z3, z4, z5;
64     int32_t d0, d1, d2, d3, d4, d5, d6, d7;
65     dctelem_t * dataptr;
66     int rowctr;
67
68     SHIFT_TEMPS
69
70     /* Pass 1: process rows. */
71     /* Note results are scaled up by sqrt(8) compared to a true IDCT; */
72     /* furthermore, we scale the results by 2**PASS1_BITS. */
73
74     dataptr = p_block;
75
76     for (rowctr = DCTSIZE-1; rowctr >= 0; rowctr--)
77     {
78         /* Due to quantization, we will usually find that many of the input
79          * coefficients are zero, especially the AC terms.  We can exploit this
80          * by short-circuiting the IDCT calculation for any row in which all
81          * the AC terms are zero.  In that case each output is equal to the
82          * DC coefficient (with scale factor as needed).
83          * With typical images and quantization tables, half or more of the
84          * row DCT calculations can be simplified this way.
85          */
86
87         register int * idataptr = (int*)dataptr;
88         d0 = dataptr[0];
89         d1 = dataptr[1];
90         if ( (d1 == 0) && ((idataptr[1] | idataptr[2] | idataptr[3]) == 0) )
91         {
92       /* AC terms all zero */
93             if (d0)
94             {
95       /* Compute a 32 bit value to assign. */
96                 dctelem_t dcval = (dctelem_t) (d0 << PASS1_BITS);
97                 register int v = (dcval & 0xffff) | (dcval << 16);
98
99                 idataptr[0] = v;
100                 idataptr[1] = v;
101                 idataptr[2] = v;
102                 idataptr[3] = v;
103             }
104
105             dataptr += DCTSIZE; /* advance pointer to next row */
106             continue;
107         }
108         d2 = dataptr[2];
109         d3 = dataptr[3];
110         d4 = dataptr[4];
111         d5 = dataptr[5];
112         d6 = dataptr[6];
113         d7 = dataptr[7];
114
115     /* Even part: reverse the even part of the forward DCT. */
116     /* The rotator is sqrt(2)*c(-6). */
117         if (d6)
118         {
119             if (d4)
120             {
121                 if (d2)
122                 {
123                     if (d0)
124                     {
125             /* d0 != 0, d2 != 0, d4 != 0, d6 != 0 */
126                         z1 = MULTIPLY(d2 + d6, FIX(0.541196100));
127                         tmp2 = z1 + MULTIPLY(d6, - FIX(1.847759065));
128                         tmp3 = z1 + MULTIPLY(d2, FIX(0.765366865));
129
130                         tmp0 = (d0 + d4) << CONST_BITS;
131                         tmp1 = (d0 - d4) << CONST_BITS;
132
133                         tmp10 = tmp0 + tmp3;
134                         tmp13 = tmp0 - tmp3;
135                         tmp11 = tmp1 + tmp2;
136                         tmp12 = tmp1 - tmp2;
137                     }
138                     else
139                     {
140                     /* d0 == 0, d2 != 0, d4 != 0, d6 != 0 */
141                         z1 = MULTIPLY(d2 + d6, FIX(0.541196100));
142                         tmp2 = z1 + MULTIPLY(d6, - FIX(1.847759065));
143                         tmp3 = z1 + MULTIPLY(d2, FIX(0.765366865));
144
145                         tmp0 = d4 << CONST_BITS;
146
147                         tmp10 = tmp0 + tmp3;
148                         tmp13 = tmp0 - tmp3;
149                         tmp11 = tmp2 - tmp0;
150                         tmp12 = -(tmp0 + tmp2);
151                         }
152                 }
153                 else
154                 {
155                     if (d0)
156                     {
157             /* d0 != 0, d2 == 0, d4 != 0, d6 != 0 */
158                         tmp2 = MULTIPLY(d6, - FIX2(1.306562965));
159                         tmp3 = MULTIPLY(d6, FIX(0.541196100));
160
161                         tmp0 = (d0 + d4) << CONST_BITS;
162                         tmp1 = (d0 - d4) << CONST_BITS;
163
164                         tmp10 = tmp0 + tmp3;
165                         tmp13 = tmp0 - tmp3;
166                         tmp11 = tmp1 + tmp2;
167                         tmp12 = tmp1 - tmp2;
168                         }
169                     else
170                     {
171                     /* d0 == 0, d2 == 0, d4 != 0, d6 != 0 */
172                         tmp2 = MULTIPLY(d6, - FIX2(1.306562965));
173                         tmp3 = MULTIPLY(d6, FIX(0.541196100));
174
175                         tmp0 = d4 << CONST_BITS;
176
177                         tmp10 = tmp0 + tmp3;
178                         tmp13 = tmp0 - tmp3;
179                         tmp11 = tmp2 - tmp0;
180                         tmp12 = -(tmp0 + tmp2);
181                         }
182                 }
183             }
184             else
185             {
186                 if (d2)
187                 {
188                     if (d0)
189                     {
190             /* d0 != 0, d2 != 0, d4 == 0, d6 != 0 */
191                         z1 = MULTIPLY(d2 + d6, FIX(0.541196100));
192                         tmp2 = z1 + MULTIPLY(d6, - FIX(1.847759065));
193                         tmp3 = z1 + MULTIPLY(d2, FIX(0.765366865));
194
195                         tmp0 = d0 << CONST_BITS;
196
197                         tmp10 = tmp0 + tmp3;
198                         tmp13 = tmp0 - tmp3;
199                         tmp11 = tmp0 + tmp2;
200                         tmp12 = tmp0 - tmp2;
201                     }
202                     else
203                     {
204                     /* d0 == 0, d2 != 0, d4 == 0, d6 != 0 */
205                         z1 = MULTIPLY(d2 + d6, FIX(0.541196100));
206                         tmp2 = z1 + MULTIPLY(d6, - FIX(1.847759065));
207                         tmp3 = z1 + MULTIPLY(d2, FIX(0.765366865));
208
209                         tmp10 = tmp3;
210                         tmp13 = -tmp3;
211                         tmp11 = tmp2;
212                         tmp12 = -tmp2;
213                             }
214                 }
215                 else
216                 {
217                     if (d0)
218                     {
219             /* d0 != 0, d2 == 0, d4 == 0, d6 != 0 */
220                         tmp2 = MULTIPLY(d6, - FIX2(1.306562965));
221                         tmp3 = MULTIPLY(d6, FIX(0.541196100));
222
223                         tmp0 = d0 << CONST_BITS;
224
225                         tmp10 = tmp0 + tmp3;
226                         tmp13 = tmp0 - tmp3;
227                         tmp11 = tmp0 + tmp2;
228                         tmp12 = tmp0 - tmp2;
229                     }
230                     else
231                     {
232             /* d0 == 0, d2 == 0, d4 == 0, d6 != 0 */
233                         tmp2 = MULTIPLY(d6, - FIX2(1.306562965));
234                         tmp3 = MULTIPLY(d6, FIX(0.541196100));
235
236                         tmp10 = tmp3;
237                         tmp13 = -tmp3;
238                         tmp11 = tmp2;
239                         tmp12 = -tmp2;
240                     }
241                 }
242             }
243         }
244         else
245         {
246             if (d4)
247             {
248                 if (d2)
249                 {
250                     if (d0)
251                     {
252                     /* d0 != 0, d2 != 0, d4 != 0, d6 == 0 */
253                         tmp2 = MULTIPLY(d2, FIX(0.541196100));
254                         tmp3 = MULTIPLY(d2, (FIX(1.306562965) + .5));
255
256                         tmp0 = (d0 + d4) << CONST_BITS;
257                         tmp1 = (d0 - d4) << CONST_BITS;
258
259                         tmp10 = tmp0 + tmp3;
260                         tmp13 = tmp0 - tmp3;
261                         tmp11 = tmp1 + tmp2;
262                         tmp12 = tmp1 - tmp2;
263                     }
264                     else
265                     {
266             /* d0 == 0, d2 != 0, d4 != 0, d6 == 0 */
267                         tmp2 = MULTIPLY(d2, FIX(0.541196100));
268                         tmp3 = MULTIPLY(d2, (FIX(1.306562965) + .5));
269
270                         tmp0 = d4 << CONST_BITS;
271
272                         tmp10 = tmp0 + tmp3;
273                         tmp13 = tmp0 - tmp3;
274                         tmp11 = tmp2 - tmp0;
275                         tmp12 = -(tmp0 + tmp2);
276                     }
277                 }
278                 else
279                 {
280                     if (d0)
281                     {
282             /* d0 != 0, d2 == 0, d4 != 0, d6 == 0 */
283                         tmp10 = tmp13 = (d0 + d4) << CONST_BITS;
284                         tmp11 = tmp12 = (d0 - d4) << CONST_BITS;
285                     }
286                     else
287                     {
288             /* d0 == 0, d2 == 0, d4 != 0, d6 == 0 */
289                         tmp10 = tmp13 = d4 << CONST_BITS;
290                         tmp11 = tmp12 = -tmp10;
291                     }
292                 }
293             }
294             else
295             {
296                 if (d2)
297                 {
298                     if (d0)
299                     {
300             /* d0 != 0, d2 != 0, d4 == 0, d6 == 0 */
301                         tmp2 = MULTIPLY(d2, FIX(0.541196100));
302                         tmp3 = MULTIPLY(d2, (FIX(1.306562965) + .5));
303
304                         tmp0 = d0 << CONST_BITS;
305
306                         tmp10 = tmp0 + tmp3;
307                         tmp13 = tmp0 - tmp3;
308                         tmp11 = tmp0 + tmp2;
309                         tmp12 = tmp0 - tmp2;
310                     }
311                     else
312                     {
313             /* d0 == 0, d2 != 0, d4 == 0, d6 == 0 */
314                         tmp2 = MULTIPLY(d2, FIX(0.541196100));
315                         tmp3 = MULTIPLY(d2, (FIX(1.306562965) + .5));
316
317                         tmp10 = tmp3;
318                         tmp13 = -tmp3;
319                         tmp11 = tmp2;
320                         tmp12 = -tmp2;
321                     }
322                 }
323                 else
324                 {
325                     if (d0)
326                     {
327             /* d0 != 0, d2 == 0, d4 == 0, d6 == 0 */
328                         tmp10 = tmp13 = tmp11 = tmp12 = d0 << CONST_BITS;
329                     }
330                     else
331                     {
332             /* d0 == 0, d2 == 0, d4 == 0, d6 == 0 */
333                         tmp10 = tmp13 = tmp11 = tmp12 = 0;
334                     }
335                 }
336             }
337         }
338
339
340     /* Odd part per figure 8; the matrix is unitary and hence its
341      * transpose is its inverse.  i0..i3 are y7,y5,y3,y1 respectively.
342      */
343
344         if (d7)
345             {
346             if (d5)
347             {
348                 if (d3)
349                 {
350                     if (d1)
351                     {
352             /* d1 != 0, d3 != 0, d5 != 0, d7 != 0 */
353                         z1 = d7 + d1;
354                         z2 = d5 + d3;
355                         z3 = d7 + d3;
356                         z4 = d5 + d1;
357                         z5 = MULTIPLY(z3 + z4, FIX(1.175875602));
358
359                         tmp0 = MULTIPLY(d7, FIX(0.298631336));
360                         tmp1 = MULTIPLY(d5, FIX(2.053119869));
361                         tmp2 = MULTIPLY(d3, FIX(3.072711026));
362                         tmp3 = MULTIPLY(d1, FIX(1.501321110));
363                         z1 = MULTIPLY(z1, - FIX(0.899976223));
364                         z2 = MULTIPLY(z2, - FIX(2.562915447));
365                         z3 = MULTIPLY(z3, - FIX(1.961570560));
366                         z4 = MULTIPLY(z4, - FIX(0.390180644));
367
368                         z3 += z5;
369                         z4 += z5;
370
371                         tmp0 += z1 + z3;
372                         tmp1 += z2 + z4;
373                         tmp2 += z2 + z3;
374                         tmp3 += z1 + z4;
375                     }
376                     else
377                     {
378             /* d1 == 0, d3 != 0, d5 != 0, d7 != 0 */
379                         z2 = d5 + d3;
380                         z3 = d7 + d3;
381                         z5 = MULTIPLY(z3 + d5, FIX(1.175875602));
382
383                         tmp0 = MULTIPLY(d7, FIX(0.298631336));
384                         tmp1 = MULTIPLY(d5, FIX(2.053119869));
385                         tmp2 = MULTIPLY(d3, FIX(3.072711026));
386                         z1 = MULTIPLY(d7, - FIX(0.899976223));
387                         z2 = MULTIPLY(z2, - FIX(2.562915447));
388                         z3 = MULTIPLY(z3, - FIX(1.961570560));
389                         z4 = MULTIPLY(d5, - FIX(0.390180644));
390
391                         z3 += z5;
392                         z4 += z5;
393
394                         tmp0 += z1 + z3;
395                         tmp1 += z2 + z4;
396                         tmp2 += z2 + z3;
397                         tmp3 = z1 + z4;
398                         }
399                     }
400                 else
401                 {
402                     if (d1)
403                     {
404             /* d1 != 0, d3 == 0, d5 != 0, d7 != 0 */
405                         z1 = d7 + d1;
406                         z4 = d5 + d1;
407                         z5 = MULTIPLY(d7 + z4, FIX(1.175875602));
408
409                         tmp0 = MULTIPLY(d7, FIX(0.298631336));
410                         tmp1 = MULTIPLY(d5, FIX(2.053119869));
411                         tmp3 = MULTIPLY(d1, FIX(1.501321110));
412                         z1 = MULTIPLY(z1, - FIX(0.899976223));
413                         z2 = MULTIPLY(d5, - FIX(2.562915447));
414                         z3 = MULTIPLY(d7, - FIX(1.961570560));
415                         z4 = MULTIPLY(z4, - FIX(0.390180644));
416
417                         z3 += z5;
418                         z4 += z5;
419
420                         tmp0 += z1 + z3;
421                         tmp1 += z2 + z4;
422                         tmp2 = z2 + z3;
423                         tmp3 += z1 + z4;
424                     }
425                     else
426                     {
427             /* d1 == 0, d3 == 0, d5 != 0, d7 != 0 */
428                         z5 = MULTIPLY(d7 + d5, FIX(1.175875602));
429
430                         tmp0 = MULTIPLY(d7, - FIX2(0.601344887));
431                         tmp1 = MULTIPLY(d5, - FIX2(0.509795578));
432                         z1 = MULTIPLY(d7, - FIX(0.899976223));
433                         z3 = MULTIPLY(d7, - FIX(1.961570560));
434                         z2 = MULTIPLY(d5, - FIX(2.562915447));
435                         z4 = MULTIPLY(d5, - FIX(0.390180644));
436
437                         z3 += z5;
438                         z4 += z5;
439
440                         tmp0 += z3;
441                         tmp1 += z4;
442                         tmp2 = z2 + z3;
443                         tmp3 = z1 + z4;
444                     }
445                 }
446             }
447             else
448             {
449                 if (d3)
450                 {
451                     if (d1)
452                     {
453             /* d1 != 0, d3 != 0, d5 == 0, d7 != 0 */
454                         z1 = d7 + d1;
455                         z3 = d7 + d3;
456                         z5 = MULTIPLY(z3 + d1, FIX(1.175875602));
457
458                         tmp0 = MULTIPLY(d7, FIX(0.298631336));
459                         tmp2 = MULTIPLY(d3, FIX(3.072711026));
460                         tmp3 = MULTIPLY(d1, FIX(1.501321110));
461                         z1 = MULTIPLY(z1, - FIX(0.899976223));
462                         z2 = MULTIPLY(d3, - FIX(2.562915447));
463                         z3 = MULTIPLY(z3, - FIX(1.961570560));
464                         z4 = MULTIPLY(d1, - FIX(0.390180644));
465
466                         z3 += z5;
467                         z4 += z5;
468
469                         tmp0 += z1 + z3;
470                         tmp1 = z2 + z4;
471                         tmp2 += z2 + z3;
472                         tmp3 += z1 + z4;
473                     }
474                     else
475                     {
476             /* d1 == 0, d3 != 0, d5 == 0, d7 != 0 */
477                         z3 = d7 + d3;
478                         z5 = MULTIPLY(z3, FIX(1.175875602));
479
480                         tmp0 = MULTIPLY(d7, - FIX2(0.601344887));
481                         tmp2 = MULTIPLY(d3, FIX(0.509795579));
482                         z1 = MULTIPLY(d7, - FIX(0.899976223));
483                         z2 = MULTIPLY(d3, - FIX(2.562915447));
484                         z3 = MULTIPLY(z3, - FIX2(0.785694958));
485
486                         tmp0 += z3;
487                         tmp1 = z2 + z5;
488                         tmp2 += z3;
489                         tmp3 = z1 + z5;
490                     }
491                 }
492                 else
493                 {
494                     if (d1)
495                     {
496             /* d1 != 0, d3 == 0, d5 == 0, d7 != 0 */
497                         z1 = d7 + d1;
498                         z5 = MULTIPLY(z1, FIX(1.175875602));
499
500                         tmp0 = MULTIPLY(d7, - FIX2(1.662939224));
501                         tmp3 = MULTIPLY(d1, FIX2(1.111140466));
502                         z1 = MULTIPLY(z1, FIX2(0.275899379));
503                         z3 = MULTIPLY(d7, - FIX(1.961570560));
504                         z4 = MULTIPLY(d1, - FIX(0.390180644));
505
506                         tmp0 += z1;
507                         tmp1 = z4 + z5;
508                         tmp2 = z3 + z5;
509                         tmp3 += z1;
510                     }
511                 else
512                     {
513             /* d1 == 0, d3 == 0, d5 == 0, d7 != 0 */
514                         tmp0 = MULTIPLY(d7, - FIX2(1.387039845));
515                         tmp1 = MULTIPLY(d7, FIX(1.175875602));
516                         tmp2 = MULTIPLY(d7, - FIX2(0.785694958));
517                         tmp3 = MULTIPLY(d7, FIX2(0.275899379));
518                     }
519                 }
520             }
521         }
522         else
523         {
524             if (d5)
525             {
526                 if (d3)
527                 {
528                     if (d1)
529                     {
530             /* d1 != 0, d3 != 0, d5 != 0, d7 == 0 */
531                         z2 = d5 + d3;
532                         z4 = d5 + d1;
533                         z5 = MULTIPLY(d3 + z4, FIX(1.175875602));
534
535                         tmp1 = MULTIPLY(d5, FIX(2.053119869));
536                         tmp2 = MULTIPLY(d3, FIX(3.072711026));
537                         tmp3 = MULTIPLY(d1, FIX(1.501321110));
538                         z1 = MULTIPLY(d1, - FIX(0.899976223));
539                         z2 = MULTIPLY(z2, - FIX(2.562915447));
540                         z3 = MULTIPLY(d3, - FIX(1.961570560));
541                         z4 = MULTIPLY(z4, - FIX(0.390180644));
542
543                         z3 += z5;
544                         z4 += z5;
545
546                         tmp0 = z1 + z3;
547                         tmp1 += z2 + z4;
548                         tmp2 += z2 + z3;
549                         tmp3 += z1 + z4;
550                     }
551                     else
552                     {
553             /* d1 == 0, d3 != 0, d5 != 0, d7 == 0 */
554                         z2 = d5 + d3;
555                         z5 = MULTIPLY(z2, FIX(1.175875602));
556
557                         tmp1 = MULTIPLY(d5, FIX2(1.662939225));
558                         tmp2 = MULTIPLY(d3, FIX2(1.111140466));
559                         z2 = MULTIPLY(z2, - FIX2(1.387039845));
560                         z3 = MULTIPLY(d3, - FIX(1.961570560));
561                         z4 = MULTIPLY(d5, - FIX(0.390180644));
562
563                         tmp0 = z3 + z5;
564                         tmp1 += z2;
565                         tmp2 += z2;
566                         tmp3 = z4 + z5;
567                     }
568                 }
569                 else
570                 {
571                     if (d1)
572                     {
573             /* d1 != 0, d3 == 0, d5 != 0, d7 == 0 */
574                         z4 = d5 + d1;
575                         z5 = MULTIPLY(z4, FIX(1.175875602));
576
577                         tmp1 = MULTIPLY(d5, - FIX2(0.509795578));
578                         tmp3 = MULTIPLY(d1, FIX2(0.601344887));
579                         z1 = MULTIPLY(d1, - FIX(0.899976223));
580                         z2 = MULTIPLY(d5, - FIX(2.562915447));
581                         z4 = MULTIPLY(z4, FIX2(0.785694958));
582
583                         tmp0 = z1 + z5;
584                         tmp1 += z4;
585                         tmp2 = z2 + z5;
586                         tmp3 += z4;
587                     }
588                     else
589                     {
590             /* d1 == 0, d3 == 0, d5 != 0, d7 == 0 */
591                         tmp0 = MULTIPLY(d5, FIX(1.175875602));
592                         tmp1 = MULTIPLY(d5, FIX2(0.275899380));
593                         tmp2 = MULTIPLY(d5, - FIX2(1.387039845));
594                         tmp3 = MULTIPLY(d5, FIX2(0.785694958));
595                     }
596                 }
597             }
598             else
599             {
600                 if (d3)
601                 {
602                     if (d1)
603                     {
604             /* d1 != 0, d3 != 0, d5 == 0, d7 == 0 */
605                         z5 = d3 + d1;
606
607                         tmp2 = MULTIPLY(d3, - FIX(1.451774981));
608                         tmp3 = MULTIPLY(d1, (FIX(0.211164243) - 1));
609                         z1 = MULTIPLY(d1, FIX(1.061594337));
610                         z2 = MULTIPLY(d3, - FIX(2.172734803));
611                         z4 = MULTIPLY(z5, FIX(0.785694958));
612                         z5 = MULTIPLY(z5, FIX(1.175875602));
613
614                         tmp0 = z1 - z4;
615                         tmp1 = z2 + z4;
616                         tmp2 += z5;
617                         tmp3 += z5;
618                     }
619                     else
620                     {
621             /* d1 == 0, d3 != 0, d5 == 0, d7 == 0 */
622                         tmp0 = MULTIPLY(d3, - FIX2(0.785694958));
623                         tmp1 = MULTIPLY(d3, - FIX2(1.387039845));
624                         tmp2 = MULTIPLY(d3, - FIX2(0.275899379));
625                         tmp3 = MULTIPLY(d3, FIX(1.175875602));
626                     }
627                 }
628                 else
629                 {
630                     if (d1)
631                     {
632             /* d1 != 0, d3 == 0, d5 == 0, d7 == 0 */
633                         tmp0 = MULTIPLY(d1, FIX2(0.275899379));
634                         tmp1 = MULTIPLY(d1, FIX2(0.785694958));
635                         tmp2 = MULTIPLY(d1, FIX(1.175875602));
636                         tmp3 = MULTIPLY(d1, FIX2(1.387039845));
637                     }
638                     else
639                     {
640             /* d1 == 0, d3 == 0, d5 == 0, d7 == 0 */
641                         tmp0 = tmp1 = tmp2 = tmp3 = 0;
642                     }
643                 }
644             }
645         }
646
647     /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */
648
649         dataptr[0] = (dctelem_t) DESCALE(tmp10 + tmp3, CONST_BITS-PASS1_BITS);
650         dataptr[7] = (dctelem_t) DESCALE(tmp10 - tmp3, CONST_BITS-PASS1_BITS);
651         dataptr[1] = (dctelem_t) DESCALE(tmp11 + tmp2, CONST_BITS-PASS1_BITS);
652         dataptr[6] = (dctelem_t) DESCALE(tmp11 - tmp2, CONST_BITS-PASS1_BITS);
653         dataptr[2] = (dctelem_t) DESCALE(tmp12 + tmp1, CONST_BITS-PASS1_BITS);
654         dataptr[5] = (dctelem_t) DESCALE(tmp12 - tmp1, CONST_BITS-PASS1_BITS);
655         dataptr[3] = (dctelem_t) DESCALE(tmp13 + tmp0, CONST_BITS-PASS1_BITS);
656         dataptr[4] = (dctelem_t) DESCALE(tmp13 - tmp0, CONST_BITS-PASS1_BITS);
657
658         dataptr += DCTSIZE;              /* advance pointer to next row */
659     }
660
661   /* Pass 2: process columns. */
662   /* Note that we must descale the results by a factor of 8 == 2**3, */
663   /* and also undo the PASS1_BITS scaling. */
664
665     dataptr = p_block;
666     for (rowctr = DCTSIZE-1; rowctr >= 0; rowctr--)
667     {
668     /* Columns of zeroes can be exploited in the same way as we did with rows.
669      * However, the row calculation has created many nonzero AC terms, so the
670      * simplification applies less often (typically 5% to 10% of the time).
671      * On machines with very fast multiplication, it's possible that the
672      * test takes more time than it's worth.  In that case this section
673      * may be commented out.
674      */
675
676         d0 = dataptr[DCTSIZE*0];
677         d1 = dataptr[DCTSIZE*1];
678         d2 = dataptr[DCTSIZE*2];
679         d3 = dataptr[DCTSIZE*3];
680         d4 = dataptr[DCTSIZE*4];
681         d5 = dataptr[DCTSIZE*5];
682         d6 = dataptr[DCTSIZE*6];
683         d7 = dataptr[DCTSIZE*7];
684
685     /* Even part: reverse the even part of the forward DCT. */
686     /* The rotator is sqrt(2)*c(-6). */
687         if (d6)
688         {
689             if (d4)
690             {
691                 if (d2)
692                 {
693                     if (d0)
694                     {
695             /* d0 != 0, d2 != 0, d4 != 0, d6 != 0 */
696                         z1 = MULTIPLY(d2 + d6, FIX(0.541196100));
697                         tmp2 = z1 + MULTIPLY(d6, - FIX(1.847759065));
698                         tmp3 = z1 + MULTIPLY(d2, FIX(0.765366865));
699
700                         tmp0 = (d0 + d4) << CONST_BITS;
701                         tmp1 = (d0 - d4) << CONST_BITS;
702
703                         tmp10 = tmp0 + tmp3;
704                         tmp13 = tmp0 - tmp3;
705                         tmp11 = tmp1 + tmp2;
706                         tmp12 = tmp1 - tmp2;
707                     }
708                     else
709                     {
710             /* d0 == 0, d2 != 0, d4 != 0, d6 != 0 */
711                         z1 = MULTIPLY(d2 + d6, FIX(0.541196100));
712                         tmp2 = z1 + MULTIPLY(d6, - FIX(1.847759065));
713                         tmp3 = z1 + MULTIPLY(d2, FIX(0.765366865));
714
715                         tmp0 = d4 << CONST_BITS;
716
717                         tmp10 = tmp0 + tmp3;
718                         tmp13 = tmp0 - tmp3;
719                         tmp11 = tmp2 - tmp0;
720                         tmp12 = -(tmp0 + tmp2);
721                     }
722                 }
723                 else
724                 {
725                     if (d0)
726                     {
727             /* d0 != 0, d2 == 0, d4 != 0, d6 != 0 */
728                         tmp2 = MULTIPLY(d6, - FIX2(1.306562965));
729                         tmp3 = MULTIPLY(d6, FIX(0.541196100));
730
731                         tmp0 = (d0 + d4) << CONST_BITS;
732                         tmp1 = (d0 - d4) << CONST_BITS;
733
734                         tmp10 = tmp0 + tmp3;
735                         tmp13 = tmp0 - tmp3;
736                         tmp11 = tmp1 + tmp2;
737                         tmp12 = tmp1 - tmp2;
738                     }
739                     else
740                     {
741             /* d0 == 0, d2 == 0, d4 != 0, d6 != 0 */
742                         tmp2 = MULTIPLY(d6, -FIX2(1.306562965));
743                         tmp3 = MULTIPLY(d6, FIX(0.541196100));
744
745                         tmp0 = d4 << CONST_BITS;
746
747                         tmp10 = tmp0 + tmp3;
748                         tmp13 = tmp0 - tmp3;
749                         tmp11 = tmp2 - tmp0;
750                         tmp12 = -(tmp0 + tmp2);
751                     }
752                 }
753             }
754             else
755             {
756                 if (d2)
757                 {
758                     if (d0)
759                     {
760             /* d0 != 0, d2 != 0, d4 == 0, d6 != 0 */
761                         z1 = MULTIPLY(d2 + d6, FIX(0.541196100));
762                         tmp2 = z1 + MULTIPLY(d6, - FIX(1.847759065));
763                         tmp3 = z1 + MULTIPLY(d2, FIX(0.765366865));
764
765                         tmp0 = d0 << CONST_BITS;
766
767                         tmp10 = tmp0 + tmp3;
768                         tmp13 = tmp0 - tmp3;
769                         tmp11 = tmp0 + tmp2;
770                         tmp12 = tmp0 - tmp2;
771                     }
772                     else
773                     {
774             /* d0 == 0, d2 != 0, d4 == 0, d6 != 0 */
775                         z1 = MULTIPLY(d2 + d6, FIX(0.541196100));
776                         tmp2 = z1 + MULTIPLY(d6, - FIX(1.847759065));
777                         tmp3 = z1 + MULTIPLY(d2, FIX(0.765366865));
778
779                         tmp10 = tmp3;
780                         tmp13 = -tmp3;
781                         tmp11 = tmp2;
782                         tmp12 = -tmp2;
783                     }
784                 }
785                 else
786                 {
787                     if (d0)
788                     {
789             /* d0 != 0, d2 == 0, d4 == 0, d6 != 0 */
790                     tmp2 = MULTIPLY(d6, - FIX2(1.306562965));
791                     tmp3 = MULTIPLY(d6, FIX(0.541196100));
792
793                     tmp0 = d0 << CONST_BITS;
794
795                     tmp10 = tmp0 + tmp3;
796                     tmp13 = tmp0 - tmp3;
797                     tmp11 = tmp0 + tmp2;
798                     tmp12 = tmp0 - tmp2;
799                 }
800                 else
801                 {
802             /* d0 == 0, d2 == 0, d4 == 0, d6 != 0 */
803                     tmp2 = MULTIPLY(d6, - FIX2(1.306562965));
804                     tmp3 = MULTIPLY(d6, FIX(0.541196100));
805                     tmp10 = tmp3;
806                     tmp13 = -tmp3;
807                     tmp11 = tmp2;
808                     tmp12 = -tmp2;
809                 }
810             }
811         }
812     }
813     else
814     {
815         if (d4)
816         {
817             if (d2)
818             {
819                 if (d0)
820                 {
821             /* d0 != 0, d2 != 0, d4 != 0, d6 == 0 */
822                     tmp2 = MULTIPLY(d2, FIX(0.541196100));
823                     tmp3 = MULTIPLY(d2, (FIX(1.306562965) + .5));
824
825                     tmp0 = (d0 + d4) << CONST_BITS;
826                     tmp1 = (d0 - d4) << CONST_BITS;
827
828                     tmp10 = tmp0 + tmp3;
829                     tmp13 = tmp0 - tmp3;
830                     tmp11 = tmp1 + tmp2;
831                     tmp12 = tmp1 - tmp2;
832                 }
833                 else
834                 {
835             /* d0 == 0, d2 != 0, d4 != 0, d6 == 0 */
836                     tmp2 = MULTIPLY(d2, FIX(0.541196100));
837                     tmp3 = MULTIPLY(d2, (FIX(1.306562965) + .5));
838
839                     tmp0 = d4 << CONST_BITS;
840
841                     tmp10 = tmp0 + tmp3;
842                     tmp13 = tmp0 - tmp3;
843                     tmp11 = tmp2 - tmp0;
844                     tmp12 = -(tmp0 + tmp2);
845                 }
846             }
847             else
848             {
849                 if (d0)
850                 {
851             /* d0 != 0, d2 == 0, d4 != 0, d6 == 0 */
852                     tmp10 = tmp13 = (d0 + d4) << CONST_BITS;
853                     tmp11 = tmp12 = (d0 - d4) << CONST_BITS;
854                 }
855                 else
856                 {
857             /* d0 == 0, d2 == 0, d4 != 0, d6 == 0 */
858                     tmp10 = tmp13 = d4 << CONST_BITS;
859                     tmp11 = tmp12 = -tmp10;
860                 }
861             }
862         }
863         else
864         {
865         if (d2)
866         {
867             if (d0)
868             {
869             /* d0 != 0, d2 != 0, d4 == 0, d6 == 0 */
870                     tmp2 = MULTIPLY(d2, FIX(0.541196100));
871                     tmp3 = MULTIPLY(d2, (FIX(1.306562965) + .5));
872
873                     tmp0 = d0 << CONST_BITS;
874
875                     tmp10 = tmp0 + tmp3;
876                     tmp13 = tmp0 - tmp3;
877                     tmp11 = tmp0 + tmp2;
878                     tmp12 = tmp0 - tmp2;
879             }
880             else
881             {
882             /* d0 == 0, d2 != 0, d4 == 0, d6 == 0 */
883                     tmp2 = MULTIPLY(d2, FIX(0.541196100));
884                     tmp3 = MULTIPLY(d2, (FIX(1.306562965) + .5));
885
886                     tmp10 = tmp3;
887                     tmp13 = -tmp3;
888                     tmp11 = tmp2;
889                     tmp12 = -tmp2;
890             }
891         }
892         else
893         {
894             if (d0)
895                 {
896             /* d0 != 0, d2 == 0, d4 == 0, d6 == 0 */
897                     tmp10 = tmp13 = tmp11 = tmp12 = d0 << CONST_BITS;
898                 }
899                 else
900                 {
901             /* d0 == 0, d2 == 0, d4 == 0, d6 == 0 */
902                     tmp10 = tmp13 = tmp11 = tmp12 = 0;
903                 }
904             }
905         }
906     }
907
908     /* Odd part per figure 8; the matrix is unitary and hence its
909      * transpose is its inverse.  i0..i3 are y7,y5,y3,y1 respectively.
910      */
911     if (d7)
912     {
913         if (d5)
914         {
915             if (d3)
916             {
917                 if (d1)
918                 {
919             /* d1 != 0, d3 != 0, d5 != 0, d7 != 0 */
920                     z1 = d7 + d1;
921                     z2 = d5 + d3;
922                     z3 = d7 + d3;
923                     z4 = d5 + d1;
924                     z5 = MULTIPLY(z3 + z4, FIX(1.175875602));
925
926                     tmp0 = MULTIPLY(d7, FIX(0.298631336));
927                     tmp1 = MULTIPLY(d5, FIX(2.053119869));
928                     tmp2 = MULTIPLY(d3, FIX(3.072711026));
929                     tmp3 = MULTIPLY(d1, FIX(1.501321110));
930                     z1 = MULTIPLY(z1, - FIX(0.899976223));
931                     z2 = MULTIPLY(z2, - FIX(2.562915447));
932                     z3 = MULTIPLY(z3, - FIX(1.961570560));
933                     z4 = MULTIPLY(z4, - FIX(0.390180644));
934
935                     z3 += z5;
936                     z4 += z5;
937
938                     tmp0 += z1 + z3;
939                     tmp1 += z2 + z4;
940                     tmp2 += z2 + z3;
941                     tmp3 += z1 + z4;
942                 }
943                 else
944                 {
945             /* d1 == 0, d3 != 0, d5 != 0, d7 != 0 */
946                     z2 = d5 + d3;
947                     z3 = d7 + d3;
948                     z5 = MULTIPLY(z3 + d5, FIX(1.175875602));
949
950                     tmp0 = MULTIPLY(d7, FIX(0.298631336));
951                     tmp1 = MULTIPLY(d5, FIX(2.053119869));
952                     tmp2 = MULTIPLY(d3, FIX(3.072711026));
953                     z1 = MULTIPLY(d7, - FIX(0.899976223));
954                     z2 = MULTIPLY(z2, - FIX(2.562915447));
955                     z3 = MULTIPLY(z3, - FIX(1.961570560));
956                     z4 = MULTIPLY(d5, - FIX(0.390180644));
957
958                     z3 += z5;
959                     z4 += z5;
960
961                     tmp0 += z1 + z3;
962                     tmp1 += z2 + z4;
963                     tmp2 += z2 + z3;
964                     tmp3 = z1 + z4;
965                 }
966             }
967             else
968             {
969                 if (d1)
970                 {
971             /* d1 != 0, d3 == 0, d5 != 0, d7 != 0 */
972                     z1 = d7 + d1;
973                     z4 = d5 + d1;
974                     z5 = MULTIPLY(d7 + z4, FIX(1.175875602));
975
976                     tmp0 = MULTIPLY(d7, FIX(0.298631336));
977                     tmp1 = MULTIPLY(d5, FIX(2.053119869));
978                     tmp3 = MULTIPLY(d1, FIX(1.501321110));
979                     z1 = MULTIPLY(z1, - FIX(0.899976223));
980                     z2 = MULTIPLY(d5, - FIX(2.562915447));
981                     z3 = MULTIPLY(d7, - FIX(1.961570560));
982                     z4 = MULTIPLY(z4, - FIX(0.390180644));
983
984                     z3 += z5;
985                     z4 += z5;
986
987                     tmp0 += z1 + z3;
988                     tmp1 += z2 + z4;
989                     tmp2 = z2 + z3;
990                     tmp3 += z1 + z4;
991                 }
992                 else
993                 {
994             /* d1 == 0, d3 == 0, d5 != 0, d7 != 0 */
995                     z5 = MULTIPLY(d5 + d7, FIX(1.175875602));
996
997                     tmp0 = MULTIPLY(d7, - FIX2(0.601344887));
998                     tmp1 = MULTIPLY(d5, - FIX2(0.509795578));
999                     z1 = MULTIPLY(d7, - FIX(0.899976223));
1000                     z3 = MULTIPLY(d7, - FIX(1.961570560));
1001                     z2 = MULTIPLY(d5, - FIX(2.562915447));
1002                     z4 = MULTIPLY(d5, - FIX(0.390180644));
1003
1004                     z3 += z5;
1005                     z4 += z5;
1006
1007                     tmp0 += z3;
1008                     tmp1 += z4;
1009                     tmp2 = z2 + z3;
1010                     tmp3 = z1 + z4;
1011                 }
1012             }
1013         }
1014         else
1015         {
1016             if (d3)
1017             {
1018                 if (d1)
1019                 {
1020             /* d1 != 0, d3 != 0, d5 == 0, d7 != 0 */
1021                     z1 = d7 + d1;
1022                     z3 = d7 + d3;
1023                     z5 = MULTIPLY(z3 + d1, FIX(1.175875602));
1024
1025                     tmp0 = MULTIPLY(d7, FIX(0.298631336));
1026                     tmp2 = MULTIPLY(d3, FIX(3.072711026));
1027                     tmp3 = MULTIPLY(d1, FIX(1.501321110));
1028                     z1 = MULTIPLY(z1, - FIX(0.899976223));
1029                     z2 = MULTIPLY(d3, - FIX(2.562915447));
1030                     z3 = MULTIPLY(z3, - FIX(1.961570560));
1031                     z4 = MULTIPLY(d1, - FIX(0.390180644));
1032
1033                     z3 += z5;
1034                     z4 += z5;
1035
1036                     tmp0 += z1 + z3;
1037                     tmp1 = z2 + z4;
1038                     tmp2 += z2 + z3;
1039                     tmp3 += z1 + z4;
1040                 }
1041                 else
1042                 {
1043             /* d1 == 0, d3 != 0, d5 == 0, d7 != 0 */
1044                     z3 = d7 + d3;
1045                     z5 = MULTIPLY(z3, FIX(1.175875602));
1046
1047                     tmp0 = MULTIPLY(d7, - FIX2(0.601344887));
1048                     z1 = MULTIPLY(d7, - FIX(0.899976223));
1049                     tmp2 = MULTIPLY(d3, FIX(0.509795579));
1050                     z2 = MULTIPLY(d3, - FIX(2.562915447));
1051                     z3 = MULTIPLY(z3, - FIX2(0.785694958));
1052
1053                     tmp0 += z3;
1054                     tmp1 = z2 + z5;
1055                     tmp2 += z3;
1056                     tmp3 = z1 + z5;
1057                 }
1058             }
1059             else
1060             {
1061                 if (d1)
1062                 {
1063             /* d1 != 0, d3 == 0, d5 == 0, d7 != 0 */
1064                     z1 = d7 + d1;
1065                     z5 = MULTIPLY(z1, FIX(1.175875602));
1066
1067                     tmp0 = MULTIPLY(d7, - FIX2(1.662939224));
1068                     tmp3 = MULTIPLY(d1, FIX2(1.111140466));
1069                     z1 = MULTIPLY(z1, FIX2(0.275899379));
1070                     z3 = MULTIPLY(d7, - FIX(1.961570560));
1071                     z4 = MULTIPLY(d1, - FIX(0.390180644));
1072
1073                     tmp0 += z1;
1074                     tmp1 = z4 + z5;
1075                     tmp2 = z3 + z5;
1076                     tmp3 += z1;
1077                 }
1078                 else
1079                 {
1080             /* d1 == 0, d3 == 0, d5 == 0, d7 != 0 */
1081                     tmp0 = MULTIPLY(d7, - FIX2(1.387039845));
1082                     tmp1 = MULTIPLY(d7, FIX(1.175875602));
1083                     tmp2 = MULTIPLY(d7, - FIX2(0.785694958));
1084                     tmp3 = MULTIPLY(d7, FIX2(0.275899379));
1085                 }
1086             }
1087         }
1088     }
1089     else
1090     {
1091         if (d5)
1092         {
1093             if (d3)
1094             {
1095                 if (d1)
1096                 {
1097             /* d1 != 0, d3 != 0, d5 != 0, d7 == 0 */
1098                     z2 = d5 + d3;
1099                     z4 = d5 + d1;
1100                     z5 = MULTIPLY(d3 + z4, FIX(1.175875602));
1101
1102                     tmp1 = MULTIPLY(d5, FIX(2.053119869));
1103                     tmp2 = MULTIPLY(d3, FIX(3.072711026));
1104                     tmp3 = MULTIPLY(d1, FIX(1.501321110));
1105                     z1 = MULTIPLY(d1, - FIX(0.899976223));
1106                     z2 = MULTIPLY(z2, - FIX(2.562915447));
1107                     z3 = MULTIPLY(d3, - FIX(1.961570560));
1108                     z4 = MULTIPLY(z4, - FIX(0.390180644));
1109
1110                     z3 += z5;
1111                     z4 += z5;
1112
1113                     tmp0 = z1 + z3;
1114                     tmp1 += z2 + z4;
1115                     tmp2 += z2 + z3;
1116                     tmp3 += z1 + z4;
1117                 }
1118                 else
1119                 {
1120             /* d1 == 0, d3 != 0, d5 != 0, d7 == 0 */
1121                     z2 = d5 + d3;
1122                     z5 = MULTIPLY(z2, FIX(1.175875602));
1123
1124                     tmp1 = MULTIPLY(d5, FIX2(1.662939225));
1125                     tmp2 = MULTIPLY(d3, FIX2(1.111140466));
1126                     z2 = MULTIPLY(z2, - FIX2(1.387039845));
1127                     z3 = MULTIPLY(d3, - FIX(1.961570560));
1128                     z4 = MULTIPLY(d5, - FIX(0.390180644));
1129
1130                     tmp0 = z3 + z5;
1131                     tmp1 += z2;
1132                     tmp2 += z2;
1133                     tmp3 = z4 + z5;
1134                 }
1135             }
1136             else
1137             {
1138                 if (d1)
1139                 {
1140             /* d1 != 0, d3 == 0, d5 != 0, d7 == 0 */
1141                     z4 = d5 + d1;
1142                     z5 = MULTIPLY(z4, FIX(1.175875602));
1143
1144                     tmp1 = MULTIPLY(d5, - FIX2(0.509795578));
1145                     tmp3 = MULTIPLY(d1, FIX2(0.601344887));
1146                     z1 = MULTIPLY(d1, - FIX(0.899976223));
1147                     z2 = MULTIPLY(d5, - FIX(2.562915447));
1148                     z4 = MULTIPLY(z4, FIX2(0.785694958));
1149
1150                     tmp0 = z1 + z5;
1151                     tmp1 += z4;
1152                     tmp2 = z2 + z5;
1153                     tmp3 += z4;
1154                 }
1155                 else
1156                 {
1157             /* d1 == 0, d3 == 0, d5 != 0, d7 == 0 */
1158                     tmp0 = MULTIPLY(d5, FIX(1.175875602));
1159                     tmp1 = MULTIPLY(d5, FIX2(0.275899380));
1160                     tmp2 = MULTIPLY(d5, - FIX2(1.387039845));
1161                     tmp3 = MULTIPLY(d5, FIX2(0.785694958));
1162                 }
1163             }
1164         }
1165         else
1166         {
1167             if (d3)
1168             {
1169                 if (d1)
1170                 {
1171             /* d1 != 0, d3 != 0, d5 == 0, d7 == 0 */
1172                     z5 = d3 + d1;
1173
1174                     tmp2 = MULTIPLY(d3, - FIX(1.451774981));
1175                     tmp3 = MULTIPLY(d1, (FIX(0.211164243) - 1));
1176                     z1 = MULTIPLY(d1, FIX(1.061594337));
1177                     z2 = MULTIPLY(d3, - FIX(2.172734803));
1178                     z4 = MULTIPLY(z5, FIX(0.785694958));
1179                     z5 = MULTIPLY(z5, FIX(1.175875602));
1180
1181                     tmp0 = z1 - z4;
1182                     tmp1 = z2 + z4;
1183                     tmp2 += z5;
1184                     tmp3 += z5;
1185                 }
1186                 else
1187                 {
1188             /* d1 == 0, d3 != 0, d5 == 0, d7 == 0 */
1189                     tmp0 = MULTIPLY(d3, - FIX2(0.785694958));
1190                     tmp1 = MULTIPLY(d3, - FIX2(1.387039845));
1191                     tmp2 = MULTIPLY(d3, - FIX2(0.275899379));
1192                     tmp3 = MULTIPLY(d3, FIX(1.175875602));
1193                 }
1194             }
1195             else
1196             {
1197                 if (d1)
1198                 {
1199             /* d1 != 0, d3 == 0, d5 == 0, d7 == 0 */
1200                     tmp0 = MULTIPLY(d1, FIX2(0.275899379));
1201                     tmp1 = MULTIPLY(d1, FIX2(0.785694958));
1202                     tmp2 = MULTIPLY(d1, FIX(1.175875602));
1203                     tmp3 = MULTIPLY(d1, FIX2(1.387039845));
1204                 }
1205                 else
1206                 {
1207             /* d1 == 0, d3 == 0, d5 == 0, d7 == 0 */
1208                     tmp0 = tmp1 = tmp2 = tmp3 = 0;
1209                 }
1210             }
1211         }
1212     }
1213
1214     /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */
1215
1216     dataptr[DCTSIZE*0] = (dctelem_t) DESCALE(tmp10 + tmp3,
1217                        CONST_BITS+PASS1_BITS+3);
1218     dataptr[DCTSIZE*7] = (dctelem_t) DESCALE(tmp10 - tmp3,
1219                        CONST_BITS+PASS1_BITS+3);
1220     dataptr[DCTSIZE*1] = (dctelem_t) DESCALE(tmp11 + tmp2,
1221                        CONST_BITS+PASS1_BITS+3);
1222     dataptr[DCTSIZE*6] = (dctelem_t) DESCALE(tmp11 - tmp2,
1223                        CONST_BITS+PASS1_BITS+3);
1224     dataptr[DCTSIZE*2] = (dctelem_t) DESCALE(tmp12 + tmp1,
1225                        CONST_BITS+PASS1_BITS+3);
1226     dataptr[DCTSIZE*5] = (dctelem_t) DESCALE(tmp12 - tmp1,
1227                        CONST_BITS+PASS1_BITS+3);
1228     dataptr[DCTSIZE*3] = (dctelem_t) DESCALE(tmp13 + tmp0,
1229                        CONST_BITS+PASS1_BITS+3);
1230     dataptr[DCTSIZE*4] = (dctelem_t) DESCALE(tmp13 - tmp0,
1231                        CONST_BITS+PASS1_BITS+3);
1232
1233     dataptr++;             /* advance pointer to next column */
1234     }
1235 }
1236
1237 static inline void RestoreCPUState( )
1238 {
1239     ;
1240 }
1241
1242 #include "idct_sparse.h"
1243 #include "idct_decl.h"