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
7e52fd6b
Commit
7e52fd6b
authored
Dec 23, 2012
by
Justin Ruggles
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
g723.1: decode directly to the user-provided AVFrame
parent
036e9b04
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
10 deletions
+6
-10
g723_1.c
libavcodec/g723_1.c
+6
-10
No files found.
libavcodec/g723_1.c
View file @
7e52fd6b
...
...
@@ -76,7 +76,6 @@ typedef struct {
typedef
struct
g723_1_context
{
AVClass
*
class
;
AVFrame
frame
;
G723_1_Subframe
subframe
[
4
];
enum
FrameType
cur_frame_type
;
...
...
@@ -117,9 +116,6 @@ static av_cold int g723_1_decode_init(AVCodecContext *avctx)
avctx
->
sample_rate
=
8000
;
p
->
pf_gain
=
1
<<
12
;
avcodec_get_frame_defaults
(
&
p
->
frame
);
avctx
->
coded_frame
=
&
p
->
frame
;
memcpy
(
p
->
prev_lsp
,
dc_lsp
,
LPC_ORDER
*
sizeof
(
*
p
->
prev_lsp
));
memcpy
(
p
->
sid_lsp
,
dc_lsp
,
LPC_ORDER
*
sizeof
(
*
p
->
sid_lsp
));
...
...
@@ -1191,6 +1187,7 @@ static int g723_1_decode_frame(AVCodecContext *avctx, void *data,
int
*
got_frame_ptr
,
AVPacket
*
avpkt
)
{
G723_1_Context
*
p
=
avctx
->
priv_data
;
AVFrame
*
frame
=
data
;
const
uint8_t
*
buf
=
avpkt
->
data
;
int
buf_size
=
avpkt
->
size
;
int
dec_mode
=
buf
[
0
]
&
3
;
...
...
@@ -1220,13 +1217,13 @@ static int g723_1_decode_frame(AVCodecContext *avctx, void *data,
p
->
cur_frame_type
=
UNTRANSMITTED_FRAME
;
}
p
->
frame
.
nb_samples
=
FRAME_LEN
;
if
((
ret
=
ff_get_buffer
(
avctx
,
&
p
->
frame
))
<
0
)
{
frame
->
nb_samples
=
FRAME_LEN
;
if
((
ret
=
ff_get_buffer
(
avctx
,
frame
))
<
0
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"get_buffer() failed
\n
"
);
return
ret
;
}
out
=
(
int16_t
*
)
p
->
frame
.
data
[
0
];
out
=
(
int16_t
*
)
frame
->
data
[
0
];
if
(
p
->
cur_frame_type
==
ACTIVE_FRAME
)
{
if
(
!
bad_frame
)
...
...
@@ -1297,7 +1294,7 @@ static int g723_1_decode_frame(AVCodecContext *avctx, void *data,
(
FRAME_LEN
+
PITCH_MAX
)
*
sizeof
(
*
p
->
excitation
));
memset
(
p
->
prev_excitation
,
0
,
PITCH_MAX
*
sizeof
(
*
p
->
excitation
));
memset
(
p
->
frame
.
data
[
0
],
0
,
memset
(
frame
->
data
[
0
],
0
,
(
FRAME_LEN
+
LPC_ORDER
)
*
sizeof
(
int16_t
));
}
else
{
int16_t
*
buf
=
p
->
audio
+
LPC_ORDER
;
...
...
@@ -1346,8 +1343,7 @@ static int g723_1_decode_frame(AVCodecContext *avctx, void *data,
out
[
i
]
=
av_clip_int16
(
p
->
audio
[
LPC_ORDER
+
i
]
<<
1
);
}
*
got_frame_ptr
=
1
;
*
(
AVFrame
*
)
data
=
p
->
frame
;
*
got_frame_ptr
=
1
;
return
frame_size
[
dec_mode
];
}
...
...
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