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 A67F94B24F for ; Tue, 2 Jul 2024 01:34:49 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 263DB68D88F; Tue, 2 Jul 2024 04:34:13 +0300 (EEST) Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 54B7868D85B for ; Tue, 2 Jul 2024 04:34:03 +0300 (EEST) Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-424acfff613so32334255e9.0 for ; Mon, 01 Jul 2024 18:34:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719884042; x=1720488842; 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=225NjH8zdVfuxDfOpV9xM9e0VwuZ8PPsz7pvNAfkCiQ=; b=MqNLr+3cdggWsXV6WGUn+dprxFYHnFjnbP6al5zSkvZNYvn3VRbrwBtKw55iGN5dg2 zBn8ZXBMYFloC3RmFP2g9u6a7Kf20b6eqkUU3PJ3Bx7Wv5gUxU4hI8dxxgDaUhypuZ0L q7PVYkEUY5dvwIbebrOzxC24LecjR6nKFSdTSsQvgZ0Xdoc74OLwiCzxoQMEQokwA8IH cVseGPHMfzSYWfZ98jHn/FJiDC44RgFZ6hkjCbypfTrqpv2HBzd+C9Cbm3Nvl8MLS6Uq hH9DrBLov/OIgKjZnbBqYgMtQjamESZcG2trAklH/7TgJCJZiwUAyK4fA0hIih6YmmwY d9Zg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719884042; x=1720488842; 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=225NjH8zdVfuxDfOpV9xM9e0VwuZ8PPsz7pvNAfkCiQ=; b=vmTWt4r3DoZZl6Srd8XWzBGNVkgsH0DEulaNWD3RhCLfHOdncuxSFOW6btsnGUOdkS s8hVE45/xB3+96G1oz3bB/9OfV4V7HrEg2nUCc1WsVZnYVYbUa+j+5yKiIwAMmNMNYz2 UxwvMK1EZiZMt+3CtWX/dw/DLguU7WNf6d7D7TMzeb1FTle6CZJp6/DBvamES46DugEe GKLauexqmVZfDaAx6lA7+gK1O8VI/CvzRyrY8a7vD03X0fCt/Vz28Ydzd7UQCAy+5ggs 9qjXIEH/NwR2EUj4Y6/MgltCPCdCTr0eqNNLmk/OhYDmW++bHZDyj9SveBz45FMwvlTb oCzw== X-Gm-Message-State: AOJu0YwuTdxLYZD8OukPrFutPn/T4uA+M05Ms0Smta+NLIvqGEDbrBPF eUCg+W56mRnjALsksLiEYAk0SZHUY84ha8vmP6AabMIpzHSg1SIsG/Nl2w== X-Google-Smtp-Source: AGHT+IGuoYYxUKY6RhcWclZgvqASxaSVoBJpM+56eS1+YW4ngoS5ReajRIFPWmwLKEbTMrN0vdaZ0Q== X-Received: by 2002:a05:600c:3509:b0:421:dd8c:35a3 with SMTP id 5b1f17b1804b1-4257a020459mr69602475e9.26.1719884042485; Mon, 01 Jul 2024 18:34:02 -0700 (PDT) Received: from localhost.localdomain ([2a02:e0:8bea:ef00:81b5:4ba8:1843:4f00]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4256b068e93sm176273295e9.24.2024.07.01.18.34.01 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 01 Jul 2024 18:34:02 -0700 (PDT) From: Yigithan Yigit To: ffmpeg-devel@ffmpeg.org Date: Tue, 2 Jul 2024 04:33:53 +0300 Message-ID: <20240702013354.14942-5-yigithanyigitdevel@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240702013354.14942-1-yigithanyigitdevel@gmail.com> References: <20240702013354.14942-1-yigithanyigitdevel@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v3 4/5] 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 778f0cac6c..a53212015d 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".