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
69665bd6
Commit
69665bd6
authored
Aug 11, 2012
by
Mans Rullgard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
g723.1: do not pass large structs by value
Signed-off-by:
Mans Rullgard
<
mans@mansr.com
>
parent
138914dc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
21 deletions
+21
-21
g723_1.c
libavcodec/g723_1.c
+21
-21
No files found.
libavcodec/g723_1.c
View file @
69665bd6
...
...
@@ -498,7 +498,7 @@ static void gen_dirac_train(int16_t *buf, int pitch_lag)
* @param pitch_lag closed loop pitch lag
* @param index current subframe index
*/
static
void
gen_fcb_excitation
(
int16_t
*
vector
,
G723_1_Subframe
subfrm
,
static
void
gen_fcb_excitation
(
int16_t
*
vector
,
G723_1_Subframe
*
subfrm
,
enum
Rate
cur_rate
,
int
pitch_lag
,
int
index
)
{
int
temp
,
i
,
j
;
...
...
@@ -506,34 +506,34 @@ static void gen_fcb_excitation(int16_t *vector, G723_1_Subframe subfrm,
memset
(
vector
,
0
,
SUBFRAME_LEN
*
sizeof
(
*
vector
));
if
(
cur_rate
==
RATE_6300
)
{
if
(
subfrm
.
pulse_pos
>=
max_pos
[
index
])
if
(
subfrm
->
pulse_pos
>=
max_pos
[
index
])
return
;
/* Decode amplitudes and positions */
j
=
PULSE_MAX
-
pulses
[
index
];
temp
=
subfrm
.
pulse_pos
;
temp
=
subfrm
->
pulse_pos
;
for
(
i
=
0
;
i
<
SUBFRAME_LEN
/
GRID_SIZE
;
i
++
)
{
temp
-=
combinatorial_table
[
j
][
i
];
if
(
temp
>=
0
)
continue
;
temp
+=
combinatorial_table
[
j
++
][
i
];
if
(
subfrm
.
pulse_sign
&
(
1
<<
(
PULSE_MAX
-
j
)))
{
vector
[
subfrm
.
grid_index
+
GRID_SIZE
*
i
]
=
-
fixed_cb_gain
[
subfrm
.
amp_index
];
if
(
subfrm
->
pulse_sign
&
(
1
<<
(
PULSE_MAX
-
j
)))
{
vector
[
subfrm
->
grid_index
+
GRID_SIZE
*
i
]
=
-
fixed_cb_gain
[
subfrm
->
amp_index
];
}
else
{
vector
[
subfrm
.
grid_index
+
GRID_SIZE
*
i
]
=
fixed_cb_gain
[
subfrm
.
amp_index
];
vector
[
subfrm
->
grid_index
+
GRID_SIZE
*
i
]
=
fixed_cb_gain
[
subfrm
->
amp_index
];
}
if
(
j
==
PULSE_MAX
)
break
;
}
if
(
subfrm
.
dirac_train
==
1
)
if
(
subfrm
->
dirac_train
==
1
)
gen_dirac_train
(
vector
,
pitch_lag
);
}
else
{
/* 5300 bps */
int
cb_gain
=
fixed_cb_gain
[
subfrm
.
amp_index
];
int
cb_shift
=
subfrm
.
grid_index
;
int
cb_sign
=
subfrm
.
pulse_sign
;
int
cb_pos
=
subfrm
.
pulse_pos
;
int
cb_gain
=
fixed_cb_gain
[
subfrm
->
amp_index
];
int
cb_shift
=
subfrm
->
grid_index
;
int
cb_sign
=
subfrm
->
pulse_sign
;
int
cb_pos
=
subfrm
->
pulse_pos
;
int
offset
,
beta
,
lag
;
for
(
i
=
0
;
i
<
8
;
i
+=
2
)
{
...
...
@@ -544,9 +544,9 @@ static void gen_fcb_excitation(int16_t *vector, G723_1_Subframe subfrm,
}
/* Enhance harmonic components */
lag
=
pitch_contrib
[
subfrm
.
ad_cb_gain
<<
1
]
+
pitch_lag
+
subfrm
.
ad_cb_lag
-
1
;
beta
=
pitch_contrib
[(
subfrm
.
ad_cb_gain
<<
1
)
+
1
];
lag
=
pitch_contrib
[
subfrm
->
ad_cb_gain
<<
1
]
+
pitch_lag
+
subfrm
->
ad_cb_lag
-
1
;
beta
=
pitch_contrib
[(
subfrm
->
ad_cb_gain
<<
1
)
+
1
];
if
(
lag
<
SUBFRAME_LEN
-
2
)
{
for
(
i
=
lag
;
i
<
SUBFRAME_LEN
;
i
++
)
...
...
@@ -586,12 +586,12 @@ static int dot_product(const int16_t *a, const int16_t *b, int length)
* Generate adaptive codebook excitation.
*/
static
void
gen_acb_excitation
(
int16_t
*
vector
,
int16_t
*
prev_excitation
,
int
pitch_lag
,
G723_1_Subframe
subfrm
,
int
pitch_lag
,
G723_1_Subframe
*
subfrm
,
enum
Rate
cur_rate
)
{
int16_t
residual
[
SUBFRAME_LEN
+
PITCH_ORDER
-
1
];
const
int16_t
*
cb_ptr
;
int
lag
=
pitch_lag
+
subfrm
.
ad_cb_lag
-
1
;
int
lag
=
pitch_lag
+
subfrm
->
ad_cb_lag
-
1
;
int
i
;
int
sum
;
...
...
@@ -605,7 +605,7 @@ static void gen_acb_excitation(int16_t *vector, int16_t *prev_excitation,
cb_ptr
=
adaptive_cb_gain170
;
/* Calculate adaptive vector */
cb_ptr
+=
subfrm
.
ad_cb_gain
*
20
;
cb_ptr
+=
subfrm
->
ad_cb_gain
*
20
;
for
(
i
=
0
;
i
<
SUBFRAME_LEN
;
i
++
)
{
sum
=
dot_product
(
residual
+
i
,
cb_ptr
,
PITCH_ORDER
);
vector
[
i
]
=
av_sat_dadd32
(
1
<<
15
,
sum
)
>>
16
;
...
...
@@ -1057,10 +1057,10 @@ static int g723_1_decode_frame(AVCodecContext *avctx, void *data,
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
,
gen_fcb_excitation
(
vector_ptr
,
&
p
->
subframe
[
i
],
p
->
cur_rate
,
p
->
pitch_lag
[
i
>>
1
],
i
);
gen_acb_excitation
(
acb_vector
,
&
p
->
excitation
[
SUBFRAME_LEN
*
i
],
p
->
pitch_lag
[
i
>>
1
],
p
->
subframe
[
i
],
p
->
pitch_lag
[
i
>>
1
],
&
p
->
subframe
[
i
],
p
->
cur_rate
);
/* Get the total excitation */
for
(
j
=
0
;
j
<
SUBFRAME_LEN
;
j
++
)
{
...
...
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