1 /* 2 * File: c2wideband.h 3 * Author: phil 4 * 5 * Created on 02 July 2017, 20:42 6 */ 7 8 #ifndef C2WIDEBAND_H 9 #define C2WIDEBAND_H 10 11 #include "defines.h" 12 #include "phase.h" 13 #include "quantise.h" 14 #include "newamp1.h" 15 #include "codec2_internal.h" 16 17 #define C2WB_K 30 /* rate K vector length */ 18 #define C2WB_FS 16000 19 20 #define C2WB_NT 8 /* number of blocks in time = 160ms blocks */ 21 #define C2WB_TF 0.02 /* 20ms frames */ 22 #define C2WB_DEC 2 /* decimation factor */ 23 #define C2WB_SPERF 30 /* samples per frame */ 24 //TODO: decide what this is 25 #define C2WB_BPERF 256 /* bits per frame */ 26 27 28 typedef struct { 29 int rmap[C2WB_K * C2WB_NT]; 30 int cmap[C2WB_K * C2WB_NT]; 31 } WIDEBAND_MAP; 32 33 34 35 void codec2_decode_wb(struct CODEC2 *c2, short speech[], const unsigned char * bits); 36 37 void calculate_Am_freqs_kHz(float Wo, int L, float p_Am_freqs_kHz[]); 38 void resample_const_rate_f_mel(C2CONST *c2const, MODEL * model, float K, float* rate_K_surface, float* rate_K_sample_freqs_kHz); 39 void correct_rate_K_vec(MODEL *model, float rate_K_vec[], float rate_K_sample_freqs_kHz[], float Am_freqs_kHz[], float orig_AmdB[], int K, float Wo, int L, int Fs, float rate_K_vec_corrected[]); 40 void batch_rate_K_dct2(C2CONST *c2const, MODEL model_frames[], int frames, int vq_en, int plots, int* voicing, float *mean_); 41 void rate_K_dct2(C2CONST *c2const, int n_block_frames, MODEL model_block[n_block_frames], WIDEBAND_MAP * wb_map); 42 void wideband_enc_dec(C2CONST *c2const, int n_block_frames, MODEL model_block[], WIDEBAND_MAP * wb_map, 43 MODEL model_block_[], float * p_dct2_sd, int * p_qn , float rate_K_surface_block[][C2WB_K], float rate_K_surface_block_[][C2WB_K]); 44 void codec2_decode_wb(struct CODEC2 *c2, short speech[], const unsigned char * bits); 45 void codec2_encode_wb(struct CODEC2 *c2, unsigned char * bits, short speech[]); 46 void experiment_rate_K_dct2(C2CONST *c2const, MODEL model_frames[], int frames); 47 48 #ifdef __cplusplus 49 extern "C" { 50 #endif 51 #ifdef __cplusplus 52 } 53 #endif 54 55 #endif /* C2WIDEBAND_H */ 56 57