Page 3 of 3

Re: oversampling coefficient specification, lib_dsp

Posted: Thu May 11, 2017 5:14 pm
by woodsb
Sorry about my lib confusion. I am using the 72-tap US3 version.

Re: oversampling coefficient specification, lib_dsp

Posted: Fri May 12, 2017 1:57 pm
by infiniteimprobability
Ah OK. That's why I was confused.
The us3_voice and ds3_voice are much more optimised, including for coefficient memory. This means the 3 phases of coefficients are re-used for both filters. However, it means whilst ds3_voice walks up through the phases, us3_voice walks down.
So a simple usage (showing impulse response) is :

Code: Select all

// Copyright (c) 2017, XMOS Ltd, All rights reserved
#include <xs1.h>
#include <xclib.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include "src.h"

#define NUM_OF_TAPS (SRC_FF3V_FIR_NUM_PHASES * SRC_FF3V_FIR_TAPS_PER_PHASE)

extern const int32_t src_ff3v_fir_coefs[SRC_FF3V_FIR_NUM_PHASES][SRC_FF3V_FIR_TAPS_PER_PHASE];

int main()
{

    int32_t data[SRC_FF3V_FIR_TAPS_PER_PHASE];
    memset(data, 0, sizeof(data));

    for (unsigned s=0;s<24;s++)
    {
        int32_t samp = (s == 0 ? 0x7fffffff : 0); //impulse

        //Walk backwards through phases
        printf("%d\n", src_us3_voice_input_sample(data, src_ff3v_fir_coefs[2], samp));
        printf("%d\n", src_us3_voice_get_next_sample(data, src_ff3v_fir_coefs[1]));
        printf("%d\n", src_us3_voice_get_next_sample(data, src_ff3v_fir_coefs[0]));
    }
    return 0;
}
Which results in this:


Image

Upside down (stray negative), but perfectly formed!

Admittedly the example is not terribly helpful (it's a test rather than example)so I have added an issue https://github.com/xmos/lib_src/issues/19