/**********************************************************************
Each of the companies; Qualcomm, and Lucent, and Motorola (hereinafter 
referred to individually as "Source" or collectively as "Sources") do 
hereby state:

To the extent to which the Source(s) may legally and freely do so, the 
Source(s), upon submission of a Contribution, grant(s) a free, 
irrevocable, non-exclusive, license to the Third Generation Partnership 
Project 2 (3GPP2) and its Organizational Partners: ARIB, CCSA, TIA, TTA, 
and TTC, under the Source's copyright or copyright license rights in the 
Contribution, to, in whole or in part, copy, make derivative works, 
perform, display and distribute the Contribution and derivative works 
thereof consistent with 3GPP2's and each Organizational Partner's 
policies and procedures, with the right to (i) sublicense the foregoing 
rights consistent with 3GPP2's and each Organizational Partner's  policies 
and procedures and (ii) copyright and sell, if applicable) in 3GPP2's name 
or each Organizational Partner's name any 3GPP2 or transposed Publication 
even though this Publication may contain the Contribution or a derivative 
work thereof.  The Contribution shall disclose any known limitations on 
the Source's rights to license as herein provided.

When a Contribution is submitted by the Source(s) to assist the 
formulating groups of 3GPP2 or any of its Organizational Partners, it 
is proposed to the Committee as a basis for discussion and is not to 
be construed as a binding proposal on the Source(s).  The Source(s) 
specifically reserve(s) the right to amend or modify the material 
contained in the Contribution. Nothing contained in the Contribution 
shall, except as herein expressly provided, be construed as conferring 
by implication, estoppel or otherwise, any license or right under (i) 
any existing or later issuing patent, whether or not the use of 
information in the document necessarily employs an invention of any 
existing or later issued patent, (ii) any copyright, (iii) any 
trademark, or (iv) any other intellectual property right.

With respect to the Software necessary for the practice of any or 
all Normative portions of the EVRC-WB Variable Rate Speech Codec as 
it exists on the date of submittal of this form, should the EVRC-WB be 
approved as a Specification or Report by 3GPP2, or as a transposed 
Standard by any of the 3GPP2's Organizational Partners, the Source(s) 
state(s) that a worldwide license to reproduce, use and distribute the 
Software, the license rights to which are held by the Source(s), will 
be made available to applicants under terms and conditions that are 
reasonable and non-discriminatory, which may include monetary compensation, 
and only to the extent necessary for the practice of any or all of the 
Normative portions of the EVRC-WB or the field of use of practice of the 
EVRC-WB Specification, Report, or Standard.  The statement contained above 
is irrevocable and shall be binding upon the Source(s).  In the event 
the rights of the Source(s) in and to copyright or copyright license 
rights subject to such commitment are assigned or transferred, the 
Source(s) shall notify the assignee or transferee of the existence of 
such commitments.
*******************************************************************/

Notes on executable compilation
======================================= 
on Cygwin/Linux - use Makefile directly to compile
on Sun OS       - enable "-D__SUNOS4__" before compiling



Notes on executable usages
=================================

S0 77 (EVRC-NW2K) COPs
----------
    * EVRC-NW2K COP 0:
          o Evrc_nw -i <input.pcm> -o <encoder_output.pkt> -e -X OP=<3|Music|Music_MDCT> -X Fsinp=16000 -D <0|1>
          o Evrc_nw -i <encoder_output.pkt> -o <decoder_output.pcm> -d -X Fsop=<8000|16000> (The decoding commands are the same for all the EVRC-NW COPs, thus omitted in below).
    * EVRC-NW2K COP 1:
          o Evrc_nw -i <input.pcm> -o <encoder_output.pkt> -e -W 9.6 -X Fsinp=<8000|16000> -D <0|1>
    * EVRC-NW2K COP 2:
          o Evrc_nw -i <input.pcm> -o <encoder_output.pkt> -e -W 7.5 -X Fsinp=<8000|16000> -D <0|1>
    * EVRC-NW2K COP 3 (new 2kbps mode):
          o Evrc_nw -i <input.pcm> -o <encoder_output.pkt> -e -X OP=2 -M 2 -X Fsinp=<8000|16000> -D <0|1>
    * EVRC-NW2K COP 4:
          o Evrc_nw -i <input.pcm> -o <encoder_output.pkt> -e -W 6.6 -X Fsinp=<8000|16000> -D <0|1>
    * EVRC-NW2K COP 5:
          o Evrc_nw -i <input.pcm> -o <encoder_output.pkt> -e -W 6.2 -X Fsinp=<8000|16000> -D <0|1>
    * EVRC-NW2K COP 6:
          o Evrc_nw -i <input.pcm> -o <encoder_output.pkt> -e -W 5.8 -X Fsinp=<8000|16000> -D <0|1>
    * EVRC-NW2K COP 7 ("half-rate max"):
          o Evrc_nw -i <input.pcm> -o <encoder_output.pkt> -e -X OP=0 -M 3 -X Fsinp=<8000|16000> -D <0|1>

    Notes:	
    1. For EVRC-NW2K COP 0: 
       When OP=3, EVRC-NW2K encodes input signal using one of RCELP/NELP/Silence coding modes on a frame-by-frame basis at the 
       active speech maximum channel rate of 9.6 kbps.
       When OP=Music, EVRC-NW2K encodes input signal using one of MDCT/RCELP/NELP/Silence coding modes on a frame-by-frame basis 
       at the active speech maximum channel rate of 9.6 kbps. 
       When OP=Music_MDCT, EVRC-NW2K encodes input signal using one of MDCT/NELP/Silence coding modes on a frame-by-frame basis 
       at the active speech maximum channel rate of 9.6 kbps.
    2. DTX is enabled by specifying "-D 1" at the encoder; DTX is disabled by specifying "-D 0" at the decoder. 
    3. When DTX is enabled, the encoder generates the regular Rate 1/8 ("Rate 1/8 critical frame", frame type is 1) frames and 
       Rate 1/8 non-critical frames (frame type 255). 
       For circuit-switched applications, the Rate 1/8 non-critical frames should be selectively suppressed using the EVRC-NW 
       MULTIPLEX SUBLAYER JOINT-SOURCE-MODEM DTX SIMULATOR (can be found inside /jsm_dtx/). 
       For packet-switched (VoIP) applications, all the Rate 1/8 non-critical frames should be suppressed before sent out. 


S0 73 (EVRC-NW) COPs
----------
    * EVRC-NW COP 0:
          o Evrc_nw -i <input.pcm> -o <encoder_output.pkt> -e -X OP=<3|Music|Music_MDCT> -X Fsinp=16000 -D <0|1>
          o Evrc_nw -i <encoder_output.pkt> -o <decoder_output.pcm> -d -X Fsop=<8000|16000> (The decoding commands are the same for all the EVRC-NW COPs, thus omitted in below).
    * EVRC-NW COP 1:
          o Evrc_nw -i <input.pcm> -o <encoder_output.pkt> -e -W 9.6 -X Fsinp=<8000|16000> -D <0|1>
    * EVRC-NW COP 2:
          o Evrc_nw -i <input.pcm> -o <encoder_output.pkt> -e -W 7.5 -X Fsinp=<8000|16000> -D <0|1>
    * EVRC-NW COP 3:
          o Evrc_nw -i <input.pcm> -o <encoder_output.pkt> -e -W 7.0 -X Fsinp=<8000|16000> -D <0|1>
    * EVRC-NW COP 4:
          o Evrc_nw -i <input.pcm> -o <encoder_output.pkt> -e -W 6.6 -X Fsinp=<8000|16000> -D <0|1>
    * EVRC-NW COP 5:
          o Evrc_nw -i <input.pcm> -o <encoder_output.pkt> -e -W 6.2 -X Fsinp=<8000|16000> -D <0|1>
    * EVRC-NW COP 6:
          o Evrc_nw -i <input.pcm> -o <encoder_output.pkt> -e -W 5.8 -X Fsinp=<8000|16000> -D <0|1>
    * EVRC-NW COP 7 ("half-rate max"):
          o Evrc_nw -i <input.pcm> -o <encoder_output.pkt> -e -X OP=0 -M 3 -X Fsinp=<8000|16000> -D <0|1>

    Notes:	
    1. For EVRC-NW COP 0: 
       When OP=3, EVRC-NW encodes input signal using one of RCELP/NELP/Silence coding modes on a frame-by-frame basis at the 
       active speech maximum channel rate of 9.6 kbps.
       When OP=Music, EVRC-NW encodes input signal using one of MDCT/RCELP/NELP/Silence coding modes on a frame-by-frame basis 
       at the active speech maximum channel rate of 9.6 kbps. 
       When OP=Music_MDCT, EVRC-NW encodes input signal using one of MDCT/NELP/Silence coding modes on a frame-by-frame basis 
       at the active speech maximum channel rate of 9.6 kbps.
    2. DTX is enabled by specifying "-D 1" at the encoder; DTX is disabled by specifying "-D 0" at the decoder. 
    3. When DTX is enabled, the encoder generates the regular Rate 1/8 ("Rate 1/8 critical frame", frame type is 1) frames and 
       Rate 1/8 non-critical frames (frame type 255). 
       For circuit-switched applications, the Rate 1/8 non-critical frames should be selectively suppressed using the EVRC-NW 
       MULTIPLEX SUBLAYER JOINT-SOURCE-MODEM DTX SIMULATOR (can be found inside /jsm_dtx/). 
       For packet-switched (VoIP) applications, all the Rate 1/8 non-critical frames should be suppressed before sent out. 


SO 70 (EVRC-WB) COPs
----------
    * EVRC-WB COP 0:
          o Evrc_wb -i <input.pcm> -o <encoder_output.pkt> -e -X OP=<3|Music|Music_MDCT> -X Fsinp=16000 -D <0|1>
          o Evrc_wb -i <encoder_output.pkt> -o <decoder_output.pcm> -d -X Fsop=<8000|16000> (The decoding commands are the same for all the EVRC-WB COPs, thus omitted in below).
    * EVRC-WB COP 4:
          o Evrc_wb -i <input.pcm> -o <encoder_output.pkt> -e -W 9.6 -X Fsinp=<8000|16000> -D <0|1>
    * EVRC-WB COP 7 ("half-rate max"):
          o Evrc_wb -i <input.pcm> -o <encoder_output.pkt> -e -X OP=0 -M 3 -X Fsinp=<8000|16000> -D <0|1>

    Notes:	
    1. For EVRC-WB COP 0: 
       When OP=3, EVRC-WB encodes input signal using one of RCELP/NELP/Silence coding modes on a frame-by-frame basis at the 
       active speech maximum channel rate of 9.6 kbps.
       When OP=Music, EVRC-WB encodes input signal using one of MDCT/RCELP/NELP/Silence coding modes on a frame-by-frame basis 
       at the active speech maximum channel rate of 9.6 kbps. 
       When OP=Music_MDCT, EVRC-WB encodes input signal using one of MDCT/NELP/Silence coding modes on a frame-by-frame basis 
       at the active speech maximum channel rate of 9.6 kbps.
    2. DTX is enabled by specifying "-D 1" at the encoder; DTX is disabled by specifying "-D 0" at the decoder. 


SO 68 (EVRC-B) COPs
----------	
    * EVRC-B COP 0:
          o EvrcB -i <input.pcm> -o <encoder_output.pkt> -e -W 9.6 -X Fsinp=<8000|16000> -D <0|1>
          o EvrcB -i <encoder_output.pkt> -o <decoder_output.pcm> -d (The decoding commands are the same for all the EVRC-B COPs, thus omitted in below).
    * EVRC-B COP 1:
          o EvrcB -i <input.pcm> -o <encoder_output.pkt> -e -W 8.5 -X Fsinp=<8000|16000> -D <0|1>
    * EVRC-B COP 2:
          o EvrcB -i <input.pcm> -o <encoder_output.pkt> -e -W 7.5 -X Fsinp=<8000|16000> -D <0|1>
    * EVRC-B COP 3:
          o EvrcB -i <input.pcm> -o <encoder_output.pkt> -e -W 7.0 -X Fsinp=<8000|16000> -D <0|1>
    * EVRC-B COP 4:
          o EvrcB -i <input.pcm> -o <encoder_output.pkt> -e -W 6.6 -X Fsinp=<8000|16000> -D <0|1>
    * EVRC-B COP 5:
          o EvrcB -i <input.pcm> -o <encoder_output.pkt> -e -W 6.2 -X Fsinp=<8000|16000> -D <0|1>
    * EVRC-B COP 6:
          o EvrcB -i <input.pcm> -o <encoder_output.pkt> -e -W 5.8 -X Fsinp=<8000|16000> -D <0|1>
    * EVRC-B COP 7 ("half-rate max"):
          o EvrcB -i <input.pcm> -o <encoder_output.pkt> -e -X OP=0 -M 3 -X Fsinp=<8000|16000> -D <0|1>


Notes on Evrc_all executable usages
=============================

   The Evrc_all executable provides an alternative way to run the codec. Evrc_all allows to specify different 
   service options and COPs directly.
   
   The usage of Evrc_all:
          o Evrc_all -X SO=<68|70|73> -X COP=<0|1|2|3|4|5|6|7> -i <input.pcm> -o <encoder_output.pkt> -e -X Fsinp=<8000|16000> -D <0|1>
	  o Evrc_all -X SO=<68|70|73> -X COP=<0|1|2|3|4|5|6|7> -i <encoder_output.pkt> -o <decoder_output.pcm> -d -X Fsinp=<8000|16000> -D <0|1>

   Notes:
   Service Option 70 only allows COP 0, 4 and 7.

		  
Input/Output Data formats
=========================

- input_speech_file, and decoded_output_speech_file 
	- 8 or 16 KHz, 16-bit(native format (little or big endian)) per sample 
- encoded_packet_file 
	- 12 16-bit words per frame 
	- 1st word is the rate word (4-full, 3-half, 2-quarter, 1-eighth, 0-blank, 0xE-erasure, 0xFF-non critical )
	- followed by 11 words of data (regardless of rate)


Notes on compiling a VoIP client simulation to interface to NCIM
================================================================

Evrc_wb.a 
----------
EVRC-WB VoIP client (DeJitter buffer and Decoder) library that interfaces to NCIM in
3GPP2 C.P1009 (3GPP2 Multimedia Services Evaluation Methodology: Software Tools).

API to this library in codec.h
