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
49e1047e
Commit
49e1047e
authored
Nov 11, 2012
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
aout_ChannelReorder: optimize 16 and 32 bits cases with aligned access
parent
d8232746
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
57 additions
and
46 deletions
+57
-46
include/vlc_aout.h
include/vlc_aout.h
+1
-1
src/audio_output/common.c
src/audio_output/common.c
+56
-45
No files found.
include/vlc_aout.h
View file @
49e1047e
...
...
@@ -179,7 +179,7 @@ static const uint32_t pi_vlc_chan_order_wg4[] =
* internal (WG4) order is requested.
*/
VLC_API
int
aout_CheckChannelReorder
(
const
uint32_t
*
pi_chan_order_in
,
const
uint32_t
*
pi_chan_order_out
,
uint32_t
i_channel_mask
,
int
i_channels
,
int
*
pi_chan_table
);
VLC_API
void
aout_ChannelReorder
(
uint8_t
*
,
int
,
int
,
const
int
*
,
int
);
VLC_API
void
aout_ChannelReorder
(
void
*
,
size_t
,
unsigned
,
const
int
*
,
unsigned
);
/**
* This fonction will compute the extraction parameter into pi_selection to go
...
...
src/audio_output/common.c
View file @
49e1047e
...
...
@@ -280,69 +280,80 @@ int aout_CheckChannelReorder( const uint32_t *pi_chan_order_in,
/*****************************************************************************
* aout_ChannelReorder :
*****************************************************************************/
void
aout_ChannelReorder
(
uint8_t
*
p_buf
,
int
i_buffer
,
int
i_channels
,
const
int
*
pi_chan_table
,
int
i_bits_per_sample
)
void
aout_ChannelReorder
(
void
*
ptr
,
size_t
bytes
,
unsigned
channels
,
const
int
*
pi_chan_table
,
unsigned
bits_per_sample
)
{
uint8_t
p_tmp
[
AOUT_CHAN_MAX
*
4
];
int
i
,
j
;
size_t
samples
=
bytes
/
(
channels
*
(
bits_per_sample
>>
3
));
if
(
i_bits_per_sample
==
8
)
assert
(
channels
<=
AOUT_CHAN_MAX
);
switch
(
bits_per_sample
)
{
for
(
i
=
0
;
i
<
i_buffer
/
i_channels
;
i
++
)
case
32
:
{
for
(
j
=
0
;
j
<
i_channels
;
j
++
)
uint32_t
*
buf
=
ptr
;
for
(
size_t
i
=
0
;
i
<
samples
;
i
++
)
{
p_tmp
[
pi_chan_table
[
j
]]
=
p_buf
[
j
];
}
uint32_t
tmp
[
AOUT_CHAN_MAX
];
memcpy
(
p_buf
,
p_tmp
,
i_channels
);
p_buf
+=
i_channels
;
for
(
size_t
j
=
0
;
j
<
channels
;
j
++
)
tmp
[
pi_chan_table
[
j
]]
=
buf
[
j
];
memcpy
(
buf
,
tmp
,
4
*
channels
);
buf
+=
channels
;
}
break
;
}
}
else
if
(
i_bits_per_sample
==
16
)
{
for
(
i
=
0
;
i
<
i_buffer
/
i_channels
/
2
;
i
++
)
case
16
:
{
for
(
j
=
0
;
j
<
i_channels
;
j
++
)
uint16_t
*
buf
=
ptr
;
for
(
size_t
i
=
0
;
i
<
samples
;
i
++
)
{
p_tmp
[
2
*
pi_chan_table
[
j
]]
=
p_buf
[
2
*
j
];
p_tmp
[
2
*
pi_chan_table
[
j
]
+
1
]
=
p_buf
[
2
*
j
+
1
];
}
uint16_t
tmp
[
AOUT_CHAN_MAX
];
memcpy
(
p_buf
,
p_tmp
,
2
*
i_channels
);
p_buf
+=
2
*
i_channels
;
for
(
size_t
j
=
0
;
j
<
channels
;
j
++
)
tmp
[
pi_chan_table
[
j
]]
=
buf
[
j
];
memcpy
(
buf
,
tmp
,
2
*
channels
);
buf
+=
channels
;
}
break
;
}
}
else
if
(
i_bits_per_sample
==
24
)
{
for
(
i
=
0
;
i
<
i_buffer
/
i_channels
/
3
;
i
++
)
case
8
:
{
for
(
j
=
0
;
j
<
i_channels
;
j
++
)
uint8_t
*
buf
=
ptr
;
for
(
size_t
i
=
0
;
i
<
samples
;
i
++
)
{
p_tmp
[
3
*
pi_chan_table
[
j
]]
=
p_buf
[
3
*
j
];
p_tmp
[
3
*
pi_chan_table
[
j
]
+
1
]
=
p_buf
[
3
*
j
+
1
];
p_tmp
[
3
*
pi_chan_table
[
j
]
+
2
]
=
p_buf
[
3
*
j
+
2
];
}
uint8_t
tmp
[
AOUT_CHAN_MAX
];
memcpy
(
p_buf
,
p_tmp
,
3
*
i_channels
);
p_buf
+=
3
*
i_channels
;
for
(
size_t
j
=
0
;
j
<
channels
;
j
++
)
tmp
[
pi_chan_table
[
j
]]
=
buf
[
j
];
memcpy
(
buf
,
tmp
,
channels
);
buf
+=
channels
;
}
break
;
}
}
else
if
(
i_bits_per_sample
==
32
)
{
for
(
i
=
0
;
i
<
i_buffer
/
i_channels
/
4
;
i
++
)
case
24
:
{
for
(
j
=
0
;
j
<
i_channels
;
j
++
)
uint8_t
*
buf
=
ptr
;
for
(
size_t
i
=
0
;
i
<
samples
;
i
++
)
{
p_tmp
[
4
*
pi_chan_table
[
j
]]
=
p_buf
[
4
*
j
];
p_tmp
[
4
*
pi_chan_table
[
j
]
+
1
]
=
p_buf
[
4
*
j
+
1
];
p_tmp
[
4
*
pi_chan_table
[
j
]
+
2
]
=
p_buf
[
4
*
j
+
2
];
p_tmp
[
4
*
pi_chan_table
[
j
]
+
3
]
=
p_buf
[
4
*
j
+
3
];
}
uint8_t
tmp
[
3
*
AOUT_CHAN_MAX
];
for
(
size_t
j
=
0
;
j
<
channels
;
j
++
)
memcpy
(
tmp
+
(
3
*
pi_chan_table
[
j
]),
buf
+
(
3
*
j
),
3
);
memcpy
(
p_buf
,
p_tmp
,
4
*
i_channels
);
p_buf
+=
4
*
i_channels
;
memcpy
(
buf
,
tmp
,
3
*
channels
);
buf
+=
3
*
channels
;
}
}
}
}
...
...
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