Changeset 2850
 Timestamp:
 10/20/99 00:19:39 (16 years ago)
 Location:
 rat/trunk
 Files:

 2 modified
Legend:
 Unmodified
 Added
 Removed

rat/trunk/MODS
r2849 r2850 899 899 update. 900 900  Unrolled loops in extrapolation converter. 901  Replaced divisions in interpolation converter that were not powers 902 of two with a multiplication scaling factor and a power of 2 903 denominator. Improves performance 46 fold for upsampling by 3,5,6. 901 904 902 905 TODO  They're features not bugs dammit! 
rat/trunk/convert_linear.c
r2553 r2850 51 51 loop = min(src_len/channels, dst_len/(channels*l>scale)); 52 52 53 /* On some platforms divisions by powers of 2 is way quicker */ 54 /* than other divisions. To improve interpolation perf. */ 55 /* approximate fractions which are not powers of two */ 56 /* i.e. 1 / 3 > 5 / 16 */ 57 /* 1 / 5 > 6 / 32 */ 58 /* 1 / 6 > 11 / 64 */ 59 53 60 switch (l>scale) { 54 61 case 6: … … 56 63 register int il, ic; 57 64 il = *last; ic = *sp; 58 r = 5 * il + 1 * ic; r /= 6; *dp = (sample)r; dp += channels; 59 r = 4 * il + 2 * ic; r /= 6; *dp = (sample)r; dp += channels; 60 r = 3 * il + 3 * ic; r /= 6; *dp = (sample)r; dp += channels; 61 r = 2 * il + 4 * ic; r /= 6; *dp = (sample)r; dp += channels; 62 r = 1 * il + 5 * ic; r /= 6; *dp = (sample)r; dp += channels; 63 *dp = (sample)ic; dp += channels; 65 66 r = 55 * il + 11 * ic; r /= 64; *dp = (sample)r; dp += channels; 67 r = 44 * il + 22 * ic; r /= 64; *dp = (sample)r; dp += channels; 68 r = 33 * il + 33 * ic; r /= 64; *dp = (sample)r; dp += channels; 69 r = 22 * il + 44 * ic; r /= 64; *dp = (sample)r; dp += channels; 70 r = 11 * il + 55 * ic; r /= 64; *dp = (sample)r; dp += channels; 71 r = 66 * ic; r /= 64; *dp = (sample)r; dp += channels; 64 72 last = sp; 65 73 sp += channels; … … 70 78 register int il, ic; 71 79 il = *last; ic = *sp; 72 r = 4 * il + 1 * ic; r /= 5; *dp = (sample)r; dp += channels;73 r = 3 * il + 2 * ic; r /= 5; *dp = (sample)r; dp += channels;74 r = 2 * il + 3 * ic; r /= 5; *dp = (sample)r; dp += channels;75 r = 1 * il + 4 * ic; r /= 5; *dp = (sample)r; dp += channels;76 *dp = (sample)ic; dp += channels;80 r = 24 * il + 6 * ic; r /= 32; *dp = (sample)r; dp += channels; 81 r = 18 * il + 12 * ic; r /= 32; *dp = (sample)r; dp += channels; 82 r = 12 * il + 18 * ic; r /= 32; *dp = (sample)r; dp += channels; 83 r = 6 * il + 24 * ic; r /= 32; *dp = (sample)r; dp += channels; 84 r = 30 * ic; r /= 32; *dp = (sample)r; dp += channels; 77 85 last = sp; 78 86 sp += channels; … … 95 103 register int il, ic; 96 104 il = *last; ic = *sp; 97 r = 2 * il + 1 * ic; r /= 3; *dp = (sample)r; dp += channels;98 r = 1 * il + 2 * ic; r /= 3; *dp = (sample)r; dp += channels;99 *dp = (sample)ic; dp += channels;105 r = 10 * il + 5 * ic; r /= 16; *dp = (sample)r; dp += channels; 106 r = 5 * il + 10 * ic; r /= 16; *dp = (sample)r; dp += channels; 107 r = 15 * ic; r /= 16; *dp = (sample)r; dp += channels; 100 108 last = sp; 101 109 sp += channels;