annotate jrevdct.c @ 2414:18d77621fbc7 libavcodec

print "D" instead of "P" for dropable frames in flv with -debug 1
author michael
date Thu, 06 Jan 2005 01:02:36 +0000
parents 258f21820108
children ef2149182f1c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
1 /*
986e461dc072 Initial revision
glantau
parents:
diff changeset
2 * jrevdct.c
986e461dc072 Initial revision
glantau
parents:
diff changeset
3 *
986e461dc072 Initial revision
glantau
parents:
diff changeset
4 * Copyright (C) 1991, 1992, Thomas G. Lane.
986e461dc072 Initial revision
glantau
parents:
diff changeset
5 * This file is part of the Independent JPEG Group's software.
986e461dc072 Initial revision
glantau
parents:
diff changeset
6 * For conditions of distribution and use, see the accompanying README file.
986e461dc072 Initial revision
glantau
parents:
diff changeset
7 *
986e461dc072 Initial revision
glantau
parents:
diff changeset
8 * This file contains the basic inverse-DCT transformation subroutine.
986e461dc072 Initial revision
glantau
parents:
diff changeset
9 *
986e461dc072 Initial revision
glantau
parents:
diff changeset
10 * This implementation is based on an algorithm described in
986e461dc072 Initial revision
glantau
parents:
diff changeset
11 * C. Loeffler, A. Ligtenberg and G. Moschytz, "Practical Fast 1-D DCT
986e461dc072 Initial revision
glantau
parents:
diff changeset
12 * Algorithms with 11 Multiplications", Proc. Int'l. Conf. on Acoustics,
986e461dc072 Initial revision
glantau
parents:
diff changeset
13 * Speech, and Signal Processing 1989 (ICASSP '89), pp. 988-991.
986e461dc072 Initial revision
glantau
parents:
diff changeset
14 * The primary algorithm described there uses 11 multiplies and 29 adds.
986e461dc072 Initial revision
glantau
parents:
diff changeset
15 * We use their alternate method with 12 multiplies and 32 adds.
986e461dc072 Initial revision
glantau
parents:
diff changeset
16 * The advantage of this method is that no data path contains more than one
986e461dc072 Initial revision
glantau
parents:
diff changeset
17 * multiplication; this allows a very simple and accurate implementation in
986e461dc072 Initial revision
glantau
parents:
diff changeset
18 * scaled fixed-point arithmetic, with a minimal number of shifts.
986e461dc072 Initial revision
glantau
parents:
diff changeset
19 *
986e461dc072 Initial revision
glantau
parents:
diff changeset
20 * I've made lots of modifications to attempt to take advantage of the
986e461dc072 Initial revision
glantau
parents:
diff changeset
21 * sparse nature of the DCT matrices we're getting. Although the logic
986e461dc072 Initial revision
glantau
parents:
diff changeset
22 * is cumbersome, it's straightforward and the resulting code is much
986e461dc072 Initial revision
glantau
parents:
diff changeset
23 * faster.
986e461dc072 Initial revision
glantau
parents:
diff changeset
24 *
986e461dc072 Initial revision
glantau
parents:
diff changeset
25 * A better way to do this would be to pass in the DCT block as a sparse
986e461dc072 Initial revision
glantau
parents:
diff changeset
26 * matrix, perhaps with the difference cases encoded.
986e461dc072 Initial revision
glantau
parents:
diff changeset
27 */
1106
1e39f273ecd6 per file doxy
michaelni
parents: 1064
diff changeset
28
1e39f273ecd6 per file doxy
michaelni
parents: 1064
diff changeset
29 /**
1e39f273ecd6 per file doxy
michaelni
parents: 1064
diff changeset
30 * @file jrevdct.c
1e39f273ecd6 per file doxy
michaelni
parents: 1064
diff changeset
31 * Independent JPEG Group's LLM idct.
1e39f273ecd6 per file doxy
michaelni
parents: 1064
diff changeset
32 */
1e39f273ecd6 per file doxy
michaelni
parents: 1064
diff changeset
33
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
34 #include "common.h"
986e461dc072 Initial revision
glantau
parents:
diff changeset
35 #include "dsputil.h"
986e461dc072 Initial revision
glantau
parents:
diff changeset
36
986e461dc072 Initial revision
glantau
parents:
diff changeset
37 #define EIGHT_BIT_SAMPLES
986e461dc072 Initial revision
glantau
parents:
diff changeset
38
986e461dc072 Initial revision
glantau
parents:
diff changeset
39 #define DCTSIZE 8
986e461dc072 Initial revision
glantau
parents:
diff changeset
40 #define DCTSIZE2 64
986e461dc072 Initial revision
glantau
parents:
diff changeset
41
986e461dc072 Initial revision
glantau
parents:
diff changeset
42 #define GLOBAL
986e461dc072 Initial revision
glantau
parents:
diff changeset
43
986e461dc072 Initial revision
glantau
parents:
diff changeset
44 #define RIGHT_SHIFT(x, n) ((x) >> (n))
986e461dc072 Initial revision
glantau
parents:
diff changeset
45
986e461dc072 Initial revision
glantau
parents:
diff changeset
46 typedef DCTELEM DCTBLOCK[DCTSIZE2];
986e461dc072 Initial revision
glantau
parents:
diff changeset
47
986e461dc072 Initial revision
glantau
parents:
diff changeset
48 #define CONST_BITS 13
986e461dc072 Initial revision
glantau
parents:
diff changeset
49
986e461dc072 Initial revision
glantau
parents:
diff changeset
50 /*
986e461dc072 Initial revision
glantau
parents:
diff changeset
51 * This routine is specialized to the case DCTSIZE = 8.
986e461dc072 Initial revision
glantau
parents:
diff changeset
52 */
986e461dc072 Initial revision
glantau
parents:
diff changeset
53
986e461dc072 Initial revision
glantau
parents:
diff changeset
54 #if DCTSIZE != 8
986e461dc072 Initial revision
glantau
parents:
diff changeset
55 Sorry, this code only copes with 8x8 DCTs. /* deliberate syntax err */
986e461dc072 Initial revision
glantau
parents:
diff changeset
56 #endif
986e461dc072 Initial revision
glantau
parents:
diff changeset
57
986e461dc072 Initial revision
glantau
parents:
diff changeset
58
986e461dc072 Initial revision
glantau
parents:
diff changeset
59 /*
986e461dc072 Initial revision
glantau
parents:
diff changeset
60 * A 2-D IDCT can be done by 1-D IDCT on each row followed by 1-D IDCT
986e461dc072 Initial revision
glantau
parents:
diff changeset
61 * on each column. Direct algorithms are also available, but they are
986e461dc072 Initial revision
glantau
parents:
diff changeset
62 * much more complex and seem not to be any faster when reduced to code.
986e461dc072 Initial revision
glantau
parents:
diff changeset
63 *
986e461dc072 Initial revision
glantau
parents:
diff changeset
64 * The poop on this scaling stuff is as follows:
986e461dc072 Initial revision
glantau
parents:
diff changeset
65 *
986e461dc072 Initial revision
glantau
parents:
diff changeset
66 * Each 1-D IDCT step produces outputs which are a factor of sqrt(N)
986e461dc072 Initial revision
glantau
parents:
diff changeset
67 * larger than the true IDCT outputs. The final outputs are therefore
986e461dc072 Initial revision
glantau
parents:
diff changeset
68 * a factor of N larger than desired; since N=8 this can be cured by
986e461dc072 Initial revision
glantau
parents:
diff changeset
69 * a simple right shift at the end of the algorithm. The advantage of
986e461dc072 Initial revision
glantau
parents:
diff changeset
70 * this arrangement is that we save two multiplications per 1-D IDCT,
986e461dc072 Initial revision
glantau
parents:
diff changeset
71 * because the y0 and y4 inputs need not be divided by sqrt(N).
986e461dc072 Initial revision
glantau
parents:
diff changeset
72 *
986e461dc072 Initial revision
glantau
parents:
diff changeset
73 * We have to do addition and subtraction of the integer inputs, which
986e461dc072 Initial revision
glantau
parents:
diff changeset
74 * is no problem, and multiplication by fractional constants, which is
986e461dc072 Initial revision
glantau
parents:
diff changeset
75 * a problem to do in integer arithmetic. We multiply all the constants
986e461dc072 Initial revision
glantau
parents:
diff changeset
76 * by CONST_SCALE and convert them to integer constants (thus retaining
986e461dc072 Initial revision
glantau
parents:
diff changeset
77 * CONST_BITS bits of precision in the constants). After doing a
986e461dc072 Initial revision
glantau
parents:
diff changeset
78 * multiplication we have to divide the product by CONST_SCALE, with proper
986e461dc072 Initial revision
glantau
parents:
diff changeset
79 * rounding, to produce the correct output. This division can be done
986e461dc072 Initial revision
glantau
parents:
diff changeset
80 * cheaply as a right shift of CONST_BITS bits. We postpone shifting
986e461dc072 Initial revision
glantau
parents:
diff changeset
81 * as long as possible so that partial sums can be added together with
986e461dc072 Initial revision
glantau
parents:
diff changeset
82 * full fractional precision.
986e461dc072 Initial revision
glantau
parents:
diff changeset
83 *
986e461dc072 Initial revision
glantau
parents:
diff changeset
84 * The outputs of the first pass are scaled up by PASS1_BITS bits so that
986e461dc072 Initial revision
glantau
parents:
diff changeset
85 * they are represented to better-than-integral precision. These outputs
986e461dc072 Initial revision
glantau
parents:
diff changeset
86 * require BITS_IN_JSAMPLE + PASS1_BITS + 3 bits; this fits in a 16-bit word
986e461dc072 Initial revision
glantau
parents:
diff changeset
87 * with the recommended scaling. (To scale up 12-bit sample data further, an
986e461dc072 Initial revision
glantau
parents:
diff changeset
88 * intermediate int32 array would be needed.)
986e461dc072 Initial revision
glantau
parents:
diff changeset
89 *
986e461dc072 Initial revision
glantau
parents:
diff changeset
90 * To avoid overflow of the 32-bit intermediate results in pass 2, we must
986e461dc072 Initial revision
glantau
parents:
diff changeset
91 * have BITS_IN_JSAMPLE + CONST_BITS + PASS1_BITS <= 26. Error analysis
986e461dc072 Initial revision
glantau
parents:
diff changeset
92 * shows that the values given below are the most effective.
986e461dc072 Initial revision
glantau
parents:
diff changeset
93 */
986e461dc072 Initial revision
glantau
parents:
diff changeset
94
986e461dc072 Initial revision
glantau
parents:
diff changeset
95 #ifdef EIGHT_BIT_SAMPLES
986e461dc072 Initial revision
glantau
parents:
diff changeset
96 #define PASS1_BITS 2
986e461dc072 Initial revision
glantau
parents:
diff changeset
97 #else
986e461dc072 Initial revision
glantau
parents:
diff changeset
98 #define PASS1_BITS 1 /* lose a little precision to avoid overflow */
986e461dc072 Initial revision
glantau
parents:
diff changeset
99 #endif
986e461dc072 Initial revision
glantau
parents:
diff changeset
100
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 440
diff changeset
101 #define ONE ((int32_t) 1)
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
102
986e461dc072 Initial revision
glantau
parents:
diff changeset
103 #define CONST_SCALE (ONE << CONST_BITS)
986e461dc072 Initial revision
glantau
parents:
diff changeset
104
986e461dc072 Initial revision
glantau
parents:
diff changeset
105 /* Convert a positive real constant to an integer scaled by CONST_SCALE.
986e461dc072 Initial revision
glantau
parents:
diff changeset
106 * IMPORTANT: if your compiler doesn't do this arithmetic at compile time,
986e461dc072 Initial revision
glantau
parents:
diff changeset
107 * you will pay a significant penalty in run time. In that case, figure
986e461dc072 Initial revision
glantau
parents:
diff changeset
108 * the correct integer constant values and insert them by hand.
986e461dc072 Initial revision
glantau
parents:
diff changeset
109 */
986e461dc072 Initial revision
glantau
parents:
diff changeset
110
986e461dc072 Initial revision
glantau
parents:
diff changeset
111 /* Actually FIX is no longer used, we precomputed them all */
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 440
diff changeset
112 #define FIX(x) ((int32_t) ((x) * CONST_SCALE + 0.5))
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
113
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 440
diff changeset
114 /* Descale and correctly round an int32_t value that's scaled by N bits.
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
115 * We assume RIGHT_SHIFT rounds towards minus infinity, so adding
986e461dc072 Initial revision
glantau
parents:
diff changeset
116 * the fudge factor is correct for either sign of X.
986e461dc072 Initial revision
glantau
parents:
diff changeset
117 */
986e461dc072 Initial revision
glantau
parents:
diff changeset
118
986e461dc072 Initial revision
glantau
parents:
diff changeset
119 #define DESCALE(x,n) RIGHT_SHIFT((x) + (ONE << ((n)-1)), n)
986e461dc072 Initial revision
glantau
parents:
diff changeset
120
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 440
diff changeset
121 /* Multiply an int32_t variable by an int32_t constant to yield an int32_t result.
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
122 * For 8-bit samples with the recommended scaling, all the variable
986e461dc072 Initial revision
glantau
parents:
diff changeset
123 * and constant values involved are no more than 16 bits wide, so a
986e461dc072 Initial revision
glantau
parents:
diff changeset
124 * 16x16->32 bit multiply can be used instead of a full 32x32 multiply;
986e461dc072 Initial revision
glantau
parents:
diff changeset
125 * this provides a useful speedup on many machines.
986e461dc072 Initial revision
glantau
parents:
diff changeset
126 * There is no way to specify a 16x16->32 multiply in portable C, but
986e461dc072 Initial revision
glantau
parents:
diff changeset
127 * some C compilers will do the right thing if you provide the correct
986e461dc072 Initial revision
glantau
parents:
diff changeset
128 * combination of casts.
986e461dc072 Initial revision
glantau
parents:
diff changeset
129 * NB: for 12-bit samples, a full 32-bit multiplication will be needed.
986e461dc072 Initial revision
glantau
parents:
diff changeset
130 */
986e461dc072 Initial revision
glantau
parents:
diff changeset
131
986e461dc072 Initial revision
glantau
parents:
diff changeset
132 #ifdef EIGHT_BIT_SAMPLES
986e461dc072 Initial revision
glantau
parents:
diff changeset
133 #ifdef SHORTxSHORT_32 /* may work if 'int' is 32 bits */
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 440
diff changeset
134 #define MULTIPLY(var,const) (((int16_t) (var)) * ((int16_t) (const)))
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
135 #endif
986e461dc072 Initial revision
glantau
parents:
diff changeset
136 #ifdef SHORTxLCONST_32 /* known to work with Microsoft C 6.0 */
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 440
diff changeset
137 #define MULTIPLY(var,const) (((int16_t) (var)) * ((int32_t) (const)))
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
138 #endif
986e461dc072 Initial revision
glantau
parents:
diff changeset
139 #endif
986e461dc072 Initial revision
glantau
parents:
diff changeset
140
986e461dc072 Initial revision
glantau
parents:
diff changeset
141 #ifndef MULTIPLY /* default definition */
986e461dc072 Initial revision
glantau
parents:
diff changeset
142 #define MULTIPLY(var,const) ((var) * (const))
986e461dc072 Initial revision
glantau
parents:
diff changeset
143 #endif
986e461dc072 Initial revision
glantau
parents:
diff changeset
144
986e461dc072 Initial revision
glantau
parents:
diff changeset
145
986e461dc072 Initial revision
glantau
parents:
diff changeset
146 /*
986e461dc072 Initial revision
glantau
parents:
diff changeset
147 Unlike our decoder where we approximate the FIXes, we need to use exact
986e461dc072 Initial revision
glantau
parents:
diff changeset
148 ones here or successive P-frames will drift too much with Reference frame coding
986e461dc072 Initial revision
glantau
parents:
diff changeset
149 */
986e461dc072 Initial revision
glantau
parents:
diff changeset
150 #define FIX_0_211164243 1730
986e461dc072 Initial revision
glantau
parents:
diff changeset
151 #define FIX_0_275899380 2260
986e461dc072 Initial revision
glantau
parents:
diff changeset
152 #define FIX_0_298631336 2446
986e461dc072 Initial revision
glantau
parents:
diff changeset
153 #define FIX_0_390180644 3196
986e461dc072 Initial revision
glantau
parents:
diff changeset
154 #define FIX_0_509795579 4176
986e461dc072 Initial revision
glantau
parents:
diff changeset
155 #define FIX_0_541196100 4433
986e461dc072 Initial revision
glantau
parents:
diff changeset
156 #define FIX_0_601344887 4926
986e461dc072 Initial revision
glantau
parents:
diff changeset
157 #define FIX_0_765366865 6270
986e461dc072 Initial revision
glantau
parents:
diff changeset
158 #define FIX_0_785694958 6436
986e461dc072 Initial revision
glantau
parents:
diff changeset
159 #define FIX_0_899976223 7373
986e461dc072 Initial revision
glantau
parents:
diff changeset
160 #define FIX_1_061594337 8697
986e461dc072 Initial revision
glantau
parents:
diff changeset
161 #define FIX_1_111140466 9102
986e461dc072 Initial revision
glantau
parents:
diff changeset
162 #define FIX_1_175875602 9633
986e461dc072 Initial revision
glantau
parents:
diff changeset
163 #define FIX_1_306562965 10703
986e461dc072 Initial revision
glantau
parents:
diff changeset
164 #define FIX_1_387039845 11363
986e461dc072 Initial revision
glantau
parents:
diff changeset
165 #define FIX_1_451774981 11893
986e461dc072 Initial revision
glantau
parents:
diff changeset
166 #define FIX_1_501321110 12299
986e461dc072 Initial revision
glantau
parents:
diff changeset
167 #define FIX_1_662939225 13623
986e461dc072 Initial revision
glantau
parents:
diff changeset
168 #define FIX_1_847759065 15137
986e461dc072 Initial revision
glantau
parents:
diff changeset
169 #define FIX_1_961570560 16069
986e461dc072 Initial revision
glantau
parents:
diff changeset
170 #define FIX_2_053119869 16819
986e461dc072 Initial revision
glantau
parents:
diff changeset
171 #define FIX_2_172734803 17799
986e461dc072 Initial revision
glantau
parents:
diff changeset
172 #define FIX_2_562915447 20995
986e461dc072 Initial revision
glantau
parents:
diff changeset
173 #define FIX_3_072711026 25172
986e461dc072 Initial revision
glantau
parents:
diff changeset
174
986e461dc072 Initial revision
glantau
parents:
diff changeset
175 /*
986e461dc072 Initial revision
glantau
parents:
diff changeset
176 * Perform the inverse DCT on one block of coefficients.
986e461dc072 Initial revision
glantau
parents:
diff changeset
177 */
986e461dc072 Initial revision
glantau
parents:
diff changeset
178
986e461dc072 Initial revision
glantau
parents:
diff changeset
179 void j_rev_dct(DCTBLOCK data)
986e461dc072 Initial revision
glantau
parents:
diff changeset
180 {
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 440
diff changeset
181 int32_t tmp0, tmp1, tmp2, tmp3;
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 440
diff changeset
182 int32_t tmp10, tmp11, tmp12, tmp13;
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 440
diff changeset
183 int32_t z1, z2, z3, z4, z5;
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 440
diff changeset
184 int32_t d0, d1, d2, d3, d4, d5, d6, d7;
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
185 register DCTELEM *dataptr;
986e461dc072 Initial revision
glantau
parents:
diff changeset
186 int rowctr;
986e461dc072 Initial revision
glantau
parents:
diff changeset
187
986e461dc072 Initial revision
glantau
parents:
diff changeset
188 /* Pass 1: process rows. */
986e461dc072 Initial revision
glantau
parents:
diff changeset
189 /* Note results are scaled up by sqrt(8) compared to a true IDCT; */
986e461dc072 Initial revision
glantau
parents:
diff changeset
190 /* furthermore, we scale the results by 2**PASS1_BITS. */
986e461dc072 Initial revision
glantau
parents:
diff changeset
191
986e461dc072 Initial revision
glantau
parents:
diff changeset
192 dataptr = data;
986e461dc072 Initial revision
glantau
parents:
diff changeset
193
986e461dc072 Initial revision
glantau
parents:
diff changeset
194 for (rowctr = DCTSIZE-1; rowctr >= 0; rowctr--) {
986e461dc072 Initial revision
glantau
parents:
diff changeset
195 /* Due to quantization, we will usually find that many of the input
986e461dc072 Initial revision
glantau
parents:
diff changeset
196 * coefficients are zero, especially the AC terms. We can exploit this
986e461dc072 Initial revision
glantau
parents:
diff changeset
197 * by short-circuiting the IDCT calculation for any row in which all
986e461dc072 Initial revision
glantau
parents:
diff changeset
198 * the AC terms are zero. In that case each output is equal to the
986e461dc072 Initial revision
glantau
parents:
diff changeset
199 * DC coefficient (with scale factor as needed).
986e461dc072 Initial revision
glantau
parents:
diff changeset
200 * With typical images and quantization tables, half or more of the
986e461dc072 Initial revision
glantau
parents:
diff changeset
201 * row DCT calculations can be simplified this way.
986e461dc072 Initial revision
glantau
parents:
diff changeset
202 */
986e461dc072 Initial revision
glantau
parents:
diff changeset
203
986e461dc072 Initial revision
glantau
parents:
diff changeset
204 register int *idataptr = (int*)dataptr;
986e461dc072 Initial revision
glantau
parents:
diff changeset
205
36
23723a0ebd24 permuted coefs in normal IDCT to avoid having different cases there
glantau
parents: 0
diff changeset
206 /* WARNING: we do the same permutation as MMX idct to simplify the
23723a0ebd24 permuted coefs in normal IDCT to avoid having different cases there
glantau
parents: 0
diff changeset
207 video core */
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
208 d0 = dataptr[0];
36
23723a0ebd24 permuted coefs in normal IDCT to avoid having different cases there
glantau
parents: 0
diff changeset
209 d2 = dataptr[1];
23723a0ebd24 permuted coefs in normal IDCT to avoid having different cases there
glantau
parents: 0
diff changeset
210 d4 = dataptr[2];
23723a0ebd24 permuted coefs in normal IDCT to avoid having different cases there
glantau
parents: 0
diff changeset
211 d6 = dataptr[3];
23723a0ebd24 permuted coefs in normal IDCT to avoid having different cases there
glantau
parents: 0
diff changeset
212 d1 = dataptr[4];
23723a0ebd24 permuted coefs in normal IDCT to avoid having different cases there
glantau
parents: 0
diff changeset
213 d3 = dataptr[5];
23723a0ebd24 permuted coefs in normal IDCT to avoid having different cases there
glantau
parents: 0
diff changeset
214 d5 = dataptr[6];
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
215 d7 = dataptr[7];
986e461dc072 Initial revision
glantau
parents:
diff changeset
216
36
23723a0ebd24 permuted coefs in normal IDCT to avoid having different cases there
glantau
parents: 0
diff changeset
217 if ((d1 | d2 | d3 | d4 | d5 | d6 | d7) == 0) {
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
218 /* AC terms all zero */
986e461dc072 Initial revision
glantau
parents:
diff changeset
219 if (d0) {
986e461dc072 Initial revision
glantau
parents:
diff changeset
220 /* Compute a 32 bit value to assign. */
986e461dc072 Initial revision
glantau
parents:
diff changeset
221 DCTELEM dcval = (DCTELEM) (d0 << PASS1_BITS);
986e461dc072 Initial revision
glantau
parents:
diff changeset
222 register int v = (dcval & 0xffff) | ((dcval << 16) & 0xffff0000);
986e461dc072 Initial revision
glantau
parents:
diff changeset
223
986e461dc072 Initial revision
glantau
parents:
diff changeset
224 idataptr[0] = v;
986e461dc072 Initial revision
glantau
parents:
diff changeset
225 idataptr[1] = v;
986e461dc072 Initial revision
glantau
parents:
diff changeset
226 idataptr[2] = v;
986e461dc072 Initial revision
glantau
parents:
diff changeset
227 idataptr[3] = v;
986e461dc072 Initial revision
glantau
parents:
diff changeset
228 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
229
986e461dc072 Initial revision
glantau
parents:
diff changeset
230 dataptr += DCTSIZE; /* advance pointer to next row */
986e461dc072 Initial revision
glantau
parents:
diff changeset
231 continue;
986e461dc072 Initial revision
glantau
parents:
diff changeset
232 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
233
986e461dc072 Initial revision
glantau
parents:
diff changeset
234 /* Even part: reverse the even part of the forward DCT. */
986e461dc072 Initial revision
glantau
parents:
diff changeset
235 /* The rotator is sqrt(2)*c(-6). */
986e461dc072 Initial revision
glantau
parents:
diff changeset
236 {
986e461dc072 Initial revision
glantau
parents:
diff changeset
237 if (d6) {
986e461dc072 Initial revision
glantau
parents:
diff changeset
238 if (d2) {
986e461dc072 Initial revision
glantau
parents:
diff changeset
239 /* d0 != 0, d2 != 0, d4 != 0, d6 != 0 */
986e461dc072 Initial revision
glantau
parents:
diff changeset
240 z1 = MULTIPLY(d2 + d6, FIX_0_541196100);
986e461dc072 Initial revision
glantau
parents:
diff changeset
241 tmp2 = z1 + MULTIPLY(-d6, FIX_1_847759065);
986e461dc072 Initial revision
glantau
parents:
diff changeset
242 tmp3 = z1 + MULTIPLY(d2, FIX_0_765366865);
986e461dc072 Initial revision
glantau
parents:
diff changeset
243
986e461dc072 Initial revision
glantau
parents:
diff changeset
244 tmp0 = (d0 + d4) << CONST_BITS;
986e461dc072 Initial revision
glantau
parents:
diff changeset
245 tmp1 = (d0 - d4) << CONST_BITS;
986e461dc072 Initial revision
glantau
parents:
diff changeset
246
986e461dc072 Initial revision
glantau
parents:
diff changeset
247 tmp10 = tmp0 + tmp3;
986e461dc072 Initial revision
glantau
parents:
diff changeset
248 tmp13 = tmp0 - tmp3;
986e461dc072 Initial revision
glantau
parents:
diff changeset
249 tmp11 = tmp1 + tmp2;
986e461dc072 Initial revision
glantau
parents:
diff changeset
250 tmp12 = tmp1 - tmp2;
986e461dc072 Initial revision
glantau
parents:
diff changeset
251 } else {
986e461dc072 Initial revision
glantau
parents:
diff changeset
252 /* d0 != 0, d2 == 0, d4 != 0, d6 != 0 */
986e461dc072 Initial revision
glantau
parents:
diff changeset
253 tmp2 = MULTIPLY(-d6, FIX_1_306562965);
986e461dc072 Initial revision
glantau
parents:
diff changeset
254 tmp3 = MULTIPLY(d6, FIX_0_541196100);
986e461dc072 Initial revision
glantau
parents:
diff changeset
255
986e461dc072 Initial revision
glantau
parents:
diff changeset
256 tmp0 = (d0 + d4) << CONST_BITS;
986e461dc072 Initial revision
glantau
parents:
diff changeset
257 tmp1 = (d0 - d4) << CONST_BITS;
986e461dc072 Initial revision
glantau
parents:
diff changeset
258
986e461dc072 Initial revision
glantau
parents:
diff changeset
259 tmp10 = tmp0 + tmp3;
986e461dc072 Initial revision
glantau
parents:
diff changeset
260 tmp13 = tmp0 - tmp3;
986e461dc072 Initial revision
glantau
parents:
diff changeset
261 tmp11 = tmp1 + tmp2;
986e461dc072 Initial revision
glantau
parents:
diff changeset
262 tmp12 = tmp1 - tmp2;
986e461dc072 Initial revision
glantau
parents:
diff changeset
263 }
2263
258f21820108 porting optimizations from 4x4 dct to 8x8
michael
parents: 2262
diff changeset
264 } else {
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
265 if (d2) {
986e461dc072 Initial revision
glantau
parents:
diff changeset
266 /* d0 != 0, d2 != 0, d4 != 0, d6 == 0 */
986e461dc072 Initial revision
glantau
parents:
diff changeset
267 tmp2 = MULTIPLY(d2, FIX_0_541196100);
986e461dc072 Initial revision
glantau
parents:
diff changeset
268 tmp3 = MULTIPLY(d2, FIX_1_306562965);
986e461dc072 Initial revision
glantau
parents:
diff changeset
269
986e461dc072 Initial revision
glantau
parents:
diff changeset
270 tmp0 = (d0 + d4) << CONST_BITS;
986e461dc072 Initial revision
glantau
parents:
diff changeset
271 tmp1 = (d0 - d4) << CONST_BITS;
986e461dc072 Initial revision
glantau
parents:
diff changeset
272
986e461dc072 Initial revision
glantau
parents:
diff changeset
273 tmp10 = tmp0 + tmp3;
986e461dc072 Initial revision
glantau
parents:
diff changeset
274 tmp13 = tmp0 - tmp3;
986e461dc072 Initial revision
glantau
parents:
diff changeset
275 tmp11 = tmp1 + tmp2;
986e461dc072 Initial revision
glantau
parents:
diff changeset
276 tmp12 = tmp1 - tmp2;
986e461dc072 Initial revision
glantau
parents:
diff changeset
277 } else {
986e461dc072 Initial revision
glantau
parents:
diff changeset
278 /* d0 != 0, d2 == 0, d4 != 0, d6 == 0 */
986e461dc072 Initial revision
glantau
parents:
diff changeset
279 tmp10 = tmp13 = (d0 + d4) << CONST_BITS;
986e461dc072 Initial revision
glantau
parents:
diff changeset
280 tmp11 = tmp12 = (d0 - d4) << CONST_BITS;
986e461dc072 Initial revision
glantau
parents:
diff changeset
281 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
282 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
283
986e461dc072 Initial revision
glantau
parents:
diff changeset
284 /* Odd part per figure 8; the matrix is unitary and hence its
986e461dc072 Initial revision
glantau
parents:
diff changeset
285 * transpose is its inverse. i0..i3 are y7,y5,y3,y1 respectively.
986e461dc072 Initial revision
glantau
parents:
diff changeset
286 */
986e461dc072 Initial revision
glantau
parents:
diff changeset
287
986e461dc072 Initial revision
glantau
parents:
diff changeset
288 if (d7) {
986e461dc072 Initial revision
glantau
parents:
diff changeset
289 if (d5) {
986e461dc072 Initial revision
glantau
parents:
diff changeset
290 if (d3) {
986e461dc072 Initial revision
glantau
parents:
diff changeset
291 if (d1) {
986e461dc072 Initial revision
glantau
parents:
diff changeset
292 /* d1 != 0, d3 != 0, d5 != 0, d7 != 0 */
986e461dc072 Initial revision
glantau
parents:
diff changeset
293 z1 = d7 + d1;
986e461dc072 Initial revision
glantau
parents:
diff changeset
294 z2 = d5 + d3;
986e461dc072 Initial revision
glantau
parents:
diff changeset
295 z3 = d7 + d3;
986e461dc072 Initial revision
glantau
parents:
diff changeset
296 z4 = d5 + d1;
986e461dc072 Initial revision
glantau
parents:
diff changeset
297 z5 = MULTIPLY(z3 + z4, FIX_1_175875602);
986e461dc072 Initial revision
glantau
parents:
diff changeset
298
986e461dc072 Initial revision
glantau
parents:
diff changeset
299 tmp0 = MULTIPLY(d7, FIX_0_298631336);
986e461dc072 Initial revision
glantau
parents:
diff changeset
300 tmp1 = MULTIPLY(d5, FIX_2_053119869);
986e461dc072 Initial revision
glantau
parents:
diff changeset
301 tmp2 = MULTIPLY(d3, FIX_3_072711026);
986e461dc072 Initial revision
glantau
parents:
diff changeset
302 tmp3 = MULTIPLY(d1, FIX_1_501321110);
986e461dc072 Initial revision
glantau
parents:
diff changeset
303 z1 = MULTIPLY(-z1, FIX_0_899976223);
986e461dc072 Initial revision
glantau
parents:
diff changeset
304 z2 = MULTIPLY(-z2, FIX_2_562915447);
986e461dc072 Initial revision
glantau
parents:
diff changeset
305 z3 = MULTIPLY(-z3, FIX_1_961570560);
986e461dc072 Initial revision
glantau
parents:
diff changeset
306 z4 = MULTIPLY(-z4, FIX_0_390180644);
986e461dc072 Initial revision
glantau
parents:
diff changeset
307
986e461dc072 Initial revision
glantau
parents:
diff changeset
308 z3 += z5;
986e461dc072 Initial revision
glantau
parents:
diff changeset
309 z4 += z5;
986e461dc072 Initial revision
glantau
parents:
diff changeset
310
986e461dc072 Initial revision
glantau
parents:
diff changeset
311 tmp0 += z1 + z3;
986e461dc072 Initial revision
glantau
parents:
diff changeset
312 tmp1 += z2 + z4;
986e461dc072 Initial revision
glantau
parents:
diff changeset
313 tmp2 += z2 + z3;
986e461dc072 Initial revision
glantau
parents:
diff changeset
314 tmp3 += z1 + z4;
986e461dc072 Initial revision
glantau
parents:
diff changeset
315 } else {
986e461dc072 Initial revision
glantau
parents:
diff changeset
316 /* d1 == 0, d3 != 0, d5 != 0, d7 != 0 */
986e461dc072 Initial revision
glantau
parents:
diff changeset
317 z2 = d5 + d3;
986e461dc072 Initial revision
glantau
parents:
diff changeset
318 z3 = d7 + d3;
986e461dc072 Initial revision
glantau
parents:
diff changeset
319 z5 = MULTIPLY(z3 + d5, FIX_1_175875602);
986e461dc072 Initial revision
glantau
parents:
diff changeset
320
986e461dc072 Initial revision
glantau
parents:
diff changeset
321 tmp0 = MULTIPLY(d7, FIX_0_298631336);
986e461dc072 Initial revision
glantau
parents:
diff changeset
322 tmp1 = MULTIPLY(d5, FIX_2_053119869);
986e461dc072 Initial revision
glantau
parents:
diff changeset
323 tmp2 = MULTIPLY(d3, FIX_3_072711026);
986e461dc072 Initial revision
glantau
parents:
diff changeset
324 z1 = MULTIPLY(-d7, FIX_0_899976223);
986e461dc072 Initial revision
glantau
parents:
diff changeset
325 z2 = MULTIPLY(-z2, FIX_2_562915447);
986e461dc072 Initial revision
glantau
parents:
diff changeset
326 z3 = MULTIPLY(-z3, FIX_1_961570560);
986e461dc072 Initial revision
glantau
parents:
diff changeset
327 z4 = MULTIPLY(-d5, FIX_0_390180644);
986e461dc072 Initial revision
glantau
parents:
diff changeset
328
986e461dc072 Initial revision
glantau
parents:
diff changeset
329 z3 += z5;
986e461dc072 Initial revision
glantau
parents:
diff changeset
330 z4 += z5;
986e461dc072 Initial revision
glantau
parents:
diff changeset
331
986e461dc072 Initial revision
glantau
parents:
diff changeset
332 tmp0 += z1 + z3;
986e461dc072 Initial revision
glantau
parents:
diff changeset
333 tmp1 += z2 + z4;
986e461dc072 Initial revision
glantau
parents:
diff changeset
334 tmp2 += z2 + z3;
986e461dc072 Initial revision
glantau
parents:
diff changeset
335 tmp3 = z1 + z4;
986e461dc072 Initial revision
glantau
parents:
diff changeset
336 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
337 } else {
986e461dc072 Initial revision
glantau
parents:
diff changeset
338 if (d1) {
986e461dc072 Initial revision
glantau
parents:
diff changeset
339 /* d1 != 0, d3 == 0, d5 != 0, d7 != 0 */
986e461dc072 Initial revision
glantau
parents:
diff changeset
340 z1 = d7 + d1;
986e461dc072 Initial revision
glantau
parents:
diff changeset
341 z4 = d5 + d1;
986e461dc072 Initial revision
glantau
parents:
diff changeset
342 z5 = MULTIPLY(d7 + z4, FIX_1_175875602);
986e461dc072 Initial revision
glantau
parents:
diff changeset
343
986e461dc072 Initial revision
glantau
parents:
diff changeset
344 tmp0 = MULTIPLY(d7, FIX_0_298631336);
986e461dc072 Initial revision
glantau
parents:
diff changeset
345 tmp1 = MULTIPLY(d5, FIX_2_053119869);
986e461dc072 Initial revision
glantau
parents:
diff changeset
346 tmp3 = MULTIPLY(d1, FIX_1_501321110);
986e461dc072 Initial revision
glantau
parents:
diff changeset
347 z1 = MULTIPLY(-z1, FIX_0_899976223);
986e461dc072 Initial revision
glantau
parents:
diff changeset
348 z2 = MULTIPLY(-d5, FIX_2_562915447);
986e461dc072 Initial revision
glantau
parents:
diff changeset
349 z3 = MULTIPLY(-d7, FIX_1_961570560);
986e461dc072 Initial revision
glantau
parents:
diff changeset
350 z4 = MULTIPLY(-z4, FIX_0_390180644);
986e461dc072 Initial revision
glantau
parents:
diff changeset
351
986e461dc072 Initial revision
glantau
parents:
diff changeset
352 z3 += z5;
986e461dc072 Initial revision
glantau
parents:
diff changeset
353 z4 += z5;
986e461dc072 Initial revision
glantau
parents:
diff changeset
354
986e461dc072 Initial revision
glantau
parents:
diff changeset
355 tmp0 += z1 + z3;
986e461dc072 Initial revision
glantau
parents:
diff changeset
356 tmp1 += z2 + z4;
986e461dc072 Initial revision
glantau
parents:
diff changeset
357 tmp2 = z2 + z3;
986e461dc072 Initial revision
glantau
parents:
diff changeset
358 tmp3 += z1 + z4;
986e461dc072 Initial revision
glantau
parents:
diff changeset
359 } else {
986e461dc072 Initial revision
glantau
parents:
diff changeset
360 /* d1 == 0, d3 == 0, d5 != 0, d7 != 0 */
986e461dc072 Initial revision
glantau
parents:
diff changeset
361 tmp0 = MULTIPLY(-d7, FIX_0_601344887);
986e461dc072 Initial revision
glantau
parents:
diff changeset
362 z1 = MULTIPLY(-d7, FIX_0_899976223);
986e461dc072 Initial revision
glantau
parents:
diff changeset
363 z3 = MULTIPLY(-d7, FIX_1_961570560);
986e461dc072 Initial revision
glantau
parents:
diff changeset
364 tmp1 = MULTIPLY(-d5, FIX_0_509795579);
986e461dc072 Initial revision
glantau
parents:
diff changeset
365 z2 = MULTIPLY(-d5, FIX_2_562915447);
986e461dc072 Initial revision
glantau
parents:
diff changeset
366 z4 = MULTIPLY(-d5, FIX_0_390180644);
986e461dc072 Initial revision
glantau
parents:
diff changeset
367 z5 = MULTIPLY(d5 + d7, FIX_1_175875602);
986e461dc072 Initial revision
glantau
parents:
diff changeset
368
986e461dc072 Initial revision
glantau
parents:
diff changeset
369 z3 += z5;
986e461dc072 Initial revision
glantau
parents:
diff changeset
370 z4 += z5;
986e461dc072 Initial revision
glantau
parents:
diff changeset
371
986e461dc072 Initial revision
glantau
parents:
diff changeset
372 tmp0 += z3;
986e461dc072 Initial revision
glantau
parents:
diff changeset
373 tmp1 += z4;
986e461dc072 Initial revision
glantau
parents:
diff changeset
374 tmp2 = z2 + z3;
986e461dc072 Initial revision
glantau
parents:
diff changeset
375 tmp3 = z1 + z4;
986e461dc072 Initial revision
glantau
parents:
diff changeset
376 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
377 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
378 } else {
986e461dc072 Initial revision
glantau
parents:
diff changeset
379 if (d3) {
986e461dc072 Initial revision
glantau
parents:
diff changeset
380 if (d1) {
986e461dc072 Initial revision
glantau
parents:
diff changeset
381 /* d1 != 0, d3 != 0, d5 == 0, d7 != 0 */
986e461dc072 Initial revision
glantau
parents:
diff changeset
382 z1 = d7 + d1;
986e461dc072 Initial revision
glantau
parents:
diff changeset
383 z3 = d7 + d3;
986e461dc072 Initial revision
glantau
parents:
diff changeset
384 z5 = MULTIPLY(z3 + d1, FIX_1_175875602);
986e461dc072 Initial revision
glantau
parents:
diff changeset
385
986e461dc072 Initial revision
glantau
parents:
diff changeset
386 tmp0 = MULTIPLY(d7, FIX_0_298631336);
986e461dc072 Initial revision
glantau
parents:
diff changeset
387 tmp2 = MULTIPLY(d3, FIX_3_072711026);
986e461dc072 Initial revision
glantau
parents:
diff changeset
388 tmp3 = MULTIPLY(d1, FIX_1_501321110);
986e461dc072 Initial revision
glantau
parents:
diff changeset
389 z1 = MULTIPLY(-z1, FIX_0_899976223);
986e461dc072 Initial revision
glantau
parents:
diff changeset
390 z2 = MULTIPLY(-d3, FIX_2_562915447);
986e461dc072 Initial revision
glantau
parents:
diff changeset
391 z3 = MULTIPLY(-z3, FIX_1_961570560);
986e461dc072 Initial revision
glantau
parents:
diff changeset
392 z4 = MULTIPLY(-d1, FIX_0_390180644);
986e461dc072 Initial revision
glantau
parents:
diff changeset
393
986e461dc072 Initial revision
glantau
parents:
diff changeset
394 z3 += z5;
986e461dc072 Initial revision
glantau
parents:
diff changeset
395 z4 += z5;
986e461dc072 Initial revision
glantau
parents:
diff changeset
396
986e461dc072 Initial revision
glantau
parents:
diff changeset
397 tmp0 += z1 + z3;
986e461dc072 Initial revision
glantau
parents:
diff changeset
398 tmp1 = z2 + z4;
986e461dc072 Initial revision
glantau
parents:
diff changeset
399 tmp2 += z2 + z3;
986e461dc072 Initial revision
glantau
parents:
diff changeset
400 tmp3 += z1 + z4;
986e461dc072 Initial revision
glantau
parents:
diff changeset
401 } else {
986e461dc072 Initial revision
glantau
parents:
diff changeset
402 /* d1 == 0, d3 != 0, d5 == 0, d7 != 0 */
986e461dc072 Initial revision
glantau
parents:
diff changeset
403 z3 = d7 + d3;
986e461dc072 Initial revision
glantau
parents:
diff changeset
404
986e461dc072 Initial revision
glantau
parents:
diff changeset
405 tmp0 = MULTIPLY(-d7, FIX_0_601344887);
986e461dc072 Initial revision
glantau
parents:
diff changeset
406 z1 = MULTIPLY(-d7, FIX_0_899976223);
986e461dc072 Initial revision
glantau
parents:
diff changeset
407 tmp2 = MULTIPLY(d3, FIX_0_509795579);
986e461dc072 Initial revision
glantau
parents:
diff changeset
408 z2 = MULTIPLY(-d3, FIX_2_562915447);
986e461dc072 Initial revision
glantau
parents:
diff changeset
409 z5 = MULTIPLY(z3, FIX_1_175875602);
986e461dc072 Initial revision
glantau
parents:
diff changeset
410 z3 = MULTIPLY(-z3, FIX_0_785694958);
986e461dc072 Initial revision
glantau
parents:
diff changeset
411
986e461dc072 Initial revision
glantau
parents:
diff changeset
412 tmp0 += z3;
986e461dc072 Initial revision
glantau
parents:
diff changeset
413 tmp1 = z2 + z5;
986e461dc072 Initial revision
glantau
parents:
diff changeset
414 tmp2 += z3;
986e461dc072 Initial revision
glantau
parents:
diff changeset
415 tmp3 = z1 + z5;
986e461dc072 Initial revision
glantau
parents:
diff changeset
416 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
417 } else {
986e461dc072 Initial revision
glantau
parents:
diff changeset
418 if (d1) {
986e461dc072 Initial revision
glantau
parents:
diff changeset
419 /* d1 != 0, d3 == 0, d5 == 0, d7 != 0 */
986e461dc072 Initial revision
glantau
parents:
diff changeset
420 z1 = d7 + d1;
986e461dc072 Initial revision
glantau
parents:
diff changeset
421 z5 = MULTIPLY(z1, FIX_1_175875602);
986e461dc072 Initial revision
glantau
parents:
diff changeset
422
986e461dc072 Initial revision
glantau
parents:
diff changeset
423 z1 = MULTIPLY(z1, FIX_0_275899380);
986e461dc072 Initial revision
glantau
parents:
diff changeset
424 z3 = MULTIPLY(-d7, FIX_1_961570560);
986e461dc072 Initial revision
glantau
parents:
diff changeset
425 tmp0 = MULTIPLY(-d7, FIX_1_662939225);
986e461dc072 Initial revision
glantau
parents:
diff changeset
426 z4 = MULTIPLY(-d1, FIX_0_390180644);
986e461dc072 Initial revision
glantau
parents:
diff changeset
427 tmp3 = MULTIPLY(d1, FIX_1_111140466);
986e461dc072 Initial revision
glantau
parents:
diff changeset
428
986e461dc072 Initial revision
glantau
parents:
diff changeset
429 tmp0 += z1;
986e461dc072 Initial revision
glantau
parents:
diff changeset
430 tmp1 = z4 + z5;
986e461dc072 Initial revision
glantau
parents:
diff changeset
431 tmp2 = z3 + z5;
986e461dc072 Initial revision
glantau
parents:
diff changeset
432 tmp3 += z1;
986e461dc072 Initial revision
glantau
parents:
diff changeset
433 } else {
986e461dc072 Initial revision
glantau
parents:
diff changeset
434 /* d1 == 0, d3 == 0, d5 == 0, d7 != 0 */
986e461dc072 Initial revision
glantau
parents:
diff changeset
435 tmp0 = MULTIPLY(-d7, FIX_1_387039845);
986e461dc072 Initial revision
glantau
parents:
diff changeset
436 tmp1 = MULTIPLY(d7, FIX_1_175875602);
986e461dc072 Initial revision
glantau
parents:
diff changeset
437 tmp2 = MULTIPLY(-d7, FIX_0_785694958);
986e461dc072 Initial revision
glantau
parents:
diff changeset
438 tmp3 = MULTIPLY(d7, FIX_0_275899380);
986e461dc072 Initial revision
glantau
parents:
diff changeset
439 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
440 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
441 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
442 } else {
986e461dc072 Initial revision
glantau
parents:
diff changeset
443 if (d5) {
986e461dc072 Initial revision
glantau
parents:
diff changeset
444 if (d3) {
986e461dc072 Initial revision
glantau
parents:
diff changeset
445 if (d1) {
986e461dc072 Initial revision
glantau
parents:
diff changeset
446 /* d1 != 0, d3 != 0, d5 != 0, d7 == 0 */
986e461dc072 Initial revision
glantau
parents:
diff changeset
447 z2 = d5 + d3;
986e461dc072 Initial revision
glantau
parents:
diff changeset
448 z4 = d5 + d1;
986e461dc072 Initial revision
glantau
parents:
diff changeset
449 z5 = MULTIPLY(d3 + z4, FIX_1_175875602);
986e461dc072 Initial revision
glantau
parents:
diff changeset
450
986e461dc072 Initial revision
glantau
parents:
diff changeset
451 tmp1 = MULTIPLY(d5, FIX_2_053119869);
986e461dc072 Initial revision
glantau
parents:
diff changeset
452 tmp2 = MULTIPLY(d3, FIX_3_072711026);
986e461dc072 Initial revision
glantau
parents:
diff changeset
453 tmp3 = MULTIPLY(d1, FIX_1_501321110);
986e461dc072 Initial revision
glantau
parents:
diff changeset
454 z1 = MULTIPLY(-d1, FIX_0_899976223);
986e461dc072 Initial revision
glantau
parents:
diff changeset
455 z2 = MULTIPLY(-z2, FIX_2_562915447);
986e461dc072 Initial revision
glantau
parents:
diff changeset
456 z3 = MULTIPLY(-d3, FIX_1_961570560);
986e461dc072 Initial revision
glantau
parents:
diff changeset
457 z4 = MULTIPLY(-z4, FIX_0_390180644);
986e461dc072 Initial revision
glantau
parents:
diff changeset
458
986e461dc072 Initial revision
glantau
parents:
diff changeset
459 z3 += z5;
986e461dc072 Initial revision
glantau
parents:
diff changeset
460 z4 += z5;
986e461dc072 Initial revision
glantau
parents:
diff changeset
461
986e461dc072 Initial revision
glantau
parents:
diff changeset
462 tmp0 = z1 + z3;
986e461dc072 Initial revision
glantau
parents:
diff changeset
463 tmp1 += z2 + z4;
986e461dc072 Initial revision
glantau
parents:
diff changeset
464 tmp2 += z2 + z3;
986e461dc072 Initial revision
glantau
parents:
diff changeset
465 tmp3 += z1 + z4;
986e461dc072 Initial revision
glantau
parents:
diff changeset
466 } else {
986e461dc072 Initial revision
glantau
parents:
diff changeset
467 /* d1 == 0, d3 != 0, d5 != 0, d7 == 0 */
986e461dc072 Initial revision
glantau
parents:
diff changeset
468 z2 = d5 + d3;
986e461dc072 Initial revision
glantau
parents:
diff changeset
469
986e461dc072 Initial revision
glantau
parents:
diff changeset
470 z5 = MULTIPLY(z2, FIX_1_175875602);
986e461dc072 Initial revision
glantau
parents:
diff changeset
471 tmp1 = MULTIPLY(d5, FIX_1_662939225);
986e461dc072 Initial revision
glantau
parents:
diff changeset
472 z4 = MULTIPLY(-d5, FIX_0_390180644);
986e461dc072 Initial revision
glantau
parents:
diff changeset
473 z2 = MULTIPLY(-z2, FIX_1_387039845);
986e461dc072 Initial revision
glantau
parents:
diff changeset
474 tmp2 = MULTIPLY(d3, FIX_1_111140466);
986e461dc072 Initial revision
glantau
parents:
diff changeset
475 z3 = MULTIPLY(-d3, FIX_1_961570560);
986e461dc072 Initial revision
glantau
parents:
diff changeset
476
986e461dc072 Initial revision
glantau
parents:
diff changeset
477 tmp0 = z3 + z5;
986e461dc072 Initial revision
glantau
parents:
diff changeset
478 tmp1 += z2;
986e461dc072 Initial revision
glantau
parents:
diff changeset
479 tmp2 += z2;
986e461dc072 Initial revision
glantau
parents:
diff changeset
480 tmp3 = z4 + z5;
986e461dc072 Initial revision
glantau
parents:
diff changeset
481 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
482 } else {
986e461dc072 Initial revision
glantau
parents:
diff changeset
483 if (d1) {
986e461dc072 Initial revision
glantau
parents:
diff changeset
484 /* d1 != 0, d3 == 0, d5 != 0, d7 == 0 */
986e461dc072 Initial revision
glantau
parents:
diff changeset
485 z4 = d5 + d1;
986e461dc072 Initial revision
glantau
parents:
diff changeset
486
986e461dc072 Initial revision
glantau
parents:
diff changeset
487 z5 = MULTIPLY(z4, FIX_1_175875602);
986e461dc072 Initial revision
glantau
parents:
diff changeset
488 z1 = MULTIPLY(-d1, FIX_0_899976223);
986e461dc072 Initial revision
glantau
parents:
diff changeset
489 tmp3 = MULTIPLY(d1, FIX_0_601344887);
986e461dc072 Initial revision
glantau
parents:
diff changeset
490 tmp1 = MULTIPLY(-d5, FIX_0_509795579);
986e461dc072 Initial revision
glantau
parents:
diff changeset
491 z2 = MULTIPLY(-d5, FIX_2_562915447);
986e461dc072 Initial revision
glantau
parents:
diff changeset
492 z4 = MULTIPLY(z4, FIX_0_785694958);
986e461dc072 Initial revision
glantau
parents:
diff changeset
493
986e461dc072 Initial revision
glantau
parents:
diff changeset
494 tmp0 = z1 + z5;
986e461dc072 Initial revision
glantau
parents:
diff changeset
495 tmp1 += z4;
986e461dc072 Initial revision
glantau
parents:
diff changeset
496 tmp2 = z2 + z5;
986e461dc072 Initial revision
glantau
parents:
diff changeset
497 tmp3 += z4;
986e461dc072 Initial revision
glantau
parents:
diff changeset
498 } else {
986e461dc072 Initial revision
glantau
parents:
diff changeset
499 /* d1 == 0, d3 == 0, d5 != 0, d7 == 0 */
986e461dc072 Initial revision
glantau
parents:
diff changeset
500 tmp0 = MULTIPLY(d5, FIX_1_175875602);
986e461dc072 Initial revision
glantau
parents:
diff changeset
501 tmp1 = MULTIPLY(d5, FIX_0_275899380);
986e461dc072 Initial revision
glantau
parents:
diff changeset
502 tmp2 = MULTIPLY(-d5, FIX_1_387039845);
986e461dc072 Initial revision
glantau
parents:
diff changeset
503 tmp3 = MULTIPLY(d5, FIX_0_785694958);
986e461dc072 Initial revision
glantau
parents:
diff changeset
504 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
505 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
506 } else {
986e461dc072 Initial revision
glantau
parents:
diff changeset
507 if (d3) {
986e461dc072 Initial revision
glantau
parents:
diff changeset
508 if (d1) {
986e461dc072 Initial revision
glantau
parents:
diff changeset
509 /* d1 != 0, d3 != 0, d5 == 0, d7 == 0 */
986e461dc072 Initial revision
glantau
parents:
diff changeset
510 z5 = d1 + d3;
986e461dc072 Initial revision
glantau
parents:
diff changeset
511 tmp3 = MULTIPLY(d1, FIX_0_211164243);
986e461dc072 Initial revision
glantau
parents:
diff changeset
512 tmp2 = MULTIPLY(-d3, FIX_1_451774981);
986e461dc072 Initial revision
glantau
parents:
diff changeset
513 z1 = MULTIPLY(d1, FIX_1_061594337);
986e461dc072 Initial revision
glantau
parents:
diff changeset
514 z2 = MULTIPLY(-d3, FIX_2_172734803);
986e461dc072 Initial revision
glantau
parents:
diff changeset
515 z4 = MULTIPLY(z5, FIX_0_785694958);
986e461dc072 Initial revision
glantau
parents:
diff changeset
516 z5 = MULTIPLY(z5, FIX_1_175875602);
986e461dc072 Initial revision
glantau
parents:
diff changeset
517
986e461dc072 Initial revision
glantau
parents:
diff changeset
518 tmp0 = z1 - z4;
986e461dc072 Initial revision
glantau
parents:
diff changeset
519 tmp1 = z2 + z4;
986e461dc072 Initial revision
glantau
parents:
diff changeset
520 tmp2 += z5;
986e461dc072 Initial revision
glantau
parents:
diff changeset
521 tmp3 += z5;
986e461dc072 Initial revision
glantau
parents:
diff changeset
522 } else {
986e461dc072 Initial revision
glantau
parents:
diff changeset
523 /* d1 == 0, d3 != 0, d5 == 0, d7 == 0 */
986e461dc072 Initial revision
glantau
parents:
diff changeset
524 tmp0 = MULTIPLY(-d3, FIX_0_785694958);
986e461dc072 Initial revision
glantau
parents:
diff changeset
525 tmp1 = MULTIPLY(-d3, FIX_1_387039845);
986e461dc072 Initial revision
glantau
parents:
diff changeset
526 tmp2 = MULTIPLY(-d3, FIX_0_275899380);
986e461dc072 Initial revision
glantau
parents:
diff changeset
527 tmp3 = MULTIPLY(d3, FIX_1_175875602);
986e461dc072 Initial revision
glantau
parents:
diff changeset
528 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
529 } else {
986e461dc072 Initial revision
glantau
parents:
diff changeset
530 if (d1) {
986e461dc072 Initial revision
glantau
parents:
diff changeset
531 /* d1 != 0, d3 == 0, d5 == 0, d7 == 0 */
986e461dc072 Initial revision
glantau
parents:
diff changeset
532 tmp0 = MULTIPLY(d1, FIX_0_275899380);
986e461dc072 Initial revision
glantau
parents:
diff changeset
533 tmp1 = MULTIPLY(d1, FIX_0_785694958);
986e461dc072 Initial revision
glantau
parents:
diff changeset
534 tmp2 = MULTIPLY(d1, FIX_1_175875602);
986e461dc072 Initial revision
glantau
parents:
diff changeset
535 tmp3 = MULTIPLY(d1, FIX_1_387039845);
986e461dc072 Initial revision
glantau
parents:
diff changeset
536 } else {
986e461dc072 Initial revision
glantau
parents:
diff changeset
537 /* d1 == 0, d3 == 0, d5 == 0, d7 == 0 */
986e461dc072 Initial revision
glantau
parents:
diff changeset
538 tmp0 = tmp1 = tmp2 = tmp3 = 0;
986e461dc072 Initial revision
glantau
parents:
diff changeset
539 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
540 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
541 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
542 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
543 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
544 /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */
986e461dc072 Initial revision
glantau
parents:
diff changeset
545
986e461dc072 Initial revision
glantau
parents:
diff changeset
546 dataptr[0] = (DCTELEM) DESCALE(tmp10 + tmp3, CONST_BITS-PASS1_BITS);
986e461dc072 Initial revision
glantau
parents:
diff changeset
547 dataptr[7] = (DCTELEM) DESCALE(tmp10 - tmp3, CONST_BITS-PASS1_BITS);
986e461dc072 Initial revision
glantau
parents:
diff changeset
548 dataptr[1] = (DCTELEM) DESCALE(tmp11 + tmp2, CONST_BITS-PASS1_BITS);
986e461dc072 Initial revision
glantau
parents:
diff changeset
549 dataptr[6] = (DCTELEM) DESCALE(tmp11 - tmp2, CONST_BITS-PASS1_BITS);
986e461dc072 Initial revision
glantau
parents:
diff changeset
550 dataptr[2] = (DCTELEM) DESCALE(tmp12 + tmp1, CONST_BITS-PASS1_BITS);
986e461dc072 Initial revision
glantau
parents:
diff changeset
551 dataptr[5] = (DCTELEM) DESCALE(tmp12 - tmp1, CONST_BITS-PASS1_BITS);
986e461dc072 Initial revision
glantau
parents:
diff changeset
552 dataptr[3] = (DCTELEM) DESCALE(tmp13 + tmp0, CONST_BITS-PASS1_BITS);
986e461dc072 Initial revision
glantau
parents:
diff changeset
553 dataptr[4] = (DCTELEM) DESCALE(tmp13 - tmp0, CONST_BITS-PASS1_BITS);
986e461dc072 Initial revision
glantau
parents:
diff changeset
554
986e461dc072 Initial revision
glantau
parents:
diff changeset
555 dataptr += DCTSIZE; /* advance pointer to next row */
986e461dc072 Initial revision
glantau
parents:
diff changeset
556 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
557
986e461dc072 Initial revision
glantau
parents:
diff changeset
558 /* Pass 2: process columns. */
986e461dc072 Initial revision
glantau
parents:
diff changeset
559 /* Note that we must descale the results by a factor of 8 == 2**3, */
986e461dc072 Initial revision
glantau
parents:
diff changeset
560 /* and also undo the PASS1_BITS scaling. */
986e461dc072 Initial revision
glantau
parents:
diff changeset
561
986e461dc072 Initial revision
glantau
parents:
diff changeset
562 dataptr = data;
986e461dc072 Initial revision
glantau
parents:
diff changeset
563 for (rowctr = DCTSIZE-1; rowctr >= 0; rowctr--) {
986e461dc072 Initial revision
glantau
parents:
diff changeset
564 /* Columns of zeroes can be exploited in the same way as we did with rows.
986e461dc072 Initial revision
glantau
parents:
diff changeset
565 * However, the row calculation has created many nonzero AC terms, so the
986e461dc072 Initial revision
glantau
parents:
diff changeset
566 * simplification applies less often (typically 5% to 10% of the time).
986e461dc072 Initial revision
glantau
parents:
diff changeset
567 * On machines with very fast multiplication, it's possible that the
986e461dc072 Initial revision
glantau
parents:
diff changeset
568 * test takes more time than it's worth. In that case this section
986e461dc072 Initial revision
glantau
parents:
diff changeset
569 * may be commented out.
986e461dc072 Initial revision
glantau
parents:
diff changeset
570 */
986e461dc072 Initial revision
glantau
parents:
diff changeset
571
986e461dc072 Initial revision
glantau
parents:
diff changeset
572 d0 = dataptr[DCTSIZE*0];
986e461dc072 Initial revision
glantau
parents:
diff changeset
573 d1 = dataptr[DCTSIZE*1];
986e461dc072 Initial revision
glantau
parents:
diff changeset
574 d2 = dataptr[DCTSIZE*2];
986e461dc072 Initial revision
glantau
parents:
diff changeset
575 d3 = dataptr[DCTSIZE*3];
986e461dc072 Initial revision
glantau
parents:
diff changeset
576 d4 = dataptr[DCTSIZE*4];
986e461dc072 Initial revision
glantau
parents:
diff changeset
577 d5 = dataptr[DCTSIZE*5];
986e461dc072 Initial revision
glantau
parents:
diff changeset
578 d6 = dataptr[DCTSIZE*6];
986e461dc072 Initial revision
glantau
parents:
diff changeset
579 d7 = dataptr[DCTSIZE*7];
986e461dc072 Initial revision
glantau
parents:
diff changeset
580
986e461dc072 Initial revision
glantau
parents:
diff changeset
581 /* Even part: reverse the even part of the forward DCT. */
986e461dc072 Initial revision
glantau
parents:
diff changeset
582 /* The rotator is sqrt(2)*c(-6). */
986e461dc072 Initial revision
glantau
parents:
diff changeset
583 if (d6) {
986e461dc072 Initial revision
glantau
parents:
diff changeset
584 if (d2) {
986e461dc072 Initial revision
glantau
parents:
diff changeset
585 /* d0 != 0, d2 != 0, d4 != 0, d6 != 0 */
986e461dc072 Initial revision
glantau
parents:
diff changeset
586 z1 = MULTIPLY(d2 + d6, FIX_0_541196100);
986e461dc072 Initial revision
glantau
parents:
diff changeset
587 tmp2 = z1 + MULTIPLY(-d6, FIX_1_847759065);
986e461dc072 Initial revision
glantau
parents:
diff changeset
588 tmp3 = z1 + MULTIPLY(d2, FIX_0_765366865);
986e461dc072 Initial revision
glantau
parents:
diff changeset
589
986e461dc072 Initial revision
glantau
parents:
diff changeset
590 tmp0 = (d0 + d4) << CONST_BITS;
986e461dc072 Initial revision
glantau
parents:
diff changeset
591 tmp1 = (d0 - d4) << CONST_BITS;
986e461dc072 Initial revision
glantau
parents:
diff changeset
592
986e461dc072 Initial revision
glantau
parents:
diff changeset
593 tmp10 = tmp0 + tmp3;
986e461dc072 Initial revision
glantau
parents:
diff changeset
594 tmp13 = tmp0 - tmp3;
986e461dc072 Initial revision
glantau
parents:
diff changeset
595 tmp11 = tmp1 + tmp2;
986e461dc072 Initial revision
glantau
parents:
diff changeset
596 tmp12 = tmp1 - tmp2;
986e461dc072 Initial revision
glantau
parents:
diff changeset
597 } else {
986e461dc072 Initial revision
glantau
parents:
diff changeset
598 /* d0 != 0, d2 == 0, d4 != 0, d6 != 0 */
986e461dc072 Initial revision
glantau
parents:
diff changeset
599 tmp2 = MULTIPLY(-d6, FIX_1_306562965);
986e461dc072 Initial revision
glantau
parents:
diff changeset
600 tmp3 = MULTIPLY(d6, FIX_0_541196100);
986e461dc072 Initial revision
glantau
parents:
diff changeset
601
986e461dc072 Initial revision
glantau
parents:
diff changeset
602 tmp0 = (d0 + d4) << CONST_BITS;
986e461dc072 Initial revision
glantau
parents:
diff changeset
603 tmp1 = (d0 - d4) << CONST_BITS;
986e461dc072 Initial revision
glantau
parents:
diff changeset
604
986e461dc072 Initial revision
glantau
parents:
diff changeset
605 tmp10 = tmp0 + tmp3;
986e461dc072 Initial revision
glantau
parents:
diff changeset
606 tmp13 = tmp0 - tmp3;
986e461dc072 Initial revision
glantau
parents:
diff changeset
607 tmp11 = tmp1 + tmp2;
986e461dc072 Initial revision
glantau
parents:
diff changeset
608 tmp12 = tmp1 - tmp2;
986e461dc072 Initial revision
glantau
parents:
diff changeset
609 }
2263
258f21820108 porting optimizations from 4x4 dct to 8x8
michael
parents: 2262
diff changeset
610 } else {
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
611 if (d2) {
986e461dc072 Initial revision
glantau
parents:
diff changeset
612 /* d0 != 0, d2 != 0, d4 != 0, d6 == 0 */
986e461dc072 Initial revision
glantau
parents:
diff changeset
613 tmp2 = MULTIPLY(d2, FIX_0_541196100);
986e461dc072 Initial revision
glantau
parents:
diff changeset
614 tmp3 = MULTIPLY(d2, FIX_1_306562965);
986e461dc072 Initial revision
glantau
parents:
diff changeset
615
986e461dc072 Initial revision
glantau
parents:
diff changeset
616 tmp0 = (d0 + d4) << CONST_BITS;
986e461dc072 Initial revision
glantau
parents:
diff changeset
617 tmp1 = (d0 - d4) << CONST_BITS;
986e461dc072 Initial revision
glantau
parents:
diff changeset
618
986e461dc072 Initial revision
glantau
parents:
diff changeset
619 tmp10 = tmp0 + tmp3;
986e461dc072 Initial revision
glantau
parents:
diff changeset
620 tmp13 = tmp0 - tmp3;
986e461dc072 Initial revision
glantau
parents:
diff changeset
621 tmp11 = tmp1 + tmp2;
986e461dc072 Initial revision
glantau
parents:
diff changeset
622 tmp12 = tmp1 - tmp2;
986e461dc072 Initial revision
glantau
parents:
diff changeset
623 } else {
986e461dc072 Initial revision
glantau
parents:
diff changeset
624 /* d0 != 0, d2 == 0, d4 != 0, d6 == 0 */
986e461dc072 Initial revision
glantau
parents:
diff changeset
625 tmp10 = tmp13 = (d0 + d4) << CONST_BITS;
986e461dc072 Initial revision
glantau
parents:
diff changeset
626 tmp11 = tmp12 = (d0 - d4) << CONST_BITS;
986e461dc072 Initial revision
glantau
parents:
diff changeset
627 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
628 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
629
986e461dc072 Initial revision
glantau
parents:
diff changeset
630 /* Odd part per figure 8; the matrix is unitary and hence its
986e461dc072 Initial revision
glantau
parents:
diff changeset
631 * transpose is its inverse. i0..i3 are y7,y5,y3,y1 respectively.
986e461dc072 Initial revision
glantau
parents:
diff changeset
632 */
986e461dc072 Initial revision
glantau
parents:
diff changeset
633 if (d7) {
986e461dc072 Initial revision
glantau
parents:
diff changeset
634 if (d5) {
986e461dc072 Initial revision
glantau
parents:
diff changeset
635 if (d3) {
986e461dc072 Initial revision
glantau
parents:
diff changeset
636 if (d1) {
986e461dc072 Initial revision
glantau
parents:
diff changeset
637 /* d1 != 0, d3 != 0, d5 != 0, d7 != 0 */
986e461dc072 Initial revision
glantau
parents:
diff changeset
638 z1 = d7 + d1;
986e461dc072 Initial revision
glantau
parents:
diff changeset
639 z2 = d5 + d3;
986e461dc072 Initial revision
glantau
parents:
diff changeset
640 z3 = d7 + d3;
986e461dc072 Initial revision
glantau
parents:
diff changeset
641 z4 = d5 + d1;
986e461dc072 Initial revision
glantau
parents:
diff changeset
642 z5 = MULTIPLY(z3 + z4, FIX_1_175875602);
986e461dc072 Initial revision
glantau
parents:
diff changeset
643
986e461dc072 Initial revision
glantau
parents:
diff changeset
644 tmp0 = MULTIPLY(d7, FIX_0_298631336);
986e461dc072 Initial revision
glantau
parents:
diff changeset
645 tmp1 = MULTIPLY(d5, FIX_2_053119869);
986e461dc072 Initial revision
glantau
parents:
diff changeset
646 tmp2 = MULTIPLY(d3, FIX_3_072711026);
986e461dc072 Initial revision
glantau
parents:
diff changeset
647 tmp3 = MULTIPLY(d1, FIX_1_501321110);
986e461dc072 Initial revision
glantau
parents:
diff changeset
648 z1 = MULTIPLY(-z1, FIX_0_899976223);
986e461dc072 Initial revision
glantau
parents:
diff changeset
649 z2 = MULTIPLY(-z2, FIX_2_562915447);
986e461dc072 Initial revision
glantau
parents:
diff changeset
650 z3 = MULTIPLY(-z3, FIX_1_961570560);
986e461dc072 Initial revision
glantau
parents:
diff changeset
651 z4 = MULTIPLY(-z4, FIX_0_390180644);
986e461dc072 Initial revision
glantau
parents:
diff changeset
652
986e461dc072 Initial revision
glantau
parents:
diff changeset
653 z3 += z5;
986e461dc072 Initial revision
glantau
parents:
diff changeset
654 z4 += z5;
986e461dc072 Initial revision
glantau
parents:
diff changeset
655
986e461dc072 Initial revision
glantau
parents:
diff changeset
656 tmp0 += z1 + z3;
986e461dc072 Initial revision
glantau
parents:
diff changeset
657 tmp1 += z2 + z4;
986e461dc072 Initial revision
glantau
parents:
diff changeset
658 tmp2 += z2 + z3;
986e461dc072 Initial revision
glantau
parents:
diff changeset
659 tmp3 += z1 + z4;
986e461dc072 Initial revision
glantau
parents:
diff changeset
660 } else {
986e461dc072 Initial revision
glantau
parents:
diff changeset
661 /* d1 == 0, d3 != 0, d5 != 0, d7 != 0 */
986e461dc072 Initial revision
glantau
parents:
diff changeset
662 z1 = d7;
986e461dc072 Initial revision
glantau
parents:
diff changeset
663 z2 = d5 + d3;
986e461dc072 Initial revision
glantau
parents:
diff changeset
664 z3 = d7 + d3;
986e461dc072 Initial revision
glantau
parents:
diff changeset
665 z5 = MULTIPLY(z3 + d5, FIX_1_175875602);
986e461dc072 Initial revision
glantau
parents:
diff changeset
666
986e461dc072 Initial revision
glantau
parents:
diff changeset
667 tmp0 = MULTIPLY(d7, FIX_0_298631336);
986e461dc072 Initial revision
glantau
parents:
diff changeset
668 tmp1 = MULTIPLY(d5, FIX_2_053119869);
986e461dc072 Initial revision
glantau
parents:
diff changeset
669 tmp2 = MULTIPLY(d3, FIX_3_072711026);
986e461dc072 Initial revision
glantau
parents:
diff changeset
670 z1 = MULTIPLY(-d7, FIX_0_899976223);
986e461dc072 Initial revision
glantau
parents:
diff changeset
671 z2 = MULTIPLY(-z2, FIX_2_562915447);
986e461dc072 Initial revision
glantau
parents:
diff changeset
672 z3 = MULTIPLY(-z3, FIX_1_961570560);
986e461dc072 Initial revision
glantau
parents:
diff changeset
673 z4 = MULTIPLY(-d5, FIX_0_390180644);
986e461dc072 Initial revision
glantau
parents:
diff changeset
674
986e461dc072 Initial revision
glantau
parents:
diff changeset
675 z3 += z5;
986e461dc072 Initial revision
glantau
parents:
diff changeset
676 z4 += z5;
986e461dc072 Initial revision
glantau
parents:
diff changeset
677
986e461dc072 Initial revision
glantau
parents:
diff changeset
678 tmp0 += z1 + z3;
986e461dc072 Initial revision
glantau
parents:
diff changeset
679 tmp1 += z2 + z4;
986e461dc072 Initial revision
glantau
parents:
diff changeset
680 tmp2 += z2 + z3;
986e461dc072 Initial revision
glantau
parents:
diff changeset
681 tmp3 = z1 + z4;
986e461dc072 Initial revision
glantau
parents:
diff changeset
682 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
683 } else {
986e461dc072 Initial revision
glantau
parents:
diff changeset
684 if (d1) {
986e461dc072 Initial revision
glantau
parents:
diff changeset
685 /* d1 != 0, d3 == 0, d5 != 0, d7 != 0 */
986e461dc072 Initial revision
glantau
parents:
diff changeset
686 z1 = d7 + d1;
986e461dc072 Initial revision
glantau
parents:
diff changeset
687 z2 = d5;
986e461dc072 Initial revision
glantau
parents:
diff changeset
688 z3 = d7;
986e461dc072 Initial revision
glantau
parents:
diff changeset
689 z4 = d5 + d1;
986e461dc072 Initial revision
glantau
parents:
diff changeset
690 z5 = MULTIPLY(z3 + z4, FIX_1_175875602);
986e461dc072 Initial revision
glantau
parents:
diff changeset
691
986e461dc072 Initial revision
glantau
parents:
diff changeset
692 tmp0 = MULTIPLY(d7, FIX_0_298631336);
986e461dc072 Initial revision
glantau
parents:
diff changeset
693 tmp1 = MULTIPLY(d5, FIX_2_053119869);
986e461dc072 Initial revision
glantau
parents:
diff changeset
694 tmp3 = MULTIPLY(d1, FIX_1_501321110);
986e461dc072 Initial revision
glantau
parents:
diff changeset
695 z1 = MULTIPLY(-z1, FIX_0_899976223);
986e461dc072 Initial revision
glantau
parents:
diff changeset
696 z2 = MULTIPLY(-d5, FIX_2_562915447);
986e461dc072 Initial revision
glantau
parents:
diff changeset
697 z3 = MULTIPLY(-d7, FIX_1_961570560);
986e461dc072 Initial revision
glantau
parents:
diff changeset
698 z4 = MULTIPLY(-z4, FIX_0_390180644);
986e461dc072 Initial revision
glantau
parents:
diff changeset
699
986e461dc072 Initial revision
glantau
parents:
diff changeset
700 z3 += z5;
986e461dc072 Initial revision
glantau
parents:
diff changeset
701 z4 += z5;
986e461dc072 Initial revision
glantau
parents:
diff changeset
702
986e461dc072 Initial revision
glantau
parents:
diff changeset
703 tmp0 += z1 + z3;
986e461dc072 Initial revision
glantau
parents:
diff changeset
704 tmp1 += z2 + z4;
986e461dc072 Initial revision
glantau
parents:
diff changeset
705 tmp2 = z2 + z3;
986e461dc072 Initial revision
glantau
parents:
diff changeset
706 tmp3 += z1 + z4;
986e461dc072 Initial revision
glantau
parents:
diff changeset
707 } else {
986e461dc072 Initial revision
glantau
parents:
diff changeset
708 /* d1 == 0, d3 == 0, d5 != 0, d7 != 0 */
986e461dc072 Initial revision
glantau
parents:
diff changeset
709 tmp0 = MULTIPLY(-d7, FIX_0_601344887);
986e461dc072 Initial revision
glantau
parents:
diff changeset
710 z1 = MULTIPLY(-d7, FIX_0_899976223);
986e461dc072 Initial revision
glantau
parents:
diff changeset
711 z3 = MULTIPLY(-d7, FIX_1_961570560);
986e461dc072 Initial revision
glantau
parents:
diff changeset
712 tmp1 = MULTIPLY(-d5, FIX_0_509795579);
986e461dc072 Initial revision
glantau
parents:
diff changeset
713 z2 = MULTIPLY(-d5, FIX_2_562915447);
986e461dc072 Initial revision
glantau
parents:
diff changeset
714 z4 = MULTIPLY(-d5, FIX_0_390180644);
986e461dc072 Initial revision
glantau
parents:
diff changeset
715 z5 = MULTIPLY(d5 + d7, FIX_1_175875602);
986e461dc072 Initial revision
glantau
parents:
diff changeset
716
986e461dc072 Initial revision
glantau
parents:
diff changeset
717 z3 += z5;
986e461dc072 Initial revision
glantau
parents:
diff changeset
718 z4 += z5;
986e461dc072 Initial revision
glantau
parents:
diff changeset
719
986e461dc072 Initial revision
glantau
parents:
diff changeset
720 tmp0 += z3;
986e461dc072 Initial revision
glantau
parents:
diff changeset
721 tmp1 += z4;
986e461dc072 Initial revision
glantau
parents:
diff changeset
722 tmp2 = z2 + z3;
986e461dc072 Initial revision
glantau
parents:
diff changeset
723 tmp3 = z1 + z4;
986e461dc072 Initial revision
glantau
parents:
diff changeset
724 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
725 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
726 } else {
986e461dc072 Initial revision
glantau
parents:
diff changeset
727 if (d3) {
986e461dc072 Initial revision
glantau
parents:
diff changeset
728 if (d1) {
986e461dc072 Initial revision
glantau
parents:
diff changeset
729 /* d1 != 0, d3 != 0, d5 == 0, d7 != 0 */
986e461dc072 Initial revision
glantau
parents:
diff changeset
730 z1 = d7 + d1;
986e461dc072 Initial revision
glantau
parents:
diff changeset
731 z3 = d7 + d3;
986e461dc072 Initial revision
glantau
parents:
diff changeset
732 z5 = MULTIPLY(z3 + d1, FIX_1_175875602);
986e461dc072 Initial revision
glantau
parents:
diff changeset
733
986e461dc072 Initial revision
glantau
parents:
diff changeset
734 tmp0 = MULTIPLY(d7, FIX_0_298631336);
986e461dc072 Initial revision
glantau
parents:
diff changeset
735 tmp2 = MULTIPLY(d3, FIX_3_072711026);
986e461dc072 Initial revision
glantau
parents:
diff changeset
736 tmp3 = MULTIPLY(d1, FIX_1_501321110);
986e461dc072 Initial revision
glantau
parents:
diff changeset
737 z1 = MULTIPLY(-z1, FIX_0_899976223);
986e461dc072 Initial revision
glantau
parents:
diff changeset
738 z2 = MULTIPLY(-d3, FIX_2_562915447);
986e461dc072 Initial revision
glantau
parents:
diff changeset
739 z3 = MULTIPLY(-z3, FIX_1_961570560);
986e461dc072 Initial revision
glantau
parents:
diff changeset
740 z4 = MULTIPLY(-d1, FIX_0_390180644);
986e461dc072 Initial revision
glantau
parents:
diff changeset
741
986e461dc072 Initial revision
glantau
parents:
diff changeset
742 z3 += z5;
986e461dc072 Initial revision
glantau
parents:
diff changeset
743 z4 += z5;
986e461dc072 Initial revision
glantau
parents:
diff changeset
744
986e461dc072 Initial revision
glantau
parents:
diff changeset
745 tmp0 += z1 + z3;
986e461dc072 Initial revision
glantau
parents:
diff changeset
746 tmp1 = z2 + z4;
986e461dc072 Initial revision
glantau
parents:
diff changeset
747 tmp2 += z2 + z3;
986e461dc072 Initial revision
glantau
parents:
diff changeset
748 tmp3 += z1 + z4;
986e461dc072 Initial revision
glantau
parents:
diff changeset
749 } else {
986e461dc072 Initial revision
glantau
parents:
diff changeset
750 /* d1 == 0, d3 != 0, d5 == 0, d7 != 0 */
986e461dc072 Initial revision
glantau
parents:
diff changeset
751 z3 = d7 + d3;
986e461dc072 Initial revision
glantau
parents:
diff changeset
752
986e461dc072 Initial revision
glantau
parents:
diff changeset
753 tmp0 = MULTIPLY(-d7, FIX_0_601344887);
986e461dc072 Initial revision
glantau
parents:
diff changeset
754 z1 = MULTIPLY(-d7, FIX_0_899976223);
986e461dc072 Initial revision
glantau
parents:
diff changeset
755 tmp2 = MULTIPLY(d3, FIX_0_509795579);
986e461dc072 Initial revision
glantau
parents:
diff changeset
756 z2 = MULTIPLY(-d3, FIX_2_562915447);
986e461dc072 Initial revision
glantau
parents:
diff changeset
757 z5 = MULTIPLY(z3, FIX_1_175875602);
986e461dc072 Initial revision
glantau
parents:
diff changeset
758 z3 = MULTIPLY(-z3, FIX_0_785694958);
986e461dc072 Initial revision
glantau
parents:
diff changeset
759
986e461dc072 Initial revision
glantau
parents:
diff changeset
760 tmp0 += z3;
986e461dc072 Initial revision
glantau
parents:
diff changeset
761 tmp1 = z2 + z5;
986e461dc072 Initial revision
glantau
parents:
diff changeset
762 tmp2 += z3;
986e461dc072 Initial revision
glantau
parents:
diff changeset
763 tmp3 = z1 + z5;
986e461dc072 Initial revision
glantau
parents:
diff changeset
764 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
765 } else {
986e461dc072 Initial revision
glantau
parents:
diff changeset
766 if (d1) {
986e461dc072 Initial revision
glantau
parents:
diff changeset
767 /* d1 != 0, d3 == 0, d5 == 0, d7 != 0 */
986e461dc072 Initial revision
glantau
parents:
diff changeset
768 z1 = d7 + d1;
986e461dc072 Initial revision
glantau
parents:
diff changeset
769 z5 = MULTIPLY(z1, FIX_1_175875602);
986e461dc072 Initial revision
glantau
parents:
diff changeset
770
986e461dc072 Initial revision
glantau
parents:
diff changeset
771 z1 = MULTIPLY(z1, FIX_0_275899380);
986e461dc072 Initial revision
glantau
parents:
diff changeset
772 z3 = MULTIPLY(-d7, FIX_1_961570560);
986e461dc072 Initial revision
glantau
parents:
diff changeset
773 tmp0 = MULTIPLY(-d7, FIX_1_662939225);
986e461dc072 Initial revision
glantau
parents:
diff changeset
774 z4 = MULTIPLY(-d1, FIX_0_390180644);
986e461dc072 Initial revision
glantau
parents:
diff changeset
775 tmp3 = MULTIPLY(d1, FIX_1_111140466);
986e461dc072 Initial revision
glantau
parents:
diff changeset
776
986e461dc072 Initial revision
glantau
parents:
diff changeset
777 tmp0 += z1;
986e461dc072 Initial revision
glantau
parents:
diff changeset
778 tmp1 = z4 + z5;
986e461dc072 Initial revision
glantau
parents:
diff changeset
779 tmp2 = z3 + z5;
986e461dc072 Initial revision
glantau
parents:
diff changeset
780 tmp3 += z1;
986e461dc072 Initial revision
glantau
parents:
diff changeset
781 } else {
986e461dc072 Initial revision
glantau
parents:
diff changeset
782 /* d1 == 0, d3 == 0, d5 == 0, d7 != 0 */
986e461dc072 Initial revision
glantau
parents:
diff changeset
783 tmp0 = MULTIPLY(-d7, FIX_1_387039845);
986e461dc072 Initial revision
glantau
parents:
diff changeset
784 tmp1 = MULTIPLY(d7, FIX_1_175875602);
986e461dc072 Initial revision
glantau
parents:
diff changeset
785 tmp2 = MULTIPLY(-d7, FIX_0_785694958);
986e461dc072 Initial revision
glantau
parents:
diff changeset
786 tmp3 = MULTIPLY(d7, FIX_0_275899380);
986e461dc072 Initial revision
glantau
parents:
diff changeset
787 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
788 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
789 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
790 } else {
986e461dc072 Initial revision
glantau
parents:
diff changeset
791 if (d5) {
986e461dc072 Initial revision
glantau
parents:
diff changeset
792 if (d3) {
986e461dc072 Initial revision
glantau
parents:
diff changeset
793 if (d1) {
986e461dc072 Initial revision
glantau
parents:
diff changeset
794 /* d1 != 0, d3 != 0, d5 != 0, d7 == 0 */
986e461dc072 Initial revision
glantau
parents:
diff changeset
795 z2 = d5 + d3;
986e461dc072 Initial revision
glantau
parents:
diff changeset
796 z4 = d5 + d1;
986e461dc072 Initial revision
glantau
parents:
diff changeset
797 z5 = MULTIPLY(d3 + z4, FIX_1_175875602);
986e461dc072 Initial revision
glantau
parents:
diff changeset
798
986e461dc072 Initial revision
glantau
parents:
diff changeset
799 tmp1 = MULTIPLY(d5, FIX_2_053119869);
986e461dc072 Initial revision
glantau
parents:
diff changeset
800 tmp2 = MULTIPLY(d3, FIX_3_072711026);
986e461dc072 Initial revision
glantau
parents:
diff changeset
801 tmp3 = MULTIPLY(d1, FIX_1_501321110);
986e461dc072 Initial revision
glantau
parents:
diff changeset
802 z1 = MULTIPLY(-d1, FIX_0_899976223);
986e461dc072 Initial revision
glantau
parents:
diff changeset
803 z2 = MULTIPLY(-z2, FIX_2_562915447);
986e461dc072 Initial revision
glantau
parents:
diff changeset
804 z3 = MULTIPLY(-d3, FIX_1_961570560);
986e461dc072 Initial revision
glantau
parents:
diff changeset
805 z4 = MULTIPLY(-z4, FIX_0_390180644);
986e461dc072 Initial revision
glantau
parents:
diff changeset
806
986e461dc072 Initial revision
glantau
parents:
diff changeset
807 z3 += z5;
986e461dc072 Initial revision
glantau
parents:
diff changeset
808 z4 += z5;
986e461dc072 Initial revision
glantau
parents:
diff changeset
809
986e461dc072 Initial revision
glantau
parents:
diff changeset
810 tmp0 = z1 + z3;
986e461dc072 Initial revision
glantau
parents:
diff changeset
811 tmp1 += z2 + z4;
986e461dc072 Initial revision
glantau
parents:
diff changeset
812 tmp2 += z2 + z3;
986e461dc072 Initial revision
glantau
parents:
diff changeset
813 tmp3 += z1 + z4;
986e461dc072 Initial revision
glantau
parents:
diff changeset
814 } else {
986e461dc072 Initial revision
glantau
parents:
diff changeset
815 /* d1 == 0, d3 != 0, d5 != 0, d7 == 0 */
986e461dc072 Initial revision
glantau
parents:
diff changeset
816 z2 = d5 + d3;
986e461dc072 Initial revision
glantau
parents:
diff changeset
817
986e461dc072 Initial revision
glantau
parents:
diff changeset
818 z5 = MULTIPLY(z2, FIX_1_175875602);
986e461dc072 Initial revision
glantau
parents:
diff changeset
819 tmp1 = MULTIPLY(d5, FIX_1_662939225);
986e461dc072 Initial revision
glantau
parents:
diff changeset
820 z4 = MULTIPLY(-d5, FIX_0_390180644);
986e461dc072 Initial revision
glantau
parents:
diff changeset
821 z2 = MULTIPLY(-z2, FIX_1_387039845);
986e461dc072 Initial revision
glantau
parents:
diff changeset
822 tmp2 = MULTIPLY(d3, FIX_1_111140466);
986e461dc072 Initial revision
glantau
parents:
diff changeset
823 z3 = MULTIPLY(-d3, FIX_1_961570560);
986e461dc072 Initial revision
glantau
parents:
diff changeset
824
986e461dc072 Initial revision
glantau
parents:
diff changeset
825 tmp0 = z3 + z5;
986e461dc072 Initial revision
glantau
parents:
diff changeset
826 tmp1 += z2;
986e461dc072 Initial revision
glantau
parents:
diff changeset
827 tmp2 += z2;
986e461dc072 Initial revision
glantau
parents:
diff changeset
828 tmp3 = z4 + z5;
986e461dc072 Initial revision
glantau
parents:
diff changeset
829 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
830 } else {
986e461dc072 Initial revision
glantau
parents:
diff changeset
831 if (d1) {
986e461dc072 Initial revision
glantau
parents:
diff changeset
832 /* d1 != 0, d3 == 0, d5 != 0, d7 == 0 */
986e461dc072 Initial revision
glantau
parents:
diff changeset
833 z4 = d5 + d1;
986e461dc072 Initial revision
glantau
parents:
diff changeset
834
986e461dc072 Initial revision
glantau
parents:
diff changeset
835 z5 = MULTIPLY(z4, FIX_1_175875602);
986e461dc072 Initial revision
glantau
parents:
diff changeset
836 z1 = MULTIPLY(-d1, FIX_0_899976223);
986e461dc072 Initial revision
glantau
parents:
diff changeset
837 tmp3 = MULTIPLY(d1, FIX_0_601344887);
986e461dc072 Initial revision
glantau
parents:
diff changeset
838 tmp1 = MULTIPLY(-d5, FIX_0_509795579);
986e461dc072 Initial revision
glantau
parents:
diff changeset
839 z2 = MULTIPLY(-d5, FIX_2_562915447);
986e461dc072 Initial revision
glantau
parents:
diff changeset
840 z4 = MULTIPLY(z4, FIX_0_785694958);
986e461dc072 Initial revision
glantau
parents:
diff changeset
841
986e461dc072 Initial revision
glantau
parents:
diff changeset
842 tmp0 = z1 + z5;
986e461dc072 Initial revision
glantau
parents:
diff changeset
843 tmp1 += z4;
986e461dc072 Initial revision
glantau
parents:
diff changeset
844 tmp2 = z2 + z5;
986e461dc072 Initial revision
glantau
parents:
diff changeset
845 tmp3 += z4;
986e461dc072 Initial revision
glantau
parents:
diff changeset
846 } else {
986e461dc072 Initial revision
glantau
parents:
diff changeset
847 /* d1 == 0, d3 == 0, d5 != 0, d7 == 0 */
986e461dc072 Initial revision
glantau
parents:
diff changeset
848 tmp0 = MULTIPLY(d5, FIX_1_175875602);
986e461dc072 Initial revision
glantau
parents:
diff changeset
849 tmp1 = MULTIPLY(d5, FIX_0_275899380);
986e461dc072 Initial revision
glantau
parents:
diff changeset
850 tmp2 = MULTIPLY(-d5, FIX_1_387039845);
986e461dc072 Initial revision
glantau
parents:
diff changeset
851 tmp3 = MULTIPLY(d5, FIX_0_785694958);
986e461dc072 Initial revision
glantau
parents:
diff changeset
852 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
853 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
854 } else {
986e461dc072 Initial revision
glantau
parents:
diff changeset
855 if (d3) {
986e461dc072 Initial revision
glantau
parents:
diff changeset
856 if (d1) {
986e461dc072 Initial revision
glantau
parents:
diff changeset
857 /* d1 != 0, d3 != 0, d5 == 0, d7 == 0 */
986e461dc072 Initial revision
glantau
parents:
diff changeset
858 z5 = d1 + d3;
986e461dc072 Initial revision
glantau
parents:
diff changeset
859 tmp3 = MULTIPLY(d1, FIX_0_211164243);
986e461dc072 Initial revision
glantau
parents:
diff changeset
860 tmp2 = MULTIPLY(-d3, FIX_1_451774981);
986e461dc072 Initial revision
glantau
parents:
diff changeset
861 z1 = MULTIPLY(d1, FIX_1_061594337);
986e461dc072 Initial revision
glantau
parents:
diff changeset
862 z2 = MULTIPLY(-d3, FIX_2_172734803);
986e461dc072 Initial revision
glantau
parents:
diff changeset
863 z4 = MULTIPLY(z5, FIX_0_785694958);
986e461dc072 Initial revision
glantau
parents:
diff changeset
864 z5 = MULTIPLY(z5, FIX_1_175875602);
986e461dc072 Initial revision
glantau
parents:
diff changeset
865
986e461dc072 Initial revision
glantau
parents:
diff changeset
866 tmp0 = z1 - z4;
986e461dc072 Initial revision
glantau
parents:
diff changeset
867 tmp1 = z2 + z4;
986e461dc072 Initial revision
glantau
parents:
diff changeset
868 tmp2 += z5;
986e461dc072 Initial revision
glantau
parents:
diff changeset
869 tmp3 += z5;
986e461dc072 Initial revision
glantau
parents:
diff changeset
870 } else {
986e461dc072 Initial revision
glantau
parents:
diff changeset
871 /* d1 == 0, d3 != 0, d5 == 0, d7 == 0 */
986e461dc072 Initial revision
glantau
parents:
diff changeset
872 tmp0 = MULTIPLY(-d3, FIX_0_785694958);
986e461dc072 Initial revision
glantau
parents:
diff changeset
873 tmp1 = MULTIPLY(-d3, FIX_1_387039845);
986e461dc072 Initial revision
glantau
parents:
diff changeset
874 tmp2 = MULTIPLY(-d3, FIX_0_275899380);
986e461dc072 Initial revision
glantau
parents:
diff changeset
875 tmp3 = MULTIPLY(d3, FIX_1_175875602);
986e461dc072 Initial revision
glantau
parents:
diff changeset
876 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
877 } else {
986e461dc072 Initial revision
glantau
parents:
diff changeset
878 if (d1) {
986e461dc072 Initial revision
glantau
parents:
diff changeset
879 /* d1 != 0, d3 == 0, d5 == 0, d7 == 0 */
986e461dc072 Initial revision
glantau
parents:
diff changeset
880 tmp0 = MULTIPLY(d1, FIX_0_275899380);
986e461dc072 Initial revision
glantau
parents:
diff changeset
881 tmp1 = MULTIPLY(d1, FIX_0_785694958);
986e461dc072 Initial revision
glantau
parents:
diff changeset
882 tmp2 = MULTIPLY(d1, FIX_1_175875602);
986e461dc072 Initial revision
glantau
parents:
diff changeset
883 tmp3 = MULTIPLY(d1, FIX_1_387039845);
986e461dc072 Initial revision
glantau
parents:
diff changeset
884 } else {
986e461dc072 Initial revision
glantau
parents:
diff changeset
885 /* d1 == 0, d3 == 0, d5 == 0, d7 == 0 */
986e461dc072 Initial revision
glantau
parents:
diff changeset
886 tmp0 = tmp1 = tmp2 = tmp3 = 0;
986e461dc072 Initial revision
glantau
parents:
diff changeset
887 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
888 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
889 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
890 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
891
986e461dc072 Initial revision
glantau
parents:
diff changeset
892 /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */
986e461dc072 Initial revision
glantau
parents:
diff changeset
893
986e461dc072 Initial revision
glantau
parents:
diff changeset
894 dataptr[DCTSIZE*0] = (DCTELEM) DESCALE(tmp10 + tmp3,
986e461dc072 Initial revision
glantau
parents:
diff changeset
895 CONST_BITS+PASS1_BITS+3);
986e461dc072 Initial revision
glantau
parents:
diff changeset
896 dataptr[DCTSIZE*7] = (DCTELEM) DESCALE(tmp10 - tmp3,
986e461dc072 Initial revision
glantau
parents:
diff changeset
897 CONST_BITS+PASS1_BITS+3);
986e461dc072 Initial revision
glantau
parents:
diff changeset
898 dataptr[DCTSIZE*1] = (DCTELEM) DESCALE(tmp11 + tmp2,
986e461dc072 Initial revision
glantau
parents:
diff changeset
899 CONST_BITS+PASS1_BITS+3);
986e461dc072 Initial revision
glantau
parents:
diff changeset
900 dataptr[DCTSIZE*6] = (DCTELEM) DESCALE(tmp11 - tmp2,
986e461dc072 Initial revision
glantau
parents:
diff changeset
901 CONST_BITS+PASS1_BITS+3);
986e461dc072 Initial revision
glantau
parents:
diff changeset
902 dataptr[DCTSIZE*2] = (DCTELEM) DESCALE(tmp12 + tmp1,
986e461dc072 Initial revision
glantau
parents:
diff changeset
903 CONST_BITS+PASS1_BITS+3);
986e461dc072 Initial revision
glantau
parents:
diff changeset
904 dataptr[DCTSIZE*5] = (DCTELEM) DESCALE(tmp12 - tmp1,
986e461dc072 Initial revision
glantau
parents:
diff changeset
905 CONST_BITS+PASS1_BITS+3);
986e461dc072 Initial revision
glantau
parents:
diff changeset
906 dataptr[DCTSIZE*3] = (DCTELEM) DESCALE(tmp13 + tmp0,
986e461dc072 Initial revision
glantau
parents:
diff changeset
907 CONST_BITS+PASS1_BITS+3);
986e461dc072 Initial revision
glantau
parents:
diff changeset
908 dataptr[DCTSIZE*4] = (DCTELEM) DESCALE(tmp13 - tmp0,
986e461dc072 Initial revision
glantau
parents:
diff changeset
909 CONST_BITS+PASS1_BITS+3);
986e461dc072 Initial revision
glantau
parents:
diff changeset
910
986e461dc072 Initial revision
glantau
parents:
diff changeset
911 dataptr++; /* advance pointer to next column */
986e461dc072 Initial revision
glantau
parents:
diff changeset
912 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
913 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
914
2256
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
915 #undef DCTSIZE
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
916 #define DCTSIZE 4
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
917 #define DCTSTRIDE 8
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
918
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
919 void j_rev_dct4(DCTBLOCK data)
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
920 {
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
921 int32_t tmp0, tmp1, tmp2, tmp3;
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
922 int32_t tmp10, tmp11, tmp12, tmp13;
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
923 int32_t z1;
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
924 int32_t d0, d2, d4, d6;
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
925 register DCTELEM *dataptr;
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
926 int rowctr;
2262
7a1c3178d759 optimizing 4x4 idct
michael
parents: 2259
diff changeset
927
2256
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
928 /* Pass 1: process rows. */
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
929 /* Note results are scaled up by sqrt(8) compared to a true IDCT; */
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
930 /* furthermore, we scale the results by 2**PASS1_BITS. */
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
931
2262
7a1c3178d759 optimizing 4x4 idct
michael
parents: 2259
diff changeset
932 data[0] += 4;
7a1c3178d759 optimizing 4x4 idct
michael
parents: 2259
diff changeset
933
2256
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
934 dataptr = data;
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
935
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
936 for (rowctr = DCTSIZE-1; rowctr >= 0; rowctr--) {
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
937 /* Due to quantization, we will usually find that many of the input
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
938 * coefficients are zero, especially the AC terms. We can exploit this
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
939 * by short-circuiting the IDCT calculation for any row in which all
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
940 * the AC terms are zero. In that case each output is equal to the
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
941 * DC coefficient (with scale factor as needed).
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
942 * With typical images and quantization tables, half or more of the
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
943 * row DCT calculations can be simplified this way.
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
944 */
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
945
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
946 register int *idataptr = (int*)dataptr;
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
947
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
948 d0 = dataptr[0];
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
949 d2 = dataptr[1];
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
950 d4 = dataptr[2];
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
951 d6 = dataptr[3];
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
952
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
953 if ((d2 | d4 | d6) == 0) {
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
954 /* AC terms all zero */
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
955 if (d0) {
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
956 /* Compute a 32 bit value to assign. */
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
957 DCTELEM dcval = (DCTELEM) (d0 << PASS1_BITS);
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
958 register int v = (dcval & 0xffff) | ((dcval << 16) & 0xffff0000);
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
959
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
960 idataptr[0] = v;
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
961 idataptr[1] = v;
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
962 }
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
963
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
964 dataptr += DCTSTRIDE; /* advance pointer to next row */
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
965 continue;
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
966 }
2262
7a1c3178d759 optimizing 4x4 idct
michael
parents: 2259
diff changeset
967
2256
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
968 /* Even part: reverse the even part of the forward DCT. */
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
969 /* The rotator is sqrt(2)*c(-6). */
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
970 if (d6) {
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
971 if (d2) {
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
972 /* d0 != 0, d2 != 0, d4 != 0, d6 != 0 */
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
973 z1 = MULTIPLY(d2 + d6, FIX_0_541196100);
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
974 tmp2 = z1 + MULTIPLY(-d6, FIX_1_847759065);
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
975 tmp3 = z1 + MULTIPLY(d2, FIX_0_765366865);
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
976
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
977 tmp0 = (d0 + d4) << CONST_BITS;
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
978 tmp1 = (d0 - d4) << CONST_BITS;
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
979
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
980 tmp10 = tmp0 + tmp3;
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
981 tmp13 = tmp0 - tmp3;
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
982 tmp11 = tmp1 + tmp2;
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
983 tmp12 = tmp1 - tmp2;
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
984 } else {
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
985 /* d0 != 0, d2 == 0, d4 != 0, d6 != 0 */
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
986 tmp2 = MULTIPLY(-d6, FIX_1_306562965);
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
987 tmp3 = MULTIPLY(d6, FIX_0_541196100);
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
988
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
989 tmp0 = (d0 + d4) << CONST_BITS;
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
990 tmp1 = (d0 - d4) << CONST_BITS;
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
991
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
992 tmp10 = tmp0 + tmp3;
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
993 tmp13 = tmp0 - tmp3;
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
994 tmp11 = tmp1 + tmp2;
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
995 tmp12 = tmp1 - tmp2;
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
996 }
2262
7a1c3178d759 optimizing 4x4 idct
michael
parents: 2259
diff changeset
997 } else {
2256
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
998 if (d2) {
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
999 /* d0 != 0, d2 != 0, d4 != 0, d6 == 0 */
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1000 tmp2 = MULTIPLY(d2, FIX_0_541196100);
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1001 tmp3 = MULTIPLY(d2, FIX_1_306562965);
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1002
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1003 tmp0 = (d0 + d4) << CONST_BITS;
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1004 tmp1 = (d0 - d4) << CONST_BITS;
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1005
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1006 tmp10 = tmp0 + tmp3;
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1007 tmp13 = tmp0 - tmp3;
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1008 tmp11 = tmp1 + tmp2;
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1009 tmp12 = tmp1 - tmp2;
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1010 } else {
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1011 /* d0 != 0, d2 == 0, d4 != 0, d6 == 0 */
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1012 tmp10 = tmp13 = (d0 + d4) << CONST_BITS;
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1013 tmp11 = tmp12 = (d0 - d4) << CONST_BITS;
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1014 }
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1015 }
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1016
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1017 /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1018
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1019 dataptr[0] = (DCTELEM) DESCALE(tmp10, CONST_BITS-PASS1_BITS);
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1020 dataptr[1] = (DCTELEM) DESCALE(tmp11, CONST_BITS-PASS1_BITS);
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1021 dataptr[2] = (DCTELEM) DESCALE(tmp12, CONST_BITS-PASS1_BITS);
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1022 dataptr[3] = (DCTELEM) DESCALE(tmp13, CONST_BITS-PASS1_BITS);
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1023
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1024 dataptr += DCTSTRIDE; /* advance pointer to next row */
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1025 }
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1026
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1027 /* Pass 2: process columns. */
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1028 /* Note that we must descale the results by a factor of 8 == 2**3, */
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1029 /* and also undo the PASS1_BITS scaling. */
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1030
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1031 dataptr = data;
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1032 for (rowctr = DCTSIZE-1; rowctr >= 0; rowctr--) {
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1033 /* Columns of zeroes can be exploited in the same way as we did with rows.
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1034 * However, the row calculation has created many nonzero AC terms, so the
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1035 * simplification applies less often (typically 5% to 10% of the time).
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1036 * On machines with very fast multiplication, it's possible that the
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1037 * test takes more time than it's worth. In that case this section
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1038 * may be commented out.
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1039 */
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1040
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1041 d0 = dataptr[DCTSTRIDE*0];
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1042 d2 = dataptr[DCTSTRIDE*1];
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1043 d4 = dataptr[DCTSTRIDE*2];
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1044 d6 = dataptr[DCTSTRIDE*3];
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1045
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1046 /* Even part: reverse the even part of the forward DCT. */
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1047 /* The rotator is sqrt(2)*c(-6). */
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1048 if (d6) {
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1049 if (d2) {
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1050 /* d0 != 0, d2 != 0, d4 != 0, d6 != 0 */
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1051 z1 = MULTIPLY(d2 + d6, FIX_0_541196100);
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1052 tmp2 = z1 + MULTIPLY(-d6, FIX_1_847759065);
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1053 tmp3 = z1 + MULTIPLY(d2, FIX_0_765366865);
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1054
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1055 tmp0 = (d0 + d4) << CONST_BITS;
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1056 tmp1 = (d0 - d4) << CONST_BITS;
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1057
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1058 tmp10 = tmp0 + tmp3;
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1059 tmp13 = tmp0 - tmp3;
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1060 tmp11 = tmp1 + tmp2;
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1061 tmp12 = tmp1 - tmp2;
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1062 } else {
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1063 /* d0 != 0, d2 == 0, d4 != 0, d6 != 0 */
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1064 tmp2 = MULTIPLY(-d6, FIX_1_306562965);
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1065 tmp3 = MULTIPLY(d6, FIX_0_541196100);
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1066
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1067 tmp0 = (d0 + d4) << CONST_BITS;
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1068 tmp1 = (d0 - d4) << CONST_BITS;
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1069
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1070 tmp10 = tmp0 + tmp3;
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1071 tmp13 = tmp0 - tmp3;
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1072 tmp11 = tmp1 + tmp2;
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1073 tmp12 = tmp1 - tmp2;
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1074 }
2262
7a1c3178d759 optimizing 4x4 idct
michael
parents: 2259
diff changeset
1075 } else {
2256
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1076 if (d2) {
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1077 /* d0 != 0, d2 != 0, d4 != 0, d6 == 0 */
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1078 tmp2 = MULTIPLY(d2, FIX_0_541196100);
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1079 tmp3 = MULTIPLY(d2, FIX_1_306562965);
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1080
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1081 tmp0 = (d0 + d4) << CONST_BITS;
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1082 tmp1 = (d0 - d4) << CONST_BITS;
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1083
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1084 tmp10 = tmp0 + tmp3;
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1085 tmp13 = tmp0 - tmp3;
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1086 tmp11 = tmp1 + tmp2;
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1087 tmp12 = tmp1 - tmp2;
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1088 } else {
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1089 /* d0 != 0, d2 == 0, d4 != 0, d6 == 0 */
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1090 tmp10 = tmp13 = (d0 + d4) << CONST_BITS;
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1091 tmp11 = tmp12 = (d0 - d4) << CONST_BITS;
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1092 }
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1093 }
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1094
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1095 /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1096
2262
7a1c3178d759 optimizing 4x4 idct
michael
parents: 2259
diff changeset
1097 dataptr[DCTSTRIDE*0] = tmp10 >> (CONST_BITS+PASS1_BITS+3);
7a1c3178d759 optimizing 4x4 idct
michael
parents: 2259
diff changeset
1098 dataptr[DCTSTRIDE*1] = tmp11 >> (CONST_BITS+PASS1_BITS+3);
7a1c3178d759 optimizing 4x4 idct
michael
parents: 2259
diff changeset
1099 dataptr[DCTSTRIDE*2] = tmp12 >> (CONST_BITS+PASS1_BITS+3);
7a1c3178d759 optimizing 4x4 idct
michael
parents: 2259
diff changeset
1100 dataptr[DCTSTRIDE*3] = tmp13 >> (CONST_BITS+PASS1_BITS+3);
2256
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1101
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1102 dataptr++; /* advance pointer to next column */
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1103 }
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1104 }
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1105
2257
5f64a30339e5 1/4 resolution decoding
michael
parents: 2256
diff changeset
1106 void j_rev_dct2(DCTBLOCK data){
5f64a30339e5 1/4 resolution decoding
michael
parents: 2256
diff changeset
1107 int d00, d01, d10, d11;
5f64a30339e5 1/4 resolution decoding
michael
parents: 2256
diff changeset
1108
5f64a30339e5 1/4 resolution decoding
michael
parents: 2256
diff changeset
1109 data[0] += 4;
5f64a30339e5 1/4 resolution decoding
michael
parents: 2256
diff changeset
1110 d00 = data[0+0*DCTSTRIDE] + data[1+0*DCTSTRIDE];
5f64a30339e5 1/4 resolution decoding
michael
parents: 2256
diff changeset
1111 d01 = data[0+0*DCTSTRIDE] - data[1+0*DCTSTRIDE];
5f64a30339e5 1/4 resolution decoding
michael
parents: 2256
diff changeset
1112 d10 = data[0+1*DCTSTRIDE] + data[1+1*DCTSTRIDE];
5f64a30339e5 1/4 resolution decoding
michael
parents: 2256
diff changeset
1113 d11 = data[0+1*DCTSTRIDE] - data[1+1*DCTSTRIDE];
5f64a30339e5 1/4 resolution decoding
michael
parents: 2256
diff changeset
1114
5f64a30339e5 1/4 resolution decoding
michael
parents: 2256
diff changeset
1115 data[0+0*DCTSTRIDE]= (d00 + d10)>>3;
5f64a30339e5 1/4 resolution decoding
michael
parents: 2256
diff changeset
1116 data[1+0*DCTSTRIDE]= (d01 + d11)>>3;
5f64a30339e5 1/4 resolution decoding
michael
parents: 2256
diff changeset
1117 data[0+1*DCTSTRIDE]= (d00 - d10)>>3;
5f64a30339e5 1/4 resolution decoding
michael
parents: 2256
diff changeset
1118 data[1+1*DCTSTRIDE]= (d01 - d11)>>3;
5f64a30339e5 1/4 resolution decoding
michael
parents: 2256
diff changeset
1119 }
2256
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 1106
diff changeset
1120
2259
12e75af1d44c 1/8 resolution decoding
michael
parents: 2257
diff changeset
1121 void j_rev_dct1(DCTBLOCK data){
12e75af1d44c 1/8 resolution decoding
michael
parents: 2257
diff changeset
1122 data[0] = (data[0] + 4)>>3;
12e75af1d44c 1/8 resolution decoding
michael
parents: 2257
diff changeset
1123 }
12e75af1d44c 1/8 resolution decoding
michael
parents: 2257
diff changeset
1124
440
000aeeac27a2 * started to cleanup name clashes for onetime compilation
kabi
parents: 36
diff changeset
1125 #undef FIX
000aeeac27a2 * started to cleanup name clashes for onetime compilation
kabi
parents: 36
diff changeset
1126 #undef CONST_BITS