COSMOS core  1.0.2 (beta)
Comprehensive Open-architecture Solution for Mission Operations Systems
jfdctint.cpp File Reference
#include "jinclude.h"
#include "jpeglib.h"
#include "jdct.h"
Include dependency graph for jfdctint.cpp:

Macros

#define JPEG_INTERNALS
 
#define CONST_BITS   13
 
#define PASS1_BITS   2
 
#define FIX_0_298631336   ((int32_t) 2446) /* FIX(0.298631336) */
 
#define FIX_0_390180644   ((int32_t) 3196) /* FIX(0.390180644) */
 
#define FIX_0_541196100   ((int32_t) 4433) /* FIX(0.541196100) */
 
#define FIX_0_765366865   ((int32_t) 6270) /* FIX(0.765366865) */
 
#define FIX_0_899976223   ((int32_t) 7373) /* FIX(0.899976223) */
 
#define FIX_1_175875602   ((int32_t) 9633) /* FIX(1.175875602) */
 
#define FIX_1_501321110   ((int32_t) 12299) /* FIX(1.501321110) */
 
#define FIX_1_847759065   ((int32_t) 15137) /* FIX(1.847759065) */
 
#define FIX_1_961570560   ((int32_t) 16069) /* FIX(1.961570560) */
 
#define FIX_2_053119869   ((int32_t) 16819) /* FIX(2.053119869) */
 
#define FIX_2_562915447   ((int32_t) 20995) /* FIX(2.562915447) */
 
#define FIX_3_072711026   ((int32_t) 25172) /* FIX(3.072711026) */
 
#define MULTIPLY(var, const)   MULTIPLY16C16(var,const)
 

Functions

void jpeg_fdct_islow (DCTELEM *data)
 

Macro Definition Documentation

#define JPEG_INTERNALS
#define CONST_BITS   13
#define PASS1_BITS   2
#define FIX_0_298631336   ((int32_t) 2446) /* FIX(0.298631336) */
#define FIX_0_390180644   ((int32_t) 3196) /* FIX(0.390180644) */
#define FIX_0_541196100   ((int32_t) 4433) /* FIX(0.541196100) */
#define FIX_0_765366865   ((int32_t) 6270) /* FIX(0.765366865) */
#define FIX_0_899976223   ((int32_t) 7373) /* FIX(0.899976223) */
#define FIX_1_175875602   ((int32_t) 9633) /* FIX(1.175875602) */
#define FIX_1_501321110   ((int32_t) 12299) /* FIX(1.501321110) */
#define FIX_1_847759065   ((int32_t) 15137) /* FIX(1.847759065) */
#define FIX_1_961570560   ((int32_t) 16069) /* FIX(1.961570560) */
#define FIX_2_053119869   ((int32_t) 16819) /* FIX(2.053119869) */
#define FIX_2_562915447   ((int32_t) 20995) /* FIX(2.562915447) */
#define FIX_3_072711026   ((int32_t) 25172) /* FIX(3.072711026) */
#define MULTIPLY (   var,
  const 
)    MULTIPLY16C16(var,const)

Function Documentation

void jpeg_fdct_islow ( DCTELEM data)
141 {
142  int32_t tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
143  int32_t tmp10, tmp11, tmp12, tmp13;
144  int32_t z1, z2, z3, z4, z5;
145  DCTELEM *dataptr;
146  int ctr;
148 
149  /* Pass 1: process rows. */
150  /* Note results are scaled up by sqrt(8) compared to a true DCT; */
151  /* furthermore, we scale the results by 2**PASS1_BITS. */
152 
153  dataptr = data;
154  for (ctr = DCTSIZE-1; ctr >= 0; ctr--) {
155  tmp0 = dataptr[0] + dataptr[7];
156  tmp7 = dataptr[0] - dataptr[7];
157  tmp1 = dataptr[1] + dataptr[6];
158  tmp6 = dataptr[1] - dataptr[6];
159  tmp2 = dataptr[2] + dataptr[5];
160  tmp5 = dataptr[2] - dataptr[5];
161  tmp3 = dataptr[3] + dataptr[4];
162  tmp4 = dataptr[3] - dataptr[4];
163 
164  /* Even part per LL&M figure 1 --- note that published figure is faulty;
165  * rotator "sqrt(2)*c1" should be "sqrt(2)*c6".
166  */
167 
168  tmp10 = tmp0 + tmp3;
169  tmp13 = tmp0 - tmp3;
170  tmp11 = tmp1 + tmp2;
171  tmp12 = tmp1 - tmp2;
172 
173  dataptr[0] = (DCTELEM) ((tmp10 + tmp11) << PASS1_BITS);
174  dataptr[4] = (DCTELEM) ((tmp10 - tmp11) << PASS1_BITS);
175 
176  z1 = MULTIPLY(tmp12 + tmp13, FIX_0_541196100);
177  dataptr[2] = (DCTELEM) DESCALE(z1 + MULTIPLY(tmp13, FIX_0_765366865),
179  dataptr[6] = (DCTELEM) DESCALE(z1 + MULTIPLY(tmp12, - FIX_1_847759065),
181 
182  /* Odd part per figure 8 --- note paper omits factor of sqrt(2).
183  * cK represents cos(K*pi/16).
184  * i0..i3 in the paper are tmp4..tmp7 here.
185  */
186 
187  z1 = tmp4 + tmp7;
188  z2 = tmp5 + tmp6;
189  z3 = tmp4 + tmp6;
190  z4 = tmp5 + tmp7;
191  z5 = MULTIPLY(z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */
192 
193  tmp4 = MULTIPLY(tmp4, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */
194  tmp5 = MULTIPLY(tmp5, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */
195  tmp6 = MULTIPLY(tmp6, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */
196  tmp7 = MULTIPLY(tmp7, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */
197  z1 = MULTIPLY(z1, - FIX_0_899976223); /* sqrt(2) * (c7-c3) */
198  z2 = MULTIPLY(z2, - FIX_2_562915447); /* sqrt(2) * (-c1-c3) */
199  z3 = MULTIPLY(z3, - FIX_1_961570560); /* sqrt(2) * (-c3-c5) */
200  z4 = MULTIPLY(z4, - FIX_0_390180644); /* sqrt(2) * (c5-c3) */
201 
202  z3 += z5;
203  z4 += z5;
204 
205  dataptr[7] = (DCTELEM) DESCALE(tmp4 + z1 + z3, CONST_BITS-PASS1_BITS);
206  dataptr[5] = (DCTELEM) DESCALE(tmp5 + z2 + z4, CONST_BITS-PASS1_BITS);
207  dataptr[3] = (DCTELEM) DESCALE(tmp6 + z2 + z3, CONST_BITS-PASS1_BITS);
208  dataptr[1] = (DCTELEM) DESCALE(tmp7 + z1 + z4, CONST_BITS-PASS1_BITS);
209 
210  dataptr += DCTSIZE; /* advance pointer to next row */
211  }
212 
213  /* Pass 2: process columns.
214  * We remove the PASS1_BITS scaling, but leave the results scaled up
215  * by an overall factor of 8.
216  */
217 
218  dataptr = data;
219  for (ctr = DCTSIZE-1; ctr >= 0; ctr--) {
220  tmp0 = dataptr[DCTSIZE*0] + dataptr[DCTSIZE*7];
221  tmp7 = dataptr[DCTSIZE*0] - dataptr[DCTSIZE*7];
222  tmp1 = dataptr[DCTSIZE*1] + dataptr[DCTSIZE*6];
223  tmp6 = dataptr[DCTSIZE*1] - dataptr[DCTSIZE*6];
224  tmp2 = dataptr[DCTSIZE*2] + dataptr[DCTSIZE*5];
225  tmp5 = dataptr[DCTSIZE*2] - dataptr[DCTSIZE*5];
226  tmp3 = dataptr[DCTSIZE*3] + dataptr[DCTSIZE*4];
227  tmp4 = dataptr[DCTSIZE*3] - dataptr[DCTSIZE*4];
228 
229  /* Even part per LL&M figure 1 --- note that published figure is faulty;
230  * rotator "sqrt(2)*c1" should be "sqrt(2)*c6".
231  */
232 
233  tmp10 = tmp0 + tmp3;
234  tmp13 = tmp0 - tmp3;
235  tmp11 = tmp1 + tmp2;
236  tmp12 = tmp1 - tmp2;
237 
238  dataptr[DCTSIZE*0] = (DCTELEM) DESCALE(tmp10 + tmp11, PASS1_BITS);
239  dataptr[DCTSIZE*4] = (DCTELEM) DESCALE(tmp10 - tmp11, PASS1_BITS);
240 
241  z1 = MULTIPLY(tmp12 + tmp13, FIX_0_541196100);
242  dataptr[DCTSIZE*2] = (DCTELEM) DESCALE(z1 + MULTIPLY(tmp13, FIX_0_765366865),
244  dataptr[DCTSIZE*6] = (DCTELEM) DESCALE(z1 + MULTIPLY(tmp12, - FIX_1_847759065),
246 
247  /* Odd part per figure 8 --- note paper omits factor of sqrt(2).
248  * cK represents cos(K*pi/16).
249  * i0..i3 in the paper are tmp4..tmp7 here.
250  */
251 
252  z1 = tmp4 + tmp7;
253  z2 = tmp5 + tmp6;
254  z3 = tmp4 + tmp6;
255  z4 = tmp5 + tmp7;
256  z5 = MULTIPLY(z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */
257 
258  tmp4 = MULTIPLY(tmp4, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */
259  tmp5 = MULTIPLY(tmp5, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */
260  tmp6 = MULTIPLY(tmp6, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */
261  tmp7 = MULTIPLY(tmp7, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */
262  z1 = MULTIPLY(z1, - FIX_0_899976223); /* sqrt(2) * (c7-c3) */
263  z2 = MULTIPLY(z2, - FIX_2_562915447); /* sqrt(2) * (-c1-c3) */
264  z3 = MULTIPLY(z3, - FIX_1_961570560); /* sqrt(2) * (-c3-c5) */
265  z4 = MULTIPLY(z4, - FIX_0_390180644); /* sqrt(2) * (c5-c3) */
266 
267  z3 += z5;
268  z4 += z5;
269 
270  dataptr[DCTSIZE*7] = (DCTELEM) DESCALE(tmp4 + z1 + z3,
272  dataptr[DCTSIZE*5] = (DCTELEM) DESCALE(tmp5 + z2 + z4,
274  dataptr[DCTSIZE*3] = (DCTELEM) DESCALE(tmp6 + z2 + z3,
276  dataptr[DCTSIZE*1] = (DCTELEM) DESCALE(tmp7 + z1 + z4,
278 
279  dataptr++; /* advance pointer to next column */
280  }
281 }
#define DESCALE(x, n)
Definition: jdct.h:146
#define FIX_0_298631336
Definition: jfdctint.cpp:93
#define FIX_0_541196100
Definition: jfdctint.cpp:95
#define FIX_3_072711026
Definition: jfdctint.cpp:104
#define SHIFT_TEMPS
Definition: jpegint.h:289
#define MULTIPLY(var, const)
Definition: jfdctint.cpp:129
#define CONST_BITS
Definition: jfdctint.cpp:78
#define FIX_2_053119869
Definition: jfdctint.cpp:102
#define FIX_0_390180644
Definition: jfdctint.cpp:94
#define PASS1_BITS
Definition: jfdctint.cpp:79
#define FIX_1_847759065
Definition: jfdctint.cpp:100
int32_t DCTELEM
Definition: jdct.h:32
#define FIX_1_501321110
Definition: jfdctint.cpp:99
#define DCTSIZE
Definition: jpeglib.h:46
#define FIX_1_961570560
Definition: jfdctint.cpp:101
#define FIX_2_562915447
Definition: jfdctint.cpp:103
#define FIX_1_175875602
Definition: jfdctint.cpp:98
#define FIX_0_765366865
Definition: jfdctint.cpp:96
#define FIX_0_899976223
Definition: jfdctint.cpp:97