-
Notifications
You must be signed in to change notification settings - Fork 1
/
ala_predictor.h
91 lines (70 loc) · 3.18 KB
/
ala_predictor.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#ifndef ALAPREDICTOR_H_INCLUDED
#define ALAPREDICTOR_H_INCLUDED
#include <stdint.h>
/* LPC係数計算ハンドル */
struct ALALPCCalculator;
/* LPC音声合成ハンドル */
struct ALALPCSynthesizer;
/* エンファシスフィルタハンドル */
struct ALAEmphasisFilter;
/* API結果型 */
typedef enum ALAPredictorApiResultTag {
ALAPREDICTOR_APIRESULT_OK, /* OK */
ALAPREDICTOR_APIRESULT_NG, /* 分類不能なエラー */
ALAPREDICTOR_APIRESULT_INVALID_ARGUMENT, /* 不正な引数 */
ALAPREDICTOR_APIRESULT_EXCEED_MAX_ORDER, /* 最大次数を超えた */
ALAPREDICTOR_APIRESULT_FAILED_TO_CALCULATION /* 計算に失敗 */
} ALAPredictorApiResult;
#ifdef __cplusplus
extern "C" {
#endif
/* LPC係数計算ハンドルの作成 */
struct ALALPCCalculator* ALALPCCalculator_Create(uint32_t max_order);
/* LPC係数計算ハンドルの破棄 */
void ALALPCCalculator_Destroy(struct ALALPCCalculator* lpc);
/* Levinson-Durbin再帰計算によりPARCOR係数を求める(倍精度) */
/* 係数parcor_coefはorder+1個の配列 */
ALAPredictorApiResult ALALPCCalculator_CalculatePARCORCoefDouble(
struct ALALPCCalculator* lpcc,
const double* data, uint32_t num_samples,
double* parcor_coef, uint32_t order);
/* LPC音声合成ハンドルの作成 */
struct ALALPCSynthesizer* ALALPCSynthesizer_Create(uint32_t max_order);
/* LPC音声合成ハンドルの破棄 */
void ALALPCSynthesizer_Destroy(struct ALALPCSynthesizer* lpc);
/* PARCOR係数により予測/誤差出力(32bit整数入出力) */
/* 係数parcor_coefはorder+1個の配列 */
ALAPredictorApiResult ALALPCSynthesizer_PredictByParcorCoefInt32(
struct ALALPCSynthesizer* lpcs,
const int32_t* data, uint32_t num_samples,
const int32_t* parcor_coef, uint32_t order,
int32_t* residual);
/* PARCOR係数により誤差信号から音声合成(32bit整数入出力) */
/* 係数parcor_coefはorder+1個の配列 */
ALAPredictorApiResult ALALPCSynthesizer_SynthesizeByParcorCoefInt32(
struct ALALPCSynthesizer* lpcs,
const int32_t* residual, uint32_t num_samples,
const int32_t* parcor_coef, uint32_t order,
int32_t* output);
/* プリエンファシス(int32, in-place) */
ALAPredictorApiResult ALAEmphasisFilter_PreEmphasisInt32(
int32_t* data, uint32_t num_samples, int32_t coef_shift);
/* プリエンファシス(double, in-place) */
ALAPredictorApiResult ALAEmphasisFilter_PreEmphasisDouble(
double* data, uint32_t num_samples, int32_t coef_shift);
/* デエンファシス(int32, in-place) */
ALAPredictorApiResult ALAEmphasisFilter_DeEmphasisInt32(
int32_t* data, uint32_t num_samples, int32_t coef_shift);
/* LR -> MS(double) */
ALAPredictorApiResult ALAChannelDecorrelator_LRtoMSDouble(
double **data, uint32_t num_channels, uint32_t num_samples);
/* LR -> MS(int32_t) */
ALAPredictorApiResult ALAChannelDecorrelator_LRtoMSInt32(
int32_t **data, uint32_t num_channels, uint32_t num_samples);
/* MS -> LR(int32_t) */
ALAPredictorApiResult ALAChannelDecorrelator_MStoLRInt32(
int32_t **data, uint32_t num_channels, uint32_t num_samples);
#ifdef __cplusplus
}
#endif
#endif /* ALAPREDICTOR_H_INCLUDED */