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

Macros

#define JPEG_INTERNALS
 
#define CONST_BITS   8
 
#define FIX_0_382683433   ((int32_t) 98) /* FIX(0.382683433) */
 
#define FIX_0_541196100   ((int32_t) 139) /* FIX(0.541196100) */
 
#define FIX_0_707106781   ((int32_t) 181) /* FIX(0.707106781) */
 
#define FIX_1_306562965   ((int32_t) 334) /* FIX(1.306562965) */
 
#define DESCALE(x, n)   RIGHT_SHIFT(x, n)
 
#define MULTIPLY(var, const)   ((DCTELEM) DESCALE((var) * (const), CONST_BITS))
 

Functions

void jpeg_fdct_ifast (DCTELEM *data)
 

Macro Definition Documentation

#define JPEG_INTERNALS
#define CONST_BITS   8
#define FIX_0_382683433   ((int32_t) 98) /* FIX(0.382683433) */
#define FIX_0_541196100   ((int32_t) 139) /* FIX(0.541196100) */
#define FIX_0_707106781   ((int32_t) 181) /* FIX(0.707106781) */
#define FIX_1_306562965   ((int32_t) 334) /* FIX(1.306562965) */
#define DESCALE (   x,
 
)    RIGHT_SHIFT(x, n)
#define MULTIPLY (   var,
  const 
)    ((DCTELEM) DESCALE((var) * (const), CONST_BITS))

Function Documentation

void jpeg_fdct_ifast ( DCTELEM data)
115 {
116  DCTELEM tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
117  DCTELEM tmp10, tmp11, tmp12, tmp13;
118  DCTELEM z1, z2, z3, z4, z5, z11, z13;
119  DCTELEM *dataptr;
120  int ctr;
122 
123  /* Pass 1: process rows. */
124 
125  dataptr = data;
126  for (ctr = DCTSIZE-1; ctr >= 0; ctr--) {
127  tmp0 = dataptr[0] + dataptr[7];
128  tmp7 = dataptr[0] - dataptr[7];
129  tmp1 = dataptr[1] + dataptr[6];
130  tmp6 = dataptr[1] - dataptr[6];
131  tmp2 = dataptr[2] + dataptr[5];
132  tmp5 = dataptr[2] - dataptr[5];
133  tmp3 = dataptr[3] + dataptr[4];
134  tmp4 = dataptr[3] - dataptr[4];
135 
136  /* Even part */
137 
138  tmp10 = tmp0 + tmp3; /* phase 2 */
139  tmp13 = tmp0 - tmp3;
140  tmp11 = tmp1 + tmp2;
141  tmp12 = tmp1 - tmp2;
142 
143  dataptr[0] = tmp10 + tmp11; /* phase 3 */
144  dataptr[4] = tmp10 - tmp11;
145 
146  z1 = MULTIPLY(tmp12 + tmp13, FIX_0_707106781); /* c4 */
147  dataptr[2] = tmp13 + z1; /* phase 5 */
148  dataptr[6] = tmp13 - z1;
149 
150  /* Odd part */
151 
152  tmp10 = tmp4 + tmp5; /* phase 2 */
153  tmp11 = tmp5 + tmp6;
154  tmp12 = tmp6 + tmp7;
155 
156  /* The rotator is modified from fig 4-8 to avoid extra negations. */
157  z5 = MULTIPLY(tmp10 - tmp12, FIX_0_382683433); /* c6 */
158  z2 = MULTIPLY(tmp10, FIX_0_541196100) + z5; /* c2-c6 */
159  z4 = MULTIPLY(tmp12, FIX_1_306562965) + z5; /* c2+c6 */
160  z3 = MULTIPLY(tmp11, FIX_0_707106781); /* c4 */
161 
162  z11 = tmp7 + z3; /* phase 5 */
163  z13 = tmp7 - z3;
164 
165  dataptr[5] = z13 + z2; /* phase 6 */
166  dataptr[3] = z13 - z2;
167  dataptr[1] = z11 + z4;
168  dataptr[7] = z11 - z4;
169 
170  dataptr += DCTSIZE; /* advance pointer to next row */
171  }
172 
173  /* Pass 2: process columns. */
174 
175  dataptr = data;
176  for (ctr = DCTSIZE-1; ctr >= 0; ctr--) {
177  tmp0 = dataptr[DCTSIZE*0] + dataptr[DCTSIZE*7];
178  tmp7 = dataptr[DCTSIZE*0] - dataptr[DCTSIZE*7];
179  tmp1 = dataptr[DCTSIZE*1] + dataptr[DCTSIZE*6];
180  tmp6 = dataptr[DCTSIZE*1] - dataptr[DCTSIZE*6];
181  tmp2 = dataptr[DCTSIZE*2] + dataptr[DCTSIZE*5];
182  tmp5 = dataptr[DCTSIZE*2] - dataptr[DCTSIZE*5];
183  tmp3 = dataptr[DCTSIZE*3] + dataptr[DCTSIZE*4];
184  tmp4 = dataptr[DCTSIZE*3] - dataptr[DCTSIZE*4];
185 
186  /* Even part */
187 
188  tmp10 = tmp0 + tmp3; /* phase 2 */
189  tmp13 = tmp0 - tmp3;
190  tmp11 = tmp1 + tmp2;
191  tmp12 = tmp1 - tmp2;
192 
193  dataptr[DCTSIZE*0] = tmp10 + tmp11; /* phase 3 */
194  dataptr[DCTSIZE*4] = tmp10 - tmp11;
195 
196  z1 = MULTIPLY(tmp12 + tmp13, FIX_0_707106781); /* c4 */
197  dataptr[DCTSIZE*2] = tmp13 + z1; /* phase 5 */
198  dataptr[DCTSIZE*6] = tmp13 - z1;
199 
200  /* Odd part */
201 
202  tmp10 = tmp4 + tmp5; /* phase 2 */
203  tmp11 = tmp5 + tmp6;
204  tmp12 = tmp6 + tmp7;
205 
206  /* The rotator is modified from fig 4-8 to avoid extra negations. */
207  z5 = MULTIPLY(tmp10 - tmp12, FIX_0_382683433); /* c6 */
208  z2 = MULTIPLY(tmp10, FIX_0_541196100) + z5; /* c2-c6 */
209  z4 = MULTIPLY(tmp12, FIX_1_306562965) + z5; /* c2+c6 */
210  z3 = MULTIPLY(tmp11, FIX_0_707106781); /* c4 */
211 
212  z11 = tmp7 + z3; /* phase 5 */
213  z13 = tmp7 - z3;
214 
215  dataptr[DCTSIZE*5] = z13 + z2; /* phase 6 */
216  dataptr[DCTSIZE*3] = z13 - z2;
217  dataptr[DCTSIZE*1] = z11 + z4;
218  dataptr[DCTSIZE*7] = z11 - z4;
219 
220  dataptr++; /* advance pointer to next column */
221  }
222 }
#define FIX_0_382683433
Definition: jfdctfst.cpp:79
#define SHIFT_TEMPS
Definition: jpegint.h:289
#define FIX_0_707106781
Definition: jfdctfst.cpp:81
#define FIX_1_306562965
Definition: jfdctfst.cpp:82
int32_t DCTELEM
Definition: jdct.h:32
#define FIX_0_541196100
Definition: jfdctfst.cpp:80
#define DCTSIZE
Definition: jpeglib.h:46
#define MULTIPLY(var, const)
Definition: jfdctfst.cpp:106