Message ID | 20240628201523.23612-2-yigithanyigitdevel@gmail.com |
---|---|
State | New |
Headers | show |
Series | avfilter/af_volumedetect.c: Add 32bit float audio | expand |
Context | Check | Description |
---|---|---|
andriy/make_x86 | success | Make finished |
andriy/make_fate_x86 | success | Make fate finished |
Le perjantaina 28. kesäkuuta 2024, 23.15.20 EEST Yigithan Yigit a écrit : > --- > libavfilter/af_volumedetect.c | 20 ++++++++++---------- > 1 file changed, 10 insertions(+), 10 deletions(-) > > diff --git a/libavfilter/af_volumedetect.c b/libavfilter/af_volumedetect.c > index 8b001d1cf2..327801a7f9 100644 > --- a/libavfilter/af_volumedetect.c > +++ b/libavfilter/af_volumedetect.c > @@ -24,6 +24,8 @@ > #include "avfilter.h" > #include "internal.h" > > +#define MAX_DB 91 > + > typedef struct VolDetectContext { > /** > * Number of samples at each PCM value. > @@ -33,6 +35,14 @@ typedef struct VolDetectContext { > uint64_t histogram[0x10001]; > } VolDetectContext; > > +static inline double logdb(uint64_t v) > +{ > + double d = v / (double)(0x8000 * 0x8000); ldexp(v, -30) ? > + if (!v) > + return MAX_DB; > + return -log10(d) * 10; > +} > + > static int filter_frame(AVFilterLink *inlink, AVFrame *samples) > { > AVFilterContext *ctx = inlink->dst; > @@ -56,16 +66,6 @@ static int filter_frame(AVFilterLink *inlink, AVFrame > *samples) return ff_filter_frame(inlink->dst->outputs[0], samples); > } > > -#define MAX_DB 91 > - > -static inline double logdb(uint64_t v) > -{ > - double d = v / (double)(0x8000 * 0x8000); > - if (!v) > - return MAX_DB; > - return -log10(d) * 10; > -} > - > static void print_stats(AVFilterContext *ctx) > { > VolDetectContext *vd = ctx->priv;
> On 29 Jun 2024, at 22:22, Rémi Denis-Courmont <remi@remlab.net> wrote: > > Le perjantaina 28. kesäkuuta 2024, 23.15.20 EEST Yigithan Yigit a écrit : >> --- >> libavfilter/af_volumedetect.c | 20 ++++++++++---------- >> 1 file changed, 10 insertions(+), 10 deletions(-) >> diff --git a/libavfilter/af_volumedetect.c b/libavfilter/af_volumedetect.c >> index 8b001d1cf2..327801a7f9 100644 >> --- a/libavfilter/af_volumedetect.c >> +++ b/libavfilter/af_volumedetect.c >> @@ -24,6 +24,8 @@ >> #include "avfilter.h" >> #include "internal.h" >> +#define MAX_DB 91 >> + >> typedef struct VolDetectContext { >> /** >> * Number of samples at each PCM value. >> @@ -33,6 +35,14 @@ typedef struct VolDetectContext { >> uint64_t histogram[0x10001]; >> } VolDetectContext; >> +static inline double logdb(uint64_t v) >> +{ >> + double d = v / (double)(0x8000 * 0x8000); > > ldexp(v, -30) ? That was the original code that already written. Should I change? Thanks, Yigithan
On 29.06.24 21:54, Yigithan Yigit wrote: > >> On 29 Jun 2024, at 22:22, Rémi Denis-Courmont <remi@remlab.net> wrote: >> >> Le perjantaina 28. kesäkuuta 2024, 23.15.20 EEST Yigithan Yigit a écrit : >>> --- >>> libavfilter/af_volumedetect.c | 20 ++++++++++---------- >>> 1 file changed, 10 insertions(+), 10 deletions(-) >>> diff --git a/libavfilter/af_volumedetect.c b/libavfilter/af_volumedetect.c >>> index 8b001d1cf2..327801a7f9 100644 >>> --- a/libavfilter/af_volumedetect.c >>> +++ b/libavfilter/af_volumedetect.c >>> @@ -24,6 +24,8 @@ >>> #include "avfilter.h" >>> #include "internal.h" >>> +#define MAX_DB 91 >>> + >>> typedef struct VolDetectContext { >>> /** >>> * Number of samples at each PCM value. >>> @@ -33,6 +35,14 @@ typedef struct VolDetectContext { >>> uint64_t histogram[0x10001]; >>> } VolDetectContext; >>> +static inline double logdb(uint64_t v) >>> +{ >>> + double d = v / (double)(0x8000 * 0x8000); >> >> ldexp(v, -30) ? > > That was the original code that already written. Should I change? Not here. Keep the move patch as-is. You can test if ldexp() is equal and if so, add another patch to the patchset changing the function to utilize ldexp(). -Thilo
diff --git a/libavfilter/af_volumedetect.c b/libavfilter/af_volumedetect.c index 8b001d1cf2..327801a7f9 100644 --- a/libavfilter/af_volumedetect.c +++ b/libavfilter/af_volumedetect.c @@ -24,6 +24,8 @@ #include "avfilter.h" #include "internal.h" +#define MAX_DB 91 + typedef struct VolDetectContext { /** * Number of samples at each PCM value. @@ -33,6 +35,14 @@ typedef struct VolDetectContext { uint64_t histogram[0x10001]; } VolDetectContext; +static inline double logdb(uint64_t v) +{ + double d = v / (double)(0x8000 * 0x8000); + if (!v) + return MAX_DB; + return -log10(d) * 10; +} + static int filter_frame(AVFilterLink *inlink, AVFrame *samples) { AVFilterContext *ctx = inlink->dst; @@ -56,16 +66,6 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *samples) return ff_filter_frame(inlink->dst->outputs[0], samples); } -#define MAX_DB 91 - -static inline double logdb(uint64_t v) -{ - double d = v / (double)(0x8000 * 0x8000); - if (!v) - return MAX_DB; - return -log10(d) * 10; -} - static void print_stats(AVFilterContext *ctx) { VolDetectContext *vd = ctx->priv;