From a1027bceebb36afc4fa9d082277478abd8101eda Mon Sep 17 00:00:00 2001 From: Justin Berger Date: Fri, 20 Apr 2018 22:31:18 -0600 Subject: Enabled and then cleaned up warnings --- redist/CNFGXDriver.c | 8 +++----- redist/json_helpers.c | 5 +++-- redist/linmath.h | 2 +- redist/minimal_opencv.c | 5 ----- redist/sba/sba_crsm.c | 43 ----------------------------------------- redist/sba/sba_levmar.c | 46 +++----------------------------------------- redist/sba/sba_levmar_wrap.c | 8 ++++---- 7 files changed, 14 insertions(+), 103 deletions(-) (limited to 'redist') diff --git a/redist/CNFGXDriver.c b/redist/CNFGXDriver.c index 91b7233..6037eff 100644 --- a/redist/CNFGXDriver.c +++ b/redist/CNFGXDriver.c @@ -215,10 +215,10 @@ void CNFGHandleInput() XEvent report; int bKeyDirection = 1; - int r; + while( XPending( CNFGDisplay ) ) { - r=XNextEvent( CNFGDisplay, &report ); + XNextEvent(CNFGDisplay, &report); bKeyDirection = 1; switch (report.type) @@ -264,7 +264,7 @@ void CNFGUpdateScreenWithBitmap( unsigned long * data, int w, int h ) static int depth; static int lw, lh; static unsigned char * lbuffer; - int r, ls; + int r; if( !xi ) { @@ -283,8 +283,6 @@ void CNFGUpdateScreenWithBitmap( unsigned long * data, int w, int h ) lh = h; } - ls = lw * lh; - XPutImage(CNFGDisplay, CNFGWindow, CNFGWindowGC, xi, 0, 0, 0, 0, w, h ); } diff --git a/redist/json_helpers.c b/redist/json_helpers.c index ebacd2c..0741c84 100644 --- a/redist/json_helpers.c +++ b/redist/json_helpers.c @@ -120,8 +120,9 @@ char* load_file_to_mem(const char* path) { int len = ftell( f ); fseek( f, 0, SEEK_SET ); char * JSON_STRING = malloc( len + 1); - memset(JSON_STRING,0,len+1); - size_t i = fread( JSON_STRING, len, 1, f ); i = i; //Ignore return value. + memset(JSON_STRING,0,len+1); + size_t i = fread(JSON_STRING, len, 1, f); + (void)i; // Ignore return value. fclose( f ); return JSON_STRING; } diff --git a/redist/linmath.h b/redist/linmath.h index 78cac5c..aff46a3 100644 --- a/redist/linmath.h +++ b/redist/linmath.h @@ -14,7 +14,7 @@ extern "C" { #endif // Yes, I know it's kind of arbitrary. -#define DEFAULT_EPSILON 0.001 +#define DEFAULT_EPSILON 0.0000000001 // For printf #define PFTHREE(x) (x)[0], (x)[1], (x)[2] diff --git a/redist/minimal_opencv.c b/redist/minimal_opencv.c index 988dd0f..d569d96 100644 --- a/redist/minimal_opencv.c +++ b/redist/minimal_opencv.c @@ -116,11 +116,6 @@ static inline void *cvAlignPtr(const void *ptr, int align) { return (void *)(((size_t)ptr + align - 1) & ~(size_t)(align - 1)); } -static inline int cvAlign(int size, int align) { - CV_DbgAssert((align & (align - 1)) == 0 && size < INT_MAX); - return (size + align - 1) & -align; -} - SURVIVE_LOCAL_ONLY void cvCreateData(CvMat *arr) { if (CV_IS_MAT_HDR_Z(arr)) { size_t step, total_size; diff --git a/redist/sba/sba_crsm.c b/redist/sba/sba_crsm.c index 9ba11f1..ea38042 100644 --- a/redist/sba/sba_crsm.c +++ b/redist/sba/sba_crsm.c @@ -22,9 +22,6 @@ #include "sba.h" -static void sba_crsm_print(struct sba_crsm *sm, FILE *fp); -static void sba_crsm_build(struct sba_crsm *sm, int *m, int nr, int nc); - /* allocate a sparse CRS matrix */ void sba_crsm_alloc(struct sba_crsm *sm, int nr, int nc, int nnz) { int msz; @@ -50,46 +47,6 @@ void sba_crsm_free(struct sba_crsm *sm) { sm->val = sm->colidx = sm->rowptr = NULL; } -static void sba_crsm_print(struct sba_crsm *sm, FILE *fp) { - register int i; - - fprintf(fp, "matrix is %dx%d, %d non-zeros\nval: ", sm->nr, sm->nc, sm->nnz); - for (i = 0; i < sm->nnz; ++i) - fprintf(fp, "%d ", sm->val[i]); - fprintf(fp, "\ncolidx: "); - for (i = 0; i < sm->nnz; ++i) - fprintf(fp, "%d ", sm->colidx[i]); - fprintf(fp, "\nrowptr: "); - for (i = 0; i <= sm->nr; ++i) - fprintf(fp, "%d ", sm->rowptr[i]); - fprintf(fp, "\n"); -} - -/* build a sparse CRS matrix from a dense one. intended to serve as an example for sm creation */ -static void sba_crsm_build(struct sba_crsm *sm, int *m, int nr, int nc) { - int nnz; - register int i, j, k; - - /* count nonzeros */ - for (i = nnz = 0; i < nr; ++i) - for (j = 0; j < nc; ++j) - if (m[i * nc + j] != 0) - ++nnz; - - sba_crsm_alloc(sm, nr, nc, nnz); - - /* fill up the sm structure */ - for (i = k = 0; i < nr; ++i) { - sm->rowptr[i] = k; - for (j = 0; j < nc; ++j) - if (m[i * nc + j] != 0) { - sm->val[k] = m[i * nc + j]; - sm->colidx[k++] = j; - } - } - sm->rowptr[nr] = nnz; -} - /* returns the index of the (i, j) element. No bounds checking! */ int sba_crsm_elmidx(struct sba_crsm *sm, int i, int j) { register int low, high, mid, diff; diff --git a/redist/sba/sba_levmar.c b/redist/sba/sba_levmar.c index 2f85f2a..e5c499f 100644 --- a/redist/sba/sba_levmar.c +++ b/redist/sba/sba_levmar.c @@ -99,46 +99,6 @@ static double sba_mean_repr_error(int n, int mnp, double *x, double *hx, struct return err / ((double)(nprojs)); } -/* print the solution in p using sba's text format. If cnp/pnp==0 only points/cameras are printed */ -static void sba_print_sol(int n, int m, double *p, int cnp, int pnp, double *x, int mnp, struct sba_crsm *idxij, - int *rcidxs, int *rcsubs) { - register int i, j, ii; - int nnz; - double *ptr; - - if (cnp) { - /* print camera parameters */ - for (j = 0; j < m; ++j) { - ptr = p + cnp * j; - for (ii = 0; ii < cnp; ++ii) - printf("%g ", ptr[ii]); - printf("\n"); - } - } - - if (pnp) { - /* 3D & 2D point parameters */ - printf("\n\n\n# X Y Z nframes frame0 x0 y0 frame1 x1 y1 ...\n"); - for (i = 0; i < n; ++i) { - ptr = p + cnp * m + i * pnp; - for (ii = 0; ii < pnp; ++ii) // print 3D coordinates - printf("%g ", ptr[ii]); - - nnz = sba_crsm_row_elmidxs(idxij, i, rcidxs, rcsubs); /* find nonzero x_ij, j=0...m-1 */ - printf("%d ", nnz); - - for (j = 0; j < nnz; ++j) { /* point i projecting on camera rcsubs[j] */ - ptr = x + idxij->val[rcidxs[j]] * mnp; - - printf("%d ", rcsubs[j]); - for (ii = 0; ii < mnp; ++ii) // print 2D coordinates - printf("%g ", ptr[ii]); - } - printf("\n"); - } - } -} - /* Compute e=x-y for two n-vectors x and y and return the squared L2 norm of e. * e can coincide with either x or y. * Uses loop unrolling and blocking to reduce bookkeeping overhead & pipeline @@ -623,7 +583,7 @@ int sba_motstr_levmar_x( * measurements vector x */ - double *pa, *pb, *ea, *eb, *dpa, *dpb; /* pointers into p, jac, eab and dp respectively */ + double *ea, *eb, *dpa, *dpb; /* pointers into p, jac, eab and dp respectively */ /* submatrices sizes */ int Asz, Bsz, ABsz, Usz, Vsz, Wsz, Ysz, esz, easz, ebsz, YWtsz, Wtdasz, Sblsz, covsz; @@ -793,8 +753,8 @@ int sba_motstr_levmar_x( jac = W + Wsz + ((Wsz > ABsz) ? nvis * (Wsz - ABsz) : 0); /* set up auxiliary pointers */ - pa = p; - pb = p + m * cnp; + // pa = p; + // pb = p + m * cnp; ea = eab; eb = eab + m * cnp; dpa = dp; diff --git a/redist/sba/sba_levmar_wrap.c b/redist/sba/sba_levmar_wrap.c index 159a040..50948ea 100644 --- a/redist/sba/sba_levmar_wrap.c +++ b/redist/sba/sba_levmar_wrap.c @@ -73,7 +73,7 @@ static void sba_motstr_Qs(double *p, struct sba_crsm *idxij, int *rcidxs, int *r register int i, j; int cnp, pnp, mnp; double *pa, *pb, *paj, *pbi, *pxij; - int n, m, nnz; + int m, nnz; struct wrap_motstr_data_ *wdata; void (*proj)(int j, int i, double *aj, double *bi, double *xij, void *proj_adata); void *proj_adata; @@ -85,7 +85,7 @@ static void sba_motstr_Qs(double *p, struct sba_crsm *idxij, int *rcidxs, int *r proj = wdata->proj; proj_adata = wdata->adata; - n = idxij->nr; + // n = idxij->nr; m = idxij->nc; pa = p; pb = p + m * cnp; @@ -117,7 +117,7 @@ static void sba_motstr_Qs_jac(double *p, struct sba_crsm *idxij, int *rcidxs, in register int i, j; int cnp, pnp, mnp; double *pa, *pb, *paj, *pbi, *pAij, *pBij; - int n, m, nnz, Asz, Bsz, ABsz, idx; + int m, nnz, Asz, Bsz, ABsz, idx; struct wrap_motstr_data_ *wdata; void (*projac)(int j, int i, double *aj, double *bi, double *Aij, double *Bij, void *projac_adata); void *projac_adata; @@ -129,7 +129,7 @@ static void sba_motstr_Qs_jac(double *p, struct sba_crsm *idxij, int *rcidxs, in projac = wdata->projac; projac_adata = wdata->adata; - n = idxij->nr; + // n = idxij->nr; m = idxij->nc; pa = p; pb = p + m * cnp; -- cgit v1.2.3