From d7cd14e53539c68b183dd80284503d9a3e7baaf2 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Thu, 16 Aug 2007 17:19:52 +0200 Subject: [PATCH] Removed unused code. --- src/filter.h | 8 ---- src/panolib.c | 131 +--------------------------------------------------------- src/viewer.c | 11 ----- 3 files changed, 1 insertion(+), 149 deletions(-) diff --git a/src/filter.h b/src/filter.h index b9a1a1a..7ccac06 100644 --- a/src/filter.h +++ b/src/filter.h @@ -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 diff --git a/src/panolib.c b/src/panolib.c index e9c04ef..8b9f30b 100644 --- a/src/panolib.c +++ b/src/panolib.c @@ -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 @@ -31,12 +32,10 @@ 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 diff --git a/src/viewer.c b/src/viewer.c index d9c5c5d..043cef8 100644 --- a/src/viewer.c +++ b/src/viewer.c @@ -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 ); -- 2.11.0