Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-2-2
Commits
0198b074
Commit
0198b074
authored
Dec 22, 2012
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
aout: macro-vectorize aout_ChannelsReorder()
parent
861e38b0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
88 deletions
+26
-88
src/audio_output/common.c
src/audio_output/common.c
+26
-88
No files found.
src/audio_output/common.c
View file @
0198b074
...
...
@@ -278,8 +278,8 @@ unsigned aout_CheckChannelReorder( const uint32_t *chans_in,
/**
* Reorders audio samples within a block of linear audio interleaved samples.
* \param ptr start address of the block of samples
* \param bytes size of the block in bytes (must be a multiple of the product
of the
* channels count and the sample size)
* \param bytes size of the block in bytes (must be a multiple of the product
*
of the
channels count and the sample size)
* \param channels channels count (also length of the chans_table table)
* \param chans_table permutation table to reorder the channels
* (usually computed by aout_CheckChannelReorder())
...
...
@@ -292,94 +292,32 @@ void aout_ChannelReorder( void *ptr, size_t bytes, unsigned channels,
assert
(
channels
!=
0
);
assert
(
channels
<=
AOUT_CHAN_MAX
);
/* The audio formats supported in audio output are inlined. For other formats (used in
* demuxers and muxers), memcpy() is used to avoid breaking type punning. */
/* The audio formats supported in audio output are inlined. For other
* formats (used in demuxers and muxers), memcpy() is used to avoid
* breaking type punning. */
#define REORDER_TYPE(type) \
do { \
const size_t frames = (bytes / sizeof (type)) / channels; \
type *buf = ptr; \
\
for( size_t i = 0; i < frames; i++ ) \
{ \
float tmp[AOUT_CHAN_MAX]; \
\
for( size_t j = 0; j < channels; j++ ) \
tmp[chans_table[j]] = buf[j]; \
memcpy( buf, tmp, sizeof (type) * channels ); \
buf += channels; \
} \
} while(0)
switch
(
fourcc
)
{
case
VLC_CODEC_FL32
:
{
const
size_t
frames
=
(
bytes
/
4
)
/
channels
;
float
*
buf
=
ptr
;
for
(
size_t
i
=
0
;
i
<
frames
;
i
++
)
{
float
tmp
[
AOUT_CHAN_MAX
];
for
(
size_t
j
=
0
;
j
<
channels
;
j
++
)
tmp
[
chans_table
[
j
]]
=
buf
[
j
];
memcpy
(
buf
,
tmp
,
4
*
channels
);
buf
+=
channels
;
}
break
;
}
case
VLC_CODEC_S16N
:
{
const
size_t
frames
=
(
bytes
/
2
)
/
channels
;
int16_t
*
buf
=
ptr
;
for
(
size_t
i
=
0
;
i
<
frames
;
i
++
)
{
int16_t
tmp
[
AOUT_CHAN_MAX
];
for
(
size_t
j
=
0
;
j
<
channels
;
j
++
)
tmp
[
chans_table
[
j
]]
=
buf
[
j
];
memcpy
(
buf
,
tmp
,
2
*
channels
);
buf
+=
channels
;
}
break
;
}
case
VLC_CODEC_FL64
:
{
const
size_t
frames
=
(
bytes
/
8
)
/
channels
;
double
*
buf
=
ptr
;
for
(
size_t
i
=
0
;
i
<
frames
;
i
++
)
{
double
tmp
[
AOUT_CHAN_MAX
];
for
(
size_t
j
=
0
;
j
<
channels
;
j
++
)
tmp
[
chans_table
[
j
]]
=
buf
[
j
];
memcpy
(
buf
,
tmp
,
8
*
channels
);
buf
+=
channels
;
}
break
;
}
case
VLC_CODEC_S32N
:
{
const
size_t
frames
=
(
bytes
/
4
)
/
channels
;
int32_t
*
buf
=
ptr
;
for
(
size_t
i
=
0
;
i
<
frames
;
i
++
)
{
int32_t
tmp
[
AOUT_CHAN_MAX
];
for
(
size_t
j
=
0
;
j
<
channels
;
j
++
)
tmp
[
chans_table
[
j
]]
=
buf
[
j
];
memcpy
(
buf
,
tmp
,
4
*
channels
);
buf
+=
channels
;
}
break
;
}
case
VLC_CODEC_U8
:
{
const
size_t
frames
=
bytes
/
channels
;
uint8_t
*
buf
=
ptr
;
for
(
size_t
i
=
0
;
i
<
frames
;
i
++
)
{
uint8_t
tmp
[
AOUT_CHAN_MAX
];
for
(
size_t
j
=
0
;
j
<
channels
;
j
++
)
tmp
[
chans_table
[
j
]]
=
buf
[
j
];
memcpy
(
buf
,
tmp
,
channels
);
buf
+=
channels
;
}
break
;
}
case
VLC_CODEC_U8
:
REORDER_TYPE
(
uint8_t
);
break
;
case
VLC_CODEC_S16N
:
REORDER_TYPE
(
int16_t
);
break
;
case
VLC_CODEC_FL32
:
REORDER_TYPE
(
float
);
break
;
case
VLC_CODEC_S32N
:
REORDER_TYPE
(
int32_t
);
break
;
case
VLC_CODEC_FL64
:
REORDER_TYPE
(
double
);
break
;
default:
{
...
...
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