Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FFmpeg
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
libremedia
Tethys
FFmpeg
Commits
254c95cd
Commit
254c95cd
authored
11 years ago
by
Anton Khirnov
Browse files
Options
Downloads
Patches
Plain Diff
resample: split linear into its own function
parent
be394968
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
libavresample/resample.c
+4
-4
4 additions, 4 deletions
libavresample/resample.c
libavresample/resample_template.c
+23
-11
23 additions, 11 deletions
libavresample/resample_template.c
with
27 additions
and
15 deletions
libavresample/resample.c
+
4
−
4
View file @
254c95cd
...
...
@@ -181,22 +181,22 @@ ResampleContext *ff_audio_resample_init(AVAudioResampleContext *avr)
switch
(
avr
->
internal_sample_fmt
)
{
case
AV_SAMPLE_FMT_DBLP
:
c
->
resample_one
=
resample_one_dbl
;
c
->
resample_one
=
c
->
linear
?
resample_linear_dbl
:
resample_one_dbl
;
c
->
resample_nearest
=
resample_nearest_dbl
;
c
->
set_filter
=
set_filter_dbl
;
break
;
case
AV_SAMPLE_FMT_FLTP
:
c
->
resample_one
=
resample_one_flt
;
c
->
resample_one
=
c
->
linear
?
resample_linear_flt
:
resample_one_flt
;
c
->
resample_nearest
=
resample_nearest_flt
;
c
->
set_filter
=
set_filter_flt
;
break
;
case
AV_SAMPLE_FMT_S32P
:
c
->
resample_one
=
resample_one_s32
;
c
->
resample_one
=
c
->
linear
?
resample_linear_s32
:
resample_one_s32
;
c
->
resample_nearest
=
resample_nearest_s32
;
c
->
set_filter
=
set_filter_s32
;
break
;
case
AV_SAMPLE_FMT_S16P
:
c
->
resample_one
=
resample_one_s16
;
c
->
resample_one
=
c
->
linear
?
resample_linear_s16
:
resample_one_s16
;
c
->
resample_nearest
=
resample_nearest_s16
;
c
->
set_filter
=
set_filter_s16
;
break
;
...
...
This diff is collapsed.
Click to expand it.
libavresample/resample_template.c
+
23
−
11
View file @
254c95cd
...
...
@@ -61,6 +61,27 @@ static void SET_TYPE(resample_nearest)(void *dst0, int dst_index, const void *sr
dst
[
dst_index
]
=
src
[
index
];
}
static
void
SET_TYPE
(
resample_linear
)(
ResampleContext
*
c
,
void
*
dst0
,
int
dst_index
,
const
void
*
src0
,
unsigned
int
index
,
int
frac
)
{
FELEM
*
dst
=
dst0
;
const
FELEM
*
src
=
src0
;
int
i
;
unsigned
int
sample_index
=
index
>>
c
->
phase_shift
;
FELEM2
val
=
0
;
FELEM
*
filter
=
((
FELEM
*
)
c
->
filter_bank
)
+
c
->
filter_length
*
(
index
&
c
->
phase_mask
);
FELEM2
v2
=
0
;
for
(
i
=
0
;
i
<
c
->
filter_length
;
i
++
)
{
val
+=
src
[
sample_index
+
i
]
*
(
FELEM2
)
filter
[
i
];
v2
+=
src
[
sample_index
+
i
]
*
(
FELEM2
)
filter
[
i
+
c
->
filter_length
];
}
val
+=
(
v2
-
val
)
*
(
FELEML
)
frac
/
c
->
src_incr
;
OUT
(
dst
[
dst_index
],
val
);
}
static
void
SET_TYPE
(
resample_one
)(
ResampleContext
*
c
,
void
*
dst0
,
int
dst_index
,
const
void
*
src0
,
unsigned
int
index
,
int
frac
)
...
...
@@ -73,17 +94,8 @@ static void SET_TYPE(resample_one)(ResampleContext *c,
FELEM
*
filter
=
((
FELEM
*
)
c
->
filter_bank
)
+
c
->
filter_length
*
(
index
&
c
->
phase_mask
);
if
(
c
->
linear
)
{
FELEM2
v2
=
0
;
for
(
i
=
0
;
i
<
c
->
filter_length
;
i
++
)
{
val
+=
src
[
sample_index
+
i
]
*
(
FELEM2
)
filter
[
i
];
v2
+=
src
[
sample_index
+
i
]
*
(
FELEM2
)
filter
[
i
+
c
->
filter_length
];
}
val
+=
(
v2
-
val
)
*
(
FELEML
)
frac
/
c
->
src_incr
;
}
else
{
for
(
i
=
0
;
i
<
c
->
filter_length
;
i
++
)
val
+=
src
[
sample_index
+
i
]
*
(
FELEM2
)
filter
[
i
];
}
for
(
i
=
0
;
i
<
c
->
filter_length
;
i
++
)
val
+=
src
[
sample_index
+
i
]
*
(
FELEM2
)
filter
[
i
];
OUT
(
dst
[
dst_index
],
val
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment