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
1c3ae1ab
Commit
1c3ae1ab
authored
Nov 16, 2008
by
Reynaldo H. Verdejo Pinochet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cosmetics
Originally committed as revision 15838 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
f29289ee
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
45 deletions
+54
-45
qcelpdec.c
libavcodec/qcelpdec.c
+54
-45
No files found.
libavcodec/qcelpdec.c
View file @
1c3ae1ab
...
...
@@ -18,6 +18,7 @@
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* @file qcelpdec.c
* QCELP decoder
...
...
@@ -38,15 +39,13 @@
#undef NDEBUG
#include <assert.h>
static
void
weighted_vector_sumf
(
float
*
out
,
const
float
*
in_a
,
const
float
*
in_b
,
float
weight_coeff_a
,
float
weight_coeff_b
,
int
length
)
{
int
i
;
static
void
weighted_vector_sumf
(
float
*
out
,
const
float
*
in_a
,
const
float
*
in_b
,
float
weight_coeff_a
,
float
weight_coeff_b
,
int
length
)
{
int
i
;
for
(
i
=
0
;
i
<
length
;
i
++
)
for
(
i
=
0
;
i
<
length
;
i
++
)
out
[
i
]
=
weight_coeff_a
*
in_a
[
i
]
+
weight_coeff_b
*
in_b
[
i
];
}
...
...
@@ -205,25 +204,28 @@ static void apply_gain_ctrl(float *v_out,
*
* @return filter output vector
*/
static
const
float
*
do_pitchfilter
(
float
memory
[
303
],
const
float
v_in
[
160
],
const
float
gain
[
4
],
const
uint8_t
*
lag
,
const
uint8_t
pfrac
[
4
])
{
static
const
float
*
do_pitchfilter
(
float
memory
[
303
],
const
float
v_in
[
160
],
const
float
gain
[
4
],
const
uint8_t
*
lag
,
const
uint8_t
pfrac
[
4
])
{
int
i
,
j
;
float
*
v_lag
,
*
v_out
;
const
float
*
v_len
;
v_out
=
memory
+
143
;
// Output vector starts at memory[143].
for
(
i
=
0
;
i
<
4
;
i
++
)
if
(
gain
[
i
])
{
for
(
i
=
0
;
i
<
4
;
i
++
)
{
if
(
gain
[
i
])
{
v_lag
=
memory
+
143
+
40
*
i
-
lag
[
i
];
for
(
v_len
=
v_in
+
40
;
v_in
<
v_len
;
v_in
++
)
{
if
(
pfrac
[
i
])
{
// If it is a fractional lag...
for
(
j
=
0
,
*
v_out
=
0
.;
j
<
4
;
j
++
)
for
(
v_len
=
v_in
+
40
;
v_in
<
v_len
;
v_in
++
)
{
if
(
pfrac
[
i
])
// If it is a fractional lag...
{
for
(
j
=
0
,
*
v_out
=
0
.;
j
<
4
;
j
++
)
*
v_out
+=
qcelp_hammsinc_table
[
j
]
*
(
v_lag
[
j
-
4
]
+
v_lag
[
3
-
j
]);
}
else
}
else
*
v_out
=
*
v_lag
;
*
v_out
=
*
v_in
+
gain
[
i
]
*
*
v_out
;
...
...
@@ -231,11 +233,13 @@ static const float *do_pitchfilter(float memory[303],
v_lag
++
;
v_out
++
;
}
}
else
{
}
else
{
memcpy
(
v_out
,
v_in
,
40
*
sizeof
(
float
));
v_in
+=
40
;
v_out
+=
40
;
}
}
memmove
(
memory
,
memory
+
160
,
143
*
sizeof
(
float
));
return
memory
+
143
;
...
...
@@ -252,47 +256,52 @@ static const float *do_pitchfilter(float memory[303],
* @param lpc float vector for the resulting LPC
* @param subframe_num frame number in decoded stream
*/
void
interpolate_lpc
(
QCELPContext
*
q
,
const
float
*
curr_lspf
,
float
*
lpc
,
const
int
subframe_num
)
{
void
interpolate_lpc
(
QCELPContext
*
q
,
const
float
*
curr_lspf
,
float
*
lpc
,
const
int
subframe_num
)
{
float
interpolated_lspf
[
10
];
float
weight
;
if
(
q
->
framerate
>=
RATE_QUARTER
)
{
if
(
q
->
framerate
>=
RATE_QUARTER
)
weight
=
0
.
25
*
(
subframe_num
+
1
);
}
else
if
(
q
->
framerate
==
RATE_OCTAVE
&&
!
subframe_num
)
{
else
if
(
q
->
framerate
==
RATE_OCTAVE
&&
!
subframe_num
)
weight
=
0
.
625
;
}
else
{
else
weight
=
1
.
0
;
}
if
(
weight
!=
1
.
0
)
{
weighted_vector_sumf
(
interpolated_lspf
,
curr_lspf
,
q
->
prev_lspf
,
weight
,
1
.
0
-
weight
,
10
);
if
(
weight
!=
1
.
0
)
{
weighted_vector_sumf
(
interpolated_lspf
,
curr_lspf
,
q
->
prev_lspf
,
weight
,
1
.
0
-
weight
,
10
);
qcelp_lspf2lpc
(
interpolated_lspf
,
lpc
);
}
else
if
(
q
->
framerate
>=
RATE_QUARTER
||
(
q
->
framerate
==
I_F_Q
&&
!
subframe_num
))
}
else
if
(
q
->
framerate
>=
RATE_QUARTER
||
(
q
->
framerate
==
I_F_Q
&&
!
subframe_num
))
qcelp_lspf2lpc
(
curr_lspf
,
lpc
);
}
static
int
buf_size2framerate
(
const
int
buf_size
)
{
switch
(
buf_size
)
{
case
35
:
return
RATE_FULL
;
case
17
:
return
RATE_HALF
;
case
8
:
return
RATE_QUARTER
;
case
4
:
return
RATE_OCTAVE
;
case
1
:
return
SILENCE
;
static
int
buf_size2framerate
(
const
int
buf_size
)
{
switch
(
buf_size
)
{
case
35
:
return
RATE_FULL
;
case
17
:
return
RATE_HALF
;
case
8
:
return
RATE_QUARTER
;
case
4
:
return
RATE_OCTAVE
;
case
1
:
return
SILENCE
;
}
return
-
1
;
}
static
void
warn_insufficient_frame_quality
(
AVCodecContext
*
avctx
,
const
char
*
message
)
{
av_log
(
avctx
,
AV_LOG_WARNING
,
"Frame #%d, IFQ: %s
\n
"
,
avctx
->
frame_number
,
message
);
const
char
*
message
)
{
av_log
(
avctx
,
AV_LOG_WARNING
,
"Frame #%d, IFQ: %s
\n
"
,
avctx
->
frame_number
,
message
);
}
AVCodec
qcelp_decoder
=
...
...
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