NO-OP: clang-format whitespace

This commit is contained in:
Robin Gareus 2018-10-11 00:52:37 +02:00
parent 876e780e4d
commit 8e78827deb
2 changed files with 1106 additions and 1138 deletions

File diff suppressed because it is too large Load diff

View file

@ -17,25 +17,22 @@
// //
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
#ifndef _ZITA_CONVOLVER_H #ifndef _ZITA_CONVOLVER_H
#define _ZITA_CONVOLVER_H #define _ZITA_CONVOLVER_H
#include <fftw3.h>
#include <pthread.h> #include <pthread.h>
#include <stdint.h> #include <stdint.h>
#include <fftw3.h>
#include "zita-convolver/zconvolver_visibility.h" #include "zita-convolver/zconvolver_visibility.h"
namespace ArdourZita { namespace ArdourZita {
#ifdef ZCSEMA_IS_IMPLEMENTED #ifdef ZCSEMA_IS_IMPLEMENTED
#undef ZCSEMA_IS_IMPLEMENTED #undef ZCSEMA_IS_IMPLEMENTED
#endif #endif
#if defined(__linux__) || defined(__GNU__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) #if defined(__linux__) || defined(__GNU__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
#include <semaphore.h> #include <semaphore.h>
@ -43,27 +40,46 @@ namespace ArdourZita {
class LIBZCONVOLVER_API ZCsema class LIBZCONVOLVER_API ZCsema
{ {
public: public:
ZCsema (void)
{
init (0, 0);
}
ZCsema (void) { init (0, 0); } ~ZCsema (void)
~ZCsema (void) { sem_destroy (&_sema); } {
sem_destroy (&_sema);
}
ZCsema (const ZCsema&); // disabled ZCsema (const ZCsema&); // disabled
ZCsema& operator= (const ZCsema&); // disabled ZCsema& operator= (const ZCsema&); // disabled
int init (int s, int v) { return sem_init (&_sema, s, v); } int init (int s, int v)
int post (void) { return sem_post (&_sema); } {
int wait (void) { return sem_wait (&_sema); } return sem_init (&_sema, s, v);
int trywait (void) { return sem_trywait (&_sema); } }
int post (void)
{
return sem_post (&_sema);
}
int wait (void)
{
return sem_wait (&_sema);
}
int trywait (void)
{
return sem_trywait (&_sema);
}
private: private:
sem_t _sema; sem_t _sema;
}; };
#define ZCSEMA_IS_IMPLEMENTED #define ZCSEMA_IS_IMPLEMENTED
#endif #endif
#ifdef __APPLE__ #ifdef __APPLE__
// NOTE: ***** I DO NOT REPEAT NOT PROVIDE SUPPORT FOR OSX ***** // NOTE: ***** I DO NOT REPEAT NOT PROVIDE SUPPORT FOR OSX *****
@ -76,7 +92,6 @@ private:
class LIBZCONVOLVER_API ZCsema class LIBZCONVOLVER_API ZCsema
{ {
public: public:
ZCsema (void) : _count (0) ZCsema (void) : _count (0)
{ {
init (0, 0); init (0, 0);
@ -101,7 +116,8 @@ public:
{ {
pthread_mutex_lock (&_mutex); pthread_mutex_lock (&_mutex);
_count++; _count++;
if (_count == 1) pthread_cond_signal (&_cond); if (_count == 1)
pthread_cond_signal (&_cond);
pthread_mutex_unlock (&_mutex); pthread_mutex_unlock (&_mutex);
return 0; return 0;
} }
@ -109,7 +125,8 @@ public:
int wait (void) int wait (void)
{ {
pthread_mutex_lock (&_mutex); pthread_mutex_lock (&_mutex);
while (_count < 1) pthread_cond_wait (&_cond, &_mutex); while (_count < 1)
pthread_cond_wait (&_cond, &_mutex);
_count--; _count--;
pthread_mutex_unlock (&_mutex); pthread_mutex_unlock (&_mutex);
return 0; return 0;
@ -117,9 +134,9 @@ public:
int trywait (void) int trywait (void)
{ {
if (pthread_mutex_trylock (&_mutex)) return -1; if (pthread_mutex_trylock (&_mutex))
if (_count < 1) return -1;
{ if (_count < 1) {
pthread_mutex_unlock (&_mutex); pthread_mutex_unlock (&_mutex);
return -1; return -1;
} }
@ -129,7 +146,6 @@ public:
} }
private: private:
int _count; int _count;
pthread_mutex_t _mutex; pthread_mutex_t _mutex;
pthread_cond_t _cond; pthread_cond_t _cond;
@ -138,19 +154,15 @@ private:
#define ZCSEMA_IS_IMPLEMENTED #define ZCSEMA_IS_IMPLEMENTED
#endif #endif
#ifndef ZCSEMA_IS_IMPLEMENTED #ifndef ZCSEMA_IS_IMPLEMENTED
#error "The ZCsema class is not implemented." #error "The ZCsema class is not implemented."
#endif #endif
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
class LIBZCONVOLVER_API Inpnode class LIBZCONVOLVER_API Inpnode
{ {
private: private:
friend class Convlevel; friend class Convlevel;
Inpnode (uint16_t inp); Inpnode (uint16_t inp);
@ -158,54 +170,47 @@ private:
void alloc_ffta (uint16_t npar, int32_t size); void alloc_ffta (uint16_t npar, int32_t size);
void free_ffta (void); void free_ffta (void);
Inpnode *_next; Inpnode* _next;
fftwf_complex **_ffta; fftwf_complex** _ffta;
uint16_t _npar; uint16_t _npar;
uint16_t _inp; uint16_t _inp;
}; };
class LIBZCONVOLVER_API Macnode class LIBZCONVOLVER_API Macnode
{ {
private: private:
friend class Convlevel; friend class Convlevel;
Macnode (Inpnode *inpn); Macnode (Inpnode* inpn);
~Macnode (void); ~Macnode (void);
void alloc_fftb (uint16_t npar); void alloc_fftb (uint16_t npar);
void free_fftb (void); void free_fftb (void);
Macnode *_next; Macnode* _next;
Inpnode *_inpn; Inpnode* _inpn;
Macnode *_link; Macnode* _link;
fftwf_complex **_fftb; fftwf_complex** _fftb;
uint16_t _npar; uint16_t _npar;
}; };
class LIBZCONVOLVER_API Outnode class LIBZCONVOLVER_API Outnode
{ {
private: private:
friend class Convlevel; friend class Convlevel;
Outnode (uint16_t out, int32_t size); Outnode (uint16_t out, int32_t size);
~Outnode (void); ~Outnode (void);
Outnode *_next; Outnode* _next;
Macnode *_list; Macnode* _list;
float *_buff [3]; float* _buff[3];
uint16_t _out; uint16_t _out;
}; };
class LIBZCONVOLVER_API Converror class LIBZCONVOLVER_API Converror
{ {
public: public:
enum {
enum
{
BAD_STATE = -1, BAD_STATE = -1,
BAD_PARAM = -2, BAD_PARAM = -2,
MEM_ALLOC = -3 MEM_ALLOC = -3
@ -214,26 +219,21 @@ public:
Converror (int error) : _error (error) {} Converror (int error) : _error (error) {}
private: private:
int _error; int _error;
}; };
class LIBZCONVOLVER_API Convlevel class LIBZCONVOLVER_API Convlevel
{ {
private: private:
friend class Convproc; friend class Convproc;
enum enum {
{
OPT_FFTW_MEASURE = 1, OPT_FFTW_MEASURE = 1,
OPT_VECTOR_MODE = 2, OPT_VECTOR_MODE = 2,
OPT_LATE_CONTIN = 4 OPT_LATE_CONTIN = 4
}; };
enum enum {
{
ST_IDLE, ST_IDLE,
ST_TERM, ST_TERM,
ST_PROC ST_PROC
@ -251,7 +251,7 @@ private:
void impdata_write (uint32_t inp, void impdata_write (uint32_t inp,
uint32_t out, uint32_t out,
int32_t step, int32_t step,
float *data, float* data,
int32_t ind0, int32_t ind0,
int32_t ind1, int32_t ind1,
bool create); bool create);
@ -266,8 +266,8 @@ private:
void reset (uint32_t inpsize, void reset (uint32_t inpsize,
uint32_t outsize, uint32_t outsize,
float **inpbuff, float** inpbuff,
float **outbuff); float** outbuff);
void start (int absprio, int policy); void start (int absprio, int policy);
@ -279,16 +279,15 @@ private:
void cleanup (void); void cleanup (void);
void fftswap (fftwf_complex *p); void fftswap (fftwf_complex* p);
void print (FILE *F); void print (FILE* F);
static void *static_main (void *arg); static void* static_main (void* arg);
void main (void); void main (void);
Macnode *findmacnode (uint32_t inp, uint32_t out, bool create); Macnode* findmacnode (uint32_t inp, uint32_t out, bool create);
volatile uint32_t _stat; // current processing state volatile uint32_t _stat; // current processing state
int _prio; // relative priority int _prio; // relative priority
@ -307,51 +306,44 @@ private:
pthread_t _pthr; // posix thread executing this level pthread_t _pthr; // posix thread executing this level
ZCsema _trig; // sema used to trigger a cycle ZCsema _trig; // sema used to trigger a cycle
ZCsema _done; // sema used to wait for a cycle ZCsema _done; // sema used to wait for a cycle
Inpnode *_inp_list; // linked list of active inputs Inpnode* _inp_list; // linked list of active inputs
Outnode *_out_list; // linked list of active outputs Outnode* _out_list; // linked list of active outputs
fftwf_plan _plan_r2c; // FFTW plan, forward FFT fftwf_plan _plan_r2c; // FFTW plan, forward FFT
fftwf_plan _plan_c2r; // FFTW plan, inverse FFT fftwf_plan _plan_c2r; // FFTW plan, inverse FFT
float *_time_data; // workspace float* _time_data; // workspace
float *_prep_data; // workspace float* _prep_data; // workspace
fftwf_complex *_freq_data; // workspace fftwf_complex* _freq_data; // workspace
float **_inpbuff; // array of shared input buffers float** _inpbuff; // array of shared input buffers
float **_outbuff; // array of shared output buffers float** _outbuff; // array of shared output buffers
}; };
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
class LIBZCONVOLVER_API Convproc class LIBZCONVOLVER_API Convproc
{ {
public: public:
Convproc (void); Convproc (void);
~Convproc (void); ~Convproc (void);
enum enum {
{
ST_IDLE, ST_IDLE,
ST_STOP, ST_STOP,
ST_WAIT, ST_WAIT,
ST_PROC ST_PROC
}; };
enum enum {
{
FL_LATE = 0x0000FFFF, FL_LATE = 0x0000FFFF,
FL_LOAD = 0x01000000 FL_LOAD = 0x01000000
}; };
enum enum {
{
OPT_FFTW_MEASURE = Convlevel::OPT_FFTW_MEASURE, OPT_FFTW_MEASURE = Convlevel::OPT_FFTW_MEASURE,
OPT_VECTOR_MODE = Convlevel::OPT_VECTOR_MODE, OPT_VECTOR_MODE = Convlevel::OPT_VECTOR_MODE,
OPT_LATE_CONTIN = Convlevel::OPT_LATE_CONTIN OPT_LATE_CONTIN = Convlevel::OPT_LATE_CONTIN
}; };
enum enum {
{
MAXINP = 64, MAXINP = 64,
MAXOUT = 64, MAXOUT = 64,
MAXLEV = 8, MAXLEV = 8,
@ -367,14 +359,14 @@ public:
return _state; return _state;
} }
float *inpdata (uint32_t inp) const float* inpdata (uint32_t inp) const
{ {
return _inpbuff [inp] + _inpoffs; return _inpbuff[inp] + _inpoffs;
} }
float *outdata (uint32_t out) const float* outdata (uint32_t out) const
{ {
return _outbuff [out] + _outoffs; return _outbuff[out] + _outoffs;
} }
int configure (uint32_t ninp, int configure (uint32_t ninp,
@ -388,7 +380,7 @@ public:
int impdata_create (uint32_t inp, int impdata_create (uint32_t inp,
uint32_t out, uint32_t out,
int32_t step, int32_t step,
float *data, float* data,
int32_t ind0, int32_t ind0,
int32_t ind1); int32_t ind1);
@ -398,7 +390,7 @@ public:
int impdata_update (uint32_t inp, int impdata_update (uint32_t inp,
uint32_t out, uint32_t out,
int32_t step, int32_t step,
float *data, float* data,
int32_t ind0, int32_t ind0,
int32_t ind1); int32_t ind1);
@ -432,13 +424,12 @@ public:
int cleanup (void); int cleanup (void);
void print (FILE *F = stdout); void print (FILE* F = stdout);
private: private:
uint32_t _state; // current state uint32_t _state; // current state
float *_inpbuff [MAXINP]; // input buffers float* _inpbuff[MAXINP]; // input buffers
float *_outbuff [MAXOUT]; // output buffers float* _outbuff[MAXOUT]; // output buffers
uint32_t _inpoffs; // current offset in input buffers uint32_t _inpoffs; // current offset in input buffers
uint32_t _outoffs; // current offset in output buffers uint32_t _outoffs; // current offset in output buffers
uint32_t _options; // option bits uint32_t _options; // option bits
@ -451,17 +442,15 @@ private:
uint32_t _nlevels; // number of partition sizes uint32_t _nlevels; // number of partition sizes
uint32_t _inpsize; // size of input buffers uint32_t _inpsize; // size of input buffers
uint32_t _latecnt; // count of cycles ending too late uint32_t _latecnt; // count of cycles ending too late
Convlevel *_convlev [MAXLEV]; // array of processors Convlevel* _convlev[MAXLEV]; // array of processors
void *_dummy [64]; void* _dummy[64];
static float _mac_cost; static float _mac_cost;
static float _fft_cost; static float _fft_cost;
}; };
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
} /* end namespace */ } /* end namespace */
#endif #endif