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
55fc0eb1
Commit
55fc0eb1
authored
Mar 22, 2007
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
AUDIOPHILE_KIDDY_MODE
Originally committed as revision 8475 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
50df67d3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
5 deletions
+21
-5
resample2.c
libavcodec/resample2.c
+21
-5
No files found.
libavcodec/resample2.c
View file @
55fc0eb1
...
...
@@ -35,17 +35,26 @@
#define FELEM int16_t
#define FELEM2 int32_t
#define FELEML int64_t
#define FELEM_MAX INT16_MAX
#define FELEM_MIN INT16_MIN
#define WINDOW_TYPE 9
#el
se
#el
if !defined(CONFIG_RESAMPLE_AUDIOPHILE_KIDDY_MODE)
#define FILTER_SHIFT 30
#define FELEM int32_t
#define FELEM2 int64_t
#define FELEML int64_t
#define FELEM_MAX INT32_MAX
#define FELEM_MIN INT32_MIN
#define WINDOW_TYPE 12
#else
#define FILTER_SHIFT 0
#define FELEM long double
#define FELEM2 long double
#define FELEML long double
#define WINDOW_TYPE 24
#endif
...
...
@@ -123,8 +132,11 @@ void av_build_filter(FELEM *filter, double factor, int tap_count, int phase_coun
/* normalize so that an uniform color remains the same */
for
(
i
=
0
;
i
<
tap_count
;
i
++
)
{
v
=
av_clip
(
lrintf
(
tab
[
i
]
*
scale
/
norm
),
FELEM_MIN
,
FELEM_MAX
);
filter
[
ph
*
tap_count
+
i
]
=
v
;
#ifdef CONFIG_RESAMPLE_AUDIOPHILE_KIDDY_MODE
filter
[
ph
*
tap_count
+
i
]
=
tab
[
i
]
/
norm
;
#else
filter
[
ph
*
tap_count
+
i
]
=
av_clip
(
lrintf
(
tab
[
i
]
*
scale
/
norm
),
FELEM_MIN
,
FELEM_MAX
);
#endif
}
}
#if 0
...
...
@@ -156,7 +168,7 @@ void av_build_filter(FELEM *filter, double factor, int tap_count, int phase_coun
maxsf= FFMAX(maxsf, sf);
minsf= FFMIN(minsf, sf);
if(i%11==0){
av_log(NULL, AV_LOG_ERROR, "i:%4d ss:%f ff:%
f-%f sf:%f-%f
\n", i, ss, maxff, minff, maxsf, minsf);
av_log(NULL, AV_LOG_ERROR, "i:%4d ss:%f ff:%
13.6e-%13.6e sf:%13.6e-%13.6e
\n", i, ss, maxff, minff, maxsf, minsf);
minff=minsf= 2;
maxff=maxsf= -2;
}
...
...
@@ -259,7 +271,7 @@ int av_resample(AVResampleContext *c, short *dst, short *src, int *consumed, int
int64_t
v
=
0
;
int
sub_phase
=
(
frac
<<
8
)
/
c
->
src_incr
;
for
(
i
=
0
;
i
<
c
->
filter_length
;
i
++
){
int64_t
coeff
=
filter
[
i
]
*
(
256
-
sub_phase
)
+
filter
[
i
+
c
->
filter_length
]
*
sub_phase
;
FELEML
coeff
=
filter
[
i
]
*
(
256
-
sub_phase
)
+
filter
[
i
+
c
->
filter_length
]
*
sub_phase
;
v
+=
src
[
sample_index
+
i
]
*
coeff
;
}
val
=
v
>>
8
;
...
...
@@ -269,8 +281,12 @@ int av_resample(AVResampleContext *c, short *dst, short *src, int *consumed, int
}
}
#ifdef CONFIG_RESAMPLE_AUDIOPHILE_KIDDY_MODE
dst
[
dst_index
]
=
av_clip
(
lrintf
(
val
),
-
32768
,
32767
);
#else
val
=
(
val
+
(
1
<<
(
FILTER_SHIFT
-
1
)))
>>
FILTER_SHIFT
;
dst
[
dst_index
]
=
(
unsigned
)(
val
+
32768
)
>
65535
?
(
val
>>
31
)
^
32767
:
val
;
#endif
frac
+=
dst_incr_frac
;
index
+=
dst_incr
;
...
...
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