Instrument Neutral Distributed Interface INDI  1.9.5
convolution.h
Go to the documentation of this file.
1 /*******************************************************************************
2  Copyright(c) 2017 Jasem Mutlaq. All rights reserved.
3 
4  DSP Convolution plugin
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Library General Public
8  License version 2 as published by the Free Software Foundation.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Library General Public License for more details.
14 
15  You should have received a copy of the GNU Library General Public License
16  along with this library; see the file COPYING.LIB. If not, write to
17  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  Boston, MA 02110-1301, USA.
19 *******************************************************************************/
20 
21 #pragma once
22 
23 #include "dspinterface.h"
24 #include "dsp.h"
25 #include <fitsio.h>
26 #define N_WAVELETS 7
27 #include <string>
28 
29 namespace DSP
30 {
31 class Convolution : public Interface
32 {
33 public:
35  bool ISNewBLOB(const char *dev, const char *name, int sizes[], int blobsizes[], char *blobs[], char *formats[], char *names[], int n) override;
36 
37 protected:
38  ~Convolution();
39  void Activated() override;
40  void Deactivated() override;
41 
42  uint8_t *Callback(uint8_t *out, uint32_t dims, int *sizes, int bits_per_sample) override;
43 
44 private:
45  dsp_stream_p matrix;
46 
47  IBLOBVectorProperty DownloadBP;
48  IBLOB DownloadB;
49 
50  bool matrix_loaded { false };
51  void Convolute();
52 };
53 
54 class Wavelets : public Interface
55 {
56 public:
58  bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override;
59 
60 protected:
61  ~Wavelets();
62  void Activated() override;
63  void Deactivated() override;
64 
65  uint8_t *Callback(uint8_t *out, uint32_t dims, int *sizes, int bits_per_sample) override;
66 
67 private:
68  dsp_stream_p matrix;
69 
70  INumberVectorProperty WaveletsNP;
71  INumber WaveletsN[N_WAVELETS];
72 
73  bool matrix_loaded { false };
74  void Convolute();
75 };
76 }
DSP::Convolution::Convolution
Convolution(INDI::DefaultDevice *dev)
Definition: convolution.cpp:42
DSP::Interface
Definition: dspinterface.h:43
dsp.h
DSP::Convolution::Callback
uint8_t * Callback(uint8_t *out, uint32_t dims, int *sizes, int bits_per_sample) override
Callback Called by processBLOB.
Definition: convolution.cpp:84
DSP::Wavelets::Activated
void Activated() override
Activated Called after activation from client application.
Definition: convolution.cpp:113
INumber
One number descriptor.
_IBLOBVectorProperty
BLOB (Binary Large Object) vector property descriptor.
Definition: indiapi.h:469
DSP::Convolution::ISNewBLOB
bool ISNewBLOB(const char *dev, const char *name, int sizes[], int blobsizes[], char *blobs[], char *formats[], char *names[], int n) override
Definition: convolution.cpp:64
DSP::Convolution::~Convolution
~Convolution()
Definition: convolution.cpp:48
DSP::Wavelets::~Wavelets
~Wavelets()
Definition: convolution.cpp:109
dspinterface.h
dsp_stream_t
Contains a set of informations and data relative to a buffer and how to use it.
Definition: dsp.h:175
DSP::Wavelets::Deactivated
void Deactivated() override
Deactivated Called after deactivation from client application.
Definition: convolution.cpp:119
_INumberVectorProperty
Number vector property descriptor.
Definition: indiapi.h:317
DSP::Wavelets
Definition: convolution.h:54
DSP
The DSP Namespace adds signal processing to INDI drivers. Primarily written for sensors and detectors...
Definition: convolution.cpp:39
DSP::Wavelets::Callback
uint8_t * Callback(uint8_t *out, uint32_t dims, int *sizes, int bits_per_sample) override
Callback Called by processBLOB.
Definition: convolution.cpp:134
name
const char * name
Definition: indiserver.c:116
N_WAVELETS
#define N_WAVELETS
Definition: convolution.h:26
DSP::Convolution::Activated
void Activated() override
Activated Called after activation from client application.
Definition: convolution.cpp:52
DSP::Wavelets::Wavelets
Wavelets(INDI::DefaultDevice *dev)
Definition: convolution.cpp:97
DSP::Wavelets::ISNewNumber
bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Definition: convolution.cpp:125
INDI::DefaultDevice
Class to provide extended functionality for devices in addition to the functionality provided by INDI...
Definition: defaultdevice.h:118
DSP::Convolution::Deactivated
void Deactivated() override
Deactivated Called after deactivation from client application.
Definition: convolution.cpp:58
IBLOB
One Blob (Binary Large Object) descriptor.
DSP::Convolution
Definition: convolution.h:31