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
ee461503
Commit
ee461503
authored
Jan 14, 2020
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pcm/Dsd2Pcm: add class MultiDsd2Pcm
parent
79c585bf
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
36 additions
and
19 deletions
+36
-19
Dsd2Pcm.cxx
src/pcm/Dsd2Pcm.cxx
+14
-0
Dsd2Pcm.hxx
src/pcm/Dsd2Pcm.hxx
+17
-0
PcmDsd.cxx
src/pcm/PcmDsd.cxx
+1
-14
PcmDsd.hxx
src/pcm/PcmDsd.hxx
+4
-5
No files found.
src/pcm/Dsd2Pcm.cxx
View file @
ee461503
...
...
@@ -34,6 +34,7 @@ or implied, of Sebastian Gesemann.
#include "util/bit_reverse.h"
#include "util/GenerateArray.hxx"
#include <assert.h>
#include <stdlib.h>
#include <string.h>
...
...
@@ -205,3 +206,16 @@ Dsd2Pcm::Translate(size_t samples,
}
fifopos
=
ffp
;
}
void
MultiDsd2Pcm
::
Translate
(
unsigned
channels
,
size_t
n_frames
,
const
uint8_t
*
src
,
float
*
dest
)
noexcept
{
assert
(
channels
<=
per_channel
.
max_size
());
for
(
unsigned
i
=
0
;
i
<
channels
;
++
i
)
{
per_channel
[
i
].
Translate
(
n_frames
,
src
++
,
channels
,
dest
++
,
channels
);
}
}
src/pcm/Dsd2Pcm.hxx
View file @
ee461503
...
...
@@ -31,6 +31,10 @@ or implied, of Sebastian Gesemann.
#ifndef DSD2PCM_H_INCLUDED
#define DSD2PCM_H_INCLUDED
#include "ChannelDefs.hxx"
#include <array>
#include <stddef.h>
#include <stdint.h>
...
...
@@ -79,5 +83,18 @@ private:
float
TranslateSample
(
size_t
ffp
,
uint8_t
src
)
noexcept
;
};
class
MultiDsd2Pcm
{
std
::
array
<
Dsd2Pcm
,
MAX_CHANNELS
>
per_channel
;
public
:
void
Reset
()
noexcept
{
for
(
auto
&
i
:
per_channel
)
i
.
Reset
();
}
void
Translate
(
unsigned
channels
,
size_t
n_frames
,
const
uint8_t
*
src
,
float
*
dest
)
noexcept
;
};
#endif
/* include guard DSD2PCM_H_INCLUDED */
src/pcm/PcmDsd.cxx
View file @
ee461503
...
...
@@ -23,31 +23,18 @@
#include <assert.h>
void
PcmDsd
::
Reset
()
noexcept
{
for
(
auto
&
i
:
dsd2pcm
)
i
.
Reset
();
}
ConstBuffer
<
float
>
PcmDsd
::
ToFloat
(
unsigned
channels
,
ConstBuffer
<
uint8_t
>
src
)
noexcept
{
assert
(
!
src
.
IsNull
());
assert
(
!
src
.
empty
());
assert
(
src
.
size
%
channels
==
0
);
assert
(
channels
<=
dsd2pcm
.
max_size
());
const
size_t
num_samples
=
src
.
size
;
const
size_t
num_frames
=
src
.
size
/
channels
;
float
*
dest
=
buffer
.
GetT
<
float
>
(
num_samples
);
for
(
unsigned
c
=
0
;
c
<
channels
;
++
c
)
{
dsd2pcm
[
c
].
Translate
(
num_frames
,
src
.
data
+
c
,
channels
,
dest
+
c
,
channels
);
}
dsd2pcm
.
Translate
(
channels
,
num_frames
,
src
.
data
,
dest
);
return
{
dest
,
num_samples
};
}
src/pcm/PcmDsd.hxx
View file @
ee461503
...
...
@@ -21,11 +21,8 @@
#define MPD_PCM_DSD_HXX
#include "Buffer.hxx"
#include "ChannelDefs.hxx"
#include "Dsd2Pcm.hxx"
#include <array>
#include <stdint.h>
template
<
typename
T
>
struct
ConstBuffer
;
...
...
@@ -36,10 +33,12 @@ template<typename T> struct ConstBuffer;
class
PcmDsd
{
PcmBuffer
buffer
;
std
::
array
<
Dsd2Pcm
,
MAX_CHANNELS
>
dsd2pcm
;
MultiDsd2Pcm
dsd2pcm
;
public
:
void
Reset
()
noexcept
;
void
Reset
()
noexcept
{
dsd2pcm
.
Reset
();
}
ConstBuffer
<
float
>
ToFloat
(
unsigned
channels
,
ConstBuffer
<
uint8_t
>
src
)
noexcept
;
...
...
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