From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 5EA60461A3 for ; Sat, 8 Jul 2023 21:26:03 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 9116068C551; Sun, 9 Jul 2023 00:25:42 +0300 (EEST) Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A3C5F68C541 for ; Sun, 9 Jul 2023 00:25:34 +0300 (EEST) X-GND-Sasl: michael@niedermayer.cc Received: by mail.gandi.net (Postfix) with ESMTPSA id DC41D40002 for ; Sat, 8 Jul 2023 21:25:33 +0000 (UTC) From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sat, 8 Jul 2023 23:25:15 +0200 Message-Id: <20230708212530.109692-3-michael@niedermayer.cc> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230708212530.109692-1-michael@niedermayer.cc> References: <20230708212530.109692-1-michael@niedermayer.cc> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 03/18] avradio/sdr: Add fm multiple parameter X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: Signed-off-by: Michael Niedermayer --- doc/demuxers.texi | 7 +++++++ libavradio/sdr.h | 1 + libavradio/sdrdemux.c | 9 +++++++++ 3 files changed, 17 insertions(+) diff --git a/doc/demuxers.texi b/doc/demuxers.texi index 81c46ce08f..86f031b9ed 100644 --- a/doc/demuxers.texi +++ b/doc/demuxers.texi @@ -965,6 +965,13 @@ it can also result in the detection of SDR artifacts such as reflections of stro as weak stations. Future versions may be better able to separate weak stations from artifacts looking like weak stations. +@item fm_multiple +Multiple of frequency in hz at which to search for stations. +you can set this to 100000 to probe stations at 0.1MHz increments +Most SDR artifacts are not at exact multiplies, this is thus an effective +way to eliminate these artifacts. +disabled by default. + @item am_mode AM Demodulation method. Several different methods are supported. @table @samp diff --git a/libavradio/sdr.h b/libavradio/sdr.h index 1053e45efe..ff4bfcaa1f 100644 --- a/libavradio/sdr.h +++ b/libavradio/sdr.h @@ -159,6 +159,7 @@ typedef struct SDRContext { float am_threshold; float fm_threshold; + float fm_multiple; pthread_t hw_thread; int thread_started; diff --git a/libavradio/sdrdemux.c b/libavradio/sdrdemux.c index 1f2d778978..13cec10505 100644 --- a/libavradio/sdrdemux.c +++ b/libavradio/sdrdemux.c @@ -915,6 +915,14 @@ static int probe_fm(SDRContext *sdr) if (fabs(f2 - f) > 1000) continue; + + if (sdr->fm_multiple) { + double f3 = lrint(f2 / sdr->fm_multiple) * sdr->fm_multiple; + if (fabs(f2 - f3) > FM_FREQ_TOLERANCE) + continue; + f2 = f3; + } + create_candidate_station(sdr, FM, f2, bandwidth_f, bandwidth_p2, score); } } @@ -2169,6 +2177,7 @@ const AVOption avpriv_sdr_options[] = { { "am_threshold" , "AM detection threshold", OFFSET(am_threshold), AV_OPT_TYPE_FLOAT, {.dbl = 20}, 0, FLT_MAX, DEC}, { "fm_threshold" , "FM detection threshold", OFFSET(fm_threshold), AV_OPT_TYPE_FLOAT, {.dbl = 50}, 0, FLT_MAX, DEC}, + { "fm_multiple" , "FM frequency mutiple", OFFSET(fm_multiple ), AV_OPT_TYPE_FLOAT, {.dbl = 0}, 0, FLT_MAX, DEC}, { NULL }, }; -- 2.31.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".