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
8114f94a
Commit
8114f94a
authored
Sep 10, 2011
by
Justin Ruggles
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adpcm_ms: clean up reading of predictor coefficients
parent
943f4db5
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
9 deletions
+13
-9
adpcm.c
libavcodec/adpcm.c
+13
-9
No files found.
libavcodec/adpcm.c
View file @
8114f94a
...
@@ -340,7 +340,6 @@ static int adpcm_decode_frame(AVCodecContext *avctx,
...
@@ -340,7 +340,6 @@ static int adpcm_decode_frame(AVCodecContext *avctx,
ADPCMDecodeContext
*
c
=
avctx
->
priv_data
;
ADPCMDecodeContext
*
c
=
avctx
->
priv_data
;
ADPCMChannelStatus
*
cs
;
ADPCMChannelStatus
*
cs
;
int
n
,
m
,
channel
,
i
;
int
n
,
m
,
channel
,
i
;
int
block_predictor
[
2
];
short
*
samples
;
short
*
samples
;
short
*
samples_end
;
short
*
samples_end
;
const
uint8_t
*
src
;
const
uint8_t
*
src
;
...
@@ -487,23 +486,27 @@ static int adpcm_decode_frame(AVCodecContext *avctx,
...
@@ -487,23 +486,27 @@ static int adpcm_decode_frame(AVCodecContext *avctx,
samples
-=
(
avctx
->
channels
-
1
);
samples
-=
(
avctx
->
channels
-
1
);
break
;
break
;
case
CODEC_ID_ADPCM_MS
:
case
CODEC_ID_ADPCM_MS
:
{
int
block_predictor
;
if
(
avctx
->
block_align
!=
0
&&
buf_size
>
avctx
->
block_align
)
if
(
avctx
->
block_align
!=
0
&&
buf_size
>
avctx
->
block_align
)
buf_size
=
avctx
->
block_align
;
buf_size
=
avctx
->
block_align
;
n
=
buf_size
-
7
*
avctx
->
channels
;
n
=
buf_size
-
7
*
avctx
->
channels
;
if
(
n
<
0
)
if
(
n
<
0
)
return
-
1
;
return
-
1
;
block_predictor
[
0
]
=
av_clip
(
*
src
++
,
0
,
6
);
block_predictor
[
1
]
=
0
;
block_predictor
=
av_clip
(
*
src
++
,
0
,
6
);
if
(
st
)
c
->
status
[
0
].
coeff1
=
ff_adpcm_AdaptCoeff1
[
block_predictor
];
block_predictor
[
1
]
=
av_clip
(
*
src
++
,
0
,
6
);
c
->
status
[
0
].
coeff2
=
ff_adpcm_AdaptCoeff2
[
block_predictor
];
if
(
st
)
{
block_predictor
=
av_clip
(
*
src
++
,
0
,
6
);
c
->
status
[
1
].
coeff1
=
ff_adpcm_AdaptCoeff1
[
block_predictor
];
c
->
status
[
1
].
coeff2
=
ff_adpcm_AdaptCoeff2
[
block_predictor
];
}
c
->
status
[
0
].
idelta
=
(
int16_t
)
bytestream_get_le16
(
&
src
);
c
->
status
[
0
].
idelta
=
(
int16_t
)
bytestream_get_le16
(
&
src
);
if
(
st
){
if
(
st
){
c
->
status
[
1
].
idelta
=
(
int16_t
)
bytestream_get_le16
(
&
src
);
c
->
status
[
1
].
idelta
=
(
int16_t
)
bytestream_get_le16
(
&
src
);
}
}
c
->
status
[
0
].
coeff1
=
ff_adpcm_AdaptCoeff1
[
block_predictor
[
0
]];
c
->
status
[
0
].
coeff2
=
ff_adpcm_AdaptCoeff2
[
block_predictor
[
0
]];
c
->
status
[
1
].
coeff1
=
ff_adpcm_AdaptCoeff1
[
block_predictor
[
1
]];
c
->
status
[
1
].
coeff2
=
ff_adpcm_AdaptCoeff2
[
block_predictor
[
1
]];
c
->
status
[
0
].
sample1
=
bytestream_get_le16
(
&
src
);
c
->
status
[
0
].
sample1
=
bytestream_get_le16
(
&
src
);
if
(
st
)
c
->
status
[
1
].
sample1
=
bytestream_get_le16
(
&
src
);
if
(
st
)
c
->
status
[
1
].
sample1
=
bytestream_get_le16
(
&
src
);
...
@@ -520,6 +523,7 @@ static int adpcm_decode_frame(AVCodecContext *avctx,
...
@@ -520,6 +523,7 @@ static int adpcm_decode_frame(AVCodecContext *avctx,
src
++
;
src
++
;
}
}
break
;
break
;
}
case
CODEC_ID_ADPCM_IMA_DK4
:
case
CODEC_ID_ADPCM_IMA_DK4
:
if
(
avctx
->
block_align
!=
0
&&
buf_size
>
avctx
->
block_align
)
if
(
avctx
->
block_align
!=
0
&&
buf_size
>
avctx
->
block_align
)
buf_size
=
avctx
->
block_align
;
buf_size
=
avctx
->
block_align
;
...
...
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