From: Anton Khirnov <anton@khirnov.net>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Cc: thilo.borgmann@mail.de, yigithanyigitdevel@gmail.com
Subject: Re: [FFmpeg-devel] [PATCH v2 2/4] avfilter/af_volumedetect.c: Added functions for int/float and planar/packed
Date: Mon, 01 Jul 2024 13:33:37 +0200
Message-ID: <171983361762.21847.14652114400196819568@lain.khirnov.net> (raw)
In-Reply-To: <20240628201523.23612-3-yigithanyigitdevel@gmail.com>
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".
next prev parent reply other threads:[~2024-07-01 11:33 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-28 20:15 [FFmpeg-devel] [PATCH v2 0/4] avfilter/af_volumedetect.c: Add 32bit float audio Yigithan Yigit
2024-06-28 20:15 ` [FFmpeg-devel] [PATCH v2 1/4] avfilter/af_volumedetect.c: Move logdb function Yigithan Yigit
2024-06-29 19:22 ` Rémi Denis-Courmont
2024-06-29 19:54 ` Yigithan Yigit
2024-06-30 8:28 ` Thilo Borgmann via ffmpeg-devel
2024-06-28 20:15 ` [FFmpeg-devel] [PATCH v2 2/4] avfilter/af_volumedetect.c: Added functions for int/float and planar/packed Yigithan Yigit
2024-07-01 11:33 ` Anton Khirnov [this message]
2024-06-28 20:15 ` [FFmpeg-devel] [PATCH v2 3/4] avfilter/af_volumedetect.c: Add 32bit float audio support Yigithan Yigit
2024-06-28 20:15 ` [FFmpeg-devel] [PATCH v2 4/4] avfilter/af_volumedetect.c: reindent after last commit Yigithan Yigit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=171983361762.21847.14652114400196819568@lain.khirnov.net \
--to=anton@khirnov.net \
--cc=ffmpeg-devel@ffmpeg.org \
--cc=thilo.borgmann@mail.de \
--cc=yigithanyigitdevel@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git