Main MRPT website > C++ reference for MRPT 1.5.7
jfdctflt.cpp
Go to the documentation of this file.
1 /* +---------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2017, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +---------------------------------------------------------------------------+ */
9 
10 #define JPEG_INTERNALS
11 #include "jinclude.h"
12 #include "mrpt_jpeglib.h"
13 #include "jdct.h" /* Private declarations for DCT subsystem */
14 
15 #ifdef DCT_FLOAT_SUPPORTED
16 
17 
18 /*
19  * This module is specialized to the case DCTSIZE = 8.
20  */
21 
22 #if DCTSIZE != 8
23  Sorry, this code only copes with 8x8 DCTs. /* deliberate syntax err */
24 #endif
25 
26 
27 /*
28  * Perform the forward DCT on one block of samples.
29  */
30 
31 GLOBAL(void)
32 jpeg_fdct_float (FAST_FLOAT * data)
33 {
34  FAST_FLOAT tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
35  FAST_FLOAT tmp10, tmp11, tmp12, tmp13;
36  FAST_FLOAT z1, z2, z3, z4, z5, z11, z13;
37  FAST_FLOAT *dataptr;
38  int ctr;
39 
40  /* Pass 1: process rows. */
41 
42  dataptr = data;
43  for (ctr = DCTSIZE-1; ctr >= 0; ctr--) {
44  tmp0 = dataptr[0] + dataptr[7];
45  tmp7 = dataptr[0] - dataptr[7];
46  tmp1 = dataptr[1] + dataptr[6];
47  tmp6 = dataptr[1] - dataptr[6];
48  tmp2 = dataptr[2] + dataptr[5];
49  tmp5 = dataptr[2] - dataptr[5];
50  tmp3 = dataptr[3] + dataptr[4];
51  tmp4 = dataptr[3] - dataptr[4];
52 
53  /* Even part */
54 
55  tmp10 = tmp0 + tmp3; /* phase 2 */
56  tmp13 = tmp0 - tmp3;
57  tmp11 = tmp1 + tmp2;
58  tmp12 = tmp1 - tmp2;
59 
60  dataptr[0] = tmp10 + tmp11; /* phase 3 */
61  dataptr[4] = tmp10 - tmp11;
62 
63  z1 = (tmp12 + tmp13) * ((FAST_FLOAT) 0.707106781); /* c4 */
64  dataptr[2] = tmp13 + z1; /* phase 5 */
65  dataptr[6] = tmp13 - z1;
66 
67  /* Odd part */
68 
69  tmp10 = tmp4 + tmp5; /* phase 2 */
70  tmp11 = tmp5 + tmp6;
71  tmp12 = tmp6 + tmp7;
72 
73  /* The rotator is modified from fig 4-8 to avoid extra negations. */
74  z5 = (tmp10 - tmp12) * ((FAST_FLOAT) 0.382683433); /* c6 */
75  z2 = ((FAST_FLOAT) 0.541196100) * tmp10 + z5; /* c2-c6 */
76  z4 = ((FAST_FLOAT) 1.306562965) * tmp12 + z5; /* c2+c6 */
77  z3 = tmp11 * ((FAST_FLOAT) 0.707106781); /* c4 */
78 
79  z11 = tmp7 + z3; /* phase 5 */
80  z13 = tmp7 - z3;
81 
82  dataptr[5] = z13 + z2; /* phase 6 */
83  dataptr[3] = z13 - z2;
84  dataptr[1] = z11 + z4;
85  dataptr[7] = z11 - z4;
86 
87  dataptr += DCTSIZE; /* advance pointer to next row */
88  }
89 
90  /* Pass 2: process columns. */
91 
92  dataptr = data;
93  for (ctr = DCTSIZE-1; ctr >= 0; ctr--) {
94  tmp0 = dataptr[DCTSIZE*0] + dataptr[DCTSIZE*7];
95  tmp7 = dataptr[DCTSIZE*0] - dataptr[DCTSIZE*7];
96  tmp1 = dataptr[DCTSIZE*1] + dataptr[DCTSIZE*6];
97  tmp6 = dataptr[DCTSIZE*1] - dataptr[DCTSIZE*6];
98  tmp2 = dataptr[DCTSIZE*2] + dataptr[DCTSIZE*5];
99  tmp5 = dataptr[DCTSIZE*2] - dataptr[DCTSIZE*5];
100  tmp3 = dataptr[DCTSIZE*3] + dataptr[DCTSIZE*4];
101  tmp4 = dataptr[DCTSIZE*3] - dataptr[DCTSIZE*4];
102 
103  /* Even part */
104 
105  tmp10 = tmp0 + tmp3; /* phase 2 */
106  tmp13 = tmp0 - tmp3;
107  tmp11 = tmp1 + tmp2;
108  tmp12 = tmp1 - tmp2;
109 
110  dataptr[DCTSIZE*0] = tmp10 + tmp11; /* phase 3 */
111  dataptr[DCTSIZE*4] = tmp10 - tmp11;
112 
113  z1 = (tmp12 + tmp13) * ((FAST_FLOAT) 0.707106781); /* c4 */
114  dataptr[DCTSIZE*2] = tmp13 + z1; /* phase 5 */
115  dataptr[DCTSIZE*6] = tmp13 - z1;
116 
117  /* Odd part */
118 
119  tmp10 = tmp4 + tmp5; /* phase 2 */
120  tmp11 = tmp5 + tmp6;
121  tmp12 = tmp6 + tmp7;
122 
123  /* The rotator is modified from fig 4-8 to avoid extra negations. */
124  z5 = (tmp10 - tmp12) * ((FAST_FLOAT) 0.382683433); /* c6 */
125  z2 = ((FAST_FLOAT) 0.541196100) * tmp10 + z5; /* c2-c6 */
126  z4 = ((FAST_FLOAT) 1.306562965) * tmp12 + z5; /* c2+c6 */
127  z3 = tmp11 * ((FAST_FLOAT) 0.707106781); /* c4 */
128 
129  z11 = tmp7 + z3; /* phase 5 */
130  z13 = tmp7 - z3;
131 
132  dataptr[DCTSIZE*5] = z13 + z2; /* phase 6 */
133  dataptr[DCTSIZE*3] = z13 - z2;
134  dataptr[DCTSIZE*1] = z11 + z4;
135  dataptr[DCTSIZE*7] = z11 - z4;
136 
137  dataptr++; /* advance pointer to next column */
138  }
139 }
140 
141 #endif /* DCT_FLOAT_SUPPORTED */
int const JOCTET * dataptr
Definition: mrpt_jpeglib.h:947
#define DCTSIZE
Definition: mrpt_jpeglib.h:38
Definition: inftrees.h:28
jpeg_fdct_float(FAST_FLOAT *data)
Definition: jfdctflt.cpp:32
#define GLOBAL(type)
Definition: jmorecfg.h:185
GLsizei GLsizei GLenum GLenum const GLvoid * data
Definition: glext.h:3520



Page generated by Doxygen 1.8.14 for MRPT 1.5.7 Git: 5902e14cc Wed Apr 24 15:04:01 2019 +0200 at lun oct 28 01:39:17 CET 2019