Removed unused code.
authorFlorian Forster <octo@leeloo.lan.home.verplant.org>
Thu, 16 Aug 2007 15:19:52 +0000 (17:19 +0200)
committerFlorian Forster <octo@leeloo.lan.home.verplant.org>
Thu, 16 Aug 2007 15:19:52 +0000 (17:19 +0200)
src/filter.h
src/panolib.c
src/viewer.c

index b9a1a1a..7ccac06 100644 (file)
@@ -62,14 +62,6 @@ enum{
 
 #define NORM_ANGLE( x )  while( x >180.0 ) x -= 360.0; while( x < -180.0 ) x += 360.0;
 
-// Convert degree to radian
-
-#define DEG_TO_RAD( x )                ( (x) * 2.0 * PI / 360.0 )
-
-// and reverse
-
-#define RAD_TO_DEG( x )                ( (x) * 360.0 / ( 2.0 * PI ) )
-
 // Convert double x to unsigned char/short c
 
 
index e9c04ef..8b9f30b 100644 (file)
@@ -23,6 +23,7 @@
 #include "filter.h"
 #include "utils_math.h"
 
+#define DEG_TO_RAD(x) ((x) * 2.0 * M_PI / 360.0 )
 
 // Lookup Tables for Trig-functions and interpolator
 
 
 int *atan_LU;
 int *sqrt_LU;
-int *mweights[256];
 
 
 void   matrix_matrix_mult      ( double m1[3][3],double m2[3][3],double result[3][3]);
 void   PV_transForm( TrformStr *TrPtr, double dist_r, double dist_e, int mt[3][3]);
-int    PV_atan2(int y, int x);
 int    PV_sqrt( int x1, int x2 );
 
 
@@ -227,134 +226,6 @@ void matrix_matrix_mult( double m1[3][3],double m2[3][3],double result[3][3])
                        result[i][k] = m1[i][0] * m2[0][k] + m1[i][1] * m2[1][k] + m1[i][2] * m2[2][k];
 } /* void matrix_matrix_mult */
 
-#if 0
-static int orig_PV_atan2(int y, int x)
-{
-       // return atan2(y,x) * 256*NATAN;
-       if( x > 0 )
-       {
-               if( y > 0 )
-               {
-                       return  atan_LU[(int)( NATAN * y / ( x + y ))];
-               }
-               else
-               {
-                       return -atan_LU[ (int)(NATAN * (-y) / ( x - y ))];
-               }
-       }
-
-       if( x == 0 )
-       {
-               if( y > 0 )
-                       return  (int)(256*NATAN*PI / 2.0);
-               else
-                       return  -(int)(256*NATAN*PI / 2.0);
-       }
-       
-       if( y < 0 )
-       {
-               return  atan_LU[(int)( NATAN * y / ( x + y ))] - (int)(PI*256*NATAN);
-       }
-       else
-       {
-               return -atan_LU[ (int)(NATAN * (-y) / ( x - y ))] + (int)(PI*256*NATAN);
-       }
-       
-} /* int orig_PV_atan2 */
-#endif
-
-int PV_atan2(int y, int x)
-{
-       double ret = atan2 (y, x) * NATAN * 256.0;
-       return ((int) ret);
-} /* int PV_atan2 */
-
-int SetUpAtan()
-{
-       int i;
-       double dz = 1.0 / (double)NATAN;
-       double z = 0.0;
-       
-       atan_LU = (int*) malloc( (NATAN+1) * sizeof( int ));
-       
-       if( atan_LU == NULL )
-               return -1;
-               
-       for( i=0; i< NATAN; i++, z+=dz )
-               atan_LU[i] = atan( z / (1.0 - z ) ) * NATAN * 256;
-               
-       atan_LU[NATAN] = PI/4.0 * NATAN * 256;
-       
-       // Print a test
-#if 0  
-       for(i = -10; i< 10; i++)
-       {
-               int k;
-               for(k=-10; k<10; k++)
-               {
-                       printf("i =  %d  k = %d   atan2(i,k) = %g    LUatan(i,k) = %g diff = %g\n", i,k,atan2(i,k), 
-                               (double)PV_atan2(i,k) / (256*NATAN) , atan2(i,k) - (double)PV_atan2(i,k) / (256*NATAN));
-               }
-       }
-       exit(0);
-#endif 
-       return 0;
-}
-
-int SetUpSqrt()
-{
-       int i;
-       double dz = 1.0 / (double)NSQRT;
-       double z = 0.0;
-       
-       sqrt_LU = (int*) malloc( (NSQRT+1) * sizeof( int ));
-       
-       if( sqrt_LU == NULL )
-               return -1;
-               
-       for( i=0; i< NSQRT; i++, z+=dz )
-               sqrt_LU[i] = sqrt( 1.0 + z*z ) * 256 * NSQRT;
-               
-       sqrt_LU[NSQRT] = sqrt(2.0) * 256 * NSQRT;
-       
-       return 0;
-}
-
-int SetUpMweights()
-{
-       int i,k;
-       
-       for(i=0; i<256; i++)
-       {
-               mweights[i] = (int*)malloc( 256 * sizeof(int) );
-               if( mweights[i] == NULL ) return -1;
-       }
-       for(i=0; i<256; i++)
-       {
-               for(k=0; k<256; k++)
-               {
-                       mweights[i][k] = i*k;
-               }
-       }
-       
-       return 0;
-}
-
-
-int PV_sqrt( int x1, int x2 )
-{
-       if( x1 > x2 )
-       {
-               return  x1 * sqrt_LU[ NSQRT * x2 /  x1 ] / NSQRT;
-       }
-       else
-       {
-               if( x2 == 0 ) return 0;
-               return x2 * sqrt_LU[ NSQRT * x1 /  x2 ] / NSQRT;
-       }
-}
-
-
 #define ID_0 0xff
 #define ID_1 0xd8
 #define ID_2 0xff
index d9c5c5d..043cef8 100644 (file)
@@ -30,9 +30,6 @@
 
 void   PV_ExtractStill( TrformStr *TrPtr );
 void   PV_SetInvMakeParams( struct fDesc *stack, struct MakeParams *mp, Image *im , Image *pn );
-int    SetUpAtan();
-int    SetUpSqrt();
-int    SetUpMweights();
 
 void   DrawWindow();
 void   DrawView(int InterPolator);
@@ -116,14 +113,6 @@ int main( int argc, char** argv )
        pano.hfov               = 360.0;
        pano.format     = _equirectangular;
        
-       // Initialize Look-up tables
-       
-       if( SetUpAtan() || SetUpSqrt() || SetUpMweights() )
-       {
-               PrintError("Could not set up LU Tables");
-               exit(0);
-       }
-
        // Set up viewer window
 
        SetImageDefaults( &view );