[FFmpeg-devel] [PATCH] avfilter/af_volumedetect.c: Add 32bit float audio support

Paul B Mahol onemda at gmail.com
Sat Mar 23 17:21:39 EET 2024


On Sat, Mar 23, 2024 at 3:28 PM Yiğithan Yiğit <yigithanyigit35 at gmail.com>
wrote:

> Hi,
>
> According to your advices, I made some changes of mine last patch. I feel
> like this one way more better. I removed trivial calculations but I want to
> say I am not proud of how I handled histogram in float despite 16 bit
> integer histogram. I am storing dB values instead of storing samples. I
> feel this one is more convenient. Still I am open to advices.
>
>
I see no patch at all.

volumedetect displays histogram typically with 1dB steps, so build
histogram with 1dB range between each bin.
for float, only use normal values, no +inf/subnormals/nans etc.
I bet there is less than current 2^16 entries in histogram table of filter
context to fill.
There is no need to convert each input sample to dB scale. Just to
calculate ranges for each 1dB entry calculate range in linear space and
every such sample that is in such range get added to such histogram bin
entry.
Or if you calculate in dB scale anyway than just round(ceilf/floorf/lrintf)
dB value (removing fractional parts) and add it into histogram table, do
not forget to count >+/-1.0 values too. (ones with >0dB values), you can
use normal mean/max/peak calculations (do not use histogram to calculate
them for float/double).



> Thank you.
> Yigithan
>
>
>>
> > On Mar 21, 2024, at 11:30 PM, Paul B Mahol <onemda at gmail.com> wrote:
> >
> > On Wed, Mar 20, 2024 at 11:55 PM Yiğithan Yiğit <
> yigithanyigit35 at gmail.com <mailto:yigithanyigit35 at gmail.com>>
> > wrote:
> >
> >>
> >>> On Mar 21, 2024, at 12:10 AM, Paul B Mahol <onemda at gmail.com> wrote:
> >>>
> >>> Why? This is pointless.
> >>>
> >>> volumedetect have histogram output, float patch does not have it at
> all.
> >>> Use astats filter.
> >>>
> >>> On Wed, Mar 20, 2024 at 9:47 PM Yiğithan Yiğit <
> >> yigithanyigit35 at gmail.com>
> >>> wrote:
> >>>
> >>>> _______________________________________________
> >>>> ffmpeg-devel mailing list
> >>>> ffmpeg-devel at ffmpeg.org
> >>>> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >>>>
> >>>> To unsubscribe, visit link above, or email
> >>>> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
> >>>>
> >>> _______________________________________________
> >>> ffmpeg-devel mailing list
> >>> ffmpeg-devel at ffmpeg.org
> >>> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >>>
> >>> To unsubscribe, visit link above, or email
> >>> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe”.
> >>
> >> I am a beginner/student also new at open source but I love FFmpeg and
> >> using in my daily life. From my perspective volumedetect way more user
> >> friendly. I believe adding this patch would be useful to people such as
> >> #9613. The reason lack of histogram output for float mostly for my
> >> indecision about range of the histogram. I am open the suggestions and
> >> after that I can make a new patch.
> >>
> >
> > It is trivial (to some people) to add histogram per dB for float/double
> > inputs.
> > But this patch just does some extremely trivial math calculations so that
> > float input have completely different output from integer ones.
> > That is very odd and unfriendly from my perspective.
> >
> > Besides if you only interested in discrete sample audio peak finder in
> > audio input use astats and measure_overall=Peak_level options.
> > Yes they are not default on. Because more statistics are more important
> > than single number.
> >
> > I'm not against adding proper and useful and correct float/double support
> > to volumedetect, but it needs to have same/similar structure of output as
> > integer sample format input audio, otherwise it just looks lazy and prone
> > for users wondering what is going on when they use different sample
> formats
> > in theirs graphs.
> >
> >
> >>
> >> Best Regards
> >> Yigithan
> >>
> >>
> >> _______________________________________________
> >> ffmpeg-devel mailing list
> >> ffmpeg-devel at ffmpeg.org <mailto:ffmpeg-devel at ffmpeg.org>
> >> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >>
> >> To unsubscribe, visit link above, or email
> >> ffmpeg-devel-request at ffmpeg.org <mailto:ffmpeg-devel-request at ffmpeg.org>
> with subject "unsubscribe".
> >>
> > _______________________________________________
> > ffmpeg-devel mailing list
> > ffmpeg-devel at ffmpeg.org <mailto:ffmpeg-devel at ffmpeg.org>
> > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >
> > To unsubscribe, visit link above, or email
> > ffmpeg-devel-request at ffmpeg.org <mailto:ffmpeg-devel-request at ffmpeg.org>
> with subject "unsubscribe".
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
>


More information about the ffmpeg-devel mailing list