Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
64db5a1a
Commit
64db5a1a
authored
Nov 16, 2011
by
Clément Bœsch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
swr: drop 'AV' prefix from ResampleContext.
This type/struct is not part of the public API.
parent
fc6351d0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
14 deletions
+14
-14
resample.c
libswresample/resample.c
+8
-8
swresample_internal.h
libswresample/swresample_internal.h
+6
-6
No files found.
libswresample/resample.c
View file @
64db5a1a
...
@@ -56,7 +56,7 @@
...
@@ -56,7 +56,7 @@
#endif
#endif
typedef
struct
AVResampleContext
{
typedef
struct
ResampleContext
{
const
AVClass
*
av_class
;
const
AVClass
*
av_class
;
FELEM
*
filter_bank
;
FELEM
*
filter_bank
;
int
filter_length
;
int
filter_length
;
...
@@ -70,7 +70,7 @@ typedef struct AVResampleContext{
...
@@ -70,7 +70,7 @@ typedef struct AVResampleContext{
int
phase_mask
;
int
phase_mask
;
int
linear
;
int
linear
;
double
factor
;
double
factor
;
}
AV
ResampleContext
;
}
ResampleContext
;
/**
/**
* 0th order modified bessel function of the first kind.
* 0th order modified bessel function of the first kind.
...
@@ -199,13 +199,13 @@ static int build_filter(FELEM *filter, double factor, int tap_count, int phase_c
...
@@ -199,13 +199,13 @@ static int build_filter(FELEM *filter, double factor, int tap_count, int phase_c
return
0
;
return
0
;
}
}
AVResampleContext
*
swr_resample_init
(
AV
ResampleContext
*
c
,
int
out_rate
,
int
in_rate
,
int
filter_size
,
int
phase_shift
,
int
linear
,
double
cutoff
){
ResampleContext
*
swr_resample_init
(
ResampleContext
*
c
,
int
out_rate
,
int
in_rate
,
int
filter_size
,
int
phase_shift
,
int
linear
,
double
cutoff
){
double
factor
=
FFMIN
(
out_rate
*
cutoff
/
in_rate
,
1
.
0
);
double
factor
=
FFMIN
(
out_rate
*
cutoff
/
in_rate
,
1
.
0
);
int
phase_count
=
1
<<
phase_shift
;
int
phase_count
=
1
<<
phase_shift
;
if
(
!
c
||
c
->
phase_shift
!=
phase_shift
||
c
->
linear
!=
linear
||
c
->
factor
!=
factor
if
(
!
c
||
c
->
phase_shift
!=
phase_shift
||
c
->
linear
!=
linear
||
c
->
factor
!=
factor
||
c
->
filter_length
!=
FFMAX
((
int
)
ceil
(
filter_size
/
factor
),
1
))
{
||
c
->
filter_length
!=
FFMAX
((
int
)
ceil
(
filter_size
/
factor
),
1
))
{
c
=
av_mallocz
(
sizeof
(
AVResampleContext
));
c
=
av_mallocz
(
sizeof
(
*
c
));
if
(
!
c
)
if
(
!
c
)
return
NULL
;
return
NULL
;
...
@@ -238,7 +238,7 @@ error:
...
@@ -238,7 +238,7 @@ error:
return
NULL
;
return
NULL
;
}
}
void
swr_resample_free
(
AV
ResampleContext
**
c
){
void
swr_resample_free
(
ResampleContext
**
c
){
if
(
!*
c
)
if
(
!*
c
)
return
;
return
;
av_freep
(
&
(
*
c
)
->
filter_bank
);
av_freep
(
&
(
*
c
)
->
filter_bank
);
...
@@ -246,13 +246,13 @@ void swr_resample_free(AVResampleContext **c){
...
@@ -246,13 +246,13 @@ void swr_resample_free(AVResampleContext **c){
}
}
void
swr_compensate
(
struct
SwrContext
*
s
,
int
sample_delta
,
int
compensation_distance
){
void
swr_compensate
(
struct
SwrContext
*
s
,
int
sample_delta
,
int
compensation_distance
){
AV
ResampleContext
*
c
=
s
->
resample
;
ResampleContext
*
c
=
s
->
resample
;
// sample_delta += (c->ideal_dst_incr - c->dst_incr)*(int64_t)c->compensation_distance / c->ideal_dst_incr;
// sample_delta += (c->ideal_dst_incr - c->dst_incr)*(int64_t)c->compensation_distance / c->ideal_dst_incr;
c
->
compensation_distance
=
compensation_distance
;
c
->
compensation_distance
=
compensation_distance
;
c
->
dst_incr
=
c
->
ideal_dst_incr
-
c
->
ideal_dst_incr
*
(
int64_t
)
sample_delta
/
compensation_distance
;
c
->
dst_incr
=
c
->
ideal_dst_incr
-
c
->
ideal_dst_incr
*
(
int64_t
)
sample_delta
/
compensation_distance
;
}
}
int
swr_resample
(
AV
ResampleContext
*
c
,
short
*
dst
,
const
short
*
src
,
int
*
consumed
,
int
src_size
,
int
dst_size
,
int
update_ctx
){
int
swr_resample
(
ResampleContext
*
c
,
short
*
dst
,
const
short
*
src
,
int
*
consumed
,
int
src_size
,
int
dst_size
,
int
update_ctx
){
int
dst_index
,
i
;
int
dst_index
,
i
;
int
index
=
c
->
index
;
int
index
=
c
->
index
;
int
frac
=
c
->
frac
;
int
frac
=
c
->
frac
;
...
@@ -341,7 +341,7 @@ av_log(NULL, AV_LOG_DEBUG, "%d %d %d\n", c->dst_incr, c->ideal_dst_incr, c->comp
...
@@ -341,7 +341,7 @@ av_log(NULL, AV_LOG_DEBUG, "%d %d %d\n", c->dst_incr, c->ideal_dst_incr, c->comp
return
dst_index
;
return
dst_index
;
}
}
int
swr_multiple_resample
(
AV
ResampleContext
*
c
,
AudioData
*
dst
,
int
dst_size
,
AudioData
*
src
,
int
src_size
,
int
*
consumed
){
int
swr_multiple_resample
(
ResampleContext
*
c
,
AudioData
*
dst
,
int
dst_size
,
AudioData
*
src
,
int
src_size
,
int
*
consumed
){
int
i
,
ret
=
-
1
;
int
i
,
ret
=
-
1
;
for
(
i
=
0
;
i
<
dst
->
ch_count
;
i
++
){
for
(
i
=
0
;
i
<
dst
->
ch_count
;
i
++
){
...
...
libswresample/swresample_internal.h
View file @
64db5a1a
...
@@ -61,7 +61,7 @@ typedef struct SwrContext { //FIXME find unused fields
...
@@ -61,7 +61,7 @@ typedef struct SwrContext { //FIXME find unused fields
struct
AudioConvert
*
in_convert
;
struct
AudioConvert
*
in_convert
;
struct
AudioConvert
*
out_convert
;
struct
AudioConvert
*
out_convert
;
struct
AudioConvert
*
full_convert
;
struct
AudioConvert
*
full_convert
;
struct
AV
ResampleContext
*
resample
;
struct
ResampleContext
*
resample
;
float
matrix
[
SWR_CH_MAX
][
SWR_CH_MAX
];
float
matrix
[
SWR_CH_MAX
][
SWR_CH_MAX
];
int32_t
matrix32
[
SWR_CH_MAX
][
SWR_CH_MAX
];
int32_t
matrix32
[
SWR_CH_MAX
][
SWR_CH_MAX
];
...
@@ -70,11 +70,11 @@ typedef struct SwrContext { //FIXME find unused fields
...
@@ -70,11 +70,11 @@ typedef struct SwrContext { //FIXME find unused fields
//TODO callbacks for asm optims
//TODO callbacks for asm optims
}
SwrContext
;
}
SwrContext
;
struct
AVResampleContext
*
swr_resample_init
(
struct
AV
ResampleContext
*
,
int
out_rate
,
int
in_rate
,
int
filter_size
,
int
phase_shift
,
int
linear
,
double
cutoff
);
struct
ResampleContext
*
swr_resample_init
(
struct
ResampleContext
*
,
int
out_rate
,
int
in_rate
,
int
filter_size
,
int
phase_shift
,
int
linear
,
double
cutoff
);
void
swr_resample_free
(
struct
AV
ResampleContext
**
c
);
void
swr_resample_free
(
struct
ResampleContext
**
c
);
int
swr_multiple_resample
(
struct
AV
ResampleContext
*
c
,
AudioData
*
dst
,
int
dst_size
,
AudioData
*
src
,
int
src_size
,
int
*
consumed
);
int
swr_multiple_resample
(
struct
ResampleContext
*
c
,
AudioData
*
dst
,
int
dst_size
,
AudioData
*
src
,
int
src_size
,
int
*
consumed
);
void
swr_resample_compensate
(
struct
AV
ResampleContext
*
c
,
int
sample_delta
,
int
compensation_distance
);
void
swr_resample_compensate
(
struct
ResampleContext
*
c
,
int
sample_delta
,
int
compensation_distance
);
int
swr_resample
(
struct
AV
ResampleContext
*
c
,
short
*
dst
,
const
short
*
src
,
int
*
consumed
,
int
src_size
,
int
dst_size
,
int
update_ctx
);
int
swr_resample
(
struct
ResampleContext
*
c
,
short
*
dst
,
const
short
*
src
,
int
*
consumed
,
int
src_size
,
int
dst_size
,
int
update_ctx
);
int
swr_rematrix_init
(
SwrContext
*
s
);
int
swr_rematrix_init
(
SwrContext
*
s
);
int
swr_rematrix
(
SwrContext
*
s
,
AudioData
*
out
,
AudioData
*
in
,
int
len
,
int
mustcopy
);
int
swr_rematrix
(
SwrContext
*
s
,
AudioData
*
out
,
AudioData
*
in
,
int
len
,
int
mustcopy
);
...
...
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