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
f645710c
Commit
f645710c
authored
Aug 11, 2012
by
Mans Rullgard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
g723.1: make postfilter write directly to output buffer
Signed-off-by:
Mans Rullgard
<
mans@mansr.com
>
parent
19532643
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
11 deletions
+11
-11
g723_1.c
libavcodec/g723_1.c
+11
-11
No files found.
libavcodec/g723_1.c
View file @
f645710c
...
...
@@ -922,9 +922,11 @@ static void gain_scale(G723_1_Context *p, int16_t * buf, int energy)
*
* @param p the context
* @param lpc quantized lpc coefficients
* @param buf output buffer
* @param buf input buffer
* @param dst output buffer
*/
static
void
formant_postfilter
(
G723_1_Context
*
p
,
int16_t
*
lpc
,
int16_t
*
buf
)
static
void
formant_postfilter
(
G723_1_Context
*
p
,
int16_t
*
lpc
,
int16_t
*
buf
,
int16_t
*
dst
)
{
int16_t
filter_coef
[
2
][
LPC_ORDER
];
int
filter_signal
[
LPC_ORDER
+
FRAME_LEN
],
*
signal_ptr
;
...
...
@@ -952,18 +954,16 @@ static void formant_postfilter(G723_1_Context *p, int16_t *lpc, int16_t *buf)
buf
+=
LPC_ORDER
;
signal_ptr
=
filter_signal
+
LPC_ORDER
;
for
(
i
=
0
;
i
<
SUBFRAMES
;
i
++
)
{
int16_t
temp_vector
[
SUBFRAME_LEN
];
int
temp
;
int
auto_corr
[
2
];
int
scale
,
energy
;
/* Normalize */
scale
=
scale_vector
(
temp_vector
,
buf
,
SUBFRAME_LEN
);
scale
=
scale_vector
(
dst
,
buf
,
SUBFRAME_LEN
);
/* Compute auto correlation coefficients */
auto_corr
[
0
]
=
dot_product
(
temp_vector
,
temp_vector
+
1
,
SUBFRAME_LEN
-
1
);
auto_corr
[
1
]
=
dot_product
(
temp_vector
,
temp_vector
,
SUBFRAME_LEN
);
auto_corr
[
0
]
=
dot_product
(
dst
,
dst
+
1
,
SUBFRAME_LEN
-
1
);
auto_corr
[
1
]
=
dot_product
(
dst
,
dst
,
SUBFRAME_LEN
);
/* Compute reflection coefficient */
temp
=
auto_corr
[
1
]
>>
16
;
...
...
@@ -975,7 +975,7 @@ static void formant_postfilter(G723_1_Context *p, int16_t *lpc, int16_t *buf)
/* Compensation filter */
for
(
j
=
0
;
j
<
SUBFRAME_LEN
;
j
++
)
{
buf
[
j
]
=
av_sat_dadd32
(
signal_ptr
[
j
],
dst
[
j
]
=
av_sat_dadd32
(
signal_ptr
[
j
],
(
signal_ptr
[
j
-
1
]
>>
16
)
*
temp
)
>>
16
;
}
...
...
@@ -986,10 +986,11 @@ static void formant_postfilter(G723_1_Context *p, int16_t *lpc, int16_t *buf)
}
else
energy
=
auto_corr
[
1
]
>>
temp
;
gain_scale
(
p
,
buf
,
energy
);
gain_scale
(
p
,
dst
,
energy
);
buf
+=
SUBFRAME_LEN
;
signal_ptr
+=
SUBFRAME_LEN
;
dst
+=
SUBFRAME_LEN
;
}
}
...
...
@@ -1136,8 +1137,7 @@ static int g723_1_decode_frame(AVCodecContext *avctx, void *data,
memcpy
(
p
->
synth_mem
,
p
->
audio
+
FRAME_LEN
,
LPC_ORDER
*
sizeof
(
*
p
->
audio
));
if
(
p
->
postfilter
)
{
formant_postfilter
(
p
,
lpc
,
p
->
audio
);
memcpy
(
p
->
frame
.
data
[
0
],
p
->
audio
+
LPC_ORDER
,
FRAME_LEN
*
2
);
formant_postfilter
(
p
,
lpc
,
p
->
audio
,
out
);
}
else
{
// if output is not postfiltered it should be scaled by 2
for
(
i
=
0
;
i
<
FRAME_LEN
;
i
++
)
out
[
i
]
=
av_clip_int16
(
p
->
audio
[
LPC_ORDER
+
i
]
<<
1
);
...
...
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