rjw | 6c1fd8f | 2022-11-30 14:33:01 +0800 | [diff] [blame] | 1 | #ifndef _MRS_EAS_SEARCH_H |
| 2 | #define _MRS_EAS_SEARCH_H |
| 3 | |
| 4 | #include "mrs_common_capability.h" |
| 5 | #include "mrs_common_search.h" |
| 6 | #include "mrs_as_struct.h" |
| 7 | #include "mcc_recog_train_data.h" |
| 8 | #ifdef UNIT_TEST |
| 9 | #include "mcc_recog_test_data.h" |
| 10 | #endif /* UNIT_TEST */ |
| 11 | |
| 12 | #define MRS_EAS_MCC_RECOG_MAX_SUBBAND_NUM 64 //Should be same as MAX_RSSI_SNIFFER_BAND_COMPLETE_SUBBAND |
| 13 | |
| 14 | typedef enum { |
| 15 | MRS_GET_PREDICT_EARFCN_TABLE, |
| 16 | MRS_EAS_GET_PREDICT_FREQ_LIST_BY_PLMN_1, |
| 17 | MRS_EAS_GET_PREDICT_FREQ_LIST_BY_PLMN_2, |
| 18 | MRS_EAS_GET_PREDICT_FREQ_LIST_BY_PLMN_3, |
| 19 | MRS_EAS_GET_PREDICT_FREQ_LIST_BY_PLMN_4, |
| 20 | MRS_EAS_GET_PREDICT_FREQ_LIST_BY_PLMN_5, |
| 21 | MRS_EAS_GET_PREDICT_FREQ_LIST_BY_BAND_1, |
| 22 | }mrs_predict_utility_ut_enum; |
| 23 | |
| 24 | typedef struct eas_mcc_recog_mcc_list { |
| 25 | kal_uint8 mcc_num; |
| 26 | mrs_mcc_id mcc[MCC_RECOG_LTE_MAX_MCC_LEN]; |
| 27 | } mrs_eas_mcc_recog_mcc_list_struct; |
| 28 | |
| 29 | typedef struct |
| 30 | { |
| 31 | EARFCN freq; // The central frequency of each subband. |
| 32 | kal_int16 rssi; // The rssi result (qdBm) or each subband. |
| 33 | } mrs_eas_subband_rssi_struct; |
| 34 | |
| 35 | typedef struct |
| 36 | { |
| 37 | kal_uint16 band; |
| 38 | kal_uint8 subband_num; // The number of subbands to report. |
| 39 | mrs_eas_subband_rssi_struct subband_rssi[MRS_EAS_MCC_RECOG_MAX_SUBBAND_NUM]; |
| 40 | } mrs_eas_band_rssi_distribution_struct; |
| 41 | |
| 42 | typedef struct |
| 43 | { |
| 44 | kal_uint16 band_num; |
| 45 | mrs_eas_band_rssi_distribution_struct band[MCC_RECOG_LTE_BAND_NUM]; |
| 46 | } mrs_eas_rssi_distribution_struct; |
| 47 | |
| 48 | kal_uint16 mrs_eas_get_predict_freq_list_by_plmn( |
| 49 | MRS_SIM_INDEX sim_index, |
| 50 | const mrs_plmn_id_list *plmn_list, |
| 51 | const EARFCN *skip_freq_list, |
| 52 | const kal_uint16 skip_freq_list_num, |
| 53 | EARFCN *predict_freq_list); |
| 54 | |
| 55 | void mrs_get_predict_earfcn_table_by_band(kal_uint32 lte_band, mrs_freq_table_struct *earfcn_table); |
| 56 | void mrs_get_top10_earfcn(mrs_freq_table_struct *earfcn_table); |
| 57 | void mrs_append_top10_earfcn_table(mrs_freq_table_struct *skip_freq_table, mrs_freq_table_struct *output_table); |
| 58 | kal_uint16 mrs_eas_get_predict_freq_list_by_band( |
| 59 | MRS_SIM_INDEX sim_index, |
| 60 | const kal_uint32 band_list_num, |
| 61 | const kal_uint16 *band_list, |
| 62 | const EARFCN *skip_freq_list, |
| 63 | const kal_uint16 skip_freq_list_num, |
| 64 | EARFCN *predict_freq_list // kal_uint32 array[64] |
| 65 | ); |
| 66 | |
| 67 | void mrs_eas_mrs_plmn_id_to_plmn_id(const mrs_plmn_id *src, plmn_id_struct *dst); |
| 68 | void mrs_eas_plmn_id_to_mrs_plmn_id(const plmn_id_struct *src, mrs_plmn_id *dst); |
| 69 | |
| 70 | double mrs_eas_mcc_recog_centered_cosine_distance(const kal_int8 *data1, const kal_int8 *data2, kal_uint32 data_len); |
| 71 | kal_bool mrs_eas_mcc_recog_is_remarkable_band(kal_uint16 band); |
| 72 | mrs_eas_mcc_recog_mcc_list_struct mrs_eas_mcc_recog_get_mcc(mrs_eas_rssi_distribution_struct *rssi_distribution); |
| 73 | void mcc_ai_init_wrapper(); |
| 74 | int mcc_ai_inference_wrapper |
| 75 | (kal_int8 *input_buf, int input_length, |
| 76 | maif_mcc_enum *prediction_mcc_code, float *softmax_probability); |
| 77 | #ifdef UNIT_TEST |
| 78 | void mrs_eas_mcc_recog_regression(); |
| 79 | void mrs_eas_mcc_recog_test(kal_int8 *test_data, kal_uint32 data_len); |
| 80 | #endif /* UNIT_TEST */ |
| 81 | #endif |