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
6cda74c1
Commit
6cda74c1
authored
Jul 09, 2012
by
Andrew D'Addesio
Committed by
Justin Ruggles
Jul 19, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
alac: simplify channel interleaving
Signed-off-by:
Justin Ruggles
<
justin.ruggles@gmail.com
>
parent
5138ff14
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
43 deletions
+14
-43
alac.c
libavcodec/alac.c
+14
-43
No files found.
libavcodec/alac.c
View file @
6cda74c1
...
...
@@ -266,28 +266,6 @@ static void append_extra_bits(int32_t *buffer[MAX_CHANNELS],
buffer
[
ch
][
i
]
=
(
buffer
[
ch
][
i
]
<<
extra_bits
)
|
extra_bits_buffer
[
ch
][
i
];
}
static
void
interleave_stereo_16
(
int32_t
*
buffer
[
MAX_CHANNELS
],
int16_t
*
buffer_out
,
int
numsamples
)
{
int
i
;
for
(
i
=
0
;
i
<
numsamples
;
i
++
)
{
*
buffer_out
++
=
buffer
[
0
][
i
];
*
buffer_out
++
=
buffer
[
1
][
i
];
}
}
static
void
interleave_stereo_24
(
int32_t
*
buffer
[
MAX_CHANNELS
],
int32_t
*
buffer_out
,
int
numsamples
)
{
int
i
;
for
(
i
=
0
;
i
<
numsamples
;
i
++
)
{
*
buffer_out
++
=
buffer
[
0
][
i
]
<<
8
;
*
buffer_out
++
=
buffer
[
1
][
i
]
<<
8
;
}
}
static
int
alac_decode_frame
(
AVCodecContext
*
avctx
,
void
*
data
,
int
*
got_frame_ptr
,
AVPacket
*
avpkt
)
{
...
...
@@ -430,28 +408,21 @@ static int alac_decode_frame(AVCodecContext *avctx, void *data,
}
switch
(
alac
->
sample_size
)
{
case
16
:
if
(
channels
==
2
)
{
interleave_stereo_16
(
alac
->
output_samples_buffer
,
(
int16_t
*
)
alac
->
frame
.
data
[
0
],
alac
->
nb_samples
);
}
else
{
int16_t
*
outbuffer
=
(
int16_t
*
)
alac
->
frame
.
data
[
0
];
for
(
i
=
0
;
i
<
alac
->
nb_samples
;
i
++
)
{
outbuffer
[
i
]
=
alac
->
output_samples_buffer
[
0
][
i
];
}
}
case
16
:
{
int16_t
*
outbuffer
=
(
int16_t
*
)
alac
->
frame
.
data
[
0
];
for
(
i
=
0
;
i
<
alac
->
nb_samples
;
i
++
)
{
*
outbuffer
++
=
alac
->
output_samples_buffer
[
0
][
i
];
if
(
channels
==
2
)
*
outbuffer
++
=
alac
->
output_samples_buffer
[
1
][
i
];
}}
break
;
case
24
:
if
(
channels
==
2
)
{
interleave_stereo_24
(
alac
->
output_samples_buffer
,
(
int32_t
*
)
alac
->
frame
.
data
[
0
],
alac
->
nb_samples
);
}
else
{
int32_t
*
outbuffer
=
(
int32_t
*
)
alac
->
frame
.
data
[
0
];
for
(
i
=
0
;
i
<
alac
->
nb_samples
;
i
++
)
outbuffer
[
i
]
=
alac
->
output_samples_buffer
[
0
][
i
]
<<
8
;
}
case
24
:
{
int32_t
*
outbuffer
=
(
int32_t
*
)
alac
->
frame
.
data
[
0
];
for
(
i
=
0
;
i
<
alac
->
nb_samples
;
i
++
)
{
*
outbuffer
++
=
alac
->
output_samples_buffer
[
0
][
i
]
<<
8
;
if
(
channels
==
2
)
*
outbuffer
++
=
alac
->
output_samples_buffer
[
1
][
i
]
<<
8
;
}}
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