/********************************************************************************************************** /* Created by Abdel Rabassa (AHR) * /* This subroutine takes as input the number of voice frames encapsulated per packets (a simulation setup * /* parameter) and one way ETE delay (a parameter obtain from the simulation on simulation time by parsing * /* incoming RTCP packets). The output is the AMR-NB frame size depending on the Mouth-to-Ear delay value * /* calculated. * /* * /*********************************************************************************************************/ #include using namespace std; /* AMR frame sizes in bytes*/ #define AMR_122_FR_SIZE 31 #define AMR_102_FR_SIZE 26 #define AMR_795_FR_SIZE 21 #define AMR_740_FR_SIZE 19 #define AMR_670_FR_SIZE 18 #define AMR_590_FR_SIZE 16 #define AMR_515_FR_SIZE 14 #define AMR_475_FR_SIZE 13 int AMR_fr_size (double M2E_delay) { int fr_size; // voice frame size [bytes] //Set the AMR frame size depending on the M2E_delay calculated. See documentation for delay limits if (M2E_delay <= 150) fr_size = AMR_122_FR_SIZE; else if (M2E_delay>150 && M2E_delay<=164.3) fr_size = AMR_102_FR_SIZE; else if (M2E_delay>164.3 && M2E_delay<=178.6) fr_size = AMR_795_FR_SIZE; else if (M2E_delay>178.6 && M2E_delay<=192.9) fr_size = AMR_740_FR_SIZE; else if (M2E_delay>192.9 && M2E_delay<=207.2) fr_size = AMR_670_FR_SIZE; else if (M2E_delay>207.2 && M2E_delay<=221.5) fr_size = AMR_590_FR_SIZE; else if (M2E_delay>221.5 && M2E_delay<=235.8) fr_size = AMR_515_FR_SIZE; else if (M2E_delay>235.8) fr_size = AMR_475_FR_SIZE; return fr_size; } void main() { const double fr_duration = 0.02; //Frame duration = 20 ms in AMR-NB int fr_packet; //number of voice frames encapsulated per packet as defined by the modeller double ETE_delay; //One way network delay [ms] double M2E; //Mouth to ear delay [ms]. cout<<"Enter the number of frames per packet : "; cin>>fr_packet; cout<<"Enter One way network delay [ms] : "; cin>>ETE_delay; M2E = (20.5 * fr_packet) + 10 + ETE_delay ; cout<< "Frame size is: "; cout<< AMR_fr_size (M2E)<< " bytes \nFrame duration is: "; cout<