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
0b42463a
Commit
0b42463a
authored
Jun 12, 2009
by
Vladimir Voroshilov
Committed by
Michael Niedermayer
Sep 24, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Gain pitch and gain code for G729D
parent
12081d05
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
0 deletions
+60
-0
g729data.h
libavcodec/g729data.h
+30
-0
g729dec.c
libavcodec/g729dec.c
+30
-0
No files found.
libavcodec/g729data.h
View file @
0b42463a
...
...
@@ -245,6 +245,36 @@ static const int16_t cb_gain_2nd_8k[1<<GC_2ND_IDX_BITS_8K][2] = { /*(1.14) (1.13
{
13260
,
3256
},
};
/**
* gain codebook (first stage), 6.4k mode (D.3.9.2 of G.729)
*/
static
const
int16_t
cb_gain_1st_6k4
[
1
<<
GC_1ST_IDX_BITS_6K4
][
2
]
=
{
/*(0.14) (1.14)*/
{
5849
,
0
},
{
3171
,
9280
},
{
3617
,
6747
},
{
4987
,
22294
},
{
2929
,
1078
},
{
6068
,
6093
},
{
9425
,
2731
},
{
3915
,
12872
},
};
/**
* gain codebook (second stage), 6.4k mode (D.3.9.2 of G.729)
*/
static
const
int16_t
cb_gain_2nd_6k4
[
1
<<
GC_2ND_IDX_BITS_6K4
][
2
]
=
{
/*(1.14) (1.14)*/
{
0
,
4175
},
{
10828
,
27602
},
{
16423
,
15724
},
{
4478
,
7324
},
{
3988
,
0
},
{
10291
,
11385
},
{
11956
,
10735
},
{
7876
,
7821
},
};
/**
* 4th order Moving Average (MA) Predictor codebook (3.2.4 of G.729)
*
...
...
libavcodec/g729dec.c
View file @
0b42463a
...
...
@@ -419,10 +419,25 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
gain_corr_factor
=
0
;
}
else
{
if
(
packet_type
==
FORMAT_G729D_6K4
)
{
ctx
->
past_gain_pitch
[
0
]
=
cb_gain_1st_6k4
[
gc_1st_index
][
0
]
+
cb_gain_2nd_6k4
[
gc_2nd_index
][
0
];
gain_corr_factor
=
cb_gain_1st_6k4
[
gc_1st_index
][
1
]
+
cb_gain_2nd_6k4
[
gc_2nd_index
][
1
];
/* Without check below overflow can occure in ff_acelp_update_past_gain.
It is not issue for G.729, because gain_corr_factor in it's case is always
greater than 1024, while in G.729D it can be even zero. */
gain_corr_factor
=
FFMAX
(
gain_corr_factor
,
1024
);
#ifndef G729_BITEXACT
gain_corr_factor
>>=
1
;
#endif
}
else
{
ctx
->
past_gain_pitch
[
0
]
=
cb_gain_1st_8k
[
gc_1st_index
][
0
]
+
cb_gain_2nd_8k
[
gc_2nd_index
][
0
];
gain_corr_factor
=
cb_gain_1st_8k
[
gc_1st_index
][
1
]
+
cb_gain_2nd_8k
[
gc_2nd_index
][
1
];
}
/* Decode the fixed-codebook gain. */
ctx
->
past_gain_code
[
0
]
=
ff_acelp_decode_gain_code
(
&
ctx
->
dsp
,
gain_corr_factor
,
...
...
@@ -430,6 +445,21 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
ctx
->
quant_energy
,
ma_prediction_coeff
,
SUBFRAME_SIZE
,
4
);
#ifdef G729_BITEXACT
/*
This correction required to get bit-exact result with
reference code, because gain_corr_factor in G.729D is
two times larger than in original G.729.
If bit-exact result is not issue then gain_corr_factor
can be simpler devided by 2 before call to g729_get_gain_code
instead of using correction below.
*/
if
(
packet_type
==
FORMAT_G729D_6K4
)
{
gain_corr_factor
>>=
1
;
ctx
->
past_gain_code
[
0
]
>>=
1
;
}
#endif
}
ff_acelp_update_past_gain
(
ctx
->
quant_energy
,
gain_corr_factor
,
2
,
frame_erasure
);
...
...
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