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 457A54619C for ; Sat, 8 Jul 2023 21:25:53 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 6C18768C54A; Sun, 9 Jul 2023 00:25:41 +0300 (EEST) Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A5E7968C33C for ; Sun, 9 Jul 2023 00:25:33 +0300 (EEST) X-GND-Sasl: michael@niedermayer.cc Received: by mail.gandi.net (Postfix) with ESMTPSA id E02EAC0002 for ; Sat, 8 Jul 2023 21:25:32 +0000 (UTC) From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sat, 8 Jul 2023 23:25:14 +0200 Message-Id: <20230708212530.109692-2-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 02/18] avradio/sdrdemux: factor frequency tolerance constants out 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 --- libavradio/sdrdemux.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libavradio/sdrdemux.c b/libavradio/sdrdemux.c index 3bb5a69cf1..1f2d778978 100644 --- a/libavradio/sdrdemux.c +++ b/libavradio/sdrdemux.c @@ -61,6 +61,9 @@ #define FREQ_BITS 22 #define TIMEBASE ((48000ll / 128) << FREQ_BITS) +#define AM_FREQ_TOLERANCE 5 +#define FM_FREQ_TOLERANCE 500 + #define STATION_TIMEOUT 100 ///< The number of frames after which a station is removed if it was not detected #define CANDIDATE_STATION_TIMEOUT 4 @@ -248,7 +251,7 @@ static int create_station(SDRContext *sdr, Station *candidate_station) { nb_candidate_match += candidate_station->nb_frequency - 1; for (i=0; ifrequency - freq); @@ -383,7 +386,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 : 500; + double snapdistance = modulation == AM ? AM_FREQ_TOLERANCE : FM_FREQ_TOLERANCE; int nb_stations = find_stations(sdr, freq, snapdistance, station_list, FF_ARRAY_ELEMS(station_list)); if (nb_stations) { -- 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".