From patchwork Sun Jul 14 22:38:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yigithan Yigit X-Patchwork-Id: 50538 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:612c:2298:b0:482:c625:d099 with SMTP id fp24csp1959391vqb; Sun, 14 Jul 2024 15:51:49 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVkFB9xQ337eybG+vSm+3k1Oirm8Yzzrmmvu9nmyLE7zxRG2Yv093qQLQ9CSxFcABUOyp9llsgr7bA9NfvvPYyaKF6pI/fOaX74fQ== X-Google-Smtp-Source: AGHT+IFOfjXbrhTmjt3qpjo4uQ8c+/17X0zdR/iZlqoKzhkMPwA36N7lp/aAw2Vh1ls6mscxP2Lm X-Received: by 2002:a2e:7c04:0:b0:2ee:4af7:d78e with SMTP id 38308e7fff4ca-2eeb3181914mr125672961fa.34.1720997507033; Sun, 14 Jul 2024 15:51:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720997507; cv=none; d=google.com; s=arc-20160816; b=ltQcpykXRQ+BpCoxk9QZZPYa2xdenEwgu8WdzBOZ2Ib1Mt9MQQcegVsRo7k1lkw7Jm 0CjpmPV9j6E/odUQn6lT2iX1GsA41HRkl575VOCS+Yu2eITvWwlI0EOSWfvE0YAPHCv4 IJ6oN46/atzwNpkn5Vy4x861wA4u++JLJDOnXLlkdsIVAXVvTM6MQu7hUQBY21BZGlVs E2Hux6qfX4cNQwija1oFpj2q98EbXs8kreGISJqmL53c9oSBxfdAV18JLZ3uzaxnpdn+ Lk+vvu+iRe9hdoDbk+/5p0mp2ZsncAb35O1LhFVQ644FsM5edBK/fUcihho5SsWORa/N 3/bQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc: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:dkim-signature:delivered-to; bh=3YkYVlThul3unmWtoV9oafPIERiOFeVfu5lA3hWYPuI=; fh=oYrUj4vT4ivb560z23e71q/pal11/Mm+yKMO8RKszaM=; b=XuJOXks1nXYf4/cvw7XaYafsrJzheBXR9uzd9N7OZP9cwJwh9gzywDhIBSebTmz6XQ Il2dLmoYHYF9ELUhwoF0imH6ZhzRp1ff/NpIyyU3wfdCSySieMr8yRtfQdqzTpGGphVM LfS/Qbq3Zb8BxIZ5uaxXRAO5vTSB9woNAjnGhV2hk1CWadk5KH3qfXAjf8IyAvBAdFDp v1ZD3SOMK4Tc+++yCsFgFIO/3OpkhJJejzB3ZeunJnrRPkLsb6CLFErNQ74iLbiUM436 ar+doEjEh7f197Vp9OKAB79f3TBdVbUUTYyzIAov8GKpbNNMAdXyK/u6t9xXcWAonmEk Yb5w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20230601 header.b=E9LxYnBP; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 38308e7fff4ca-2eee192a9e9si10406571fa.360.2024.07.14.15.51.46; Sun, 14 Jul 2024 15:51:47 -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; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20230601 header.b=E9LxYnBP; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2DBC068D8FA; Mon, 15 Jul 2024 01:38:18 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id DAF2868D8FA for ; Mon, 15 Jul 2024 01:38:10 +0300 (EEST) Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-426636ef8c9so24603995e9.2 for ; Sun, 14 Jul 2024 15:38:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1720996690; x=1721601490; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=3RhGsvsh1Ce/Ozyp1mKulVT3T+PIeKLeYedx+PXjycg=; b=E9LxYnBPZJp9HGdd8FZmGsXqFc6OG1JoirRbmRrCKt51qQ0PA/QiPpNUuOnTr98LZr DacjjT/ZZ2O2cloUSLF7JEWS6j76eFnJJ8FYfJoiv82PhkSFCV54A3RZXDay6gY0Ub5L GSKOvFUwLMpXdFDBlysNVGootRXZZQYYyYzz4MT+AwbbFOa2m8c8JbTcPu9lW1ZAP1qK xVU7SswW5MmYyUbWAE5SHCl26GW63w5c2TRIQRAHDp+EpZyOahcwSTZG14wZHh7HQOpE PSIuN+BLznWdpFY3P+OpmV8WLd34vUipnKRGCBWRe4wVv8u1aaMI4Bp8NWA9KlREqxZK xVMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720996690; x=1721601490; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3RhGsvsh1Ce/Ozyp1mKulVT3T+PIeKLeYedx+PXjycg=; b=XON/CG2hMnsbYayYzTqXPQKU7knU7wN0fIcJwYirnYNpbOAmOGBh95vsn8FVyFo8HF jLq4bVZrer6QUV9VXRfeu2lWAo/poti2eAIps0enRfK9YX6qi6ppeDwWBNPLPolV0QVo FGOnMgO12/ovWWg7jGV66+bG4OTxtodPMkrHBBy+rpF6QMkY0B3hirfmydVQT+zSnA87 DdSVkQnAQylFNZ9MJITRbbfuBJjwzwuVQrszyHzi68EHrUF/NbRgcsChhtBlikwEr5hX HqJXGYm2pUSawOZQ+K+1bSDJ+iVLvbW8GpXITiUcdys9ojzffDtaMj3uku10DOGG27SC 9/3g== X-Gm-Message-State: AOJu0YwrEY/9e99mIuz94VeFI9H2sNj97u+lw/0Zwp7OG8mZFwckUdTD Qlc7bjFD6FUweDE5DqUUtVuXum8yWuQmd6krQIPjepSwV0h84Lk8IPPmMw== X-Received: by 2002:a05:600c:1587:b0:426:5e91:3920 with SMTP id 5b1f17b1804b1-426708f1df1mr137671415e9.29.1720996689962; Sun, 14 Jul 2024 15:38:09 -0700 (PDT) Received: from localhost.localdomain ([2a02:e0:8bea:ef00:7859:9bc:b8c3:93b8]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4279f2cc21esm99171515e9.31.2024.07.14.15.38.09 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 14 Jul 2024 15:38:09 -0700 (PDT) From: Yigithan Yigit To: ffmpeg-devel@ffmpeg.org Date: Mon, 15 Jul 2024 01:38:04 +0300 Message-ID: <20240714223805.9760-2-yigithanyigitdevel@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240714223805.9760-1-yigithanyigitdevel@gmail.com> References: <20240714223805.9760-1-yigithanyigitdevel@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v5 1/2] avfilter/af_volumedetect.c: Move logdb function 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 Cc: thilo.borgmann@mail.de, yigithanyigitdevel@gmail.com Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: HvryMeCDGYI8 --- libavfilter/af_volumedetect.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/libavfilter/af_volumedetect.c b/libavfilter/af_volumedetect.c index 8b001d1cf2..327801a7f9 100644 --- a/libavfilter/af_volumedetect.c +++ b/libavfilter/af_volumedetect.c @@ -24,6 +24,8 @@ #include "avfilter.h" #include "internal.h" +#define MAX_DB 91 + typedef struct VolDetectContext { /** * Number of samples at each PCM value. @@ -33,6 +35,14 @@ typedef struct VolDetectContext { uint64_t histogram[0x10001]; } VolDetectContext; +static inline double logdb(uint64_t v) +{ + double d = v / (double)(0x8000 * 0x8000); + if (!v) + return MAX_DB; + return -log10(d) * 10; +} + static int filter_frame(AVFilterLink *inlink, AVFrame *samples) { AVFilterContext *ctx = inlink->dst; @@ -56,16 +66,6 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *samples) return ff_filter_frame(inlink->dst->outputs[0], samples); } -#define MAX_DB 91 - -static inline double logdb(uint64_t v) -{ - double d = v / (double)(0x8000 * 0x8000); - if (!v) - return MAX_DB; - return -log10(d) * 10; -} - static void print_stats(AVFilterContext *ctx) { VolDetectContext *vd = ctx->priv;