[Repost] WFFY column
A New Generation Open Source VoIP Protection Stack --opal (OpenH323 V2)
Opal is the letters of Open Phone Abstract Library, which is still an open source VoIP protocol stack developed by Equivalence. It has been developed in 2001 until it is not officially released, and only from cvs: http: // CVS. SourceForge.Net/viewcvs.py/openh323/opal downloads the latest version, and now the 2.05bate version has a lot of questions, but these don't prevent me from optimistic about Opal. Opal still uses PWLIB as a development library. The latest PWLib actually only PTLIB, Equivalence has stopped developing the PWLIB's GUI, and the GUI turned to more powerful wxwindows. The maximum feature of OPAL as the next-generation protocol stack of OpenH323 is to join the support for the SIP protocol. OPAL retains most of the OpenH323, and joins the base class for an abstract description of EndPoint, Connection, making it new protocols and devices. It is more simple and convenient.
The most important classes in OPAL are new: OpalManager, which is the same as the H323ndPoint position in OpenH323, which defines the most basic operations in the OPAL system, so each application must derive a class from OpalManager, and then overload virtual functions Implement your own operation. OpalManager :: SetUpCall (partyA, partyB, token); call, partyA a session initiator, partyB recipient is a session OpalManager :: OnIncomingConnection (connection); answer, the answer returns TRUE, then returns FLASH rejected OpalManager :: AdjustMediaFormats (connection , MediaFormats; Adjusting Media Format OpalManager :: ClearCall (Token, REASON, SYNC) Clear Call, Sync If null is NULL, it will not wait for quick return OPALENDPOINT is the base class, H323, SIP, PSTN, IVR, LID, sound card. The endpoints are inherited in this class, and it is worth noting here that even the sound card devices also see a endpoint. OpalpcssendPoint is a more important class in Endpoing. After all, the call or the sound card is used, and the constructor of opalpcssendpoint must reference an instance of the derived OpalManager class.
The following specific example simpleopal is explained: opal = new mymanager; // Newly built an instance if (opal-> initialise (args)) // call mymanager :: initialise () function initialization Opal-> main (args); // Waiting for the user to enter the command cout << "EXITING" << getName () << endl; delete opal; // Wipe PP section initialise () function code: setVideoInputDevice (video); // Set input video device ... setVideooutputDevice (VideoOutputDevice ); // Output video device ... setAudiojitterdelay (minjitter, maxiitter); // Sound jitter cache minimum and maximum ... setMediaformatmask (args.getoptionstring ('d'). Lines ()); // Shielded Media format setMediaformatorder (args.getoptionstring ('p'). Lines ()); // Media format usage sequence ... setTranslationAddress (args.getoptionstring ("translate"); // Set external IP address ... set *** Ports (r GS.GetOptionString ("TCP-BASE"). Asunsigned (), args.getoptionstring ("tcp-max"). asunSigned ()); // Settings related port setstunserver (args.getoptionstring ("stun")); / / Use Stun Server ... pcssep = new mypcssendpoint (* this); // Newly build a MyPCSsendPoint instance PCSsep-> setSoundDevice (args, "sound", psoundchannel :: recorder) // set related play sound equipment ... H323EP = New H323ndPoint (* this); // H323EP initialization H323EP-> DisablefastStart (args.hasoption ('f')); // Close fast dial mode H323EP-> disableh245tunneling (args.hasoption ('t'));
// Close H245 channel mode H323EP-> addaliasName (aliases [i]); // Add nickname H323EP-> setInitialbandWidth; // Limit bandwidth H323EP-> StartListeners // Now start listening, the default is TCP : 1720H323EP-> setgatekeeperpassword (args.getoptionstring ('p')); // Register the password required by the Netlear H323EP-> UsegateKeeper (GKHOST, GKIDENTIFER, GKINTERFACE) // Register> SiPep = New SiPENDPOINT (* This); // SIP also comes to SIPEP-> SetUseRagent ("SIP-User-Agent")); // Setting User Agent, UseERAGENT is equivalent to EndPointSIpep-> setProxy (args.getoptionstring) of OpenH323 "SIP-Proxy")); // Set the SIP agent, here Proxy is equivalent to GatekeePersiPep-> setmimeform ("use-long-mime") in H323; // mime header SIPEP-> StartListeners // Listening start, default is TCP: 5060 and UDP: 5060MAIN () function partial code: IF (pcssep! = Null &&! Pcssep-> incomingconnectionToken) {// Be careful, there is a phone to IF (cmd = = "n") PCSsep-> CLEA RCALL (pcssep-> incomingconnectionToken, // I don't pick OpalConnection :: endedbyrefusal); Else IF (cmd == "y") PCSsep-> acceptincomingconnection (pcssep-> // Hello, Xiaoli? incomingConnectionToken;} ... opalall * call = findcallwithlock (currentCallToken); // Let me see that the call if (call! = null) {cout << "clearing call" << * Call << Endl; Call -> Clear (); // nonsense so much, hit the IP phone, hit Call-> unlock (); ... if (Potsep! =
NULL) / / Is it a computer or a machine? SetupCall ("Pots: *", Params [1], CurrentCallToken; // Holder Bar (PSTN) Else SetupCall ("PC: *", params [1], currentcalltoken); // PC does not want money, 嘿 嘿 opal The example MFC is not available at all. OpenPhone's GUI uses wxwindows, so you must have wxwindows to be properly compiled. OpalGW I have tried many times, I can't let others register, it seems that the road to opal is still very long, but Equivalence has developed has gradually turned from OpenH323 to OPAL, and I believe that a stable opal will be released.
G.729 and G.723 speech coding introduction and optimization
Voice coding is divided into waveform encoding, parameter encoding, and hybrid encoding. The waveform encoding is the waveform of the speech signal to process and processing, the parameter code is based on the digital model generated by the voice signal, and the model parameters are obtained, and then restore the number according to these parameters. Model, synthetic voice. Mixed coding is a long place in which waveform coding and parameter encoding is combined, and high quality speech synthesis at the rate of 4-16 kbps. For example, multi-pulsed excitation linear prediction coding (MPLPC), codebook excitation linear prediction coding (CELP) is mixed encoded.
The hearing range of human vesicles is 20-20kHz. At the fundamental sampling, it is necessary to ensure that the sound is not true, it must be sampling with 44kHz, but the scope of people are 300-3400 Hz, so they are mainly sampled with 8kHz.
Before the waveform encoding, the analog speech signal is first sampled, and then the sampling result is quantified, and the binary encoding is performed. The parameter encoding is the value of the parameters of the digital model. It is currently the non-loss of tube discrete time model. The model integrates the most important three factors of voices: Sound doors, excitation and radiation. These three factors can be expressed in mathematical functions. Then, in the non-uniformity and correlation of the speech signal, the non-uniformity manifests has a large probability that the small amplitude signal is large, and the correlation is expressed in two samples associated with the adjacent sample points and the separation of the chromatin cycle. Point is also related. The linear prediction is used to calculate the signal that appears from the original speech signal. And some of the time in normal conversation is mute, only listening to the other party, speech detection VAD is used to determine whether it is mute, and soft noise regeneration CNG is used to generate a "good" mute to each other. ,
G.729 and G.723 are ITU-formulated applications for IP phone voice coding, because of its high quality, low yield rate, which is widely used, and the following introduction:
G.729 is the 8kbps of the 8kbps of the ITU, which is converted into bytes, which uses an arithmetic code excitation linear prediction (CS-ACELP) using a conjugate structure. G.723 is also ITU, but it is a dual rate voice code, which works in two ways of 5.3kbps and 6.3kbps, and the corresponding individual code excitation linear prediction (ACELP) and multi-pulse maximize energy quantization (MP) -Mlq).
If you register a account on the ITU, you can download the reality C source code and describe the document, compile and run under VC 6, but found that the coding efficiency is too low, the encoding time is basically 5-6 times. The ITU's source code is the most basic calculation, and has not been optimized, so the efficiency is extremely low. Before optimizing a debugging software DevPartner Studio Professional, it can perform error analysis and performance analysis, powerful, easy to operate.
The source code is analyzed by DEVPARTNER. Even if G.729 is also G.723, most of the operations are concentrated in the Basic_op.c function, and Basic_op.c is all basic operations, L_Mac (), L_Mult (), L_ADD ( ) And Sature () also occupy most of the operations in Basic_op.c. So optimization should also be concentrated in these functions. In Basic_op.c has an overflow flag Overflow, many basic functions are mostly wasting a lot of time, in fact, can be removed directly, directly judging the results, you can know if it is overflow, and the function of Basic_op.c MMX instruction optimization, use its saturation characteristics to lose a lot of judgment overflow operation, give an additional example word16 add (Word16 Var1, Word16 var2) {_ASM {MOVD MM0, Var1; MOVD MM1, VAR2; Paddsw MM0, MM1 MOVD EAX, MM0; EMMS;}} The source code in the source code is called, for example, the L_Mult and L_ADD functions are called. If you fill in the L_Mult and L_ADD code directly in l_mac, you can save a lot of functions. For the detailed description of the algorithm in the ITU code, there are many similar cycles that are not merged, and their merge can also increase efficiency, and some of the calculations in the cycle can also mention the cyclic body, the number of cycles controlled with for () is best. Use parameters so that the compiler can unlocate the loop. Because I have limited energy and energy, it is only optimized at the source code level, but it has also achieved considerable effects, and the optimized efficiency is doubled before optimization. If you do A deeper algorithm optimization believes that there will be higher improvements. When you click Download, let you enter your password, click Electrol Bookshop on the right, then select I wish to register in Order to Download Up to Three (3) Itu Recommendations Free of Charge Register an account, then select I have already registered and wish to Download Itu Recommendations Free Of Charge can download 3 times, you can download more than a few registration.
I see VoIP technology