diff Meerwald/frid2_common.c @ 20:bd669312f068

suppress warnings, fix link errors
author Peter Meerwald-Stadler <pmeerw@pmeerw.net>
date Sat, 28 Jan 2023 23:54:58 +0100
parents be303a3f5ea8
children
line wrap: on
line diff
--- a/Meerwald/frid2_common.c	Tue Sep 21 13:40:51 2010 +0200
+++ b/Meerwald/frid2_common.c	Sat Jan 28 23:54:58 2023 +0100
@@ -1,5 +1,5 @@
 #include "frid2_common.h"
-#include "signature.h"
+#include "signature-utils.h"
 #include "wm.h"
 
 extern char *progname;
@@ -43,7 +43,7 @@
       if (fabs(d - x) < fabs(d - x * BACKWARD_STEP(alpha)))
         x *= FORWARD_STEP(alpha);
       else
-        x *= BACKWARD_STEP(alpha);        
+        x *= BACKWARD_STEP(alpha);
     }
 
     d =  (x + x * BACKWARD_STEP(alpha)) / 2.0;
@@ -54,8 +54,8 @@
     dcts[row][col] = d;
 
     n++;
-  }  
-}        
+  }
+}
 
 void embed_med_freq(double **dcts, int cols, int rows, double gamma, int seed, int verbose) {
   // select mid-frequency (30%) coefficients
@@ -64,12 +64,12 @@
 
   double *vector;
   int x = 0, y = 0, dir = 1;
-  int i, j;    
+  int i, j;
 
   vector = malloc((end - start) * sizeof(double));
   for (i = 0; i < (end - start); i++)
     vector[i] = 0.0;
-        
+
   // create pseudo-random vector
   srandom(seed);
   for (i = 0; i < nbit_signature; i++) {
@@ -98,7 +98,7 @@
 //      fprintf(stderr, "%d/%d: %f -> %f\n", x, y, dcts[y][x], dcts[y][x] + gamma * vector[i - start]);
       dcts[y][x] += gamma * vector[i - start];
     }
-  }        
+  }
 
   free(vector);
 }
@@ -148,7 +148,7 @@
     sum2 += pow(fabs(d), beta);
 
     n++;
-  }  
+  }
 
   return sum1 / sum2;
 }
@@ -165,7 +165,7 @@
   double corr[2];
   double correlation;
 
-  // locate start positions 
+  // locate start positions
   for (i = 0; i < start; i++) {
     x -= dir;
     y += dir;
@@ -173,10 +173,10 @@
     if (x >= cols) { dir = 1; x = cols - 1; y += 2; }
     if (y < 0) { dir = 1; y = 0; }
     if (y >= rows) { dir = -1; y = rows - 1; x += 2; }
-  }		
+  }
 
   // save start positions
-  startx = x;		
+  startx = x;
   starty = y;
   startdir = dir;
   srandom(seed);
@@ -187,14 +187,14 @@
 
     for (j = 0; j <= (end - start); j++)
       vector[j] = (double) (random() & RAND_MAX) / (double) RAND_MAX - 0.5;
-				
+
     for (j = 0; j <= 1; j++) {
       x = startx;
       y = starty;
       dir = startdir;
       corr[j] = 0;
 
-      for (k = 0; start + k < end; k++) {   
+      for (k = 0; start + k < end; k++) {
         x -= dir;
         y += dir;
         if (x < 0) { dir = -1; x = 0; }
@@ -203,7 +203,7 @@
         if (y >= rows) { dir = -1; y = rows - 1; x += 2; }
         corr[j] += dcts[y][x] * vector[k + j];
       }
-    }	
+    }
 
     set_signature2_bit(i,  (corr[0] >= corr[1]) ? 0 : 1);
   }
@@ -216,5 +216,5 @@
   }
   correlation = (double) sum / (sqrt(sum1) * sqrt(sum2));
 
-  return correlation;		
+  return correlation;
 }

Repositories maintained by Peter Meerwald, pmeerw@pmeerw.net.