From patchwork Sat Jul 8 21:25:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 42538 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:6d25:b0:130:f365:34ad with SMTP id fv37csp663195pzb; Sat, 8 Jul 2023 14:26:23 -0700 (PDT) X-Google-Smtp-Source: APBJJlFuRU/lpMxzgXQay9r9HdLnR9+tylVikqNGn9E5pY+OgFGKpHKAup/9Ia2C2xulSI0qosPI X-Received: by 2002:a5d:5087:0:b0:313:f505:8211 with SMTP id a7-20020a5d5087000000b00313f5058211mr7060127wrt.46.1688851583080; Sat, 08 Jul 2023 14:26:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688851583; cv=none; d=google.com; s=arc-20160816; b=XxESgq0zDb74wga87LnWy2weSyuggbdMiZSVolbF5rHb38fy15NyiFMATh1viGtf1E T3gM4h+T24PHkfP4WfGkI7ubpnxaJLIR7csMFRG5e7hgHe2/hrFvfJAtKDDrc9/37djm pizGTB40zNjANolxKAkYgXfkiY+rF/KPU8OWR4rMdQZUYBVJ9R8OLjugJ8JISwsICCZY Ix0fmEoCk+QAllqfnDM4P+mdsn8Qb430e1XOKeNHKcZvMr7g1ULVAZ2LgsvG8hlxlarZ 7Kn4TcSY492DR4KjeNOnevniPkuVwHKG6YzxwTBlkj1JzPyhmK06oWWvhMfHwA2F13z2 ZBPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=2GN3GzWWti9VhdSvSJ2cZfK/HQ5W/cRsX1EguvUiJ3k=; fh=YYwLYmpaV0Fpw/rxmSKNRLS2XzDkAlGbHATiKOPtZrY=; b=vS7UQNjX/BHaeotVrvsM6vI3aepa43sEPIJuzvaNE2BR4KRuVKCpRZMzlNS4ohyoT5 lwmJDLyK7/l75D5PfOEmkmztFcjQf9ErcaT23KZQWqPuO/5Fnx6/kIb2vu2kI542lDo2 /htgrMKN7H1jsWJrmN6dRCUrSm80QqHD2RokU6gBgKyCqstkK/eP2EDQ0lwyunuHFP1u 5GZbyNxyyoocF2xw9pQBjwsx+fi7fAARsdALdKILnXsLfRWX3zbEjibzyHW3cVdulWTm 28hHbFGe51CH/k/9jnyzqNHi5/JNSIUH7gky117RWOjODMlTjQC/jO/OpJ79AvQYNvv5 Nu6A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id m11-20020a056402050b00b0051e247492a5si4514759edv.626.2023.07.08.14.26.22; Sat, 08 Jul 2023 14:26:23 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E90B068C566; Sun, 9 Jul 2023 00:25:44 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [217.70.183.199]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7D65768C54F for ; Sun, 9 Jul 2023 00:25:37 +0300 (EEST) X-GND-Sasl: michael@niedermayer.cc Received: by mail.gandi.net (Postfix) with ESMTPSA id ACE49FF803 for ; Sat, 8 Jul 2023 21:25:36 +0000 (UTC) From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sat, 8 Jul 2023 23:25:17 +0200 Message-Id: <20230708212530.109692-5-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 05/18] avradio/sdrdemux: Do not timeout negative stations 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: LMdIep5rcp+S If we identified that a station is an artifact of the SDR, we dont want to timeout that to avoid it being redetected as station Signed-off-by: Michael Niedermayer --- libavradio/sdrdemux.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/libavradio/sdrdemux.c b/libavradio/sdrdemux.c index 13cec10505..39eaa0c094 100644 --- a/libavradio/sdrdemux.c +++ b/libavradio/sdrdemux.c @@ -347,6 +347,7 @@ static void decay_stations(SDRContext *sdr) for (int i=0; ifrequency - station->bandwidth/2 < sdr->block_center_freq - sdr->bandwidth/2 || station->frequency + station->bandwidth/2 > sdr->block_center_freq + sdr->bandwidth/2) @@ -355,9 +356,10 @@ static void decay_stations(SDRContext *sdr) if (station->timeout) station->non_detection_per_mix_frequency[histogram_index(sdr, station->frequency)] ++; + hs = histogram_score(station); + if (station->in_station_list) { int station_timeout = STATION_TIMEOUT; - int hs = histogram_score(station); if (hs == 0) { station_timeout = 5; //give the station a moment to be properly detected and then discard it @@ -370,7 +372,13 @@ static void decay_stations(SDRContext *sdr) station->in_station_list = 0; } } else { - if (station->timeout++ > CANDIDATE_STATION_TIMEOUT) { + int station_timeout = CANDIDATE_STATION_TIMEOUT; + + //We do not want to drop "negative" stations to avoid them being redetected + if (hs <= 0) + station_timeout = INT_MAX; + + if (station->timeout++ > station_timeout) { struct AVTreeNode *next = NULL; tree_remove(&sdr->station_root, station, station_cmp, &next); av_freep(&next);