Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
3d308746
Commit
3d308746
authored
Oct 07, 2018
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/af_afade: add logistic sigmoid curve
parent
9c120b4d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
1 deletion
+13
-1
filters.texi
doc/filters.texi
+2
-0
af_afade.c
libavfilter/af_afade.c
+11
-1
No files found.
doc/filters.texi
View file @
3d308746
...
...
@@ -955,6 +955,8 @@ select inverted half of sine wave
select
double
-
exponential
seat
@
item
desi
select
double
-
exponential
sigmoid
@
item
losi
select
logistic
sigmoid
@
end
table
@
end
table
...
...
libavfilter/af_afade.c
View file @
3d308746
...
...
@@ -57,7 +57,7 @@ typedef struct AudioFadeContext {
int
curve0
,
int
curve1
);
}
AudioFadeContext
;
enum
CurveType
{
TRI
,
QSIN
,
ESIN
,
HSIN
,
LOG
,
IPAR
,
QUA
,
CUB
,
SQU
,
CBR
,
PAR
,
EXP
,
IQSIN
,
IHSIN
,
DESE
,
DESI
,
NB_CURVES
};
enum
CurveType
{
TRI
,
QSIN
,
ESIN
,
HSIN
,
LOG
,
IPAR
,
QUA
,
CUB
,
SQU
,
CBR
,
PAR
,
EXP
,
IQSIN
,
IHSIN
,
DESE
,
DESI
,
LOSI
,
NB_CURVES
};
#define OFFSET(x) offsetof(AudioFadeContext, x)
#define FLAGS AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
...
...
@@ -151,6 +151,14 @@ static double fade_gain(int curve, int64_t index, int64_t range)
case
DESI
:
gain
=
gain
<=
0
.
5
?
CUBE
(
2
*
gain
)
/
2
:
1
-
CUBE
(
2
*
(
1
-
gain
))
/
2
;
break
;
case
LOSI
:
{
const
double
a
=
1
.
/
(
1
.
-
0
.
787
)
-
1
;
double
A
=
1
.
/
(
1
.
0
+
exp
(
0
-
((
gain
-
0
.
5
)
*
a
*
2
.
0
)));
double
B
=
1
.
/
(
1
.
0
+
exp
(
a
));
double
C
=
1
.
/
(
1
.
0
+
exp
(
0
-
a
));
gain
=
(
A
-
B
)
/
(
C
-
B
);
}
break
;
}
return
gain
;
...
...
@@ -257,6 +265,7 @@ static const AVOption afade_options[] = {
{
"ihsin"
,
"inverted half of sine wave"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
IHSIN
},
0
,
0
,
FLAGS
,
"curve"
},
{
"dese"
,
"double-exponential seat"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
DESE
},
0
,
0
,
FLAGS
,
"curve"
},
{
"desi"
,
"double-exponential sigmoid"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
DESI
},
0
,
0
,
FLAGS
,
"curve"
},
{
"losi"
,
"logistic sigmoid"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
LOSI
},
0
,
0
,
FLAGS
,
"curve"
},
{
NULL
}
};
...
...
@@ -376,6 +385,7 @@ static const AVOption acrossfade_options[] = {
{
"ihsin"
,
"inverted half of sine wave"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
IHSIN
},
0
,
0
,
FLAGS
,
"curve"
},
{
"dese"
,
"double-exponential seat"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
DESE
},
0
,
0
,
FLAGS
,
"curve"
},
{
"desi"
,
"double-exponential sigmoid"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
DESI
},
0
,
0
,
FLAGS
,
"curve"
},
{
"losi"
,
"logistic sigmoid"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
LOSI
},
0
,
0
,
FLAGS
,
"curve"
},
{
"curve2"
,
"set fade curve type for 2nd stream"
,
OFFSET
(
curve2
),
AV_OPT_TYPE_INT
,
{.
i64
=
TRI
},
0
,
NB_CURVES
-
1
,
FLAGS
,
"curve"
},
{
"c2"
,
"set fade curve type for 2nd stream"
,
OFFSET
(
curve2
),
AV_OPT_TYPE_INT
,
{.
i64
=
TRI
},
0
,
NB_CURVES
-
1
,
FLAGS
,
"curve"
},
{
NULL
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment