RTL RMS Tests to Reduce CPU Usage;

This commit is contained in:
lwvmobile
2023-09-18 10:51:22 -04:00
parent eb5de342ba
commit 2161c3d762
3 changed files with 19 additions and 15 deletions

View File

@@ -1369,12 +1369,12 @@ liveScanner (dsd_opts * opts, dsd_state * state)
{ {
open_rtlsdr_stream(opts); open_rtlsdr_stream(opts);
opts->rtl_started = 1; //set here so ncurses terminal doesn't attempt to open it again opts->rtl_started = 1; //set here so ncurses terminal doesn't attempt to open it again
#ifdef __arm__ // #ifdef __arm__
fprintf (stderr, "WARNING: RMS Function is Disabled on ARM Devices (Raspberry Pi) due to High CPU use. \n"); // fprintf (stderr, "WARNING: RMS Function is Disabled on ARM Devices (Raspberry Pi) due to High CPU use. \n");
fprintf (stderr, "RMS/Squelch Functionality for NXDN, dPMR, EDACS Analog, M17 and Raw Audio Monitor are unavailable and these modes will not function properly. \n"); // fprintf (stderr, "RMS/Squelch Functionality for NXDN, dPMR, EDACS Analog, M17 and Raw Audio Monitor are unavailable and these modes will not function properly. \n");
if (opts->monitor_input_audio == 1) opts->monitor_input_audio = 0; // if (opts->monitor_input_audio == 1) opts->monitor_input_audio = 0;
opts->rtl_squelch_level = 0; // opts->rtl_squelch_level = 0;
#endif // #endif
} }
#endif #endif

View File

@@ -642,10 +642,10 @@ void edacs(dsd_opts * opts, dsd_state * state)
fprintf (stderr, " Digital"); fprintf (stderr, " Digital");
//skip analog calls on RTL Input on ARM devices due to High CPU usage from RTL RMS function //skip analog calls on RTL Input on ARM devices due to High CPU usage from RTL RMS function
#ifdef __arm__ // #ifdef __arm__
if (command == 0xEE && opts->audio_in_type == 3) // if (command == 0xEE && opts->audio_in_type == 3)
goto ENDPV; // goto ENDPV;
#endif // #endif
//skip analog calls on UDP Audio Output //skip analog calls on UDP Audio Output
if (command == 0xEE && opts->audio_out_type == 8) if (command == 0xEE && opts->audio_out_type == 8)

View File

@@ -1130,11 +1130,15 @@ void rtl_dev_tune(dsd_opts * opts, long int frequency)
long int rtl_return_rms() long int rtl_return_rms()
{ {
long int sr = 0; long int sr = 0;
#ifdef __arm__ // #ifdef __arm__
sr = 100; // sr = 100;
#else // #else
sr = rms(demod.lowpassed, demod.lp_len, 1); //debug -- on main machine, lp_len is around 6420, so this probably contributes to very high CPU usage
#endif // fprintf (stderr, "LP_LEN: %d \n", demod.lp_len);
//I've found that just using a sample size of 160 will give us a good approximation without killing the CPU
// sr = rms(demod.lowpassed, demod.lp_len, 1);
sr = rms(demod.lowpassed, 160, 1); //I wonder what a reasonable value would be for #2 (input len) there
// #endif
return (sr); return (sr);
} }