From patchwork Sun Jul 30 22:11:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 43036 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:7927:b0:130:ccc6:6c4b with SMTP id b39csp2030625pzg; Sun, 30 Jul 2023 15:12:53 -0700 (PDT) X-Google-Smtp-Source: APBJJlHA3z9o4nCaa4wf4ijJclaTbtgPUarfSCs6PuwBCJMmdawYSPfGqUfZFT9bgj1wUkfbOORH X-Received: by 2002:a17:907:1dce:b0:969:7739:2eb7 with SMTP id og14-20020a1709071dce00b0096977392eb7mr5016433ejc.4.1690755173320; Sun, 30 Jul 2023 15:12:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690755173; cv=none; d=google.com; s=arc-20160816; b=KlTfGGTcH++Xy9JJFFj3z8Bg8Pyc2wme1TsCq6Tvbn9Vv72u8rpic7rYIQa+e2J/pf ZVrSlNE5mGm77cR1RlVvmzLV0QyHHM7coinbV68yNnWKqbfXFCJ3DWGu9dwKIrzZz2/S RLG1Hi/mszr+B9kstU5GlBrnUYRFgmAKbbgUi0Bc2n8hIijn6JOVse7jPegDWzklRhU7 dguY6VGsSxB0nHw1VF1CLI/3PXGWC3qDkgGyM81eT46Rvhcp6vUiusPOlA+vAHckmob7 sdNIqSN/pWpzF/XXCo1v9wetJv61yWEoO+xBsR8KcQzyRBFunvDGt8SC0GIMU4yHuidi OWrg== 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=LoQGkur/R2qwvSUpZxcR+JdURTos+dFmImFpLurjCWQ=; fh=YYwLYmpaV0Fpw/rxmSKNRLS2XzDkAlGbHATiKOPtZrY=; b=fcDjv2qlR2o/MaUWJp56XfGX2IuTx24eR8akScfkyg+BPrwPzW3DtXwNYlB8pZqqCW cJrz+HgqrB9brIhHBix9/IRSfppH/LvXNH/nbk/3kZr6GOc6+VOJ0ANSz2kCAoAOfOnq +2H2yygTDN+1xIIwCCQRgju6v411hDQ2Hjb23MQrsSi8up4l7MsBNdMZ0cMYs86rDWlh wtoe3U7aH6fYXrW8VsbKQAwH5lgFtFmG2fSXxSJnTCmb/qFaitIpvGPB0tcLooQIq1Qd yUQD3iBGSs8ZgCzePpk7O+B67LlhWZ0AVTNg/u6swB4uob2p0HcR17y7jfk5iZ2phNjA QBLA== 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 u7-20020a170906408700b00988713509c1si5951440ejj.895.2023.07.30.15.12.52; Sun, 30 Jul 2023 15:12:53 -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 07BAD68C59F; Mon, 31 Jul 2023 01:11:51 +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 9B1D468C578 for ; Mon, 31 Jul 2023 01:11:41 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id BDEE8FF802 for ; Sun, 30 Jul 2023 22:11:40 +0000 (UTC) From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Mon, 31 Jul 2023 00:11:25 +0200 Message-Id: <20230730221131.1205193-6-michael@niedermayer.cc> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230730221131.1205193-1-michael@niedermayer.cc> References: <20230730221131.1205193-1-michael@niedermayer.cc> MIME-Version: 1.0 X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 06/12] avradio/avformat/sdrdemux: run clip check on the correct samples 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: JABHPXE3RL/T Signed-off-by: Michael Niedermayer --- libavformat/sdrdemux.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/libavformat/sdrdemux.c b/libavformat/sdrdemux.c index 44a6489bd2..69349add7b 100644 --- a/libavformat/sdrdemux.c +++ b/libavformat/sdrdemux.c @@ -1153,10 +1153,9 @@ static int demodulate_fm(SDRContext *sdr, Station *station, AVStream *st, AVPack sst->out_buf[2*i+0] = sst->out_buf[2*i+1] = m; } - - if (fabs(sst->out_buf[i]) > clip) { - av_log(sdr->avfmt, AV_LOG_WARNING, "CLIP %f\n", sst->out_buf[i]); - clip = fabs(sst->out_buf[i]) * 1.1; + if (fmax(fabs(sst->out_buf[2*i+0]), fabs(sst->out_buf[2*i+1])) > clip) { + av_log(sdr->avfmt, AV_LOG_WARNING, "CLIP %f %f\n", sst->out_buf[2*i+0], sst->out_buf[2*i+1]); + clip = fmax(fabs(sst->out_buf[2*i+0]), fabs(sst->out_buf[2*i+1])) * 1.1; } }