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 CDEF84AD43 for ; Mon, 20 May 2024 20:16:43 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 51D9F68D2A9; Mon, 20 May 2024 23:16:22 +0300 (EEST) Received: from mail-ed1-f49.google.com (mail-ed1-f49.google.com [209.85.208.49]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4A11068D212 for ; Mon, 20 May 2024 23:16:15 +0300 (EEST) Received: by mail-ed1-f49.google.com with SMTP id 4fb4d7f45d1cf-574f7c0bab4so10011889a12.0 for ; Mon, 20 May 2024 13:16:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716236174; x=1716840974; 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=F7bLcZggvwiyKroygO+vrJ7jdM8X1EMZGsZVzD0VPfq1PopN/adLLCshamHKYt6yLX 7yLFzwcire1iBCXdWu9PTVeRFt2tv4tt4QT8ogFG3yi2rEbI9ZIOETSli/E+HBACr1pd qbOoaXGBW/nxnWdiXQuLINcgDlRkRRgupzBmMkSgpKp/R3VOpX0j54aRmwULeF+vlb8h 9Niao290JdvHr5Xu+OO63IMAY/rm3Gwwv6Oy6u21SJ0vMLciAE5gQDe5PXl0YPvz5nA4 MUBfC6hhQVCHuP1DGCYWsEWkYg0P7pKiuMcy3r/Q74GB/3qzCqaLPH4as57ei8IUe7n/ 5e2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716236174; x=1716840974; 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=ISOXQMVOWzdQ3mKzHyTkjcxLZUac+SScGOJK8d7oYmBnURnTui2mwBd9DBoaHjJAGF augnxvMmtu6zQzJSILu+gBtmow0KY7DaYPaVWLShL7vgHrBFAuRqed90L0slh33iGXeO 1MZ+yA6sYjZeGTsv5xdruEnvRNUFnIbINuJNdrnEcYKQ0Ezbd+7LqsB110nuc7aIYaxL +30ZGMLcIXnpGiMqkawONSLA6rg0Aa/LoDF00scUvUyht58ZO5GCrW3hqkLM/mMO29Uc 2N7n+jKo82PXfaNW8n/sqHFMFMepgR8bzIcCJo9BSacmoLeZrwPQ1ToJtWGXWaxnpX5D Y6OA== X-Gm-Message-State: AOJu0YwLvK34MVsZXQ58lf//ZI8TUvaRA+0jIdesTlTUIJjahPDpFbuA dvpFgFj2oWJm3dRklZPZd1z//LbZnYZzkbViFHqV68yJwx/2R771w0ISnO+B X-Google-Smtp-Source: AGHT+IFfc6tLJwmd6bRCnvleToH7XKuwkxEBzNPkjZHHr7HuioG/yiftmO/XgQQFIe2Y+nODddWOMA== X-Received: by 2002:a17:906:a05a:b0:a59:a7ea:dd22 with SMTP id a640c23a62f3a-a5d5a376cb2mr613602766b.14.1716236174140; Mon, 20 May 2024 13:16:14 -0700 (PDT) Received: from localhost.localdomain ([2a02:e0:8bd6:600:b19e:f464:654a:2d9b]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a5a1787c6ffsm1498463466b.49.2024.05.20.13.16.12 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 20 May 2024 13:16:13 -0700 (PDT) From: Yigithan Yigit To: ffmpeg-devel@ffmpeg.org Date: Mon, 20 May 2024 23:16:06 +0300 Message-ID: <20240520201606.90567-4-yigithanyigitdevel@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240520201606.90567-1-yigithanyigitdevel@gmail.com> References: <20240520201606.90567-1-yigithanyigitdevel@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v3 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".