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
7a124138
Commit
7a124138
authored
Dec 15, 2018
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec/g723_1dec: reindent after last commit
parent
62dbcb7d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
117 additions
and
117 deletions
+117
-117
g723_1dec.c
libavcodec/g723_1dec.c
+117
-117
No files found.
libavcodec/g723_1dec.c
View file @
7a124138
...
@@ -874,137 +874,137 @@ static int g723_1_decode_frame(AVCodecContext *avctx, void *data,
...
@@ -874,137 +874,137 @@ static int g723_1_decode_frame(AVCodecContext *avctx, void *data,
return
ret
;
return
ret
;
for
(
int
ch
=
0
;
ch
<
avctx
->
channels
;
ch
++
)
{
for
(
int
ch
=
0
;
ch
<
avctx
->
channels
;
ch
++
)
{
G723_1_ChannelContext
*
p
=
&
s
->
ch
[
ch
];
G723_1_ChannelContext
*
p
=
&
s
->
ch
[
ch
];
int16_t
*
audio
=
p
->
audio
;
int16_t
*
audio
=
p
->
audio
;
if
(
unpack_bitstream
(
p
,
buf
,
buf_size
)
<
0
)
{
bad_frame
=
1
;
if
(
p
->
past_frame_type
==
ACTIVE_FRAME
)
p
->
cur_frame_type
=
ACTIVE_FRAME
;
else
p
->
cur_frame_type
=
UNTRANSMITTED_FRAME
;
}
if
(
unpack_bitstream
(
p
,
buf
,
buf_size
)
<
0
)
{
out
=
(
int16_t
*
)
frame
->
extended_data
[
ch
];
bad_frame
=
1
;
if
(
p
->
past_frame_type
==
ACTIVE_FRAME
)
p
->
cur_frame_type
=
ACTIVE_FRAME
;
else
p
->
cur_frame_type
=
UNTRANSMITTED_FRAME
;
}
out
=
(
int16_t
*
)
frame
->
extended_data
[
ch
];
if
(
p
->
cur_frame_type
==
ACTIVE_FRAME
)
{
if
(
!
bad_frame
)
if
(
p
->
cur_frame_type
==
ACTIVE_FRAME
)
{
p
->
erased_frames
=
0
;
if
(
!
bad_frame
)
else
if
(
p
->
erased_frames
!=
3
)
p
->
erased_frames
=
0
;
p
->
erased_frames
++
;
else
if
(
p
->
erased_frames
!=
3
)
p
->
erased_frames
++
;
ff_g723_1_inverse_quant
(
cur_lsp
,
p
->
prev_lsp
,
p
->
lsp_index
,
bad_frame
);
ff_g723_1_lsp_interpolate
(
lpc
,
cur_lsp
,
p
->
prev_lsp
);
/* Save the lsp_vector for the next frame */
memcpy
(
p
->
prev_lsp
,
cur_lsp
,
LPC_ORDER
*
sizeof
(
*
p
->
prev_lsp
));
/* Generate the excitation for the frame */
memcpy
(
p
->
excitation
,
p
->
prev_excitation
,
PITCH_MAX
*
sizeof
(
*
p
->
excitation
));
if
(
!
p
->
erased_frames
)
{
int16_t
*
vector_ptr
=
p
->
excitation
+
PITCH_MAX
;
/* Update interpolation gain memory */
p
->
interp_gain
=
fixed_cb_gain
[(
p
->
subframe
[
2
].
amp_index
+
p
->
subframe
[
3
].
amp_index
)
>>
1
];
for
(
i
=
0
;
i
<
SUBFRAMES
;
i
++
)
{
gen_fcb_excitation
(
vector_ptr
,
&
p
->
subframe
[
i
],
p
->
cur_rate
,
p
->
pitch_lag
[
i
>>
1
],
i
);
ff_g723_1_gen_acb_excitation
(
acb_vector
,
&
p
->
excitation
[
SUBFRAME_LEN
*
i
],
p
->
pitch_lag
[
i
>>
1
],
&
p
->
subframe
[
i
],
p
->
cur_rate
);
/* Get the total excitation */
for
(
j
=
0
;
j
<
SUBFRAME_LEN
;
j
++
)
{
int
v
=
av_clip_int16
(
vector_ptr
[
j
]
*
2
);
vector_ptr
[
j
]
=
av_clip_int16
(
v
+
acb_vector
[
j
]);
}
vector_ptr
+=
SUBFRAME_LEN
;
}
vector_ptr
=
p
->
excitation
+
PITCH_MAX
;
ff_g723_1_inverse_quant
(
cur_lsp
,
p
->
prev_lsp
,
p
->
lsp_index
,
bad_frame
);
ff_g723_1_lsp_interpolate
(
lpc
,
cur_lsp
,
p
->
prev_lsp
);
p
->
interp_index
=
comp_interp_index
(
p
,
p
->
pitch_lag
[
1
],
&
p
->
sid_gain
,
&
p
->
cur_gain
);
/* Perform pitch postfiltering */
if
(
s
->
postfilter
)
{
i
=
PITCH_MAX
;
for
(
j
=
0
;
j
<
SUBFRAMES
;
i
+=
SUBFRAME_LEN
,
j
++
)
comp_ppf_coeff
(
p
,
i
,
p
->
pitch_lag
[
j
>>
1
],
ppf
+
j
,
p
->
cur_rate
);
for
(
i
=
0
,
j
=
0
;
j
<
SUBFRAMES
;
i
+=
SUBFRAME_LEN
,
j
++
)
ff_acelp_weighted_vector_sum
(
p
->
audio
+
LPC_ORDER
+
i
,
vector_ptr
+
i
,
vector_ptr
+
i
+
ppf
[
j
].
index
,
ppf
[
j
].
sc_gain
,
ppf
[
j
].
opt_gain
,
1
<<
14
,
15
,
SUBFRAME_LEN
);
}
else
{
audio
=
vector_ptr
-
LPC_ORDER
;
}
/* Save the excitation for the next frame */
/* Save the lsp_vector for the next frame */
memcpy
(
p
->
prev_excitation
,
p
->
excitation
+
FRAME_LEN
,
memcpy
(
p
->
prev_lsp
,
cur_lsp
,
LPC_ORDER
*
sizeof
(
*
p
->
prev_lsp
));
/* Generate the excitation for the frame */
memcpy
(
p
->
excitation
,
p
->
prev_excitation
,
PITCH_MAX
*
sizeof
(
*
p
->
excitation
));
PITCH_MAX
*
sizeof
(
*
p
->
excitation
));
}
else
{
if
(
!
p
->
erased_frames
)
{
p
->
interp_gain
=
(
p
->
interp_gain
*
3
+
2
)
>>
2
;
int16_t
*
vector_ptr
=
p
->
excitation
+
PITCH_MAX
;
if
(
p
->
erased_frames
==
3
)
{
/* Mute output */
/* Update interpolation gain memory */
memset
(
p
->
excitation
,
0
,
p
->
interp_gain
=
fixed_cb_gain
[(
p
->
subframe
[
2
].
amp_index
+
(
FRAME_LEN
+
PITCH_MAX
)
*
sizeof
(
*
p
->
excitation
));
p
->
subframe
[
3
].
amp_index
)
>>
1
];
memset
(
p
->
prev_excitation
,
0
,
for
(
i
=
0
;
i
<
SUBFRAMES
;
i
++
)
{
PITCH_MAX
*
sizeof
(
*
p
->
excitation
));
gen_fcb_excitation
(
vector_ptr
,
&
p
->
subframe
[
i
],
p
->
cur_rate
,
memset
(
frame
->
data
[
0
],
0
,
p
->
pitch_lag
[
i
>>
1
],
i
);
(
FRAME_LEN
+
LPC_ORDER
)
*
sizeof
(
int16_t
));
ff_g723_1_gen_acb_excitation
(
acb_vector
,
}
else
{
&
p
->
excitation
[
SUBFRAME_LEN
*
i
],
int16_t
*
buf
=
p
->
audio
+
LPC_ORDER
;
p
->
pitch_lag
[
i
>>
1
],
&
p
->
subframe
[
i
],
p
->
cur_rate
);
/* Get the total excitation */
for
(
j
=
0
;
j
<
SUBFRAME_LEN
;
j
++
)
{
int
v
=
av_clip_int16
(
vector_ptr
[
j
]
*
2
);
vector_ptr
[
j
]
=
av_clip_int16
(
v
+
acb_vector
[
j
]);
}
vector_ptr
+=
SUBFRAME_LEN
;
}
/* Regenerate frame */
vector_ptr
=
p
->
excitation
+
PITCH_MAX
;
residual_interp
(
p
->
excitation
,
buf
,
p
->
interp_index
,
p
->
interp_gain
,
&
p
->
random_seed
);
p
->
interp_index
=
comp_interp_index
(
p
,
p
->
pitch_lag
[
1
],
&
p
->
sid_gain
,
&
p
->
cur_gain
);
/* Perform pitch postfiltering */
if
(
s
->
postfilter
)
{
i
=
PITCH_MAX
;
for
(
j
=
0
;
j
<
SUBFRAMES
;
i
+=
SUBFRAME_LEN
,
j
++
)
comp_ppf_coeff
(
p
,
i
,
p
->
pitch_lag
[
j
>>
1
],
ppf
+
j
,
p
->
cur_rate
);
for
(
i
=
0
,
j
=
0
;
j
<
SUBFRAMES
;
i
+=
SUBFRAME_LEN
,
j
++
)
ff_acelp_weighted_vector_sum
(
p
->
audio
+
LPC_ORDER
+
i
,
vector_ptr
+
i
,
vector_ptr
+
i
+
ppf
[
j
].
index
,
ppf
[
j
].
sc_gain
,
ppf
[
j
].
opt_gain
,
1
<<
14
,
15
,
SUBFRAME_LEN
);
}
else
{
audio
=
vector_ptr
-
LPC_ORDER
;
}
/* Save the excitation for the next frame */
/* Save the excitation for the next frame */
memcpy
(
p
->
prev_excitation
,
buf
+
(
FRAME_LEN
-
PITCH_MAX
)
,
memcpy
(
p
->
prev_excitation
,
p
->
excitation
+
FRAME_LEN
,
PITCH_MAX
*
sizeof
(
*
p
->
excitation
));
PITCH_MAX
*
sizeof
(
*
p
->
excitation
));
}
else
{
p
->
interp_gain
=
(
p
->
interp_gain
*
3
+
2
)
>>
2
;
if
(
p
->
erased_frames
==
3
)
{
/* Mute output */
memset
(
p
->
excitation
,
0
,
(
FRAME_LEN
+
PITCH_MAX
)
*
sizeof
(
*
p
->
excitation
));
memset
(
p
->
prev_excitation
,
0
,
PITCH_MAX
*
sizeof
(
*
p
->
excitation
));
memset
(
frame
->
data
[
0
],
0
,
(
FRAME_LEN
+
LPC_ORDER
)
*
sizeof
(
int16_t
));
}
else
{
int16_t
*
buf
=
p
->
audio
+
LPC_ORDER
;
/* Regenerate frame */
residual_interp
(
p
->
excitation
,
buf
,
p
->
interp_index
,
p
->
interp_gain
,
&
p
->
random_seed
);
/* Save the excitation for the next frame */
memcpy
(
p
->
prev_excitation
,
buf
+
(
FRAME_LEN
-
PITCH_MAX
),
PITCH_MAX
*
sizeof
(
*
p
->
excitation
));
}
}
p
->
cng_random_seed
=
CNG_RANDOM_SEED
;
}
else
{
if
(
p
->
cur_frame_type
==
SID_FRAME
)
{
p
->
sid_gain
=
sid_gain_to_lsp_index
(
p
->
subframe
[
0
].
amp_index
);
ff_g723_1_inverse_quant
(
p
->
sid_lsp
,
p
->
prev_lsp
,
p
->
lsp_index
,
0
);
}
else
if
(
p
->
past_frame_type
==
ACTIVE_FRAME
)
{
p
->
sid_gain
=
estimate_sid_gain
(
p
);
}
}
}
p
->
cng_random_seed
=
CNG_RANDOM_SEED
;
}
else
{
if
(
p
->
cur_frame_type
==
SID_FRAME
)
{
p
->
sid_gain
=
sid_gain_to_lsp_index
(
p
->
subframe
[
0
].
amp_index
);
ff_g723_1_inverse_quant
(
p
->
sid_lsp
,
p
->
prev_lsp
,
p
->
lsp_index
,
0
);
}
else
if
(
p
->
past_frame_type
==
ACTIVE_FRAME
)
{
p
->
sid_gain
=
estimate_sid_gain
(
p
);
}
if
(
p
->
past_frame_type
==
ACTIVE_FRAME
)
if
(
p
->
past_frame_type
==
ACTIVE_FRAME
)
p
->
cur_gain
=
p
->
sid_gain
;
p
->
cur_gain
=
p
->
sid_gain
;
else
else
p
->
cur_gain
=
(
p
->
cur_gain
*
7
+
p
->
sid_gain
)
>>
3
;
p
->
cur_gain
=
(
p
->
cur_gain
*
7
+
p
->
sid_gain
)
>>
3
;
generate_noise
(
p
);
generate_noise
(
p
);
ff_g723_1_lsp_interpolate
(
lpc
,
p
->
sid_lsp
,
p
->
prev_lsp
);
ff_g723_1_lsp_interpolate
(
lpc
,
p
->
sid_lsp
,
p
->
prev_lsp
);
/* Save the lsp_vector for the next frame */
/* Save the lsp_vector for the next frame */
memcpy
(
p
->
prev_lsp
,
p
->
sid_lsp
,
LPC_ORDER
*
sizeof
(
*
p
->
prev_lsp
));
memcpy
(
p
->
prev_lsp
,
p
->
sid_lsp
,
LPC_ORDER
*
sizeof
(
*
p
->
prev_lsp
));
}
}
p
->
past_frame_type
=
p
->
cur_frame_type
;
p
->
past_frame_type
=
p
->
cur_frame_type
;
memcpy
(
p
->
audio
,
p
->
synth_mem
,
LPC_ORDER
*
sizeof
(
*
p
->
audio
));
memcpy
(
p
->
audio
,
p
->
synth_mem
,
LPC_ORDER
*
sizeof
(
*
p
->
audio
));
for
(
i
=
LPC_ORDER
,
j
=
0
;
j
<
SUBFRAMES
;
i
+=
SUBFRAME_LEN
,
j
++
)
for
(
i
=
LPC_ORDER
,
j
=
0
;
j
<
SUBFRAMES
;
i
+=
SUBFRAME_LEN
,
j
++
)
ff_celp_lp_synthesis_filter
(
p
->
audio
+
i
,
&
lpc
[
j
*
LPC_ORDER
],
ff_celp_lp_synthesis_filter
(
p
->
audio
+
i
,
&
lpc
[
j
*
LPC_ORDER
],
audio
+
i
,
SUBFRAME_LEN
,
LPC_ORDER
,
audio
+
i
,
SUBFRAME_LEN
,
LPC_ORDER
,
0
,
1
,
1
<<
12
);
0
,
1
,
1
<<
12
);
memcpy
(
p
->
synth_mem
,
p
->
audio
+
FRAME_LEN
,
LPC_ORDER
*
sizeof
(
*
p
->
audio
));
memcpy
(
p
->
synth_mem
,
p
->
audio
+
FRAME_LEN
,
LPC_ORDER
*
sizeof
(
*
p
->
audio
));
if
(
s
->
postfilter
)
{
if
(
s
->
postfilter
)
{
formant_postfilter
(
p
,
lpc
,
p
->
audio
,
out
);
formant_postfilter
(
p
,
lpc
,
p
->
audio
,
out
);
}
else
{
// if output is not postfiltered it should be scaled by 2
}
else
{
// if output is not postfiltered it should be scaled by 2
for
(
i
=
0
;
i
<
FRAME_LEN
;
i
++
)
for
(
i
=
0
;
i
<
FRAME_LEN
;
i
++
)
out
[
i
]
=
av_clip_int16
(
p
->
audio
[
LPC_ORDER
+
i
]
<<
1
);
out
[
i
]
=
av_clip_int16
(
p
->
audio
[
LPC_ORDER
+
i
]
<<
1
);
}
}
}
}
*
got_frame_ptr
=
1
;
*
got_frame_ptr
=
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