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
3db8db40
Commit
3db8db40
authored
Sep 11, 2011
by
Justin Ruggles
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dpcm: factor out the stereo flag calculation
parent
b09c7eef
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
14 deletions
+15
-14
dpcm.c
libavcodec/dpcm.c
+15
-14
No files found.
libavcodec/dpcm.c
View file @
3db8db40
...
...
@@ -169,6 +169,7 @@ static int dpcm_decode_frame(AVCodecContext *avctx,
int
in
,
out
=
0
;
int
predictor
[
2
];
int
ch
=
0
;
int
stereo
=
s
->
channels
-
1
;
short
*
output_samples
=
data
;
int
shift
[
2
];
unsigned
char
byte
;
...
...
@@ -184,11 +185,11 @@ static int dpcm_decode_frame(AVCodecContext *avctx,
switch
(
avctx
->
codec
->
id
)
{
case
CODEC_ID_ROQ_DPCM
:
if
(
s
->
channels
==
1
)
predictor
[
0
]
=
AV_RL16
(
&
buf
[
6
]);
else
{
if
(
stereo
)
{
predictor
[
0
]
=
buf
[
7
]
<<
8
;
predictor
[
1
]
=
buf
[
6
]
<<
8
;
}
else
{
predictor
[
0
]
=
AV_RL16
(
&
buf
[
6
]);
}
SE_16BIT
(
predictor
[
0
]);
SE_16BIT
(
predictor
[
1
]);
...
...
@@ -200,7 +201,7 @@ static int dpcm_decode_frame(AVCodecContext *avctx,
output_samples
[
out
]
=
predictor
[
ch
];
/* toggle channel */
ch
^=
s
->
channels
-
1
;
ch
^=
s
tereo
;
}
break
;
...
...
@@ -210,7 +211,7 @@ static int dpcm_decode_frame(AVCodecContext *avctx,
in
+=
2
;
SE_16BIT
(
predictor
[
0
])
output_samples
[
out
++
]
=
predictor
[
0
];
if
(
s
->
channels
==
2
)
{
if
(
s
tereo
)
{
predictor
[
1
]
=
AV_RL16
(
&
buf
[
in
]);
in
+=
2
;
SE_16BIT
(
predictor
[
1
])
...
...
@@ -223,7 +224,7 @@ static int dpcm_decode_frame(AVCodecContext *avctx,
output_samples
[
out
++
]
=
predictor
[
ch
];
/* toggle channel */
ch
^=
s
->
channels
-
1
;
ch
^=
s
tereo
;
}
break
;
...
...
@@ -234,7 +235,7 @@ static int dpcm_decode_frame(AVCodecContext *avctx,
predictor
[
0
]
=
AV_RL16
(
&
buf
[
in
]);
in
+=
2
;
SE_16BIT
(
predictor
[
0
]);
if
(
s
->
channels
==
2
)
{
if
(
s
tereo
)
{
predictor
[
1
]
=
AV_RL16
(
&
buf
[
in
]);
in
+=
2
;
SE_16BIT
(
predictor
[
1
]);
...
...
@@ -258,7 +259,7 @@ static int dpcm_decode_frame(AVCodecContext *avctx,
output_samples
[
out
++
]
=
predictor
[
ch
];
/* toggle channel */
ch
^=
s
->
channels
-
1
;
ch
^=
s
tereo
;
}
break
;
case
CODEC_ID_SOL_DPCM
:
...
...
@@ -274,10 +275,10 @@ static int dpcm_decode_frame(AVCodecContext *avctx,
if
(
s
->
sample
[
0
]
<
0
)
s
->
sample
[
0
]
=
0
;
if
(
s
->
sample
[
0
]
>
255
)
s
->
sample
[
0
]
=
255
;
output_samples
[
out
++
]
=
(
s
->
sample
[
0
]
-
128
)
<<
8
;
s
->
sample
[
s
->
channels
-
1
]
+=
s
->
sol_table
[
n2
];
if
(
s
->
sample
[
s
->
channels
-
1
]
<
0
)
s
->
sample
[
s
->
channels
-
1
]
=
0
;
if
(
s
->
sample
[
s
->
channels
-
1
]
>
255
)
s
->
sample
[
s
->
channels
-
1
]
=
255
;
output_samples
[
out
++
]
=
(
s
->
sample
[
s
->
channels
-
1
]
-
128
)
<<
8
;
s
->
sample
[
s
tereo
]
+=
s
->
sol_table
[
n2
];
if
(
s
->
sample
[
s
tereo
]
<
0
)
s
->
sample
[
stereo
]
=
0
;
if
(
s
->
sample
[
s
tereo
]
>
255
)
s
->
sample
[
stereo
]
=
255
;
output_samples
[
out
++
]
=
(
s
->
sample
[
s
tereo
]
-
128
)
<<
8
;
}
}
else
{
while
(
in
<
buf_size
)
{
...
...
@@ -288,7 +289,7 @@ static int dpcm_decode_frame(AVCodecContext *avctx,
s
->
sample
[
ch
]
=
av_clip_int16
(
s
->
sample
[
ch
]);
output_samples
[
out
++
]
=
s
->
sample
[
ch
];
/* toggle channel */
ch
^=
s
->
channels
-
1
;
ch
^=
s
tereo
;
}
}
break
;
...
...
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