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 30E9C45CB8 for ; Fri, 28 Jun 2024 20:16:15 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 6891368D6BD; Fri, 28 Jun 2024 23:15:40 +0300 (EEST) Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7923D68D692 for ; Fri, 28 Jun 2024 23:15:32 +0300 (EEST) Received: by mail-wr1-f46.google.com with SMTP id ffacd0b85a97d-36532d177a0so640488f8f.2 for ; Fri, 28 Jun 2024 13:15:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719605731; x=1720210531; 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=iR6obMx7WpRWSD1xp1HjA3/p2teyn5w1dP8oMA5Pflk=; b=gUgsinNOO/U9GHYunR01s9yZNfmVW9dlZbucSL57UoR2W5YeJMFknAKc2Ui3ApjCM4 h0MGEMbVOUKDfrV6kl1bilNu2JWIHDop9FswrSbcaeqCpOP5NhQNCB86ZQZj6ScOEob3 yvKSg3k9F0fyaHO+zC/DNvzdH8EiLJ83ajtQ71uYmNo1koLsL81F5Z5CzM/aKRzRwznf 87n16N2r/1OikpttOaxainF6bx5KbAfoKRgSbBcyXseb75WRx57AElEH58f+5sQ7BsGK RwBPzAH//duD0s1X4vgGD2wizFjXbxpBoZ8Yyb/lxGm7mBvsuGjr/5U5xVWYtneHQiP+ cwsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719605731; x=1720210531; 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=iR6obMx7WpRWSD1xp1HjA3/p2teyn5w1dP8oMA5Pflk=; b=fzmXcIQuR2k6HhTdDfQuYTI1cwXpqZjBElhyBJVkbyAk5FDiCVRMRk8z9bMozOSHC+ 6uypTTZKet8KACKO9KPn4bXDOhd6S6WwY3xWWjQyCoVtQpO2KXuPR5Xfz60YrdLLoavb c2eayxU5lffA31/l3IaM+yPMgz/aOzY6b//+98SCzjEjtRQP5BMQ1drcfbv4zcC1j1pP 9RGe5uyRaCxci9foL1AKXD/osJ81ykUUFRS6DTphRFgtApfjhAk4Ra8ouS8NGBvl4HmN Jhjb0pQlZUwBNhVkRaqbcqshX/ZoeIM038NagamS8NiS/9LcVOBCTBwg2cZyJAhQ92v2 5Uww== X-Gm-Message-State: AOJu0Yxx1lrn0TDQ5geHCZjKjz4kCm/OJRCH+tWm1qiEjrlQIXRiwZ5i FX0rsIgXmCyVN9RReBd1D7OmWHLjDbtb+rL/KiRurYB+NPfFE9wsVXkJBg== X-Google-Smtp-Source: AGHT+IGOX3IbcrI1qybMZmX56Ph4ip5bTj6ztXpL3NPTPFkvS5ip53tSBG0Jr8159cGyjbSO2u9ezA== X-Received: by 2002:a05:6000:22f:b0:35f:276c:ac5f with SMTP id ffacd0b85a97d-366e4ede0f1mr10078474f8f.40.1719605731574; Fri, 28 Jun 2024 13:15:31 -0700 (PDT) Received: from localhost.localdomain ([2a02:e0:8bea:ef00:1561:d557:9aa3:53f4]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3675a0cd4a1sm3249164f8f.23.2024.06.28.13.15.30 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 28 Jun 2024 13:15:31 -0700 (PDT) From: Yigithan Yigit To: ffmpeg-devel@ffmpeg.org Date: Fri, 28 Jun 2024 23:15:23 +0300 Message-ID: <20240628201523.23612-5-yigithanyigitdevel@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240628201523.23612-1-yigithanyigitdevel@gmail.com> References: <20240628201523.23612-1-yigithanyigitdevel@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 4/4] avfilter/af_volumedetect.c: reindent after last commit 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 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: --- libavfilter/af_volumedetect.c | 62 +++++++++++++++++------------------ 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/libavfilter/af_volumedetect.c b/libavfilter/af_volumedetect.c index ff408a8b50..02e5740499 100644 --- a/libavfilter/af_volumedetect.c +++ b/libavfilter/af_volumedetect.c @@ -160,40 +160,40 @@ static void print_stats(AVFilterContext *ctx) sum += vd->histogram[i]; } } else { - for (i = 0; i < 0x10000; i++) - nb_samples += vd->histogram[i]; - av_log(ctx, AV_LOG_INFO, "n_samples: %"PRId64"\n", nb_samples); - if (!nb_samples) - return; + for (i = 0; i < 0x10000; i++) + nb_samples += vd->histogram[i]; + av_log(ctx, AV_LOG_INFO, "n_samples: %"PRId64"\n", nb_samples); + if (!nb_samples) + return; - /* If nb_samples > 1<<34, there is a risk of overflow in the - multiplication or the sum: shift all histogram values to avoid that. - The total number of samples must be recomputed to avoid rounding - errors. */ - shift = av_log2(nb_samples >> 33); - for (i = 0; i < 0x10000; i++) { - nb_samples_shift += vd->histogram[i] >> shift; - power += (i - 0x8000) * (i - 0x8000) * (vd->histogram[i] >> shift); - } - if (!nb_samples_shift) - return; - power = (power + nb_samples_shift / 2) / nb_samples_shift; - av_assert0(power <= 0x8000 * 0x8000); - av_log(ctx, AV_LOG_INFO, "mean_volume: %.1f dB\n", -logdb((double)power, AV_SAMPLE_FMT_S16)); + /* If nb_samples > 1<<34, there is a risk of overflow in the + multiplication or the sum: shift all histogram values to avoid that. + The total number of samples must be recomputed to avoid rounding + errors. */ + shift = av_log2(nb_samples >> 33); + for (i = 0; i < 0x10000; i++) { + nb_samples_shift += vd->histogram[i] >> shift; + power += (i - 0x8000) * (i - 0x8000) * (vd->histogram[i] >> shift); + } + if (!nb_samples_shift) + return; + power = (power + nb_samples_shift / 2) / nb_samples_shift; + av_assert0(power <= 0x8000 * 0x8000); + av_log(ctx, AV_LOG_INFO, "mean_volume: %.1f dB\n", -logdb((double)power, AV_SAMPLE_FMT_S16)); - max_volume = 0x8000; - while (max_volume > 0 && !vd->histogram[0x8000 + max_volume] && - !vd->histogram[0x8000 - max_volume]) - max_volume--; - av_log(ctx, AV_LOG_INFO, "max_volume: %.1f dB\n", -logdb((double)(max_volume * max_volume), AV_SAMPLE_FMT_S16)); + max_volume = 0x8000; + while (max_volume > 0 && !vd->histogram[0x8000 + max_volume] && + !vd->histogram[0x8000 - max_volume]) + max_volume--; + av_log(ctx, AV_LOG_INFO, "max_volume: %.1f dB\n", -logdb((double)(max_volume * max_volume), AV_SAMPLE_FMT_S16)); - for (i = 0; i < 0x10000; i++) - histdb[(int)logdb((double)(i - 0x8000) * (i - 0x8000), AV_SAMPLE_FMT_S16)] += vd->histogram[i]; - for (i = 0; i <= MAX_DB && !histdb[i]; i++); - for (; i <= MAX_DB && sum < nb_samples / 1000; i++) { - av_log(ctx, AV_LOG_INFO, "histogram_%ddb: %"PRId64"\n", -i, histdb[i]); - sum += histdb[i]; - } + for (i = 0; i < 0x10000; i++) + histdb[(int)logdb((double)(i - 0x8000) * (i - 0x8000), AV_SAMPLE_FMT_S16)] += vd->histogram[i]; + for (i = 0; i <= MAX_DB && !histdb[i]; i++); + for (; i <= MAX_DB && sum < nb_samples / 1000; i++) { + av_log(ctx, AV_LOG_INFO, "histogram_%ddb: %"PRId64"\n", -i, histdb[i]); + sum += histdb[i]; + } } } -- 2.45.2 _______________________________________________ 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".