diff mbox series

[FFmpeg-devel,v3,1/3] avfilter/af_volumedetect.c: Move logdb function

Message ID 20240520201606.90567-2-yigithanyigitdevel@gmail.com
State New
Headers show
Series avfilter/af_volumedetect.c: Move logdb function | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished

Commit Message

Yigithan Yigit May 20, 2024, 8:16 p.m. UTC
---
 libavfilter/af_volumedetect.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

Comments

Paul B Mahol May 21, 2024, 7:20 a.m. UTC | #1
On Mon, May 20, 2024 at 10:25 PM Yigithan Yigit <
yigithanyigitdevel@gmail.com> wrote:

> ---
>  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
> +
>

That is only true for 16bit input files, not for floats.


>  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;
> --
> 2.44.0
>
> _______________________________________________
> 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".
>
Paul B Mahol May 21, 2024, 7:22 a.m. UTC | #2
On Tue, May 21, 2024 at 9:20 AM Paul B Mahol <onemda@gmail.com> wrote:

>
>
> On Mon, May 20, 2024 at 10:25 PM Yigithan Yigit <
> yigithanyigitdevel@gmail.com> wrote:
>
>> ---
>>  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
>> +
>>
>
> That is only true for 16bit input files, not for floats.
>

Ignore this, its just split patch....

>
>
>>  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;
>> --
>> 2.44.0
>>
>> _______________________________________________
>> 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".
>>
>
diff mbox series

Patch

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;