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
1b9b6d6e
Commit
1b9b6d6e
authored
Dec 24, 2012
by
Justin Ruggles
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
qcelp: decode directly to the user-provided AVFrame
parent
0905c963
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
9 deletions
+5
-9
qcelpdec.c
libavcodec/qcelpdec.c
+5
-9
No files found.
libavcodec/qcelpdec.c
View file @
1b9b6d6e
...
...
@@ -53,7 +53,6 @@ typedef enum {
}
qcelp_packet_rate
;
typedef
struct
{
AVFrame
avframe
;
GetBitContext
gb
;
qcelp_packet_rate
bitrate
;
QCELPFrame
frame
;
/**< unpacked data frame */
...
...
@@ -97,9 +96,6 @@ static av_cold int qcelp_decode_init(AVCodecContext *avctx)
for
(
i
=
0
;
i
<
10
;
i
++
)
q
->
prev_lspf
[
i
]
=
(
i
+
1
)
/
11
.;
avcodec_get_frame_defaults
(
&
q
->
avframe
);
avctx
->
coded_frame
=
&
q
->
avframe
;
return
0
;
}
...
...
@@ -690,6 +686,7 @@ static int qcelp_decode_frame(AVCodecContext *avctx, void *data,
const
uint8_t
*
buf
=
avpkt
->
data
;
int
buf_size
=
avpkt
->
size
;
QCELPContext
*
q
=
avctx
->
priv_data
;
AVFrame
*
frame
=
data
;
float
*
outbuffer
;
int
i
,
ret
;
float
quantized_lspf
[
10
],
lpc
[
10
];
...
...
@@ -697,12 +694,12 @@ static int qcelp_decode_frame(AVCodecContext *avctx, void *data,
float
*
formant_mem
;
/* get output buffer */
q
->
avframe
.
nb_samples
=
160
;
if
((
ret
=
ff_get_buffer
(
avctx
,
&
q
->
av
frame
))
<
0
)
{
frame
->
nb_samples
=
160
;
if
((
ret
=
ff_get_buffer
(
avctx
,
frame
))
<
0
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"get_buffer() failed
\n
"
);
return
ret
;
}
outbuffer
=
(
float
*
)
q
->
avframe
.
data
[
0
];
outbuffer
=
(
float
*
)
frame
->
data
[
0
];
if
((
q
->
bitrate
=
determine_bitrate
(
avctx
,
buf_size
,
&
buf
))
==
I_F_Q
)
{
warn_insufficient_frame_quality
(
avctx
,
"bitrate cannot be determined."
);
...
...
@@ -785,8 +782,7 @@ erasure:
memcpy
(
q
->
prev_lspf
,
quantized_lspf
,
sizeof
(
q
->
prev_lspf
));
q
->
prev_bitrate
=
q
->
bitrate
;
*
got_frame_ptr
=
1
;
*
(
AVFrame
*
)
data
=
q
->
avframe
;
*
got_frame_ptr
=
1
;
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