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
0fd1ddf1
Commit
0fd1ddf1
authored
Oct 22, 2012
by
Justin Ruggles
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dpcm: use AVCodecContext.channels instead of keeping a private copy
parent
1c7a0161
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
8 deletions
+6
-8
dpcm.c
libavcodec/dpcm.c
+6
-8
No files found.
libavcodec/dpcm.c
View file @
0fd1ddf1
...
...
@@ -44,7 +44,6 @@
typedef
struct
DPCMContext
{
AVFrame
frame
;
int
channels
;
int16_t
roq_square_array
[
256
];
int
sample
[
2
];
///< previous sample (for SOL_DPCM)
const
int8_t
*
sol_table
;
///< delta table for SOL_DPCM
...
...
@@ -123,7 +122,6 @@ static av_cold int dpcm_decode_init(AVCodecContext *avctx)
return
AVERROR
(
EINVAL
);
}
s
->
channels
=
avctx
->
channels
;
s
->
sample
[
0
]
=
s
->
sample
[
1
]
=
0
;
switch
(
avctx
->
codec
->
id
)
{
...
...
@@ -179,7 +177,7 @@ static int dpcm_decode_frame(AVCodecContext *avctx, void *data,
int
out
=
0
,
ret
;
int
predictor
[
2
];
int
ch
=
0
;
int
stereo
=
s
->
channels
-
1
;
int
stereo
=
avctx
->
channels
-
1
;
int16_t
*
output_samples
,
*
samples_end
;
GetByteContext
gb
;
...
...
@@ -193,10 +191,10 @@ static int dpcm_decode_frame(AVCodecContext *avctx, void *data,
out
=
buf_size
-
8
;
break
;
case
AV_CODEC_ID_INTERPLAY_DPCM
:
out
=
buf_size
-
6
-
s
->
channels
;
out
=
buf_size
-
6
-
avctx
->
channels
;
break
;
case
AV_CODEC_ID_XAN_DPCM
:
out
=
buf_size
-
2
*
s
->
channels
;
out
=
buf_size
-
2
*
avctx
->
channels
;
break
;
case
AV_CODEC_ID_SOL_DPCM
:
if
(
avctx
->
codec_tag
!=
3
)
...
...
@@ -211,7 +209,7 @@ static int dpcm_decode_frame(AVCodecContext *avctx, void *data,
}
/* get output buffer */
s
->
frame
.
nb_samples
=
out
/
s
->
channels
;
s
->
frame
.
nb_samples
=
out
/
avctx
->
channels
;
if
((
ret
=
avctx
->
get_buffer
(
avctx
,
&
s
->
frame
))
<
0
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"get_buffer() failed
\n
"
);
return
ret
;
...
...
@@ -245,7 +243,7 @@ static int dpcm_decode_frame(AVCodecContext *avctx, void *data,
case
AV_CODEC_ID_INTERPLAY_DPCM
:
bytestream2_skipu
(
&
gb
,
6
);
/* skip over the stream mask and stream length */
for
(
ch
=
0
;
ch
<
s
->
channels
;
ch
++
)
{
for
(
ch
=
0
;
ch
<
avctx
->
channels
;
ch
++
)
{
predictor
[
ch
]
=
sign_extend
(
bytestream2_get_le16u
(
&
gb
),
16
);
*
output_samples
++
=
predictor
[
ch
];
}
...
...
@@ -265,7 +263,7 @@ static int dpcm_decode_frame(AVCodecContext *avctx, void *data,
{
int
shift
[
2
]
=
{
4
,
4
};
for
(
ch
=
0
;
ch
<
s
->
channels
;
ch
++
)
for
(
ch
=
0
;
ch
<
avctx
->
channels
;
ch
++
)
predictor
[
ch
]
=
sign_extend
(
bytestream2_get_le16u
(
&
gb
),
16
);
ch
=
0
;
...
...
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