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
e565dcf1
Commit
e565dcf1
authored
Jan 14, 2020
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pcm/dsd2pcm: convert to C++
parent
5a87fc7c
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
23 deletions
+20
-23
Dsd2Pcm.cxx
src/pcm/Dsd2Pcm.cxx
+17
-12
Dsd2Pcm.hxx
src/pcm/Dsd2Pcm.hxx
+1
-9
PcmDsd.cxx
src/pcm/PcmDsd.cxx
+1
-1
meson.build
src/pcm/meson.build
+1
-1
No files found.
src/pcm/
dsd2pcm/dsd2pcm.c
→
src/pcm/
Dsd2Pcm.cxx
View file @
e565dcf1
...
...
@@ -2,6 +2,8 @@
Copyright 2009, 2011 Sebastian Gesemann. All rights reserved.
Copyright 2020 Max Kellermann <max.kellermann@gmail.com>
Redistribution and use in source and binary forms, with or without modification, are
permitted provided that the following conditions are met:
...
...
@@ -28,21 +30,25 @@ or implied, of Sebastian Gesemann.
*/
#include "Dsd2Pcm.hxx"
#include "util/bit_reverse.h"
#include <stdlib.h>
#include <string.h>
#include "dsd2pcm.h"
/** number of FIR constants */
static
constexpr
size_t
HTAPS
=
48
;
/** number of "8 MACs" lookup tables */
static
constexpr
int
CTABLES
=
(
HTAPS
+
7
)
/
8
;
#define HTAPS 48
/* number of FIR constants */
#define FIFOSIZE 16
/* must be a power of two */
#define FIFOMASK (FIFOSIZE-1)
/* bit mask for FIFO offsets */
#define CTABLES ((HTAPS+7)/8)
/* number of "8 MACs" lookup tables */
/* must be a power of two */
static
constexpr
int
FIFOSIZE
=
16
;
#if FIFOSIZE*8 < HTAPS*2
#error "FIFOSIZE too small"
#endif
/** bit mask for FIFO offsets */
static
constexpr
size_t
FIFOMASK
=
FIFOSIZE
-
1
;
static_assert
(
FIFOSIZE
*
8
>=
HTAPS
*
2
,
"FIFOSIZE too small"
);
/*
* Properties of this 96-tap lowpass filter when applied on a signal
...
...
@@ -64,7 +70,7 @@ or implied, of Sebastian Gesemann.
/*
* The 2nd half (48 coeffs) of a 96-tap symmetric lowpass filter
*/
static
const
double
htaps
[
HTAPS
]
=
{
static
const
expr
double
htaps
[
HTAPS
]
=
{
0.09950731974056658
,
0.09562845727714668
,
0.08819647126516944
,
...
...
@@ -118,7 +124,7 @@ static const double htaps[HTAPS] = {
static
float
ctables
[
CTABLES
][
256
];
static
int
precalculated
=
0
;
static
void
precalc
(
void
)
static
void
precalc
()
{
int
t
,
e
,
m
,
k
;
double
acc
;
...
...
@@ -143,7 +149,7 @@ struct dsd2pcm_ctx_s
unsigned
fifopos
;
};
extern
dsd2pcm_ctx
*
dsd2pcm_init
(
void
)
extern
dsd2pcm_ctx
*
dsd2pcm_init
()
{
dsd2pcm_ctx
*
ptr
;
if
(
!
precalculated
)
precalc
();
...
...
@@ -211,4 +217,3 @@ extern void dsd2pcm_translate(
}
ptr
->
fifopos
=
ffp
;
}
src/pcm/
dsd2pcm/dsd2pcm.h
→
src/pcm/
Dsd2Pcm.hxx
View file @
e565dcf1
...
...
@@ -33,10 +33,6 @@ or implied, of Sebastian Gesemann.
#include <stddef.h>
#ifdef __cplusplus
extern
"C"
{
#endif
struct
dsd2pcm_ctx_s
;
typedef
struct
dsd2pcm_ctx_s
dsd2pcm_ctx
;
...
...
@@ -49,7 +45,7 @@ typedef struct dsd2pcm_ctx_s dsd2pcm_ctx;
* POSIX thread-safety definition because it modifies global state
* (lookup tables are computed during the first call)
*/
extern
dsd2pcm_ctx
*
dsd2pcm_init
(
void
);
extern
dsd2pcm_ctx
*
dsd2pcm_init
();
/**
* deinitializes a "dsd2pcm engine"
...
...
@@ -85,9 +81,5 @@ extern void dsd2pcm_translate(dsd2pcm_ctx *ctx,
int
lsbitfirst
,
float
*
dst
,
ptrdiff_t
dst_stride
);
#ifdef __cplusplus
}
/* extern "C" */
#endif
#endif
/* include guard DSD2PCM_H_INCLUDED */
src/pcm/PcmDsd.cxx
View file @
e565dcf1
...
...
@@ -18,7 +18,7 @@
*/
#include "PcmDsd.hxx"
#include "
dsd2pcm/dsd2pcm.h
"
#include "
Dsd2Pcm.hxx
"
#include "util/ConstBuffer.hxx"
#include <assert.h>
...
...
src/pcm/meson.build
View file @
e565dcf1
...
...
@@ -28,7 +28,7 @@ if get_option('dsd')
'Dsd16.cxx',
'Dsd32.cxx',
'PcmDsd.cxx',
'
dsd2pcm/dsd2pcm.c
',
'
Dsd2Pcm.cxx
',
]
endif
...
...
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