git-svn-id: http://moon:8086/svn/software/trunk/libsrc/radio@10 b431acfa-c32f-4a4a-93f1-934dc6c82436
159 lines
4.6 KiB
C
Executable File
159 lines
4.6 KiB
C
Executable File
// --------------------------------------------------------------
|
|
#ifndef INTERPOLATION_H
|
|
#define INTERPOLATION_H
|
|
|
|
#include "radio_types.h"
|
|
#include "real.h"
|
|
#include "cpx.h"
|
|
#include <fir/fir2.h>
|
|
#include "ringbuf.h"
|
|
#include "synchronization.h"
|
|
|
|
// --------------------------------------------------------------
|
|
#define CEF_MODE_NOP 0
|
|
#define CEF_MODE_CMA 1
|
|
#define CEF_MODE_DD 2
|
|
#define CEF_MODE_EQ_UPD 3
|
|
|
|
// --------------------------------------------------------------
|
|
// Types
|
|
// --------------------------------------------------------------
|
|
typedef struct _fir_cpx_t
|
|
{
|
|
uint32_t N, r, w;
|
|
cpx_t *pX;
|
|
uint32_t M_up, M_down;
|
|
sample_clock_t clockUp;
|
|
sample_clock_t clockDown;
|
|
} fir_cpx_t;
|
|
|
|
typedef struct _fir_cpx_multirate_stage_t
|
|
{
|
|
uint32_t N;
|
|
uint32_t k;
|
|
uint32_t K;
|
|
cpx_t *pX;
|
|
radio_float_t *pW;
|
|
|
|
} fir_cpx_multirate_stage_t;
|
|
|
|
typedef struct _fir_cpx_multirate_t
|
|
{
|
|
uint32_t N;
|
|
uint32_t L;
|
|
uint32_t M;
|
|
fir_cpx_multirate_stage_t *pStageUp;
|
|
fir_cpx_multirate_stage_t *pStageDown;
|
|
cpx_t res;
|
|
uint32_t k;
|
|
|
|
} fir_cpx_multirate_t;
|
|
|
|
typedef struct _fdly_t
|
|
{
|
|
int32_t Nf;
|
|
radio_float_t *hf, *statef;
|
|
} fdly_t;
|
|
|
|
typedef struct _lgip_t
|
|
{
|
|
int32_t N, bufsize;
|
|
rbuf_t rbuf;
|
|
} lgip_t;
|
|
|
|
typedef struct _lgip_cpx_t
|
|
{
|
|
cpx_t *pFifo;
|
|
uint32_t N, L, w, r;
|
|
|
|
} lgip_cpx_t;
|
|
|
|
typedef struct _fir_pp_t
|
|
{
|
|
uint32_t N, M;
|
|
radio_float_t **ppCoeff, *pState;
|
|
|
|
} fir_pp_t;
|
|
|
|
typedef struct _ppip_t
|
|
{
|
|
radio_float_t **ppCoeff, *pState;
|
|
uint32_t N, M;
|
|
rbuf_t rbuf;
|
|
|
|
} ppip_t;
|
|
|
|
typedef struct _ppip_cpx_t
|
|
{
|
|
cpx_t *pFifo;
|
|
radio_float_t **ppCoeff;
|
|
uint32_t N, L, M, w, r;
|
|
cpx_t *pX;
|
|
|
|
} ppip_cpx_t;
|
|
|
|
typedef struct _ppip_farrow_cpx_t
|
|
{
|
|
cpx_t *pFifo, *pH, *pB;
|
|
radio_float_t **ppCoeff;
|
|
uint32_t N, L, M, w, r;
|
|
cpx_t *pX;
|
|
|
|
} ppip_farrow_cpx_t;
|
|
|
|
// --------------------------------------------------------------
|
|
// Functions
|
|
// --------------------------------------------------------------
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
void FDly_Init(fdly_t *pObj, int32_t order);
|
|
void FDly_Free(fdly_t *pObj);
|
|
void FDly_CalcCoeff(fdly_t *pObj, radio_float_t delay);
|
|
radio_float_t FDly_Process(fdly_t *pObj, radio_float_t x);
|
|
|
|
void LGIpInit(lgip_t *pObj, int32_t order, int32_t bufsize);
|
|
void LGIpFree(lgip_t *pObj);
|
|
radio_float_t LGIpProcess(lgip_t *pObj, radio_float_t x, int32_t m, radio_float_t mu);
|
|
|
|
void LGCpxIpInit(lgip_cpx_t *pObj, int32_t order);
|
|
void LGCpxIpFree(lgip_cpx_t *pObj);
|
|
cpx_t LGCpxIpProcess(lgip_cpx_t *pObj, cpx_t x, int32_t m, radio_float_t mu);
|
|
|
|
radio_float_t PolyPhaseSRRCInit(fir_pp_t *pObj, radio_float_t fa, radio_float_t tsym, radio_float_t alpha, uint32_t N, uint32_t M);
|
|
void PolyPhaseSRRCFree(fir_pp_t *pObj);
|
|
uint32_t PolyPhaseSRRCProcess(fir_pp_t *pObj, radio_float_t mu, radio_float_t *pX, radio_float_t *pY, uint32_t len);
|
|
|
|
radio_float_t PolyPhaseIpInit(ppip_t *pObj, radio_float_t fa, radio_float_t tsym, radio_float_t alpha, uint32_t N, uint32_t M);
|
|
void PolyPhaseIpFree(ppip_t *pObj);
|
|
radio_float_t PolyPhaseIpProcess(ppip_t *pObj, radio_float_t x, int32_t m, radio_float_t mu);
|
|
|
|
radio_float_t PolyPhaseCpxIpInit(ppip_cpx_t *pObj, radio_float_t fa, radio_float_t tsym, radio_float_t alpha, uint32_t N, uint32_t M);
|
|
void PolyPhaseCpxIpFree(ppip_cpx_t *pObj);
|
|
void PolyPhaseCpxIpFeed(ppip_cpx_t *pObj, uint32_t push, cpx_t x);
|
|
cpx_t PolyPhaseCpxIpInterpolate(ppip_cpx_t *pObj, int32_t pop, radio_float_t mu);
|
|
|
|
void FarrowPPIPCpxInit(ppip_farrow_cpx_t *pObj, uint32_t M, uint32_t N);
|
|
void FarrowPPIPCpxFree(ppip_farrow_cpx_t *pObj);
|
|
void FarrowPPIPCpxFeed(ppip_farrow_cpx_t *pObj, uint32_t push, cpx_t x);
|
|
cpx_t FarrowPPIPCpxInterpolate(ppip_farrow_cpx_t *pObj, uint32_t pop, radio_float_t mu);
|
|
|
|
void FirCpxInit(fir_cpx_t *pObj, uint32_t N, uint32_t M_up, uint32_t M_down);
|
|
void FirCpxFree(fir_cpx_t *pObj);
|
|
uint32_t FirCpxProcessReal(fir_cpx_t *pObj, radio_float_t *pW, cpx_t *pSrc, cpx_t *pDst, uint32_t len);
|
|
|
|
void FirCpxMultirateDownInit(fir_cpx_multirate_t *pObj, radio_float_t *pW, uint32_t N, uint32_t M);
|
|
void FirCpxMultirateUpInit(fir_cpx_multirate_t *pObj, radio_float_t *pW, uint32_t N, uint32_t L);
|
|
void FirCpxMultirateUpReinit(fir_cpx_multirate_t *pObj, radio_float_t *pW, uint32_t N, uint32_t L);
|
|
void FirCpxMultirateFree(fir_cpx_multirate_t *pObj);
|
|
uint32_t FirCpxDownProcess(fir_cpx_multirate_t *pObj, cpx_t *pSrc, cpx_t *pDst, uint32_t len);
|
|
uint32_t FirCpxUpProcess(fir_cpx_multirate_t *pObj, cpx_t *pSrc, cpx_t *pDst, uint32_t len);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
// --------------------------------------------------------------
|
|
#endif // INTERPOLATION_H
|