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
480324e7
Commit
480324e7
authored
Oct 28, 2011
by
Justin Ruggles
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
libgsm: simplify decoding by using a loop
parent
9d52f0a7
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
7 deletions
+8
-7
libgsm.c
libavcodec/libgsm.c
+8
-7
No files found.
libavcodec/libgsm.c
View file @
480324e7
...
...
@@ -166,8 +166,11 @@ static av_cold int libgsm_decode_close(AVCodecContext *avctx) {
static
int
libgsm_decode_frame
(
AVCodecContext
*
avctx
,
void
*
data
,
int
*
data_size
,
AVPacket
*
avpkt
)
{
int
i
,
ret
;
struct
gsm_state
*
s
=
avctx
->
priv_data
;
uint8_t
*
buf
=
avpkt
->
data
;
int
buf_size
=
avpkt
->
size
;
int16_t
*
samples
=
data
;
int
out_size
=
avctx
->
frame_size
*
av_get_bytes_per_sample
(
avctx
->
sample_fmt
);
if
(
*
data_size
<
out_size
)
{
...
...
@@ -180,13 +183,11 @@ static int libgsm_decode_frame(AVCodecContext *avctx,
return
AVERROR_INVALIDDATA
;
}
switch
(
avctx
->
codec_id
)
{
case
CODEC_ID_GSM
:
if
(
gsm_decode
(
avctx
->
priv_data
,
buf
,
data
))
return
-
1
;
break
;
case
CODEC_ID_GSM_MS
:
if
(
gsm_decode
(
avctx
->
priv_data
,
buf
,
data
)
||
gsm_decode
(
avctx
->
priv_data
,
buf
+
33
,((
int16_t
*
)
data
)
+
GSM_FRAME_SIZE
))
return
-
1
;
for
(
i
=
0
;
i
<
avctx
->
frame_size
/
GSM_FRAME_SIZE
;
i
++
)
{
if
((
ret
=
gsm_decode
(
s
,
buf
,
samples
))
<
0
)
return
-
1
;
buf
+=
GSM_BLOCK_SIZE
;
samples
+=
GSM_FRAME_SIZE
;
}
*
data_size
=
out_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