5. Reference Floating-Point C-Code Implementation
The Annex C+ recommendation includes an electronic attachment containing version 2.1 of the reference C-code. This software serves as the official, normative reference for developers, providing a bit-exact model for integrating the G.729 main body with Annexes B, D, and E. This section outlines the structure, execution, and organization of the simulation software.
5.1 Simulation Software Overview
The simulation software consists of two primary ANSI-C programs that simulate the encoder and decoder: coderp.c and decoderp.c. The encoder program processes an input file of 16-bit PCM audio samples and produces a bitstream file. The decoder program reads this bitstream file and generates an output audio file.
The command-line execution syntax for the encoder is: coderp inputfile bitstreamfile dtx_option rate_option
The decoder is executed as: decoderp bitstreamfile outputfile
The encoder options provide control over DTX and bit rate selection:
- dtx_option:
- 0: DTX disabled
- 1: DTX enabled
- rate_option:
- 0: Selects the lower rate (6.4 kbit/s)
- 1: Selects the main G.729 Recommendation rate (8 kbit/s)
- 2: Selects the higher rate (11.8 kbit/s)
If the rate_option is not specified, the simulation defaults to the 8 kbit/s rate.
5.2 Organization of Software Modules
The integrated G.729 floating-point software is organized into a series of modular C files. This file list is derived from the original G.729 Annex C floating-point implementation, with files being modified, added, or reused to support the integrated annexes. The following table provides a list of the key software files, their functional descriptions, and the annexes to which they are primarily associated.
| File Name | Description | Associated Annex(es) |
| Gainpred.c | Gain predictor | C |
| Lpfuncp.c | Miscellaneous routines related to LP filter | C+E |
| Cor_func.c | Miscellaneous routines related to excitation computation | C |
| Pre_proc.c | Pre-processing (HP filtering and scaling) | C |
| P_parity.c | Compute pitch parity | C |
| Pwfc.c | Computation of perceptual weighting coefficients (8 kbit/s) | C |
| Pred_lt3.c | Generation of adaptive codebook | C |
| Post_pro.c | Post processing (HP filtering and scaling) | C |
| Tab_ld8k.c | ROM tables | C |
| Ld8k.h | Function prototypes | C |
| Tab_ld8k.h | Extern ROM table declarations | C |
| Typedef.h | Data type definition (machine dependent) | C |
| Taming.c | Pitch instability control | C |
| Qua_gsp0.c | SID Gain Quantization | B |
| Qua_lsf.c | SID-LSF Quantization | B |
| Tab_dtx.c | ROM tables | B |
| Vad.h | Prototype and Constants | B |
| Octet.h | Octet transmission mode definition | B |
| Tab_dtx.h | Extern ROM table declarations | B |
| Pwfe.c | Computation of perceptual weighting coefficients (11.8 kbit/s) | E |
| Vad.c | VAD | B |
| Dtx.c | DTX Decision | B |
| Dtx.h | Prototype and Constants | B |
| Cng.c | CNG Excitation Calculation | B |
| Dec_sid.c | Decode SID Information | B |
| Phdisp.c | Phase dispersion | C+B |
| Utility.c | Functions | D+E |
| Bwfw.c | Backward/forward switch selection | E |
| Bwfwfunc.c | Miscellaneous routines related to backward/forward switch | E |
| Filter.c | Filter functions | C+E |
| Lpceep.c | LP analysis | C+E |
| Lspdece.c | LSP decoding routines | C+E |
| Lspgetqe.c | LSP quantizer | C+E |
| Qua_lspe.c | LSP quantizer | C+E |
| Track_p.c | Pitch tracking | E |
| Codercp.c | Main encoder routine | C+B+D+E |
| Codld8cp.c | Encoder routine | C+B+D+E |
| Decodcp.c | Main decoder routine | C+B+D+E |
| Decld8cp.c | Decoder routine | C+B+D+E |
| Acelp_cp.c | search ACELP fixed codebook (6.4, 8, 11.8 kbit/s) | C+D+E |
| Dacelp_cp.c | Decode algebraic codebook (6.4, 8, 11.8 kbit/s) | C+D+E |
| Pitchp.c | Pitch search | C+D+E |
| Declagcp.c | Decode adaptive-codebook index | C+D+E |
| Q_gaincp.c | Gain quantizer | C+D+E |
| Decgaincp.c | Decode gain | C+D+E |
| Pstpcp.c | Postfilter routines | C+B+E |
| Bits_cp.c | Bit manipulation routines | C+B+D+E |
| Tabld8cp.c | ROM tables for G.729 at 6.4 and 11.8 kbit/s | D+E |
| Tabld8cp.h | Extern ROM declarations for G.729 at 6.4 and 11.8 kbit/s | D+E |
| Ld8ep.h | Constant and Function prototypes for G.729 at 6.4 and 11.8 kbit/s | D+E |
| Mus_dtct.c | Music detection module | New |
A correct implementation requires adherence not only to this structure but also to the broader set of ITU-T standards upon which it is built.