forked from hegdi/libldacdec
-
Notifications
You must be signed in to change notification settings - Fork 7
/
libldacBT_dec.h
282 lines (228 loc) · 6.06 KB
/
libldacBT_dec.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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
#ifndef __LDACBTDEC_H_
#define __LDACBTDEC_H_
typedef unsigned char undefined;
typedef unsigned char bool;
typedef unsigned char byte;
typedef unsigned int dword;
typedef unsigned char uchar;
typedef unsigned int uint;
typedef unsigned long ulong;
typedef unsigned long long ulonglong;
typedef unsigned char undefined1;
typedef unsigned short undefined2;
typedef unsigned int undefined4;
typedef unsigned long long undefined8;
typedef unsigned short ushort;
typedef unsigned short word;
typedef struct _st_ldacbt_config _st_ldacbt_config, *P_st_ldacbt_config;
typedef struct _st_ldacbt_config * P_LDACBT_CONFIG;
struct _st_ldacbt_config {
int id;
int nfrm_in_pkt;
int frmlen;
int frmlen_1ch;
};
typedef struct _st_ldacbt_eqmid_property _st_ldacbt_eqmid_property, *P_st_ldacbt_eqmid_property;
struct _st_ldacbt_eqmid_property {
int eqmid;
char strModeName[4];
int id_for_2DH5;
};
typedef struct _audio_block_ldac _audio_block_ldac, *P_audio_block_ldac;
typedef struct _audio_channel_ldac _audio_channel_ldac, *P_audio_channel_ldac;
typedef struct _audio_channel_ldac AC;
typedef struct _audio_block_ldac AB;
typedef struct _audio_channel_sub_ldac _audio_channel_sub_ldac, *P_audio_channel_sub_ldac;
typedef struct _audio_channel_sub_ldac ACSUB;
struct _audio_block_ldac {
int blk_type;
int blk_nchs;
int nbands;
int nqus;
int unk1;
int unk2;
int grad_mode;
int grad_qu_l;
int grad_qu_h;
int grad_os_l;
int grad_os_h;
int a_grad[50];
int nadjqus;
int abc_status;
int nbits_ab;
int nbits_band;
int nbits_grad;
int nbits_scfc;
int nbits_spec;
int nbits_avail;
int nbits_used;
int * p_smplrate_id;
int * p_error_code;
AC * ap_ac[2];
};
struct _audio_channel_ldac {
int ich;
int frmana_cnt;
int unk3;
int sfc_mode;
int sfc_bitlen;
int sfc_offset;
int sfc_weight;
int a_idsf[34];
int a_idwl1[34];
int a_idwl2[34];
int a_addwl[34];
int a_tmp[34];
int a_qspec[256];
int a_rspec[256];
AB * p_ab;
ACSUB * p_ascub;
};
struct _audio_channel_sub_ldac {
float a_time[512];
float a_spec[256];
};
typedef union IEEE754_FI IEEE754_FI, *PIEEE754_FI;
union IEEE754_FI {
float f;
int i;
};
typedef struct _config_info_ldac _config_info_ldac, *P_config_info_ldac;
typedef struct _config_info_ldac CFG;
struct _config_info_ldac {
int syncword;
int smplrate_id;
int chconfig_id;
int ch;
int frame_length;
int frame_status;
};
typedef struct _sfinfo_ldac _sfinfo_ldac, *P_sfinfo_ldac;
typedef struct _sfinfo_ldac SFINFO;
struct _sfinfo_ldac {
CFG CFG;
AB * p_ab;
AC * ap_ac[2];
char * p_mempos;
int error_code;
};
enum{
_2_DH1=3,
_2_DH2=4,
_2_DH3=5,
_3_DH1=6,
_3_DH2=7,
_3_DH3=8,
___DH1=0,
___DH2=1,
___DH3=2
};
typedef enum LDAC_SMPL_FMT_T {
LDAC_SMPL_FMT_F32=5,
LDAC_SMPL_FMT_MAX=2147483647,
LDAC_SMPL_FMT_NONE=0,
LDAC_SMPL_FMT_NUM=6,
LDAC_SMPL_FMT_S08=1,
LDAC_SMPL_FMT_S16=2,
LDAC_SMPL_FMT_S24=3,
LDAC_SMPL_FMT_S32=4
} LDAC_SMPL_FMT_T;
typedef struct _handle_ldac_struct _handle_ldac_struct, *P_handle_ldac_struct;
struct _handle_ldac_struct {
int nlnn;
int nbands;
int grad_mode;
int grad_qu_l;
int grad_qu_h;
int grad_os_l;
int grad_os_h;
int abc_status;
int error_code;
SFINFO sfinfo;
};
typedef struct _ldacbt_pcm_ring_buf _ldacbt_pcm_ring_buf, *P_ldacbt_pcm_ring_buf;
typedef struct _ldacbt_pcm_ring_buf LDACBT_PCM_RING_BUF;
struct _ldacbt_pcm_ring_buf {
char buf[6144];
int wp;
int rp;
int nsmpl;
};
typedef struct _ldacbt_transport_frame_buf _ldacbt_transport_frame_buf, *P_ldacbt_transport_frame_buf;
struct _ldacbt_transport_frame_buf {
char buf[1024];
int used;
int nfrm_in;
};
typedef struct _st_ldacbt_handle _st_ldacbt_handle, *P_st_ldacbt_handle;
typedef struct _handle_ldac_struct * HANDLE_LDAC;
typedef enum LDACBT_PROCMODE {
LDACBT_PROCMODE_DECODE=2,
LDACBT_PROCMODE_ENCODE=1,
LDACBT_PROCMODE_UNSET=4294967295
} LDACBT_PROCMODE;
typedef struct _ldacbt_pcm_info _ldacbt_pcm_info, *P_ldacbt_pcm_info;
typedef struct _ldacbt_pcm_info LDACBT_PCM_INFO;
typedef struct _ldacbt_tx_info _ldacbt_tx_info, *P_ldacbt_tx_info;
typedef struct _ldacbt_tx_info LDACBT_TX_INFO;
typedef struct _ldacbt_transport_frame_buf LDACBT_TRANSPORT_FRM_BUF;
typedef enum LDACBT_SMPL_FMT_T {
LDACBT_SMPL_FMT_F32=5,
LDACBT_SMPL_FMT_S16=2,
LDACBT_SMPL_FMT_S24=3,
LDACBT_SMPL_FMT_S32=4
} LDACBT_SMPL_FMT_T;
struct _ldacbt_tx_info {
int mtu;
int tx_size;
int pkt_type;
int pkt_hdr_sz;
int nrfm_in_pkt;
};
struct _ldacbt_pcm_info {
int sf;
int ch;
int wl;
enum LDACBT_SMPL_FMT_T fmt;
};
struct _st_ldacbt_handle {
HANDLE_LDAC hLDAC;
enum LDACBT_PROCMODE proc_mode;
int error_code;
int error_code_api;
LDACBT_PCM_INFO pcm;
LDACBT_TX_INFO tx;
int frm_samples;
int sfid;
int nshift;
int flg_encode_flushed;
int frm_status;
int frmlen;
int frmlen_tx;
int bitrate;
int eqmid;
int tgt_eqmid;
int tgt_nfrm_in_pkt;
int tgt_frmlen;
int stat_alter_op;
int cm;
int cci;
int transport;
int some_code;
LDACBT_TRANSPORT_FRM_BUF ldac_trns_frm_buf;
LDACBT_PCM_RING_BUF pcmring;
char * * pp_pcm;
char * ap_pcm[2];
char a_pcm[4096];
};
typedef struct _st_ldacbt_handle STRUCT_LDACBT_HANDLE;
typedef uchar STREAM;
typedef struct _st_ldacbt_eqmid_property * P_LDACBT_EQMID_PROPERTY;
typedef struct _st_ldacbt_handle * HANDLE_LDAC_BT;
typedef struct _st_ldacbt_eqmid_property LDACBT_EQMID_PROPERTY;
typedef struct _st_ldacbt_config LDACBT_CONFIG;
int ldacBT_decode(HANDLE_LDAC_BT hLdacBT, uchar *p_stream, void *p_pcm, LDACBT_SMPL_FMT_T fmt, int stream_sz, int *used_bytes, int *pcm_sz);
int ldacBT_init_handle_decode(HANDLE_LDAC_BT hLdacBT, int cm, int sf, int nshift, int var1, int var2);
HANDLE_LDAC_BT ldacBT_get_handle(void);
void ldacBT_free_handle(HANDLE_LDAC_BT hLdacBT);
#endif // __LDACBTDEC_H_