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
f830d1b7
Commit
f830d1b7
authored
Jun 04, 2009
by
Vladimir Voroshilov
Committed by
Michael Niedermayer
Sep 24, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Interolate excitation signal
parent
0a333788
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
2 deletions
+22
-2
g729dec.c
libavcodec/g729dec.c
+22
-2
No files found.
libavcodec/g729dec.c
View file @
f830d1b7
...
...
@@ -95,6 +95,10 @@ typedef struct {
typedef
struct
{
DSPContext
dsp
;
/// past excitation signal buffer
int16_t
exc_base
[
2
*
SUBFRAME_SIZE
+
PITCH_DELAY_MAX
+
INTERPOL_LEN
];
int16_t
*
exc
;
///< start of past excitation data in buffer
int
pitch_delay_int_prev
;
///< integer part of previous subframe's pitch delay (4.1.3)
/// (2.13) LSP quantizer outputs
...
...
@@ -113,6 +117,7 @@ typedef struct {
/// (14.1) gain code from previous subframe
int16_t
gain_code
;
int16_t
was_periodic
;
///< whether previous frame was declared as periodic or not (4.4)
uint16_t
rand_value
;
///< random number generator value (4.4.4)
int
ma_predictor_prev
;
///< switched MA predictor of LSP quantizer from last good frame
}
G729Context
;
...
...
@@ -241,6 +246,8 @@ static av_cold int decoder_init(AVCodecContext * avctx)
ctx
->
lsp
[
1
]
=
ctx
->
lsp_buf
[
1
];
memcpy
(
ctx
->
lsp
[
0
],
lsp_init
,
10
*
sizeof
(
int16_t
));
ctx
->
exc
=
&
ctx
->
exc_base
[
PITCH_DELAY_MAX
+
INTERPOL_LEN
];
/* random seed initialization */
ctx
->
rand_value
=
21845
;
...
...
@@ -276,6 +283,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
int
pitch_delay_int
;
// pitch delay, integer part
int
pitch_delay_3x
;
// pitch delay, multiplied by 3
int16_t
fc
[
SUBFRAME_SIZE
];
// fixed-codebook vector
int
is_periodic
=
0
;
// whether one of the subframes is declared as periodic or not
if
(
*
data_size
<
SUBFRAME_SIZE
<<
2
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Error processing packet: output buffer too small
\n
"
);
...
...
@@ -422,10 +430,17 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
}
ff_acelp_update_past_gain
(
ctx
->
quant_energy
,
gain_corr_factor
,
2
,
frame_erasure
);
/* Routine requires rounding to lowest. */
ff_acelp_interpolate
(
ctx
->
exc
+
i
*
SUBFRAME_SIZE
,
ctx
->
exc
+
i
*
SUBFRAME_SIZE
-
pitch_delay_3x
/
3
,
ff_acelp_interp_filter
,
6
,
(
pitch_delay_3x
%
3
)
<<
1
,
10
,
SUBFRAME_SIZE
);
ff_acelp_weighted_vector_sum
(
ctx
->
exc
+
i
*
SUBFRAME_SIZE
,
ctx
->
exc
+
i
*
SUBFRAME_SIZE
,
fc
,
(
!
voicing
&&
frame_erasure
)
?
0
:
ctx
->
gain_pitch
,
(
voicing
&&
frame_erasure
)
?
0
:
ctx
->
gain_code
,
(
!
ctx
->
was_periodic
&&
frame_erasure
)
?
0
:
ctx
->
gain_pitch
,
(
ctx
->
was_periodic
&&
frame_erasure
)
?
0
:
ctx
->
gain_code
,
1
<<
13
,
14
,
SUBFRAME_SIZE
);
if
(
frame_erasure
)
...
...
@@ -434,6 +449,11 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
ctx
->
pitch_delay_int_prev
=
pitch_delay_int
;
}
ctx
->
was_periodic
=
is_periodic
;
/* Save signal for use in next frame. */
memmove
(
ctx
->
exc_base
,
ctx
->
exc_base
+
2
*
SUBFRAME_SIZE
,
(
PITCH_DELAY_MAX
+
INTERPOL_LEN
)
*
sizeof
(
int16_t
));
*
data_size
=
SUBFRAME_SIZE
<<
2
;
return
buf_size
;
}
...
...
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