oversampling coefficient specification, lib_dsp

Technical questions regarding the XTC tools and programming with XMOS.
woodsb
Experienced Member
Posts: 79
Joined: Thu Nov 17, 2016 11:24 pm

Post by woodsb »

Sorry about my lib confusion. I am using the 72-tap US3 version.


User avatar
infiniteimprobability
XCore Legend
Posts: 1126
Joined: Thu May 27, 2010 10:08 am
Contact:

Post 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
Post Reply