Ignore:
Timestamp:
Feb 4, 2014 10:13:56 AM (10 years ago)
Author:
bennylp
Message:

Misc (re #1630): Fixing warnings about variable set but not used with recent gcc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/third_party/resample/src/resamplesubs.c

    r3085 r4728  
    77 * 
    88 * Snippet from the resample.1 man page: 
    9  *  
     9 * 
    1010 * HISTORY 
    1111 * 
     
    1414 * 1981.  It was called SRCONV and was written in SAIL for PDP-10 
    1515 * compatible machines.  The algorithm was first published in 
    16  *  
     16 * 
    1717 * Smith, Julius O. and Phil Gossett. ``A Flexible Sampling-Rate 
    1818 * Conversion Method,'' Proceedings (2): 19.4.1-19.4.4, IEEE Conference 
    1919 * on Acoustics, Speech, and Signal Processing, San Diego, March 1984. 
    20  *  
     20 * 
    2121 * An expanded tutorial based on this paper is available at the Digital 
    2222 * Audio Resampling Home Page given above. 
    23  *  
     23 * 
    2424 * Circa 1988, the SRCONV program was translated from SAIL to C by 
    2525 * Christopher Lee Fraley working with Roger Dannenberg at CMU. 
    26  *  
     26 * 
    2727 * Since then, the C version has been maintained by jos. 
    28  *  
     28 * 
    2929 * Sndlib support was added 6/99 by John Gibson <jgg9c@virginia.edu>. 
    30  *  
     30 * 
    3131 * The resample program is free software distributed in accordance 
    3232 * with the Lesser GNU Public License (LGPL).  There is NO warranty; not 
     
    7878#undef INLINE 
    7979#define INLINE 
    80 #define HAVE_FILTER 0     
     80#define HAVE_FILTER 0 
    8181 
    8282#ifndef NULL 
     
    9595    } else if (v < MIN_HWORD) { 
    9696        v = MIN_HWORD; 
    97     }    
     97    } 
    9898    out = (RES_HWORD) v; 
    9999    return out; 
     
    102102/* Sampling rate conversion using linear interpolation for maximum speed. 
    103103 */ 
    104 static int  
     104static int 
    105105  SrcLinear(const RES_HWORD X[], RES_HWORD Y[], double pFactor, RES_UHWORD nx) 
    106106{ 
     
    110110    RES_HWORD *Ystart, *Yend; 
    111111    RES_WORD v,x1,x2; 
    112      
    113     double dt;                  /* Step through input signal */  
     112 
     113    double dt;                  /* Step through input signal */ 
    114114    RES_UWORD dtb;                  /* Fixed-point version of Dt */ 
    115     RES_UWORD endTime;              /* When time reaches EndTime, return to user */ 
    116      
     115    //RES_UWORD endTime;              /* When time reaches EndTime, return to user */ 
     116 
    117117    dt = 1.0/pFactor;            /* Output sampling period */ 
    118118    dtb = dt*(1<<Np) + 0.5;     /* Fixed-point representation */ 
    119      
     119 
    120120    Ystart = Y; 
    121121    Yend = Ystart + (unsigned)(nx * pFactor + 0.5); 
    122     endTime = time + (1<<Np)*(RES_WORD)nx; 
    123      
    124     // Integer round down in dtb calculation may cause (endTime % dtb > 0),  
     122    //endTime = time + (1<<Np)*(RES_WORD)nx; 
     123 
     124    // Integer round down in dtb calculation may cause (endTime % dtb > 0), 
    125125    // so it may cause resample write pass the output buffer (Y >= Yend). 
    126126    // while (time < endTime) 
     
    140140} 
    141141 
    142 static RES_WORD FilterUp(const RES_HWORD Imp[], const RES_HWORD ImpD[],  
     142static RES_WORD FilterUp(const RES_HWORD Imp[], const RES_HWORD ImpD[], 
    143143                     RES_UHWORD Nwing, RES_BOOL Interp, 
    144144                     const RES_HWORD *Xp, RES_HWORD Ph, RES_HWORD Inc) 
     
    149149    RES_HWORD a = 0; 
    150150    RES_WORD v, t; 
    151      
     151 
    152152    v=0; 
    153153    Hp = &Imp[Ph>>Na]; 
     
    179179 
    180180          Xp += Inc;            /* Input signal step. NO CHECK ON BOUNDS */ 
    181       }  
    182     else  
     181      } 
     182    else 
    183183      while (Hp < End) { 
    184184          t = *Hp;              /* Get filter coeff */ 
     
    203203    RES_WORD v, t; 
    204204    RES_UWORD Ho; 
    205      
     205 
    206206    v=0; 
    207207    Ho = (Ph*(RES_UWORD)dhb)>>Np; 
     
    228228          Xp += Inc;            /* Input signal step. NO CHECK ON BOUNDS */ 
    229229      } 
    230     else  
     230    else 
    231231      while ((Hp = &Imp[Ho>>Na]) < End) { 
    232232          t = *Hp;              /* Get IR sample */ 
     
    245245 * Slightly faster than down-conversion; 
    246246 */ 
    247 static int SrcUp(const RES_HWORD X[], RES_HWORD Y[], double pFactor,  
     247static int SrcUp(const RES_HWORD X[], RES_HWORD Y[], double pFactor, 
    248248                 RES_UHWORD nx, RES_UHWORD pNwing, RES_UHWORD pLpScl, 
    249249                 const RES_HWORD pImp[], const RES_HWORD pImpD[], RES_BOOL Interp) 
     
    252252    RES_HWORD *Ystart, *Yend; 
    253253    RES_WORD v; 
    254      
    255     double dt;                  /* Step through input signal */  
     254 
     255    double dt;                  /* Step through input signal */ 
    256256    RES_UWORD dtb;                  /* Fixed-point version of Dt */ 
    257257    RES_UWORD time = 0; 
    258     RES_UWORD endTime;              /* When time reaches EndTime, return to user */ 
    259      
     258    //RES_UWORD endTime;              /* When time reaches EndTime, return to user */ 
     259 
    260260    dt = 1.0/pFactor;            /* Output sampling period */ 
    261261    dtb = dt*(1<<Np) + 0.5;     /* Fixed-point representation */ 
    262      
     262 
    263263    Ystart = Y; 
    264264    Yend = Ystart + (unsigned)(nx * pFactor + 0.5); 
    265     endTime = time + (1<<Np)*(RES_WORD)nx; 
    266  
    267     // Integer round down in dtb calculation may cause (endTime % dtb > 0),  
     265    //endTime = time + (1<<Np)*(RES_WORD)nx; 
     266 
     267    // Integer round down in dtb calculation may cause (endTime % dtb > 0), 
    268268    // so it may cause resample write pass the output buffer (Y >= Yend). 
    269269    // while (time < endTime) 
     
    289289/* Sampling rate conversion subroutine */ 
    290290 
    291 static int SrcUD(const RES_HWORD X[], RES_HWORD Y[], double pFactor,  
     291static int SrcUD(const RES_HWORD X[], RES_HWORD Y[], double pFactor, 
    292292                 RES_UHWORD nx, RES_UHWORD pNwing, RES_UHWORD pLpScl, 
    293293                 const RES_HWORD pImp[], const RES_HWORD pImpD[], RES_BOOL Interp) 
     
    296296    RES_HWORD *Ystart, *Yend; 
    297297    RES_WORD v; 
    298      
     298 
    299299    double dh;                  /* Step through filter impulse response */ 
    300300    double dt;                  /* Step through input signal */ 
    301301    RES_UWORD time = 0; 
    302     RES_UWORD endTime;          /* When time reaches EndTime, return to user */ 
     302    //RES_UWORD endTime;          /* When time reaches EndTime, return to user */ 
    303303    RES_UWORD dhb, dtb;         /* Fixed-point versions of Dh,Dt */ 
    304      
     304 
    305305    dt = 1.0/pFactor;            /* Output sampling period */ 
    306306    dtb = dt*(1<<Np) + 0.5;     /* Fixed-point representation */ 
    307      
     307 
    308308    dh = MIN(Npc, pFactor*Npc);  /* Filter sampling period */ 
    309309    dhb = dh*(1<<Na) + 0.5;     /* Fixed-point representation */ 
    310      
     310 
    311311    Ystart = Y; 
    312312    Yend = Ystart + (unsigned)(nx * pFactor + 0.5); 
    313     endTime = time + (1<<Np)*(RES_WORD)nx; 
    314  
    315     // Integer round down in dtb calculation may cause (endTime % dtb > 0),  
     313    //endTime = time + (1<<Np)*(RES_WORD)nx; 
     314 
     315    // Integer round down in dtb calculation may cause (endTime % dtb > 0), 
    316316    // so it may cause resample write pass the output buffer (Y >= Yend). 
    317317    // while (time < endTime) 
     
    332332 
    333333 
    334 DECL(int) res_SrcLinear(const RES_HWORD X[], RES_HWORD Y[],  
     334DECL(int) res_SrcLinear(const RES_HWORD X[], RES_HWORD Y[], 
    335335                        double pFactor, RES_UHWORD nx) 
    336336{ 
     
    338338} 
    339339 
    340 DECL(int) res_Resample(const RES_HWORD X[], RES_HWORD Y[], double pFactor,  
     340DECL(int) res_Resample(const RES_HWORD X[], RES_HWORD Y[], double pFactor, 
    341341                       RES_UHWORD nx, RES_BOOL LargeF, RES_BOOL Interp) 
    342342{ 
     
    355355 
    356356        if (LargeF) 
    357             return SrcUD(X, Y, pFactor, nx,  
     357            return SrcUD(X, Y, pFactor, nx, 
    358358                         LARGE_FILTER_NWING, LARGE_FILTER_SCALE * pFactor + 0.5, 
    359359                         LARGE_FILTER_IMP, LARGE_FILTER_IMPD, Interp); 
    360360        else 
    361             return SrcUD(X, Y, pFactor, nx,  
     361            return SrcUD(X, Y, pFactor, nx, 
    362362                         SMALL_FILTER_NWING, SMALL_FILTER_SCALE * pFactor + 0.5, 
    363363                         SMALL_FILTER_IMP, SMALL_FILTER_IMPD, Interp); 
     
    369369{ 
    370370    if (LargeF) 
    371         return (LARGE_FILTER_NMULT + 1) / 2.0  *   
     371        return (LARGE_FILTER_NMULT + 1) / 2.0  * 
    372372                MAX(1.0, 1.0/pFactor); 
    373373    else 
    374         return (SMALL_FILTER_NMULT + 1) / 2.0  *   
     374        return (SMALL_FILTER_NMULT + 1) / 2.0  * 
    375375                MAX(1.0, 1.0/pFactor); 
    376376} 
Note: See TracChangeset for help on using the changeset viewer.