Changeset 386:372958bba38d in roaraudio


Ignore:
Timestamp:
08/06/08 14:55:54 (16 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

make the resample use a more accorate value for step

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • include/libroardsp/convert.h

    r383 r386  
    2727 
    2828 
    29 int roar_conv_poly4_16 (int16_t * out, int16_t * in, size_t olen, size_t ilen); 
     29int roar_conv_poly4_16  (int16_t * out, int16_t * in, size_t olen, size_t ilen); 
     30int roar_conv_poly4_16s (int16_t * out, int16_t * in, size_t olen, size_t ilen, float step); 
    3031 
    3132#endif 
  • libroardsp/convert.c

    r385 r386  
    9797 
    9898int roar_conv_rate_16 (void * out, void * in, int samples, int from, int to, int channels) { 
     99 if ( channels == 1 ) { 
     100  printf("roar_conv_rate_16(): samples=%i -> %i, rate=%i -> %i\n", samples*from/to, samples, from, to); 
     101  return roar_conv_poly4_16s((int16_t*) out, (int16_t*) in, samples, samples*from/to, (float)from/to); 
     102//  return roar_conv_poly4_16((int16_t*) out, (int16_t*) in, samples*to/from, samples); 
     103 } 
     104 
    99105 return -1; 
    100106} 
     
    148154 } 
    149155 
     156 if ( from->rate != to->rate ) { 
     157  if ( roar_conv_rate(out, ip, samples, from->rate, to->rate, to->bits, from->channels) == -1 ) 
     158   return -1; 
     159  else 
     160   ip = out; 
     161 } 
     162 
    150163 if ( from->channels != to->channels ) { 
    151164  if ( roar_conv_chans(out, ip, samples, from->channels, to->channels, to->bits) == -1 ) 
     
    155168 } 
    156169 
    157  if ( from->rate != to->rate ) { 
    158   if ( roar_conv_rate(out, ip, samples, from->rate, to->rate, to->bits, to->channels) == -1 ) 
    159    return -1; 
    160   else 
    161    ip = out; 
    162  } 
    163  
    164170 if ( from->codec != to->codec ) 
    165171  return -1; 
     
    171177 
    172178int roar_conv_poly4_16 (int16_t * out, int16_t * in, size_t olen, size_t ilen) { 
     179 return roar_conv_poly4_16s(out, in, olen, ilen, (float)ilen/olen); 
     180} 
     181 
     182int roar_conv_poly4_16s (int16_t * out, int16_t * in, size_t olen, size_t ilen, float step) { 
    173183 float poly[4]; 
    174184 float data[4]; 
    175185 float t    = 0; 
    176  float step = (float)ilen/olen; 
    177186 int16_t * ci = in; 
    178187 int io, ii = 0; 
    179188 int i; 
     189 
     190 printf("step=%f\n", step); 
    180191 
    181192 // we can not make a poly4 with less than 4 points ;) 
     
    219230 } 
    220231 
     232 printf("io=%i\n", io); 
     233 
    221234 return 0; 
    222235} 
Note: See TracChangeset for help on using the changeset viewer.