Coder Social home page Coder Social logo

lib_agc's People

Contributors

andrewstanfordjason avatar brennangit avatar chrisc-xmos avatar danielpieczko avatar dfollent avatar ed-xmos avatar henkmuller avatar hughh-xmos avatar kieran-kohtz avatar lucianomartin avatar mbanth avatar oscarbailey-xmos avatar samchesney avatar shuchitak avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

brennangit mbanth

lib_agc's Issues

AGC gain value is undefined

The gain value, as defined in agc_channel_state_t, doesn't correspond to a gain (in dB value) on the input signal.

For example, with channel state gain set to 6, and gain_exp set to 0 (see agc_init_channel()) a constant input signal results in the following constant output values:

G(INT_MAX * 0.1) = INT_MAX * 0.54
G(INT_MAX * 0.2) = INT_MAX * 0.73
G(INT_MAX * 0.25) = INT_MAX * 0.77
G(INT_MAX * 0.4) = INT_MAX * 0.83

This is unexpected. Shouldn't the gain value in agc_channel_state_t correspond to a dB gain on the channel input?

Fix flake8

Recent CI runs of the develop branch show a failure when running flake8, which checks Python scripts for good style. Currently we pin flake8 at v3.8.3. Flake8 uses importlib-metadata. A known issue in importlib-metadata breaks flake8. By pinning importlib-metadata at v4.13.0, flake8 can run as normal.

In passing, this issue also covers an update of the XMOS Jenkins Shared Library to the latest available version, v0.20.0.

Bugs in AGC subtract function

{uint32_t, int} subtract(uint32_t a, int a_exp, uint32_t b, int b_exp), as defined in agc.xc, returns wildly incorrect values in cases where:

  • is_greater_than(a, a_exp, b, b_exp) is true
  • (a_exp - b_exp) < 0

Or, conversely, when:

  • is_greater_than(a, a_exp, b, b_exp) is false
  • (b_exp - a_exp) < 0

Tidy up magic values

The EWMA alpha value for the weighted average of the correlation factor uses a 'magic number' rather than a defined constant.

state.lc_corr_factor = (vtb_uq0_32_t)(((uint64_t)VTB_UQ0_32(0.98) * (uint64_t)state.lc_corr_factor + (uint64_t)VTB_UQ0_32(0.02) * (uint64_t)aec_corr)>>32);

self.corr_val = 0.98 * self.corr_val + 0.02 * aec_corr_factor

This should be defined as a hash define alongside the other EWMA alpha values used in the AGC block.

AGC initialised incorrectly

agc_init_channel() sets the agc state to the following values:

db: 20
gain exp: 3
gain: 20971522

This scrambles the output of the agc process.

Missing Application Note

This repository does not contain an application note providing an example to support a customer in becoming familiar with building and using it.

Missing C API

The API header files include xccompat.h and use its macros to accommodate both a C and XC interface. However, only an XC definition of each declared API function exists.

AGC Setter/Getter index checks

The set and get functions in agc.h do not check ch_index parameter for correctness.

If ch_index >= AGC_INPUT_CHANNELS then an out-of-bounds exception will occur.

Any fix should be documented in the setter/getter Doxygen comments as defined behaviour.

Missing C API

The AGC API includes XC language features, specifically the use of references..

The branch feature/c_callable contains initial enhancements to provide a C API. Pull request #120 exists to review and merge these enhancements. The changes in this PR do not include the C language definitions of the AGC functions, only their declarations.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.