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
ce385c86
Commit
ce385c86
authored
Jul 17, 2014
by
Muhammad Faiz
Committed by
Michael Niedermayer
Jul 21, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/biquads: avoid clipping when using floating type
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
71e515c1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
11 deletions
+11
-11
af_biquads.c
libavfilter/af_biquads.c
+11
-11
No files found.
libavfilter/af_biquads.c
View file @
ce385c86
...
...
@@ -161,7 +161,7 @@ static int query_formats(AVFilterContext *ctx)
return
0
;
}
#define BIQUAD_FILTER(name, type, min, max
)
\
#define BIQUAD_FILTER(name, type, min, max
, need_clipping)
\
static void biquad_## name (const void *input, void *output, int len, \
double *in1, double *in2, \
double *out1, double *out2, \
...
...
@@ -181,10 +181,10 @@ static void biquad_## name (const void *input, void *output, int len, \
for (i = 0; i+1 < len; i++) { \
o2 = i2 * b2 + i1 * b1 + ibuf[i] * b0 + o2 * a2 + o1 * a1; \
i2 = ibuf[i]; \
if (
o2 < min) {
\
if (
need_clipping && o2 < min) {
\
av_log(NULL, AV_LOG_WARNING, "clipping\n"); \
obuf[i] = min; \
} else if (
o2 > max) {
\
} else if (
need_clipping && o2 > max) {
\
av_log(NULL, AV_LOG_WARNING, "clipping\n"); \
obuf[i] = max; \
} else { \
...
...
@@ -193,10 +193,10 @@ static void biquad_## name (const void *input, void *output, int len, \
i++; \
o1 = i1 * b2 + i2 * b1 + ibuf[i] * b0 + o1 * a2 + o2 * a1; \
i1 = ibuf[i]; \
if (
o1 < min) {
\
if (
need_clipping && o1 < min) {
\
av_log(NULL, AV_LOG_WARNING, "clipping\n"); \
obuf[i] = min; \
} else if (
o1 > max) {
\
} else if (
need_clipping && o1 > max) {
\
av_log(NULL, AV_LOG_WARNING, "clipping\n"); \
obuf[i] = max; \
} else { \
...
...
@@ -209,10 +209,10 @@ static void biquad_## name (const void *input, void *output, int len, \
i1 = ibuf[i]; \
o2 = o1; \
o1 = o0; \
if (
o0 < min) {
\
if (
need_clipping && o0 < min) {
\
av_log(NULL, AV_LOG_WARNING, "clipping\n"); \
obuf[i] = min; \
} else if (
o0 > max) {
\
} else if (
need_clipping && o0 > max) {
\
av_log(NULL, AV_LOG_WARNING, "clipping\n"); \
obuf[i] = max; \
} else { \
...
...
@@ -225,10 +225,10 @@ static void biquad_## name (const void *input, void *output, int len, \
*out2 = o2; \
}
BIQUAD_FILTER
(
s16
,
int16_t
,
INT16_MIN
,
INT16_MAX
)
BIQUAD_FILTER
(
s32
,
int32_t
,
INT32_MIN
,
INT32_MAX
)
BIQUAD_FILTER
(
flt
,
float
,
-
1
.,
1
.)
BIQUAD_FILTER
(
dbl
,
double
,
-
1
.,
1
.)
BIQUAD_FILTER
(
s16
,
int16_t
,
INT16_MIN
,
INT16_MAX
,
1
)
BIQUAD_FILTER
(
s32
,
int32_t
,
INT32_MIN
,
INT32_MAX
,
1
)
BIQUAD_FILTER
(
flt
,
float
,
-
1
.,
1
.
,
0
)
BIQUAD_FILTER
(
dbl
,
double
,
-
1
.,
1
.
,
0
)
static
int
config_output
(
AVFilterLink
*
outlink
)
{
...
...
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