Ignore:
Timestamp:
Feb 1, 2010 11:23:54 AM (14 years ago)
Author:
nanang
Message:

Ticket #766:

File:
1 edited

Legend:

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

    r1969 r3085  
    119119     
    120120    Ystart = Y; 
    121     Yend = Ystart + (unsigned)(nx * pFactor); 
     121    Yend = Ystart + (unsigned)(nx * pFactor + 0.5); 
    122122    endTime = time + (1<<Np)*(RES_WORD)nx; 
    123     while (time < endTime) 
     123     
     124    // Integer round down in dtb calculation may cause (endTime % dtb > 0),  
     125    // so it may cause resample write pass the output buffer (Y >= Yend). 
     126    // while (time < endTime) 
     127    while (Y < Yend) 
    124128    { 
    125129        iconst = (time) & Pmask; 
     
    258262     
    259263    Ystart = Y; 
    260     Yend = Ystart + (unsigned)(nx * pFactor); 
     264    Yend = Ystart + (unsigned)(nx * pFactor + 0.5); 
    261265    endTime = time + (1<<Np)*(RES_WORD)nx; 
    262266 
     
    306310     
    307311    Ystart = Y; 
    308     Yend = Ystart + (unsigned)(nx * pFactor); 
     312    Yend = Ystart + (unsigned)(nx * pFactor + 0.5); 
    309313    endTime = time + (1<<Np)*(RES_WORD)nx; 
    310314 
Note: See TracChangeset for help on using the changeset viewer.