Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
ffmpeg
Project
Project
Details
Activity
Releases
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Stefan Westerfeld
ffmpeg
Commits
52ebb15e
Commit
52ebb15e
authored
Aug 20, 2023
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/af_afade: add 4 more curves
parent
e41bd6e6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
1 deletion
+29
-1
filters.texi
doc/filters.texi
+8
-0
af_afade.c
libavfilter/af_afade.c
+21
-1
No files found.
doc/filters.texi
View file @
52ebb15e
...
...
@@ -1459,6 +1459,14 @@ select logistic sigmoid
select sine cardinal function
@item isinc
select inverted sine cardinal function
@item quat
select quartic
@item quatr
select quartic root
@item qsin2
select squared quarter of sine wave
@item hsin2
select squared half of sine wave
@item nofade
no fade applied
@end table
...
...
libavfilter/af_afade.c
View file @
52ebb15e
...
...
@@ -58,7 +58,7 @@ typedef struct AudioFadeContext {
int
curve0
,
int
curve1
);
}
AudioFadeContext
;
enum
CurveType
{
NONE
=
-
1
,
TRI
,
QSIN
,
ESIN
,
HSIN
,
LOG
,
IPAR
,
QUA
,
CUB
,
SQU
,
CBR
,
PAR
,
EXP
,
IQSIN
,
IHSIN
,
DESE
,
DESI
,
LOSI
,
SINC
,
ISINC
,
NB_CURVES
};
enum
CurveType
{
NONE
=
-
1
,
TRI
,
QSIN
,
ESIN
,
HSIN
,
LOG
,
IPAR
,
QUA
,
CUB
,
SQU
,
CBR
,
PAR
,
EXP
,
IQSIN
,
IHSIN
,
DESE
,
DESI
,
LOSI
,
SINC
,
ISINC
,
QUAT
,
QUATR
,
QSIN2
,
HSIN2
,
NB_CURVES
};
#define OFFSET(x) offsetof(AudioFadeContext, x)
#define FLAGS AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
...
...
@@ -142,6 +142,18 @@ static double fade_gain(int curve, int64_t index, int64_t range, double silence,
case
ISINC
:
gain
=
gain
<=
0
.
0
?
0
.
0
:
1
.
0
-
sin
(
M_PI
*
gain
)
/
(
M_PI
*
gain
);
break
;
case
QUAT
:
gain
=
gain
*
gain
*
gain
*
gain
;
break
;
case
QUATR
:
gain
=
pow
(
gain
,
0
.
25
);
break
;
case
QSIN2
:
gain
=
sin
(
gain
*
M_PI
/
2
.
0
)
*
sin
(
gain
*
M_PI
/
2
.
0
);
break
;
case
HSIN2
:
gain
=
pow
((
1
.
0
-
cos
(
gain
*
M_PI
))
/
2
.
0
,
2
.
0
);
break
;
case
NONE
:
gain
=
1
.
0
;
break
;
...
...
@@ -316,6 +328,10 @@ static const AVOption afade_options[] = {
{
"losi"
,
"logistic sigmoid"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
LOSI
},
0
,
0
,
TFLAGS
,
"curve"
},
{
"sinc"
,
"sine cardinal function"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
SINC
},
0
,
0
,
TFLAGS
,
"curve"
},
{
"isinc"
,
"inverted sine cardinal function"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
ISINC
},
0
,
0
,
TFLAGS
,
"curve"
},
{
"quat"
,
"quartic"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
QUAT
},
0
,
0
,
TFLAGS
,
"curve"
},
{
"quatr"
,
"quartic root"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
QUATR
},
0
,
0
,
TFLAGS
,
"curve"
},
{
"qsin2"
,
"squared quarter of sine wave"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
QSIN2
},
0
,
0
,
TFLAGS
,
"curve"
},
{
"hsin2"
,
"squared half of sine wave"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
HSIN2
},
0
,
0
,
TFLAGS
,
"curve"
},
{
"silence"
,
"set the silence gain"
,
OFFSET
(
silence
),
AV_OPT_TYPE_DOUBLE
,
{.
dbl
=
0
},
0
,
1
,
TFLAGS
},
{
"unity"
,
"set the unity gain"
,
OFFSET
(
unity
),
AV_OPT_TYPE_DOUBLE
,
{.
dbl
=
1
},
0
,
1
,
TFLAGS
},
{
NULL
}
...
...
@@ -464,6 +480,10 @@ static const AVOption acrossfade_options[] = {
{
"losi"
,
"logistic sigmoid"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
LOSI
},
0
,
0
,
FLAGS
,
"curve"
},
{
"sinc"
,
"sine cardinal function"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
SINC
},
0
,
0
,
FLAGS
,
"curve"
},
{
"isinc"
,
"inverted sine cardinal function"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
ISINC
},
0
,
0
,
FLAGS
,
"curve"
},
{
"quat"
,
"quartic"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
QUAT
},
0
,
0
,
FLAGS
,
"curve"
},
{
"quatr"
,
"quartic root"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
QUATR
},
0
,
0
,
FLAGS
,
"curve"
},
{
"qsin2"
,
"squared quarter of sine wave"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
QSIN2
},
0
,
0
,
FLAGS
,
"curve"
},
{
"hsin2"
,
"squared half of sine wave"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
HSIN2
},
0
,
0
,
FLAGS
,
"curve"
},
{
"curve2"
,
"set fade curve type for 2nd stream"
,
OFFSET
(
curve2
),
AV_OPT_TYPE_INT
,
{.
i64
=
TRI
},
NONE
,
NB_CURVES
-
1
,
FLAGS
,
"curve"
},
{
"c2"
,
"set fade curve type for 2nd stream"
,
OFFSET
(
curve2
),
AV_OPT_TYPE_INT
,
{.
i64
=
TRI
},
NONE
,
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