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 76C334A523 for ; Mon, 1 Jul 2024 11:33:48 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C06B368D6ED; Mon, 1 Jul 2024 14:33:44 +0300 (EEST) Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E84D868D0BD for ; Mon, 1 Jul 2024 14:33:38 +0300 (EEST) Authentication-Results: mail0.khirnov.net; dkim=pass (2048-bit key; unprotected) header.d=khirnov.net header.i=@khirnov.net header.a=rsa-sha256 header.s=mail header.b=aKHERANP; dkim-atps=neutral Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 598D1240DAC; Mon, 1 Jul 2024 13:33:38 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id MNRlcpV5cQ5i; Mon, 1 Jul 2024 13:33:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1719833617; bh=hRcN0QYx8Dg+tjtXKG/KkvNalnmohX94Ey0S77YHr5Q=; h=Subject:From:To:Cc:In-Reply-To:References:Date:From; b=aKHERANP+s3NskUlx45FlLeZRX3SJZkMwQH4Lse4GWRXgxWw7qV+HpxOsYAMsR/4V nEnwZfLhf+ISCPMoRxFDlxytCSAvWMBD3PH8Lnib6kEY/i9fI6BsVJ3PgTcjtp+L7k IkVd2ZZO+AX0W3QeY2MS1+0ZvxpB9Zmenn1vlZfEhCr2fLUU1yDsTs0tAPbk4+nrVu tf/wQ+FrcUTVc8aUs6Lp2480vgen3euHoujJOp8KUTPo96K9yN+gY2xYLIrjm2lkwa ySr2inE80Tb76j6+tVSibMR3mV6GkwR1Sjf6xfkC9fuxfQouDz3qnQq4TWZVl07RoF DAJk43MRIZ7yw== Received: from lain.khirnov.net (lain.khirnov.net [IPv6:2001:67c:1138:4306::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "lain.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id B63B82404E5; Mon, 1 Jul 2024 13:33:37 +0200 (CEST) Received: by lain.khirnov.net (Postfix, from userid 1000) id 9FB141601B9; Mon, 1 Jul 2024 13:33:37 +0200 (CEST) From: Anton Khirnov To: FFmpeg development discussions and patches In-Reply-To: <20240628201523.23612-3-yigithanyigitdevel@gmail.com> References: <20240628201523.23612-1-yigithanyigitdevel@gmail.com> <20240628201523.23612-3-yigithanyigitdevel@gmail.com> Mail-Followup-To: FFmpeg development discussions and patches , thilo.borgmann@mail.de, yigithanyigitdevel@gmail.com Date: Mon, 01 Jul 2024 13:33:37 +0200 Message-ID: <171983361762.21847.14652114400196819568@lain.khirnov.net> User-Agent: alot/0.8.1 MIME-Version: 1.0 Subject: Re: [FFmpeg-devel] [PATCH v2 2/4] avfilter/af_volumedetect.c: Added functions for int/float and planar/packed 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: Quoting Yigithan Yigit (2024-06-28 22:15:21) > --- > libavfilter/af_volumedetect.c | 58 +++++++++++++++++++++++++++++++++++ > 1 file changed, 58 insertions(+) > > diff --git a/libavfilter/af_volumedetect.c b/libavfilter/af_volumedetect.c > index 327801a7f9..61c00e0248 100644 > --- a/libavfilter/af_volumedetect.c > +++ b/libavfilter/af_volumedetect.c > @@ -43,6 +43,64 @@ static inline double logdb(uint64_t v) > return -log10(d) * 10; > } > > +static void process_float_planar_samples(VolDetectContext *vd, AVFrame *samples) > +{ > + int plane, i; > + int nb_channels = samples->ch_layout.nb_channels; > + int nb_samples = samples->nb_samples; > + float *audio_data; > + for (plane = 0; plane < nb_channels; plane++) { > + audio_data = (float *)samples->extended_data[plane]; > + for (i = 0; i < nb_samples; i++) { > + update_float_stats(vd, &audio_data[i]); > + } > + } > +} > + > +static void process_float_packed_samples(VolDetectContext *vd, AVFrame *samples) > +{ > + int i, j; > + int nb_channels = samples->ch_layout.nb_channels; > + int nb_samples = samples->nb_samples; > + float *audio_data; > + for (i = 0; i < nb_samples; i++) { > + audio_data = (float *)samples->extended_data[0]; > + for (j = 0; j < nb_channels; j++) { > + update_float_stats(vd, &audio_data[i * nb_channels + j]); > + } > + } > +} > + > +static void process_int_planar_samples(VolDetectContext *vd, AVFrame *samples) > +{ > + int plane, i; > + int nb_channels = samples->ch_layout.nb_channels; > + int nb_samples = samples->nb_samples; > + int16_t *pcm; > + for (plane = 0; plane < nb_channels; plane++) { > + pcm = (int16_t *)samples->extended_data[plane]; > + for (i = 0; i < nb_samples; i++) { > + vd->histogram[pcm[i] + 0x8000]++; > + vd->nb_samples++; > + } > + } > +} > + > +static void process_int_packed_samples(VolDetectContext *vd, AVFrame *samples) > +{ > + int i, j; > + int nb_channels = samples->ch_layout.nb_channels; > + int nb_samples = samples->nb_samples; > + int16_t *pcm; > + for (i = 0; i < nb_samples; i++) { > + pcm = (int16_t *)samples->extended_data[0]; > + for (j = 0; j < nb_channels; j++) { > + vd->histogram[pcm[i * nb_channels + j] + 0x8000]++; > + vd->nb_samples++; > + } > + } > +} This looks in need of some templating. -- Anton Khirnov _______________________________________________ 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".