xref: /aosp_15_r20/external/libopus/dnn/pitchdnn.h (revision a58d3d2adb790c104798cd88c8a3aff4fa8b82cc)
1 #ifndef PITCHDNN_H
2 #define PITCHDNN_H
3 
4 
5 typedef struct PitchDNN PitchDNN;
6 
7 #include "pitchdnn_data.h"
8 
9 #define PITCH_MIN_PERIOD 32
10 #define PITCH_MAX_PERIOD 256
11 
12 #define NB_XCORR_FEATURES (PITCH_MAX_PERIOD-PITCH_MIN_PERIOD)
13 
14 
15 typedef struct {
16   PitchDNN model;
17   float gru_state[GRU_1_STATE_SIZE];
18   float xcorr_mem1[(NB_XCORR_FEATURES + 2)*2];
19   float xcorr_mem2[(NB_XCORR_FEATURES + 2)*2*8];
20   float xcorr_mem3[(NB_XCORR_FEATURES + 2)*2*8];
21 } PitchDNNState;
22 
23 
24 void pitchdnn_init(PitchDNNState *st);
25 int pitchdnn_load_model(PitchDNNState *st, const void *data, int len);
26 
27 float compute_pitchdnn(
28     PitchDNNState *st,
29     const float *if_features,
30     const float *xcorr_features,
31     int arch
32     );
33 
34 #endif
35