Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
235b6980
Commit
235b6980
authored
Jan 14, 2020
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pcm/Dsd2Pcm: add optimized stereo version
This code path is 2% faster.
parent
ee461503
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
0 deletions
+30
-0
Dsd2Pcm.cxx
src/pcm/Dsd2Pcm.cxx
+18
-0
Dsd2Pcm.hxx
src/pcm/Dsd2Pcm.hxx
+12
-0
No files found.
src/pcm/Dsd2Pcm.cxx
View file @
235b6980
...
...
@@ -213,9 +213,27 @@ MultiDsd2Pcm::Translate(unsigned channels, size_t n_frames,
{
assert
(
channels
<=
per_channel
.
max_size
());
if
(
channels
==
2
)
{
TranslateStereo
(
n_frames
,
src
,
dest
);
return
;
}
for
(
unsigned
i
=
0
;
i
<
channels
;
++
i
)
{
per_channel
[
i
].
Translate
(
n_frames
,
src
++
,
channels
,
dest
++
,
channels
);
}
}
inline
void
MultiDsd2Pcm
::
TranslateStereo
(
size_t
n_frames
,
const
uint8_t
*
src
,
float
*
dest
)
noexcept
{
size_t
ffp
=
fifopos
;
while
(
n_frames
--
>
0
)
{
*
dest
++
=
per_channel
[
0
].
TranslateSample
(
ffp
,
*
src
++
);
*
dest
++
=
per_channel
[
1
].
TranslateSample
(
ffp
,
*
src
++
);
ffp
=
(
ffp
+
1
)
&
Dsd2Pcm
::
FIFOMASK
;
}
fifopos
=
ffp
;
}
src/pcm/Dsd2Pcm.hxx
View file @
235b6980
...
...
@@ -42,6 +42,8 @@ or implied, of Sebastian Gesemann.
* A "dsd2pcm engine" for one channel.
*/
class
Dsd2Pcm
{
friend
class
MultiDsd2Pcm
;
public
:
/* must be a power of two */
static
constexpr
size_t
FIFOSIZE
=
16
;
...
...
@@ -86,14 +88,24 @@ private:
class
MultiDsd2Pcm
{
std
::
array
<
Dsd2Pcm
,
MAX_CHANNELS
>
per_channel
;
size_t
fifopos
=
0
;
public
:
void
Reset
()
noexcept
{
for
(
auto
&
i
:
per_channel
)
i
.
Reset
();
fifopos
=
0
;
}
void
Translate
(
unsigned
channels
,
size_t
n_frames
,
const
uint8_t
*
src
,
float
*
dest
)
noexcept
;
private
:
/**
* Optimized implementation for the common case.
*/
void
TranslateStereo
(
size_t
n_frames
,
const
uint8_t
*
src
,
float
*
dest
)
noexcept
;
};
#endif
/* include guard DSD2PCM_H_INCLUDED */
...
...
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