diff mbox series

[FFmpeg-devel,8/9] avradio/sdrdemux: increase the FM station frequency tolerance

Message ID 20230707172224.2368067-8-michael@niedermayer.cc
State New
Headers show
Series [FFmpeg-devel,1/9] avradio/sdr: use AVTree for candidate stations | expand

Checks

Context Check Description
yinshiyou/configure_loongarch64 warning Failed to apply patch
andriy/configure_x86 warning Failed to apply patch

Commit Message

Michael Niedermayer July 7, 2023, 5:22 p.m. UTC
The current FM station probing code is quite inaccurate with the
detected frequency.
Doing better requires some extra computations, maybe this is good
enough

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavradio/sdrdemux.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/libavradio/sdrdemux.c b/libavradio/sdrdemux.c
index 1fc528317c..4c1ec7b51c 100644
--- a/libavradio/sdrdemux.c
+++ b/libavradio/sdrdemux.c
@@ -248,7 +248,7 @@  static int create_station(SDRContext *sdr, Station *candidate_station) {
 
     nb_candidate_match += candidate_station->nb_frequency - 1;
     for (i=0; i<nb_stations; i++) {
-        int freq_precission = modulation == AM ? 5 : 50;
+        int freq_precission = modulation == AM ? 5 : 500;
         Station *s = station_list[i];
         double delta = fabs(s->frequency - freq);
 
@@ -383,7 +383,7 @@  static int create_candidate_station(SDRContext *sdr, enum Modulation modulation,
     void *tmp;
     struct AVTreeNode *next = NULL;
     Station *station_list[1000];
-    double snapdistance = modulation == AM ? 5 : 50;
+    double snapdistance = modulation == AM ? 5 : 500;
     int nb_stations = find_stations(sdr, freq, snapdistance, station_list, FF_ARRAY_ELEMS(station_list));
 
     if (nb_stations) {