[FFmpeg-cvslog] avfilter/af_asoftclip: add erf soft clip type

Paul B Mahol git at videolan.org
Tue Nov 3 13:31:26 EET 2020


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Tue Nov  3 12:05:24 2020 +0100| [ee686236cd1dcceca2ecdfe64e509a7ef977e8f0] | committer: Paul B Mahol

avfilter/af_asoftclip: add erf soft clip type

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ee686236cd1dcceca2ecdfe64e509a7ef977e8f0
---

 doc/filters.texi           |  1 +
 libavfilter/af_asoftclip.c | 12 ++++++++++++
 2 files changed, 13 insertions(+)

diff --git a/doc/filters.texi b/doc/filters.texi
index d98c696f60..a186f9dca1 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -2323,6 +2323,7 @@ It accepts the following values:
 @item alg
 @item quintic
 @item sin
+ at item erf
 @end table
 
 @item param
diff --git a/libavfilter/af_asoftclip.c b/libavfilter/af_asoftclip.c
index e9e3666ef6..c49ba5a49f 100644
--- a/libavfilter/af_asoftclip.c
+++ b/libavfilter/af_asoftclip.c
@@ -32,6 +32,7 @@ enum ASoftClipTypes {
     ASC_ALG,
     ASC_QUINTIC,
     ASC_SIN,
+    ASC_ERF,
     NB_TYPES,
 };
 
@@ -57,6 +58,7 @@ static const AVOption asoftclip_options[] = {
     { "alg",                 NULL,            0, AV_OPT_TYPE_CONST,  {.i64=ASC_ALG},    0,          0, A, "types" },
     { "quintic",             NULL,            0, AV_OPT_TYPE_CONST,  {.i64=ASC_QUINTIC},0,          0, A, "types" },
     { "sin",                 NULL,            0, AV_OPT_TYPE_CONST,  {.i64=ASC_SIN},    0,          0, A, "types" },
+    { "erf",                 NULL,            0, AV_OPT_TYPE_CONST,  {.i64=ASC_ERF},    0,          0, A, "types" },
     { "param", "set softclip parameter", OFFSET(param), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0.01,        3, A },
     { NULL }
 };
@@ -148,6 +150,11 @@ static void filter_flt(ASoftClipContext *s,
                     dst[n] = sinf(src[n]);
             }
             break;
+        case ASC_ERF:
+            for (int n = 0; n < nb_samples; n++) {
+                dst[n] = erff(src[n]);
+            }
+            break;
         }
     }
 }
@@ -205,6 +212,11 @@ static void filter_dbl(ASoftClipContext *s,
                     dst[n] = sin(src[n]);
             }
             break;
+        case ASC_ERF:
+            for (int n = 0; n < nb_samples; n++) {
+                dst[n] = erf(src[n]);
+            }
+            break;
         }
     }
 }



More information about the ffmpeg-cvslog mailing list