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 4DFF54B85E for ; Mon, 17 Jun 2024 11:18:52 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D43C568D787; Mon, 17 Jun 2024 14:18:32 +0300 (EEST) Received: from mail-lj1-f177.google.com (mail-lj1-f177.google.com [209.85.208.177]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8CC4B68D778 for ; Mon, 17 Jun 2024 14:18:23 +0300 (EEST) Received: by mail-lj1-f177.google.com with SMTP id 38308e7fff4ca-2ec002caeb3so56404721fa.2 for ; Mon, 17 Jun 2024 04:18:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718623102; x=1719227902; 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=qT+/cR5XuIe0cgRWOaovGp9ucMUws0WRgUpxZc5Q2UM=; b=Z2H9c6eOFUdiS2lg8qJm8L55X5vi3uWtRu7eBM3xRYdgGX8yN95WeW95+bxd1dW/YM b2WMts7KB0T1us7OjEYhMws+xqV/G/LO7P6ImnH5tVwf0NUPD3HvNZvz/abuAUMRj9+w 258M1pRqpXnD/r4MBUARFJOHSFzBeaXx7+J9EpsNWoif3VxrSirpAOzv9yePjfW0dCq2 di7idmi2p3HrpDDlT8An1c2BOfErhWrb3vWMdnhAAYoN9auA2M+gnzl69oiy7R2SwxJ/ r4FPt8uGv5PxwUlUqiYi2vSQ+WvckK/VuRLxFaBpLRHQQ3r7pHKoaxqtz1/ESLYWGBlY VOjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718623102; x=1719227902; 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=qT+/cR5XuIe0cgRWOaovGp9ucMUws0WRgUpxZc5Q2UM=; b=BTJjVQkiv6KOs5jWfJu3bnTsz0ygKJBYBJdFOTM22+lhphE4Pk+qw4RbG6wowt4tTQ wkHqUQgtKgYKJiqyyTytpudRLIY2qk67GDlRMl6ASfx26xtENIibYDS7LdcKDLuwEXkY 27ImuaS1rgXAZ80DmEQB+9URX0g1Mh1+dS1ykUSSvH99D901TVNlniiciz2Owj/j4vAa Xdt/MTwnox9Hf9wEUZcIXxmoMirOOl6iKN5iaG2U9Xtx8ZQVB3ywP7n2OcWiavc5NnGk fX4v3EV0nzmcucDSZb4zjk15cFnWv89sfwUEjgBc61B93RgW8eoHIOeiyaUAoS3wy7hI miaA== X-Gm-Message-State: AOJu0YzhW9ZvPuJ0WKb2fC7jRnc1/McT1ZOhiLN2in23a1mHdiD0N2y+ 4bSXvi3cQoSXzUmTpyzMDZ5IJ11oA1nWwu/tfyXej/VdsS+nvYZwjazgfA== X-Google-Smtp-Source: AGHT+IE8Pl5C6sxOBdEz/r2NOfdRmRdj8/MHzmKGeEgA4N7bkh/xuuRdhAF68MDrB5DJIZInwDtkpg== X-Received: by 2002:a05:651c:547:b0:2ec:e98:36a8 with SMTP id 38308e7fff4ca-2ec0e983e42mr73824511fa.5.1718623102002; Mon, 17 Jun 2024 04:18:22 -0700 (PDT) Received: from localhost.localdomain ([88.239.140.156]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-422f5f33c38sm157888015e9.9.2024.06.17.04.18.20 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 17 Jun 2024 04:18:21 -0700 (PDT) From: Yigithan Yigit To: ffmpeg-devel@ffmpeg.org Date: Mon, 17 Jun 2024 14:18:12 +0300 Message-ID: <20240617111812.84575-4-yigithanyigitdevel@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240617111812.84575-1-yigithanyigitdevel@gmail.com> References: <20240617111812.84575-1-yigithanyigitdevel@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 3/3] 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 | 68 +++++++++++++++++------------------ 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/libavfilter/af_volumedetect.c b/libavfilter/af_volumedetect.c index dbbcd037a5..b78b073c09 100644 --- a/libavfilter/af_volumedetect.c +++ b/libavfilter/af_volumedetect.c @@ -134,40 +134,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; - - /* 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)); - - 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++) + 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)); + + 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]; + } } } -- 2.44.0 _______________________________________________ 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".