void fdmdv_8_to_16(float out16k[], float in8k[], int n)
{
- int i,j,k,l;
+ int i,k,l;
+ float acc;
/* make sure n is an integer multiple of the oversampling rate, ow
this function breaks */
assert((n % FDMDV_OS) == 0);
+ /* this version unrolled for specific FDMDV_OS */
+
+ assert(FDMDV_OS == 2);
+
for(i=0; i<n; i++) {
- for(j=0; j<FDMDV_OS; j++) {
- out16k[i*FDMDV_OS+j] = 0.0;
- for(k=0,l=0; k<FDMDV_OS_TAPS_16K; k+=FDMDV_OS,l++)
- out16k[i*FDMDV_OS+j] += fdmdv_os_filter[k+j]*in8k[i-l];
- out16k[i*FDMDV_OS+j] *= FDMDV_OS;
-
- }
+ acc = 0.0;
+ for(k=0,l=0; k<FDMDV_OS_TAPS_16K; k+=FDMDV_OS,l++)
+ acc += fdmdv_os_filter[k]*in8k[i-l];
+ out16k[i*FDMDV_OS] = FDMDV_OS*acc;
+
+ acc = 0.0;
+ for(k=1,l=0; k<FDMDV_OS_TAPS_16K; k+=FDMDV_OS,l++)
+ acc += fdmdv_os_filter[k]*in8k[i-l];
+ out16k[i*FDMDV_OS+1] = FDMDV_OS*acc;
}
/* update filter memory */
void fdmdv_8_to_16_short(short out16k[], short in8k[], int n)
{
- int i,j,k,l;
+ int i,k,l;
float acc;
/* make sure n is an integer multiple of the oversampling rate, ow
assert((n % FDMDV_OS) == 0);
+ /* this version unrolled for specific FDMDV_OS */
+
+ assert(FDMDV_OS == 2);
+
for(i=0; i<n; i++) {
- for(j=0; j<FDMDV_OS; j++) {
- acc = 0.0;
- for(k=0,l=0; k<FDMDV_OS_TAPS_16K; k+=FDMDV_OS,l++)
- acc += fdmdv_os_filter[k+j]*(float)in8k[i-l];
- out16k[i*FDMDV_OS+j] = acc*FDMDV_OS;
-
- }
+ acc = 0.0;
+ for(k=0,l=0; k<FDMDV_OS_TAPS_16K; k+=FDMDV_OS,l++)
+ acc += fdmdv_os_filter[k]*(float)in8k[i-l];
+ out16k[i*FDMDV_OS] = FDMDV_OS*acc;
+
+ acc = 0.0;
+ for(k=1,l=0; k<FDMDV_OS_TAPS_16K; k+=FDMDV_OS,l++)
+ acc += fdmdv_os_filter[k]*(float)in8k[i-l];
+ out16k[i*FDMDV_OS+1] = FDMDV_OS*acc;
}
/* update filter memory */
float acc;
int i,j,k;
- for(i=0, k=0; k<n; i+=FDMDV_OS, k++) {
-
+ for(i=0, k=0; k<n; i+=FDMDV_OS, k++) {
acc = 0.0;
for(j=0; j<FDMDV_OS_TAPS_16K; j++)
- acc += fdmdv_os_filter[j]*(float)in16k[i-j];
+ acc += fdmdv_os_filter[j]*in16k[i-j];
out8k[k] = acc;
}
void fdmdv_16_to_8_short(short out8k[], short in16k[], int n)
{
- int i,j;
+ float acc;
+ int i,j,k;
- for(i=0; i<n; i++) {
- out8k[i] = 0.0;
+ for(i=0, k=0; k<n; i+=FDMDV_OS, k++) {
+ acc = 0.0;
for(j=0; j<FDMDV_OS_TAPS_16K; j++)
- out8k[i] += fdmdv_os_filter[j]*(float)in16k[i*FDMDV_OS-j];
+ acc += fdmdv_os_filter[j]*(float)in16k[i-j];
+ out8k[k] = acc;
}
/* update filter memory */