luigifcruz / CyberEther

Multi-platform GPU-accelerated interface for compute-intensive pipelines. Radio, the final frontier.
MIT License
382 stars 14 forks source link

Improved AGC logic. #54

Open luigifcruz opened 5 months ago

luigifcruz commented 5 months ago

The current implementation of the AGC is sub-optimal. New implementation should retain good parallelization characteristics and correctly implement averaging.

Paulo-D2000 commented 5 months ago

I've had some good results using a simple control loop like:

T agc_work(T input,  float agc_target = 1.0f, float agc_gain = 1e-4f , float agc_max = 655635.0f) {
  T output = input * gain;
  float error = agc_target - std::abs(T); // absolute magnitude of signal
  gain += error * agc_gain;
  // Optional ? Gain limit...
  if(agc_max > 0.0f && gain > agc_max){
    gain = agc_max;
  }
  return output;
}

I have one AGC and some other blocks partially implemented on my other machine local repo... I could open one PR later and we can finish them... I'm on vacation and don't have acess to the machine right now :\

Some refs / implementations...

WirelessPi AGC Gnuradio AGC F32 Gnuradio AGC CF32