3 #ifdef RIGHT_SHIFT_IS_UNSIGNED
4 #define SHIFT_TEMPS long shift_temp;
5 #define RIGHT_SHIFT(x, shft) \
6 ((shift_temp = (x)) < 0 ? \
7 (shift_temp >> (shft)) | ((~((long) 0)) << (32-(shft))) : \
8 (shift_temp >> (shft)))
11 #define RIGHT_SHIFT(x, shft) ((x) >> (shft))
14 #define MAXJSAMPLE 255
15 #define RANGE_MASK (MAXJSAMPLE * 4 + 3)
16 #define CONST_SCALE (ONE << CONST_BITS)
22 #define MULTIPLY(var, const) ((var) * (const))
23 #define FIX(x) ((long)((x) * CONST_SCALE + 0.5))
24 #define DESCALE(x,n) RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
26 int quicktime_rev_dct(int16_t *data
, unsigned char *outptr
, unsigned char *rnglimit
)
28 long tmp0
, tmp1
, tmp2
, tmp3
;
29 long tmp10
, tmp11
, tmp12
, tmp13
;
30 long z1
, z2
, z3
, z4
, z5
;
31 long d0
, d1
, d2
, d3
, d4
, d5
, d6
, d7
;
32 register int16_t *dataptr
;
36 /* Pass 1: process rows. */
37 /* Note results are scaled up by sqrt(8) compared to a true IDCT; */
38 /* furthermore, we scale the results by 2**PASS1_BITS. */
42 for(rowctr
= DCTSIZE1
- 1; rowctr
>= 0; rowctr
--)
44 /* Due to quantization, we will usually find that many of the input
45 * coefficients are zero, especially the AC terms. We can exploit this
46 * by short-circuiting the IDCT calculation for any row in which all
47 * the AC terms are zero. In that case each output is equal to the
48 * DC coefficient (with scale factor as needed).
49 * With typical images and quantization tables, half or more of the
50 * row DCT calculations can be simplified this way.
53 register int *idataptr
= (int*)dataptr
;
56 if((d1
== 0) && (idataptr
[1] | idataptr
[2] | idataptr
[3]) == 0)
58 /* AC terms all zero */
61 /* Compute a 32 bit value to assign. */
62 int16_t dcval
= (int16_t) (d0
<< PASS1_BITS
);
63 register int v
= (dcval
& 0xffff) | ((dcval
<< 16) & 0xffff0000);
71 /* advance pointer to next row */
82 /* Even part: reverse the even part of the forward DCT. */
83 /* The rotator is sqrt(2)*c(-6). */
92 /* d0 != 0, d2 != 0, d4 != 0, d6 != 0 */
93 z1
= MULTIPLY(d2
+ d6
, FIX(0.541196100));
94 tmp2
= z1
+ MULTIPLY(d6
, -FIX(1.847759065));
95 tmp3
= z1
+ MULTIPLY(d2
, FIX(0.765366865));
97 tmp0
= (d0
+ d4
) << CONST_BITS
;
98 tmp1
= (d0
- d4
) << CONST_BITS
;
107 /* d*0 == 0, d2 != 0, d4 != 0, d6 != 0 */
108 z1
= MULTIPLY(d2
+ d6
, FIX(0.541196100));
109 tmp2
= z1
+ MULTIPLY(d6
, -FIX(1.847759065));
110 tmp3
= z1
+ MULTIPLY(d2
, FIX(0.765366865));
112 tmp0
= d4
<< CONST_BITS
;
117 tmp12
= -(tmp0
+ tmp2
);
124 /* d0 != 0, d2 == 0, d4 != 0, d6 != 0 */
125 tmp2
= MULTIPLY(d6
, -FIX(1.306562965));
126 tmp3
= MULTIPLY(d6
, FIX(0.541196100));
128 tmp0
= (d0
+ d4
) << CONST_BITS
;
129 tmp1
= (d0
- d4
) << CONST_BITS
;
138 /* d0 == 0, d2 == 0, d4 != 0, d6 != 0 */
139 tmp2
= MULTIPLY(d6
, -FIX(1.306562965));
140 tmp3
= MULTIPLY(d6
, FIX(0.541196100));
142 tmp0
= d4
<< CONST_BITS
;
147 tmp12
= -(tmp0
+ tmp2
);
157 /* d0 != 0, d2 != 0, d4 == 0, d6 != 0 */
158 z1
= MULTIPLY(d2
+ d6
, FIX(0.541196100));
159 tmp2
= z1
+ MULTIPLY(d6
, -FIX(1.847759065));
160 tmp3
= z1
+ MULTIPLY(d2
, FIX(0.765366865));
162 tmp0
= d0
<< CONST_BITS
;
171 /* d0 == 0, d2 != 0, d4 == 0, d6 != 0 */
172 z1
= MULTIPLY(d2
+ d6
, FIX(0.541196100));
173 tmp2
= z1
+ MULTIPLY(d6
, -FIX(1.847759065));
174 tmp3
= z1
+ MULTIPLY(d2
, FIX(0.765366865));
186 /* d0 != 0, d2 == 0, d4 == 0, d6 != 0 */
187 tmp2
= MULTIPLY(d6
, -FIX(1.306562965));
188 tmp3
= MULTIPLY(d6
, FIX(0.541196100));
190 tmp0
= d0
<< CONST_BITS
;
199 /* d0 == 0, d2 == 0, d4 == 0, d6 != 0 */
200 tmp2
= MULTIPLY(d6
, -FIX(1.306562965));
201 tmp3
= MULTIPLY(d6
, FIX(0.541196100));
219 /* d*0 != 0, d2 != 0, d4 != 0, d6 == 0 */
220 tmp2
= MULTIPLY(d2
, FIX(0.541196100));
221 tmp3
= MULTIPLY(d2
, FIX(1.306562965));
223 tmp0
= (d0
+ d4
) << CONST_BITS
;
224 tmp1
= (d0
- d4
) << CONST_BITS
;
233 /* d0 == 0, d2 != 0, d4 != 0, d6 == 0 */
234 tmp2
= MULTIPLY(d2
, FIX(0.541196100));
235 tmp3
= MULTIPLY(d2
, FIX(1.306562965));
237 tmp0
= d4
<< CONST_BITS
;
242 tmp12
= -(tmp0
+ tmp2
);
249 /* d0 != 0, d2 == 0, d4 != 0, d6 == 0 */
250 tmp10
= tmp13
= (d0
+ d4
) << CONST_BITS
;
251 tmp11
= tmp12
= (d0
- d4
) << CONST_BITS
;
255 /* d0 == 0, d2 == 0, d4 != 0, d6 == 0 */
256 tmp10
= tmp13
= d4
<< CONST_BITS
;
257 tmp11
= tmp12
= -tmp10
;
267 /* d0 != 0, d2 != 0, d4 == 0, d6 == 0 */
268 tmp2
= MULTIPLY(d2
, FIX(0.541196100));
269 tmp3
= MULTIPLY(d2
, FIX(1.306562965));
271 tmp0
= d0
<< CONST_BITS
;
280 /* d0 == 0, d2 != 0, d4 == 0, d6 == 0 */
281 tmp2
= MULTIPLY(d2
, FIX(0.541196100));
282 tmp3
= MULTIPLY(d2
, FIX(1.306562965));
294 /* d0 != 0, d2 == 0, d4 == 0, d6 == 0 */
295 tmp10
= tmp13
= tmp11
= tmp12
= d0
<< CONST_BITS
;
299 /* d0 == 0, d2 == 0, d4 == 0, d6 == 0 */
300 tmp10
= tmp13
= tmp11
= tmp12
= 0;
307 /* Odd part per figure 8; the matrix is unitary and hence its
308 * transpose is its inverse. i0..i3 are y7,y5,y3,y1 respectively.
319 /* d1 != 0, d3 != 0, d5 != 0, d7 != 0 */
324 z5
= MULTIPLY(z3
+ z4
, FIX(1.175875602));
326 tmp0
= MULTIPLY(d7
, FIX(0.298631336));
327 tmp1
= MULTIPLY(d5
, FIX(2.053119869));
328 tmp2
= MULTIPLY(d3
, FIX(3.072711026));
329 tmp3
= MULTIPLY(d1
, FIX(1.501321110));
330 z1
= MULTIPLY(z1
, -FIX(0.899976223));
331 z2
= MULTIPLY(z2
, -FIX(2.562915447));
332 z3
= MULTIPLY(z3
, -FIX(1.961570560));
333 z4
= MULTIPLY(z4
, -FIX(0.390180644));
345 /* d1 == 0, d3 != 0, d5 != 0, d7 != 0 */
349 z5
= MULTIPLY(z3
+ d5
, FIX(1.175875602));
351 tmp0
= MULTIPLY(d7
, FIX(0.298631336));
352 tmp1
= MULTIPLY(d5
, FIX(2.053119869));
353 tmp2
= MULTIPLY(d3
, FIX(3.072711026));
354 z1
= MULTIPLY(d7
, -FIX(0.899976223));
355 z2
= MULTIPLY(z2
, -FIX(2.562915447));
356 z3
= MULTIPLY(z3
, -FIX(1.961570560));
357 z4
= MULTIPLY(d5
, -FIX(0.390180644));
372 /* d1 != 0, d3 == 0, d5 != 0, d7 != 0 */
377 z5
= MULTIPLY(z3
+ z4
, FIX(1.175875602));
379 tmp0
= MULTIPLY(d7
, FIX(0.298631336));
380 tmp1
= MULTIPLY(d5
, FIX(2.053119869));
381 tmp3
= MULTIPLY(d1
, FIX(1.501321110));
382 z1
= MULTIPLY(z1
, -FIX(0.899976223));
383 z2
= MULTIPLY(d5
, -FIX(2.562915447));
384 z3
= MULTIPLY(d7
, -FIX(1.961570560));
385 z4
= MULTIPLY(z4
, -FIX(0.390180644));
397 /* d1 == 0, d3 == 0, d5 != 0, d7 != 0 */
398 tmp0
= MULTIPLY(d7
, -FIX(0.601344887));
399 z1
= MULTIPLY(d7
, -FIX(0.899976223));
400 z3
= MULTIPLY(d7
, -FIX(1.961570560));
401 tmp1
= MULTIPLY(d5
, -FIX(0.509795578));
402 z2
= MULTIPLY(d5
, -FIX(2.562915447));
403 z4
= MULTIPLY(d5
, -FIX(0.390180644));
404 z5
= MULTIPLY(d5
+ d7
, FIX(1.175875602));
422 /* d1 != 0, d3 != 0, d5 == 0, d7 != 0 */
425 z5
= MULTIPLY(z3
+ d1
, FIX(1.175875602));
427 tmp0
= MULTIPLY(d7
, FIX(0.298631336));
428 tmp2
= MULTIPLY(d3
, FIX(3.072711026));
429 tmp3
= MULTIPLY(d1
, FIX(1.501321110));
430 z1
= MULTIPLY(z1
, -FIX(0.899976223));
431 z2
= MULTIPLY(d3
, -FIX(2.562915447));
432 z3
= MULTIPLY(z3
, -FIX(1.961570560));
433 z4
= MULTIPLY(d1
, -FIX(0.390180644));
445 /* d1 == 0, d3 != 0, d5 == 0, d7 != 0 */
448 tmp0
= MULTIPLY(d7
, -FIX(0.601344887));
449 z1
= MULTIPLY(d7
, -FIX(0.899976223));
450 tmp2
= MULTIPLY(d3
, FIX(0.509795579));
451 z2
= MULTIPLY(d3
, -FIX(2.562915447));
452 z5
= MULTIPLY(z3
, FIX(1.175875602));
453 z3
= MULTIPLY(z3
, -FIX(0.785694958));
465 /* d1 != 0, d3 == 0, d5 == 0, d7 != 0 */
467 z5
= MULTIPLY(z1
, FIX(1.175875602));
469 z1
= MULTIPLY(z1
, FIX(0.275899379));
470 z3
= MULTIPLY(d7
, -FIX(1.961570560));
471 tmp0
= MULTIPLY(d7
, -FIX(1.662939224));
472 z4
= MULTIPLY(d1
, -FIX(0.390180644));
473 tmp3
= MULTIPLY(d1
, FIX(1.111140466));
482 /* d1 == 0, d3 == 0, d5 == 0, d7 != 0 */
483 tmp0
= MULTIPLY(d7
, -FIX(1.387039845));
484 tmp1
= MULTIPLY(d7
, FIX(1.175875602));
485 tmp2
= MULTIPLY(d7
, -FIX(0.785694958));
486 tmp3
= MULTIPLY(d7
, FIX(0.275899379));
499 /* d1 != 0, d3 != 0, d5 != 0, d7 == 0 */
502 z5
= MULTIPLY(d3
+ z4
, FIX(1.175875602));
504 tmp1
= MULTIPLY(d5
, FIX(2.053119869));
505 tmp2
= MULTIPLY(d3
, FIX(3.072711026));
506 tmp3
= MULTIPLY(d1
, FIX(1.501321110));
507 z1
= MULTIPLY(d1
, -FIX(0.899976223));
508 z2
= MULTIPLY(z2
, -FIX(2.562915447));
509 z3
= MULTIPLY(d3
, -FIX(1.961570560));
510 z4
= MULTIPLY(z4
, -FIX(0.390180644));
522 /* d1 == 0, d3 != 0, d5 != 0, d7 == 0 */
525 z5
= MULTIPLY(z2
, FIX(1.175875602));
526 tmp1
= MULTIPLY(d5
, FIX(1.662939225));
527 z4
= MULTIPLY(d5
, -FIX(0.390180644));
528 z2
= MULTIPLY(z2
, -FIX(1.387039845));
529 tmp2
= MULTIPLY(d3
, FIX(1.111140466));
530 z3
= MULTIPLY(d3
, -FIX(1.961570560));
542 /* d1 != 0, d3 == 0, d5 != 0, d7 == 0 */
545 z5
= MULTIPLY(z4
, FIX(1.175875602));
546 z1
= MULTIPLY(d1
, -FIX(0.899976223));
547 tmp3
= MULTIPLY(d1
, FIX(0.601344887));
548 tmp1
= MULTIPLY(d5
, -FIX(0.509795578));
549 z2
= MULTIPLY(d5
, -FIX(2.562915447));
550 z4
= MULTIPLY(z4
, FIX(0.785694958));
559 /* d1 == 0, d3 == 0, d5 != 0, d7 == 0 */
560 tmp0
= MULTIPLY(d5
, FIX(1.175875602));
561 tmp1
= MULTIPLY(d5
, FIX(0.275899380));
562 tmp2
= MULTIPLY(d5
, -FIX(1.387039845));
563 tmp3
= MULTIPLY(d5
, FIX(0.785694958));
573 /* d1 != 0, d3 != 0, d5 == 0, d7 == 0 */
575 tmp3
= MULTIPLY(d1
, FIX(0.211164243));
576 tmp2
= MULTIPLY(d3
, -FIX(1.451774981));
577 z1
= MULTIPLY(d1
, FIX(1.061594337));
578 z2
= MULTIPLY(d3
, -FIX(2.172734803));
579 z4
= MULTIPLY(z5
, FIX(0.785694958));
580 z5
= MULTIPLY(z5
, FIX(1.175875602));
589 /* d1 == 0, d3 != 0, d5 == 0, d7 == 0 */
590 tmp0
= MULTIPLY(d3
, -FIX(0.785694958));
591 tmp1
= MULTIPLY(d3
, -FIX(1.387039845));
592 tmp2
= MULTIPLY(d3
, -FIX(0.275899379));
593 tmp3
= MULTIPLY(d3
, FIX(1.175875602));
600 /* d1 != 0, d3 == 0, d5 == 0, d7 == 0 */
601 tmp0
= MULTIPLY(d1
, FIX(0.275899379));
602 tmp1
= MULTIPLY(d1
, FIX(0.785694958));
603 tmp2
= MULTIPLY(d1
, FIX(1.175875602));
604 tmp3
= MULTIPLY(d1
, FIX(1.387039845));
608 /* d1 == 0, d3 == 0, d5 == 0, d7 == 0 */
609 tmp0
= tmp1
= tmp2
= tmp3
= 0;
615 /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */
617 dataptr
[0] = (int16_t) DESCALE(tmp10
+ tmp3
, CONST_BITS
- PASS1_BITS
);
618 dataptr
[7] = (int16_t) DESCALE(tmp10
- tmp3
, CONST_BITS
- PASS1_BITS
);
619 dataptr
[1] = (int16_t) DESCALE(tmp11
+ tmp2
, CONST_BITS
- PASS1_BITS
);
620 dataptr
[6] = (int16_t) DESCALE(tmp11
- tmp2
, CONST_BITS
- PASS1_BITS
);
621 dataptr
[2] = (int16_t) DESCALE(tmp12
+ tmp1
, CONST_BITS
- PASS1_BITS
);
622 dataptr
[5] = (int16_t) DESCALE(tmp12
- tmp1
, CONST_BITS
- PASS1_BITS
);
623 dataptr
[3] = (int16_t) DESCALE(tmp13
+ tmp0
, CONST_BITS
- PASS1_BITS
);
624 dataptr
[4] = (int16_t) DESCALE(tmp13
- tmp0
, CONST_BITS
- PASS1_BITS
);
626 dataptr
+= DCTSIZE1
; /* advance pointer to next row */
629 /* Pass 2: process columns. */
630 /* Note that we must descale the results by a factor of 8 == 2**3, */
631 /* and also undo the PASS1_BITS scaling. */
634 for(rowctr
= DCTSIZE1
- 1; rowctr
>= 0; rowctr
--)
636 /* Columns of zeroes can be exploited in the same way as we did with rows.
637 * However, the row calculation has created many nonzero AC terms, so the
638 * simplification applies less often (typically 5% to 10% of the time).
639 * On machines with very fast multiplication, it's possible that the
640 * test takes more time than it's worth. In that case this section
641 * may be commented out.
644 d0
= dataptr
[DCTSIZE1
* 0];
645 d1
= dataptr
[DCTSIZE1
* 1];
646 d2
= dataptr
[DCTSIZE1
* 2];
647 d3
= dataptr
[DCTSIZE1
* 3];
648 d4
= dataptr
[DCTSIZE1
* 4];
649 d5
= dataptr
[DCTSIZE1
* 5];
650 d6
= dataptr
[DCTSIZE1
* 6];
651 d7
= dataptr
[DCTSIZE1
* 7];
653 /* Even part: reverse the even part of the forward DCT. */
654 /* The rotator is sqrt(2)*c(-6). */
663 /* d0 != 0, d2 != 0, d4 != 0, d6 != 0 */
664 z1
= MULTIPLY(d2
+ d6
, FIX(0.541196100));
665 tmp2
= z1
+ MULTIPLY(d6
, -FIX(1.847759065));
666 tmp3
= z1
+ MULTIPLY(d2
, FIX(0.765366865));
668 tmp0
= (d0
+ d4
) << CONST_BITS
;
669 tmp1
= (d0
- d4
) << CONST_BITS
;
676 /* d0 == 0, d2 != 0, d4 != 0, d6 != 0 */
677 z1
= MULTIPLY(d2
+ d6
, FIX(0.541196100));
678 tmp2
= z1
+ MULTIPLY(d6
, -FIX(1.847759065));
679 tmp3
= z1
+ MULTIPLY(d2
, FIX(0.765366865));
681 tmp0
= d4
<< CONST_BITS
;
686 tmp12
= -(tmp0
+ tmp2
);
693 /* d0 != 0, d2 == 0, d4 != 0, d6 != 0 */
694 tmp2
= MULTIPLY(d6
, -FIX(1.306562965));
695 tmp3
= MULTIPLY(d6
, FIX(0.541196100));
697 tmp0
= (d0
+ d4
) << CONST_BITS
;
698 tmp1
= (d0
- d4
) << CONST_BITS
;
707 /* d0 == 0, d2 == 0, d4 != 0, d6 != 0 */
708 tmp2
= MULTIPLY(d6
, -FIX(1.306562965));
709 tmp3
= MULTIPLY(d6
, FIX(0.541196100));
711 tmp0
= d4
<< CONST_BITS
;
716 tmp12
= -(tmp0
+ tmp2
);
726 /* d0 != 0, d2 != 0, d4 == 0, d6 != 0 */
727 z1
= MULTIPLY(d2
+ d6
, FIX(0.541196100));
728 tmp2
= z1
+ MULTIPLY(d6
, -FIX(1.847759065));
729 tmp3
= z1
+ MULTIPLY(d2
, FIX(0.765366865));
731 tmp0
= d0
<< CONST_BITS
;
740 /* d0 == 0, d2 != 0, d4 == 0, d6 != 0 */
741 z1
= MULTIPLY(d2
+ d6
, FIX(0.541196100));
742 tmp2
= z1
+ MULTIPLY(d6
, -FIX(1.847759065));
743 tmp3
= z1
+ MULTIPLY(d2
, FIX(0.765366865));
755 /* d0 != 0, d2 == 0, d4 == 0, d6 != 0 */
756 tmp2
= MULTIPLY(d6
, -FIX(1.306562965));
757 tmp3
= MULTIPLY(d6
, FIX(0.541196100));
759 tmp0
= d0
<< CONST_BITS
;
768 /* d0 == 0, d2 == 0, d4 == 0, d6 != 0 */
769 tmp2
= MULTIPLY(d6
, -FIX(1.306562965));
770 tmp3
= MULTIPLY(d6
, FIX(0.541196100));
788 /* d0 != 0, d2 != 0, d4 != 0, d6 == 0 */
789 tmp2
= MULTIPLY(d2
, FIX(0.541196100));
790 tmp3
= MULTIPLY(d2
, FIX(1.306562965));
792 tmp0
= (d0
+ d4
) << CONST_BITS
;
793 tmp1
= (d0
- d4
) << CONST_BITS
;
802 /* d0 == 0, d2 != 0, d4 != 0, d6 == 0 */
803 tmp2
= MULTIPLY(d2
, FIX(0.541196100));
804 tmp3
= MULTIPLY(d2
, FIX(1.306562965));
806 tmp0
= d4
<< CONST_BITS
;
811 tmp12
= -(tmp0
+ tmp2
);
818 /* d0 != 0, d2 == 0, d4 != 0, d6 == 0 */
819 tmp10
= tmp13
= (d0
+ d4
) << CONST_BITS
;
820 tmp11
= tmp12
= (d0
- d4
) << CONST_BITS
;
824 /* d0 == 0, d2 == 0, d4 != 0, d6 == 0 */
825 tmp10
= tmp13
= d4
<< CONST_BITS
;
826 tmp11
= tmp12
= -tmp10
;
836 /* d0 != 0, d2 != 0, d4 == 0, d6 == 0 */
837 tmp2
= MULTIPLY(d2
, FIX(0.541196100));
838 tmp3
= MULTIPLY(d2
, FIX(1.306562965));
840 tmp0
= d0
<< CONST_BITS
;
849 /* d0 == 0, d2 != 0, d4 == 0, d6 == 0 */
850 tmp2
= MULTIPLY(d2
, FIX(0.541196100));
851 tmp3
= MULTIPLY(d2
, FIX(1.306562965));
863 /* d0 != 0, d2 == 0, d4 == 0, d6 == 0 */
864 tmp10
= tmp13
= tmp11
= tmp12
= d0
<< CONST_BITS
;
868 /* d0 == 0, d2 == 0, d4 == 0, d6 == 0 */
869 tmp10
= tmp13
= tmp11
= tmp12
= 0;
875 /* Odd part per figure 8; the matrix is unitary and hence its
876 * transpose is its inverse. i0..i3 are y7,y5,y3,y1 respectively.
886 /* d1 != 0, d3 != 0, d5 != 0, d7 != 0 */
891 z5
= MULTIPLY(z3
+ z4
, FIX(1.175875602));
893 tmp0
= MULTIPLY(d7
, FIX(0.298631336));
894 tmp1
= MULTIPLY(d5
, FIX(2.053119869));
895 tmp2
= MULTIPLY(d3
, FIX(3.072711026));
896 tmp3
= MULTIPLY(d1
, FIX(1.501321110));
897 z1
= MULTIPLY(z1
, -FIX(0.899976223));
898 z2
= MULTIPLY(z2
, -FIX(2.562915447));
899 z3
= MULTIPLY(z3
, -FIX(1.961570560));
900 z4
= MULTIPLY(z4
, -FIX(0.390180644));
912 /* d1 == 0, d3 != 0, d5 != 0, d7 != 0 */
916 z5
= MULTIPLY(z3
+ d5
, FIX(1.175875602));
918 tmp0
= MULTIPLY(d7
, FIX(0.298631336));
919 tmp1
= MULTIPLY(d5
, FIX(2.053119869));
920 tmp2
= MULTIPLY(d3
, FIX(3.072711026));
921 z1
= MULTIPLY(d7
, -FIX(0.899976223));
922 z2
= MULTIPLY(z2
, -FIX(2.562915447));
923 z3
= MULTIPLY(z3
, -FIX(1.961570560));
924 z4
= MULTIPLY(d5
, -FIX(0.390180644));
939 /* d1 != 0, d3 == 0, d5 != 0, d7 != 0 */
944 z5
= MULTIPLY(z3
+ z4
, FIX(1.175875602));
946 tmp0
= MULTIPLY(d7
, FIX(0.298631336));
947 tmp1
= MULTIPLY(d5
, FIX(2.053119869));
948 tmp3
= MULTIPLY(d1
, FIX(1.501321110));
949 z1
= MULTIPLY(z1
, -FIX(0.899976223));
950 z2
= MULTIPLY(d5
, -FIX(2.562915447));
951 z3
= MULTIPLY(d7
, -FIX(1.961570560));
952 z4
= MULTIPLY(z4
, -FIX(0.390180644));
964 /* d1 == 0, d3 == 0, d5 != 0, d7 != 0 */
965 tmp0
= MULTIPLY(d7
, -FIX(0.601344887));
966 z1
= MULTIPLY(d7
, -FIX(0.899976223));
967 z3
= MULTIPLY(d7
, -FIX(1.961570560));
968 tmp1
= MULTIPLY(d5
, -FIX(0.509795578));
969 z2
= MULTIPLY(d5
, -FIX(2.562915447));
970 z4
= MULTIPLY(d5
, -FIX(0.390180644));
971 z5
= MULTIPLY(d5
+ d7
, FIX(1.175875602));
989 /* d1 != 0, d3 != 0, d5 == 0, d7 != 0 */
992 z5
= MULTIPLY(z3
+ d1
, FIX(1.175875602));
994 tmp0
= MULTIPLY(d7
, FIX(0.298631336));
995 tmp2
= MULTIPLY(d3
, FIX(3.072711026));
996 tmp3
= MULTIPLY(d1
, FIX(1.501321110));
997 z1
= MULTIPLY(z1
, -FIX(0.899976223));
998 z2
= MULTIPLY(d3
, -FIX(2.562915447));
999 z3
= MULTIPLY(z3
, -FIX(1.961570560));
1000 z4
= MULTIPLY(d1
, -FIX(0.390180644));
1012 /* d1 == 0, d3 != 0, d5 == 0, d7 != 0 */
1015 tmp0
= MULTIPLY(d7
, -FIX(0.601344887));
1016 z1
= MULTIPLY(d7
, -FIX(0.899976223));
1017 tmp2
= MULTIPLY(d3
, FIX(0.509795579));
1018 z2
= MULTIPLY(d3
, -FIX(2.562915447));
1019 z5
= MULTIPLY(z3
, FIX(1.175875602));
1020 z3
= MULTIPLY(z3
, -FIX(0.785694958));
1032 /* d1 != 0, d3 == 0, d5 == 0, d7 != 0 */
1034 z5
= MULTIPLY(z1
, FIX(1.175875602));
1036 z1
= MULTIPLY(z1
, FIX(0.275899379));
1037 z3
= MULTIPLY(d7
, -FIX(1.961570560));
1038 tmp0
= MULTIPLY(d7
, -FIX(1.662939224));
1039 z4
= MULTIPLY(d1
, -FIX(0.390180644));
1040 tmp3
= MULTIPLY(d1
, FIX(1.111140466));
1049 /* d1 == 0, d3 == 0, d5 == 0, d7 != 0 */
1050 tmp0
= MULTIPLY(d7
, -FIX(1.387039845));
1051 tmp1
= MULTIPLY(d7
, FIX(1.175875602));
1052 tmp2
= MULTIPLY(d7
, -FIX(0.785694958));
1053 tmp3
= MULTIPLY(d7
, FIX(0.275899379));
1066 /* d1 != 0, d3 != 0, d5 != 0, d7 == 0 */
1069 z5
= MULTIPLY(d3
+ z4
, FIX(1.175875602));
1071 tmp1
= MULTIPLY(d5
, FIX(2.053119869));
1072 tmp2
= MULTIPLY(d3
, FIX(3.072711026));
1073 tmp3
= MULTIPLY(d1
, FIX(1.501321110));
1074 z1
= MULTIPLY(d1
, -FIX(0.899976223));
1075 z2
= MULTIPLY(z2
, -FIX(2.562915447));
1076 z3
= MULTIPLY(d3
, -FIX(1.961570560));
1077 z4
= MULTIPLY(z4
, -FIX(0.390180644));
1089 /* d1 == 0, d3 != 0, d5 != 0, d7 == 0 */
1092 z5
= MULTIPLY(z2
, FIX(1.175875602));
1093 tmp1
= MULTIPLY(d5
, FIX(1.662939225));
1094 z4
= MULTIPLY(d5
, -FIX(0.390180644));
1095 z2
= MULTIPLY(z2
, -FIX(1.387039845));
1096 tmp2
= MULTIPLY(d3
, FIX(1.111140466));
1097 z3
= MULTIPLY(d3
, -FIX(1.961570560));
1109 /* d1 != 0, d3 == 0, d5 != 0, d7 == 0 */
1112 z5
= MULTIPLY(z4
, FIX(1.175875602));
1113 z1
= MULTIPLY(d1
, -FIX(0.899976223));
1114 tmp3
= MULTIPLY(d1
, FIX(0.601344887));
1115 tmp1
= MULTIPLY(d5
, -FIX(0.509795578));
1116 z2
= MULTIPLY(d5
, -FIX(2.562915447));
1117 z4
= MULTIPLY(z4
, FIX(0.785694958));
1126 /* d1 == 0, d3 == 0, d5 != 0, d7 == 0 */
1127 tmp0
= MULTIPLY(d5
, FIX(1.175875602));
1128 tmp1
= MULTIPLY(d5
, FIX(0.275899380));
1129 tmp2
= MULTIPLY(d5
, -FIX(1.387039845));
1130 tmp3
= MULTIPLY(d5
, FIX(0.785694958));
1140 /* d1 != 0, d3 != 0, d5 == 0, d7 == 0 */
1142 tmp3
= MULTIPLY(d1
, FIX(0.211164243));
1143 tmp2
= MULTIPLY(d3
, -FIX(1.451774981));
1144 z1
= MULTIPLY(d1
, FIX(1.061594337));
1145 z2
= MULTIPLY(d3
, -FIX(2.172734803));
1146 z4
= MULTIPLY(z5
, FIX(0.785694958));
1147 z5
= MULTIPLY(z5
, FIX(1.175875602));
1156 /* d1 == 0, d3 != 0, d5 == 0, d7 == 0 */
1157 tmp0
= MULTIPLY(d3
, -FIX(0.785694958));
1158 tmp1
= MULTIPLY(d3
, -FIX(1.387039845));
1159 tmp2
= MULTIPLY(d3
, -FIX(0.275899379));
1160 tmp3
= MULTIPLY(d3
, FIX(1.175875602));
1167 /* d1 != 0, d3 == 0, d5 == 0, d7 == 0 */
1168 tmp0
= MULTIPLY(d1
, FIX(0.275899379));
1169 tmp1
= MULTIPLY(d1
, FIX(0.785694958));
1170 tmp2
= MULTIPLY(d1
, FIX(1.175875602));
1171 tmp3
= MULTIPLY(d1
, FIX(1.387039845));
1175 /* d1 == 0, d3 == 0, d5 == 0, d7 == 0 */
1176 tmp0
= tmp1
= tmp2
= tmp3
= 0;
1182 /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */
1185 outptr
[DCTSIZE1
* 0] = rnglimit
[(int)DESCALE(tmp10
+ tmp3
, CONST_BITS
+ PASS1_BITS
+ 3) & RANGE_MASK
];
1186 outptr
[DCTSIZE1
* 7] = rnglimit
[(int)DESCALE(tmp10
- tmp3
, CONST_BITS
+ PASS1_BITS
+ 3) & RANGE_MASK
];
1187 outptr
[DCTSIZE1
* 1] = rnglimit
[(int)DESCALE(tmp11
+ tmp2
, CONST_BITS
+ PASS1_BITS
+ 3) & RANGE_MASK
];
1188 outptr
[DCTSIZE1
* 6] = rnglimit
[(int)DESCALE(tmp11
- tmp2
, CONST_BITS
+ PASS1_BITS
+ 3) & RANGE_MASK
];
1189 outptr
[DCTSIZE1
* 2] = rnglimit
[(int)DESCALE(tmp12
+ tmp1
, CONST_BITS
+ PASS1_BITS
+ 3) & RANGE_MASK
];
1190 outptr
[DCTSIZE1
* 5] = rnglimit
[(int)DESCALE(tmp12
- tmp1
, CONST_BITS
+ PASS1_BITS
+ 3) & RANGE_MASK
];
1191 outptr
[DCTSIZE1
* 3] = rnglimit
[(int)DESCALE(tmp13
+ tmp0
, CONST_BITS
+ PASS1_BITS
+ 3) & RANGE_MASK
];
1192 outptr
[DCTSIZE1
* 4] = rnglimit
[(int)DESCALE(tmp13
- tmp0
, CONST_BITS
+ PASS1_BITS
+ 3) & RANGE_MASK
];
1194 dataptr
++; /* advance pointer to next column */