about summary refs log tree commit diff
path: root/converter/ppm/ppmtompeg/jrevdct.c
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2019-06-28 23:45:11 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2019-06-28 23:45:11 +0000
commitcdf6e0151411d887fef61245cb303ef190b29335 (patch)
tree678c2212e125e66e0a868773e2b4ec460794da4e /converter/ppm/ppmtompeg/jrevdct.c
parentde1311e820dc892f1a3c5c9ae70dbc56868030d8 (diff)
downloadnetpbm-mirror-cdf6e0151411d887fef61245cb303ef190b29335.tar.gz
netpbm-mirror-cdf6e0151411d887fef61245cb303ef190b29335.tar.xz
netpbm-mirror-cdf6e0151411d887fef61245cb303ef190b29335.zip
Promote Advanced to Stable
git-svn-id: http://svn.code.sf.net/p/netpbm/code/stable@3641 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'converter/ppm/ppmtompeg/jrevdct.c')
-rw-r--r--converter/ppm/ppmtompeg/jrevdct.c44
1 files changed, 21 insertions, 23 deletions
diff --git a/converter/ppm/ppmtompeg/jrevdct.c b/converter/ppm/ppmtompeg/jrevdct.c
index bf9196c4..dd1f9fff 100644
--- a/converter/ppm/ppmtompeg/jrevdct.c
+++ b/converter/ppm/ppmtompeg/jrevdct.c
@@ -26,7 +26,11 @@
  * matrix, perhaps with the difference cases encoded.
  */
 
+#define _XOPEN_SOURCE 500  /* get M_PI in math.h */
+
 #include <memory.h>
+#include <math.h>
+
 #include "all.h"
 #include "dct.h"
 
@@ -1211,35 +1215,29 @@ mpeg_jrevdct_quick(data)
 */
 
 
-/* Here we use math.h to generate constants.  Compiler results may
-   vary a little */
-
-#ifndef PI
-#ifdef M_PI
-#define PI M_PI
-#else
-#define PI 3.14159265358979323846
-#endif
-#endif
-
 /* cosine transform matrix for 8x1 IDCT */
 static double itrans_coef[8][8];
 
-/* initialize DCT coefficient matrix */
 
-void init_idctref()
-{
-  int freq, time;
-  double scale;
-
-  for (freq=0; freq < 8; freq++)
-  {
-    scale = (freq == 0) ? sqrt(0.125) : 0.5;
-    for (time=0; time<8; time++)
-      itrans_coef[freq][time] = scale*cos((PI/8.0)*freq*(time + 0.5));
-  }
+
+void init_idctref() {
+/*----------------------------------------------------------------------------
+   initialize DCT coefficient matrix 
+-----------------------------------------------------------------------------*/
+    unsigned int freq;
+
+    for (freq=0; freq < 8; ++freq) {
+        double const scale = (freq == 0) ? sqrt(0.125) : 0.5;
+
+        unsigned int time;
+
+        for (time = 0; time < 8; ++time)
+            itrans_coef[freq][time] = scale*cos((M_PI/8.0)*freq*(time + 0.5));
+    }
 }
 
+
+
 /* perform IDCT matrix multiply for 8x8 coefficient block */
 
 void reference_rev_dct(block)