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
4010d724
Commit
4010d724
authored
Apr 26, 2012
by
Justin Ruggles
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavr: use 8.8 instead of 10.6 as the 16-bit fixed-point mixing coeff type
parent
f1ffb01e
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
18 additions
and
15 deletions
+18
-15
APIchanges
doc/APIchanges
+3
-0
audio_mix.c
libavresample/audio_mix.c
+5
-5
audio_mix.h
libavresample/audio_mix.h
+1
-1
audio_mix_matrix.c
libavresample/audio_mix_matrix.c
+5
-5
avresample.h
libavresample/avresample.h
+1
-1
options.c
libavresample/options.c
+2
-2
version.h
libavresample/version.h
+1
-1
No files found.
doc/APIchanges
View file @
4010d724
...
...
@@ -13,6 +13,9 @@ libavutil: 2011-04-18
API changes, most recent first:
2012-xx-xx - xxxxxxx - lavr 0.0.1
Change AV_MIX_COEFF_TYPE_Q6 to AV_MIX_COEFF_TYPE_Q8.
2012-04-25 - 3527a73 - lavu 51.29.0 - cpu.h
Add av_parse_cpu_flags()
...
...
libavresample/audio_mix.c
View file @
4010d724
...
...
@@ -27,7 +27,7 @@
#include "audio_data.h"
#include "audio_mix.h"
static
const
char
*
coeff_type_names
[]
=
{
"q
6
"
,
"q15"
,
"flt"
};
static
const
char
*
coeff_type_names
[]
=
{
"q
8
"
,
"q15"
,
"flt"
};
void
ff_audio_mix_set_func
(
AudioMix
*
am
,
enum
AVSampleFormat
fmt
,
enum
AVMixCoeffType
coeff_type
,
int
in_channels
,
...
...
@@ -89,7 +89,7 @@ static void MIX_FUNC_NAME(fmt, cfmt)(stype **samples, ctype **matrix, \
MIX_FUNC_GENERIC
(
FLTP
,
FLT
,
float
,
float
,
float
,
sum
)
MIX_FUNC_GENERIC
(
S16P
,
FLT
,
int16_t
,
float
,
float
,
av_clip_int16
(
lrintf
(
sum
)))
MIX_FUNC_GENERIC
(
S16P
,
Q15
,
int16_t
,
int32_t
,
int64_t
,
av_clip_int16
(
sum
>>
15
))
MIX_FUNC_GENERIC
(
S16P
,
Q
6
,
int16_t
,
int16_t
,
int32_t
,
av_clip_int16
(
sum
>>
6
))
MIX_FUNC_GENERIC
(
S16P
,
Q
8
,
int16_t
,
int16_t
,
int32_t
,
av_clip_int16
(
sum
>>
8
))
/* TODO: templatize the channel-specific C functions */
...
...
@@ -221,8 +221,8 @@ static int mix_function_init(AudioMix *am)
ff_audio_mix_set_func
(
am
,
AV_SAMPLE_FMT_S16P
,
AV_MIX_COEFF_TYPE_Q15
,
0
,
0
,
1
,
1
,
"C"
,
MIX_FUNC_NAME
(
S16P
,
Q15
));
ff_audio_mix_set_func
(
am
,
AV_SAMPLE_FMT_S16P
,
AV_MIX_COEFF_TYPE_Q
6
,
0
,
0
,
1
,
1
,
"C"
,
MIX_FUNC_NAME
(
S16P
,
Q
6
));
ff_audio_mix_set_func
(
am
,
AV_SAMPLE_FMT_S16P
,
AV_MIX_COEFF_TYPE_Q
8
,
0
,
0
,
1
,
1
,
"C"
,
MIX_FUNC_NAME
(
S16P
,
Q
8
));
/* channel-specific C versions */
...
...
@@ -320,7 +320,7 @@ void ff_audio_mix_close(AudioMix *am)
av_free
(
am
->
matrix
[
0
]);
am
->
matrix
=
NULL
;
}
memset
(
am
->
matrix_q
6
,
0
,
sizeof
(
am
->
matrix_q6
));
memset
(
am
->
matrix_q
8
,
0
,
sizeof
(
am
->
matrix_q8
));
memset
(
am
->
matrix_q15
,
0
,
sizeof
(
am
->
matrix_q15
));
memset
(
am
->
matrix_flt
,
0
,
sizeof
(
am
->
matrix_flt
));
}
...
...
libavresample/audio_mix.h
View file @
4010d724
...
...
@@ -47,7 +47,7 @@ typedef struct AudioMix {
mix_func
*
mix
;
mix_func
*
mix_generic
;
int16_t
*
matrix_q
6
[
AVRESAMPLE_MAX_CHANNELS
];
int16_t
*
matrix_q
8
[
AVRESAMPLE_MAX_CHANNELS
];
int32_t
*
matrix_q15
[
AVRESAMPLE_MAX_CHANNELS
];
float
*
matrix_flt
[
AVRESAMPLE_MAX_CHANNELS
];
void
**
matrix
;
...
...
libavresample/audio_mix_matrix.c
View file @
4010d724
...
...
@@ -257,14 +257,14 @@ int avresample_get_matrix(AVAudioResampleContext *avr, double *matrix,
}
switch
(
avr
->
mix_coeff_type
)
{
case
AV_MIX_COEFF_TYPE_Q
6
:
if
(
!
avr
->
am
->
matrix_q
6
[
0
])
{
case
AV_MIX_COEFF_TYPE_Q
8
:
if
(
!
avr
->
am
->
matrix_q
8
[
0
])
{
av_log
(
avr
,
AV_LOG_ERROR
,
"matrix is not set
\n
"
);
return
AVERROR
(
EINVAL
);
}
for
(
o
=
0
;
o
<
out_channels
;
o
++
)
for
(
i
=
0
;
i
<
in_channels
;
i
++
)
matrix
[
o
*
stride
+
i
]
=
avr
->
am
->
matrix_q
6
[
o
][
i
]
/
64
.
0
;
matrix
[
o
*
stride
+
i
]
=
avr
->
am
->
matrix_q
8
[
o
][
i
]
/
256
.
0
;
break
;
case
AV_MIX_COEFF_TYPE_Q15
:
if
(
!
avr
->
am
->
matrix_q15
[
0
])
{
...
...
@@ -325,8 +325,8 @@ int avresample_set_matrix(AVAudioResampleContext *avr, const double *matrix,
avr->am->matrix = (void **)avr->am->matrix_## type;
switch
(
avr
->
mix_coeff_type
)
{
case
AV_MIX_COEFF_TYPE_Q
6
:
CONVERT_MATRIX
(
q
6
,
av_clip_int16
(
lrint
(
64
.
0
*
v
)))
case
AV_MIX_COEFF_TYPE_Q
8
:
CONVERT_MATRIX
(
q
8
,
av_clip_int16
(
lrint
(
256
.
0
*
v
)))
break
;
case
AV_MIX_COEFF_TYPE_Q15
:
CONVERT_MATRIX
(
q15
,
av_clipl_int32
(
llrint
(
32768
.
0
*
v
)))
...
...
libavresample/avresample.h
View file @
4010d724
...
...
@@ -39,7 +39,7 @@ typedef struct AVAudioResampleContext AVAudioResampleContext;
/** Mixing Coefficient Types */
enum
AVMixCoeffType
{
AV_MIX_COEFF_TYPE_Q
6
,
/** 16-bit 10.6 fixed-point
*/
AV_MIX_COEFF_TYPE_Q
8
,
/** 16-bit 8.8 fixed-point
*/
AV_MIX_COEFF_TYPE_Q15
,
/** 32-bit 17.15 fixed-point */
AV_MIX_COEFF_TYPE_FLT
,
/** floating-point */
AV_MIX_COEFF_TYPE_NB
,
/** Number of coeff types. Not part of ABI */
...
...
libavresample/options.c
View file @
4010d724
...
...
@@ -40,8 +40,8 @@ static const AVOption options[] = {
{
"out_sample_fmt"
,
"Output Sample Format"
,
OFFSET
(
out_sample_fmt
),
AV_OPT_TYPE_INT
,
{
AV_SAMPLE_FMT_S16
},
AV_SAMPLE_FMT_U8
,
AV_SAMPLE_FMT_NB
-
1
,
PARAM
},
{
"out_sample_rate"
,
"Output Sample Rate"
,
OFFSET
(
out_sample_rate
),
AV_OPT_TYPE_INT
,
{
48000
},
1
,
INT_MAX
,
PARAM
},
{
"internal_sample_fmt"
,
"Internal Sample Format"
,
OFFSET
(
internal_sample_fmt
),
AV_OPT_TYPE_INT
,
{
AV_SAMPLE_FMT_FLTP
},
AV_SAMPLE_FMT_NONE
,
AV_SAMPLE_FMT_NB
-
1
,
PARAM
},
{
"mix_coeff_type"
,
"Mixing Coefficient Type"
,
OFFSET
(
mix_coeff_type
),
AV_OPT_TYPE_INT
,
{
AV_MIX_COEFF_TYPE_FLT
},
AV_MIX_COEFF_TYPE_Q
6
,
AV_MIX_COEFF_TYPE_NB
-
1
,
PARAM
,
"mix_coeff_type"
},
{
"q
6"
,
"16-bit 10.6 Fixed-Point"
,
0
,
AV_OPT_TYPE_CONST
,
{
AV_MIX_COEFF_TYPE_Q6
},
INT_MIN
,
INT_MAX
,
PARAM
,
"mix_coeff_type"
},
{
"mix_coeff_type"
,
"Mixing Coefficient Type"
,
OFFSET
(
mix_coeff_type
),
AV_OPT_TYPE_INT
,
{
AV_MIX_COEFF_TYPE_FLT
},
AV_MIX_COEFF_TYPE_Q
8
,
AV_MIX_COEFF_TYPE_NB
-
1
,
PARAM
,
"mix_coeff_type"
},
{
"q
8"
,
"16-bit 8.8 Fixed-Point"
,
0
,
AV_OPT_TYPE_CONST
,
{
AV_MIX_COEFF_TYPE_Q8
},
INT_MIN
,
INT_MAX
,
PARAM
,
"mix_coeff_type"
},
{
"q15"
,
"32-bit 17.15 Fixed-Point"
,
0
,
AV_OPT_TYPE_CONST
,
{
AV_MIX_COEFF_TYPE_Q15
},
INT_MIN
,
INT_MAX
,
PARAM
,
"mix_coeff_type"
},
{
"flt"
,
"Floating-Point"
,
0
,
AV_OPT_TYPE_CONST
,
{
AV_MIX_COEFF_TYPE_FLT
},
INT_MIN
,
INT_MAX
,
PARAM
,
"mix_coeff_type"
},
{
"center_mix_level"
,
"Center Mix Level"
,
OFFSET
(
center_mix_level
),
AV_OPT_TYPE_DOUBLE
,
{
M_SQRT1_2
},
-
32
.
0
,
32
.
0
,
PARAM
},
...
...
libavresample/version.h
View file @
4010d724
...
...
@@ -21,7 +21,7 @@
#define LIBAVRESAMPLE_VERSION_MAJOR 0
#define LIBAVRESAMPLE_VERSION_MINOR 0
#define LIBAVRESAMPLE_VERSION_MICRO
0
#define LIBAVRESAMPLE_VERSION_MICRO
1
#define LIBAVRESAMPLE_VERSION_INT AV_VERSION_INT(LIBAVRESAMPLE_VERSION_MAJOR, \
LIBAVRESAMPLE_VERSION_MINOR, \
...
...
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