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
c4deb90c
Commit
c4deb90c
authored
Nov 16, 2011
by
Clément Bœsch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
swr: use "swri_" prefix instead of "swr_" for the private API.
parent
64db5a1a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
22 deletions
+22
-22
rematrix.c
libswresample/rematrix.c
+2
-2
resample.c
libswresample/resample.c
+5
-5
swresample.c
libswresample/swresample.c
+8
-8
swresample_internal.h
libswresample/swresample_internal.h
+7
-7
No files found.
libswresample/rematrix.c
View file @
c4deb90c
...
...
@@ -84,7 +84,7 @@ static int sane_layout(int64_t layout){
return
1
;
}
int
swr_rematrix_init
(
SwrContext
*
s
){
int
swr
i
_rematrix_init
(
SwrContext
*
s
){
int
i
,
j
,
out_i
;
double
matrix
[
64
][
64
]
=
{{
0
}};
int64_t
unaccounted
=
s
->
in_ch_layout
&
~
s
->
out_ch_layout
;
...
...
@@ -239,7 +239,7 @@ int swr_rematrix_init(SwrContext *s){
return
0
;
}
int
swr_rematrix
(
SwrContext
*
s
,
AudioData
*
out
,
AudioData
*
in
,
int
len
,
int
mustcopy
){
int
swr
i
_rematrix
(
SwrContext
*
s
,
AudioData
*
out
,
AudioData
*
in
,
int
len
,
int
mustcopy
){
int
out_i
,
in_i
,
i
,
j
;
av_assert0
(
out
->
ch_count
==
av_get_channel_layout_nb_channels
(
s
->
out_ch_layout
));
...
...
libswresample/resample.c
View file @
c4deb90c
...
...
@@ -199,7 +199,7 @@ static int build_filter(FELEM *filter, double factor, int tap_count, int phase_c
return
0
;
}
ResampleContext
*
swr_resample_init
(
ResampleContext
*
c
,
int
out_rate
,
int
in_rate
,
int
filter_size
,
int
phase_shift
,
int
linear
,
double
cutoff
){
ResampleContext
*
swr
i
_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
);
int
phase_count
=
1
<<
phase_shift
;
...
...
@@ -238,7 +238,7 @@ error:
return
NULL
;
}
void
swr_resample_free
(
ResampleContext
**
c
){
void
swr
i
_resample_free
(
ResampleContext
**
c
){
if
(
!*
c
)
return
;
av_freep
(
&
(
*
c
)
->
filter_bank
);
...
...
@@ -252,7 +252,7 @@ void swr_compensate(struct SwrContext *s, int sample_delta, int compensation_dis
c
->
dst_incr
=
c
->
ideal_dst_incr
-
c
->
ideal_dst_incr
*
(
int64_t
)
sample_delta
/
compensation_distance
;
}
int
swr_resample
(
ResampleContext
*
c
,
short
*
dst
,
const
short
*
src
,
int
*
consumed
,
int
src_size
,
int
dst_size
,
int
update_ctx
){
int
swr
i
_resample
(
ResampleContext
*
c
,
short
*
dst
,
const
short
*
src
,
int
*
consumed
,
int
src_size
,
int
dst_size
,
int
update_ctx
){
int
dst_index
,
i
;
int
index
=
c
->
index
;
int
frac
=
c
->
frac
;
...
...
@@ -341,11 +341,11 @@ av_log(NULL, AV_LOG_DEBUG, "%d %d %d\n", c->dst_incr, c->ideal_dst_incr, c->comp
return
dst_index
;
}
int
swr_multiple_resample
(
ResampleContext
*
c
,
AudioData
*
dst
,
int
dst_size
,
AudioData
*
src
,
int
src_size
,
int
*
consumed
){
int
swr
i
_multiple_resample
(
ResampleContext
*
c
,
AudioData
*
dst
,
int
dst_size
,
AudioData
*
src
,
int
src_size
,
int
*
consumed
){
int
i
,
ret
=
-
1
;
for
(
i
=
0
;
i
<
dst
->
ch_count
;
i
++
){
ret
=
swr_resample
(
c
,
(
short
*
)
dst
->
ch
[
i
],
(
const
short
*
)
src
->
ch
[
i
],
consumed
,
src_size
,
dst_size
,
i
+
1
==
dst
->
ch_count
);
ret
=
swr
i
_resample
(
c
,
(
short
*
)
dst
->
ch
[
i
],
(
const
short
*
)
src
->
ch
[
i
],
consumed
,
src_size
,
dst_size
,
i
+
1
==
dst
->
ch_count
);
}
return
ret
;
...
...
libswresample/swresample.c
View file @
c4deb90c
...
...
@@ -122,7 +122,7 @@ void swr_free(SwrContext **ss){
swri_audio_convert_free
(
&
s
->
in_convert
);
swri_audio_convert_free
(
&
s
->
out_convert
);
swri_audio_convert_free
(
&
s
->
full_convert
);
swr_resample_free
(
&
s
->
resample
);
swr
i
_resample_free
(
&
s
->
resample
);
}
av_freep
(
ss
);
...
...
@@ -168,9 +168,9 @@ int swr_init(SwrContext *s){
if
(
s
->
out_sample_rate
!=
s
->
in_sample_rate
||
(
s
->
flags
&
SWR_FLAG_RESAMPLE
)){
s
->
resample
=
swr_resample_init
(
s
->
resample
,
s
->
out_sample_rate
,
s
->
in_sample_rate
,
16
,
10
,
0
,
0
.
8
);
s
->
resample
=
swr
i
_resample_init
(
s
->
resample
,
s
->
out_sample_rate
,
s
->
in_sample_rate
,
16
,
10
,
0
,
0
.
8
);
}
else
swr_resample_free
(
&
s
->
resample
);
swr
i
_resample_free
(
&
s
->
resample
);
if
(
s
->
int_sample_fmt
!=
AV_SAMPLE_FMT_S16
&&
s
->
resample
){
av_log
(
s
,
AV_LOG_ERROR
,
"Resampling only supported with internal s16 currently
\n
"
);
//FIXME
return
-
1
;
...
...
@@ -238,7 +238,7 @@ av_assert0(s->out.ch_count);
s
->
in_buffer
.
planar
=
s
->
postin
.
planar
=
s
->
midbuf
.
planar
=
s
->
preout
.
planar
=
1
;
if
(
s
->
rematrix
&&
swr_rematrix_init
(
s
)
<
0
)
if
(
s
->
rematrix
&&
swr
i
_rematrix_init
(
s
)
<
0
)
return
-
1
;
return
0
;
...
...
@@ -392,10 +392,10 @@ int swr_convert(struct SwrContext *s, uint8_t *out_arg[SWR_CH_MAX], int out_coun
if
(
postin
!=
midbuf
)
out_count
=
resample
(
s
,
midbuf
,
out_count
,
postin
,
in_count
);
if
(
midbuf
!=
preout
)
swr_rematrix
(
s
,
preout
,
midbuf
,
out_count
,
preout
==
out
);
swr
i
_rematrix
(
s
,
preout
,
midbuf
,
out_count
,
preout
==
out
);
}
else
{
if
(
postin
!=
midbuf
)
swr_rematrix
(
s
,
midbuf
,
postin
,
in_count
,
midbuf
==
out
);
swr
i
_rematrix
(
s
,
midbuf
,
postin
,
in_count
,
midbuf
==
out
);
if
(
midbuf
!=
preout
)
out_count
=
resample
(
s
,
preout
,
out_count
,
midbuf
,
in_count
);
}
...
...
@@ -439,7 +439,7 @@ static int resample(SwrContext *s, AudioData *out_param, int out_count,
int
ret
,
size
,
consumed
;
if
(
!
s
->
resample_in_constraint
&&
s
->
in_buffer_count
){
buf_set
(
&
tmp
,
&
s
->
in_buffer
,
s
->
in_buffer_index
);
ret
=
swr_multiple_resample
(
s
->
resample
,
&
out
,
out_count
,
&
tmp
,
s
->
in_buffer_count
,
&
consumed
);
ret
=
swr
i
_multiple_resample
(
s
->
resample
,
&
out
,
out_count
,
&
tmp
,
s
->
in_buffer_count
,
&
consumed
);
out_count
-=
ret
;
ret_sum
+=
ret
;
buf_set
(
&
out
,
&
out
,
ret
);
...
...
@@ -459,7 +459,7 @@ static int resample(SwrContext *s, AudioData *out_param, int out_count,
if
(
in_count
&&
!
s
->
in_buffer_count
){
s
->
in_buffer_index
=
0
;
ret
=
swr_multiple_resample
(
s
->
resample
,
&
out
,
out_count
,
&
in
,
in_count
,
&
consumed
);
ret
=
swr
i
_multiple_resample
(
s
->
resample
,
&
out
,
out_count
,
&
in
,
in_count
,
&
consumed
);
out_count
-=
ret
;
ret_sum
+=
ret
;
buf_set
(
&
out
,
&
out
,
ret
);
...
...
libswresample/swresample_internal.h
View file @
c4deb90c
...
...
@@ -70,12 +70,12 @@ typedef struct SwrContext { //FIXME find unused fields
//TODO callbacks for asm optims
}
SwrContext
;
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
ResampleContext
**
c
);
int
swr_multiple_resample
(
struct
ResampleContext
*
c
,
AudioData
*
dst
,
int
dst_size
,
AudioData
*
src
,
int
src_size
,
int
*
consumed
);
void
swr_resample_compensate
(
struct
ResampleContext
*
c
,
int
sample_delta
,
int
compensation_distance
);
int
swr_resample
(
struct
ResampleContext
*
c
,
short
*
dst
,
const
short
*
src
,
int
*
consumed
,
int
src_size
,
int
dst_size
,
int
update_ctx
);
struct
ResampleContext
*
swr
i
_resample_init
(
struct
ResampleContext
*
,
int
out_rate
,
int
in_rate
,
int
filter_size
,
int
phase_shift
,
int
linear
,
double
cutoff
);
void
swr
i
_resample_free
(
struct
ResampleContext
**
c
);
int
swr
i
_multiple_resample
(
struct
ResampleContext
*
c
,
AudioData
*
dst
,
int
dst_size
,
AudioData
*
src
,
int
src_size
,
int
*
consumed
);
void
swr
i
_resample_compensate
(
struct
ResampleContext
*
c
,
int
sample_delta
,
int
compensation_distance
);
int
swr
i
_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
(
SwrContext
*
s
,
AudioData
*
out
,
AudioData
*
in
,
int
len
,
int
mustcopy
);
int
swr
i
_rematrix_init
(
SwrContext
*
s
);
int
swr
i
_rematrix
(
SwrContext
*
s
,
AudioData
*
out
,
AudioData
*
in
,
int
len
,
int
mustcopy
);
#endif
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