Home Units Hierarchy Routines All identifiers

Unit unaGSM

DescriptionUsesClasses, Interfaces, Objects and RecordsFunctions and ProceduresTypesConstantsVariables

Description

GSM6.10 codec. Delphi implementation based on C-source code by Jutta Degener and Carsten Bormann

1.0 First release

Uses

Overview

Classes, Interfaces, Objects and Records

Name Description
record gsm_state  
Class unaGSMcoder  
Class unaGSMDecoder GSM Decoder
Class unaGSMEncoder GSM Encoder

Functions and Procedures

function _gsm_mult (a : _word ; b :_word ): _word;
function _gsm_div (num: _word ; denum :_word ): _word;
function _gsm_add (a : _word ; b :_word ): _word;
function _gsm_sub (a : _word ; b :_word ): _word;
function gsm_L_sub (a : _longword ; b :_longword ): _longword;
function _gsm_norm (a : _longword ): _word;
function _gsm_L_asl (a : _longword ; n :int32 ): _longword;
function _gsm_asl (a : _word ; n :int32 ): _word;
function _gsm_L_asr (a : _longword ; n :int32 ): _longword;
function _gsm_asr (a : _word ; n :int32 ): _word;
procedure Gsm_Coder( S: pgsm_state; _s: _pword; LARc: _pword; Nc: _pword; bc: _pword; Mc: _pword; xmaxc: _pword; xMc: _pword );
procedure Gsm_Long_Term_Predictor( S: pgsm_state; d: _pword; dp: _pword; e: _pword; dpp: _pword; Nc: _pword; bc: _pword );
procedure Gsm_LPC_Analysis( S: pgsm_state; _s: _pword; LARc: _pword );
procedure Gsm_Preprocess( S: pgsm_state; _s: _pword; _so: _pword );
procedure Gsm_Short_Term_Analysis_Filter( S: pgsm_state; LARc: _pword; _s: _pword );
procedure Gsm_Decoder( S: pgsm_state; LARcr: _pword; Ncr: _pword; bcr: _pword; Mcr: _pword; xmaxcr: _pword; xMcr: _pword; _s: _pword );
procedure Gsm_Long_Term_Synthesis_Filtering( S: pgsm_state; Ncr: _word; bcr: _word; erp: _pword; drp: _pword );
procedure Gsm_RPE_Decoding( S: pgsm_state; xmaxcr: _word; Mcr: _word; xMcr: _pword; erp: _pword );
procedure Gsm_RPE_Encoding( S: pgsm_state; e: _pword; xmaxc: _pword; Mc: _pword; xMc: _pword );
procedure Gsm_Short_Term_Synthesis_Filter( S: pgsm_state; LARcr: _pword; wt: _pword; _s: _pword );
function gsm_create(): gsm;
procedure gsm_destroy(g: gsm);
function gsm_option (g: gsm; opt: int32; val: pInt32): int32;
procedure gsm_encode (s: gsm; source: pgsm_signal; c: pgsm_byte);
function gsm_decode (s: gsm; c: pgsm_byte; target: pgsm_signal): int32;
function SASR(v: _word; c: int): _word; overload;
function SASR(v: _longword; c: int): _longword; overload;
function GSM_MULT_R(a, b: _word): _word;
function GSM_MULT(a, b: _word): _word;
function GSM_L_MULT(a, b: _longword): _longword;
function GSM_L_ADD(a, b: _longword): _longword;
function GSM_ADD(a, b: _word): _word;
function GSM_SUB(a, b: _word): _word;
function GSM_ABS(a: _word): _word;

Types

_pword = ˆ_word;
_word = int16;
_pwordArray = ˆ_wordArray;
_wordArray = array[word] of _word;
_plongword = ˆ_longword;
_longword = int32;
uword = uint16;
ulongword = uint32;
pgsm_state = ˆgsm_state;
gsm = pgsm_state;
pgsm_signal = ˆgsm_signal;
gsm_signal = int16;
pgsm_byte = ˆgsm_byte;
gsm_byte = byte;
gsm_frame = array[0..33 - 1] of gsm_byte;

Constants

gsm_A: array[0..8 - 1] of _word = (20480, 20480, 20480, 20480, 13964, 15360, 8534, 9036);
gsm_B: array[0..8 - 1] of _word = ( 0, 0, 2048, -2560, 94, -1792, -341, -1144);
gsm_DLB: array[0..4 - 1] of _word = ( 6554, 16384, 26214, 32767 );
gsm_FAC: array[0..8 - 1] of _word = ( 18431, 20479, 22527, 24575, 26623, 28671, 30719, 32767);
gsm_H: array[0..11 - 1] of _word = (-134, -374, 0, 2054, 5741, 8192, 5741, 2054, 0, -374, -134);
gsm_INVA: array[0..8 - 1] of _word = ( 13107, 13107, 13107, 13107, 19223, 17476, 31454, 29708);
gsm_MAC: array[0..8 - 1] of _word = ( 31, 31, 15, 15, 7, 7, 3, 3 );
GSM_MAGIC = $D;
GSM_MAJOR = 1;
gsm_MIC: array[0..8 - 1] of _word = ( -32, -32, -16, -16, -8, -8, -4, -4 );
GSM_MINOR = 0;
gsm_NRFAC: array[0..8 - 1] of _word = ( 29128, 26215, 23832, 21846, 20165, 18725, 17476, 16384);
GSM_OPT_FAST = 2;
GSM_OPT_FRAME_CHAIN = 6;
GSM_OPT_FRAME_INDEX = 5;
GSM_OPT_LTP_CUT = 3;
GSM_OPT_VERBOSE = 1;
GSM_OPT_WAV49 = 4;
GSM_PATCHLEVEL = 10;
gsm_QLB: array[0..4 - 1] of _word = ( 3277, 11469, 21299, 32767 );
MAX_LONGWORD = 2147483647;
MAX_WORD = 32767;
MIN_LONGWORD = (-2147483647 - 1);
MIN_WORD = (-32767 - 1);

Description

Functions and Procedures

function _gsm_mult (a : _word ; b :_word ): _word;

* Prototypes from add.c *

function _gsm_div (num: _word ; denum :_word ): _word;

function gsm_L_mult (a : _word ; b :_word ): _longword;{$IFDEF UNA_OK_INLINE }inline;{$ENDIF UNA_OK_INLINE } function gsm_mult_r (a : _word ; b :_word ): _word;{$IFDEF UNA_OK_INLINE }inline;{$ENDIF UNA_OK_INLINE }

function _gsm_add (a : _word ; b :_word ): _word;
 
function _gsm_sub (a : _word ; b :_word ): _word;

function gsm_L_add (a : _longword ; b :_longword ): _longword;{$IFDEF UNA_OK_INLINE }inline;{$ENDIF UNA_OK_INLINE }

function gsm_L_sub (a : _longword ; b :_longword ): _longword;
 
function _gsm_norm (a : _longword ): _word;

function gsm_abs (a : _word ): _word;{$IFDEF UNA_OK_INLINE }inline;{$ENDIF UNA_OK_INLINE }

function _gsm_L_asl (a : _longword ; n :int32 ): _longword;
 
function _gsm_asl (a : _word ; n :int32 ): _word;
 
function _gsm_L_asr (a : _longword ; n :int32 ): _longword;
 
function _gsm_asr (a : _word ; n :int32 ): _word;
 
procedure Gsm_Coder( S: pgsm_state; _s: _pword; LARc: _pword; Nc: _pword; bc: _pword; Mc: _pword; xmaxc: _pword; xMc: _pword );
 
procedure Gsm_Long_Term_Predictor( S: pgsm_state; d: _pword; dp: _pword; e: _pword; dpp: _pword; Nc: _pword; bc: _pword );
 
procedure Gsm_LPC_Analysis( S: pgsm_state; _s: _pword; LARc: _pword );
 
procedure Gsm_Preprocess( S: pgsm_state; _s: _pword; _so: _pword );
 
procedure Gsm_Short_Term_Analysis_Filter( S: pgsm_state; LARc: _pword; _s: _pword );

procedure Gsm_Encoding( S: pgsm_state; e: _pword; ep: _pword; xmaxc: _pword; Mc: _pword; xMc: _pword );

procedure Gsm_Decoder( S: pgsm_state; LARcr: _pword; Ncr: _pword; bcr: _pword; Mcr: _pword; xmaxcr: _pword; xMcr: _pword; _s: _pword );
 
procedure Gsm_Long_Term_Synthesis_Filtering( S: pgsm_state; Ncr: _word; bcr: _word; erp: _pword; drp: _pword );

procedure Gsm_Decoding( S: pgsm_state; xmaxcr: _word; Mcr: _word; xMcr: _pword; //* [0..12] IN */ erp: _pword //* [0..39] OUT */ );

procedure Gsm_RPE_Decoding( S: pgsm_state; xmaxcr: _word; Mcr: _word; xMcr: _pword; erp: _pword );
 
procedure Gsm_RPE_Encoding( S: pgsm_state; e: _pword; xmaxc: _pword; Mc: _pword; xMc: _pword );
 
procedure Gsm_Short_Term_Synthesis_Filter( S: pgsm_state; LARcr: _pword; wt: _pword; _s: _pword );
 
function gsm_create(): gsm;
 
procedure gsm_destroy(g: gsm);
 
function gsm_option (g: gsm; opt: int32; val: pInt32): int32;

function gsm_print (FILE *, gsm, gsm_byte *): int32;

procedure gsm_encode (s: gsm; source: pgsm_signal; c: pgsm_byte);
 
function gsm_decode (s: gsm; c: pgsm_byte; target: pgsm_signal): int32;
 
function SASR(v: _word; c: int): _word; overload;

function gsm_explode (gsm, gsm_byte *, gsm_signal *): int32; procedure gsm_implode (gsm, gsm_signal *, gsm_byte *); #endif /* GSM_H */

function SASR(v: _longword; c: int): _longword; overload;
 
function GSM_MULT_R(a, b: _word): _word;
 
function GSM_MULT(a, b: _word): _word;
 
function GSM_L_MULT(a, b: _longword): _longword;
 
function GSM_L_ADD(a, b: _longword): _longword;
 
function GSM_ADD(a, b: _word): _word;
 
function GSM_SUB(a, b: _word): _word;
 
function GSM_ABS(a: _word): _word;
 

Types

_pword = ˆ_word;

$Header: /tmp_amd/presto/export/kbs/jutta/src/gsm/RCS/private.h,v 1.6 1996/07/02 10:15:26 jutta Exp $*/ #ifndef PRIVATE_H #define PRIVATE_H

_word = int16;
 
_pwordArray = ˆ_wordArray;
 
_wordArray = array[word] of _word;
 
_plongword = ˆ_longword;
 
_longword = int32;
 
uword = uint16;
 
ulongword = uint32;
 
pgsm_state = ˆgsm_state;
 
gsm = pgsm_state;

* Interface */

pgsm_signal = ˆgsm_signal;
 
gsm_signal = int16;
 
pgsm_byte = ˆgsm_byte;
 
gsm_byte = byte;
 
gsm_frame = array[0..33 - 1] of gsm_byte;
 

Constants

gsm_A: array[0..8 - 1] of _word = (20480, 20480, 20480, 20480, 13964, 15360, 8534, 9036);

#ifndef GSM_TABLE_C Table 4.1 Quantization of the Log.-Area Ratios i 1 2 3 4 5 6 7 8 */

gsm_B: array[0..8 - 1] of _word = ( 0, 0, 2048, -2560, 94, -1792, -341, -1144);
 
gsm_DLB: array[0..4 - 1] of _word = ( 6554, 16384, 26214, 32767 );

Table 4.3a Decision level of the LTP gain quantizer bc 0 1 2 3 */

gsm_FAC: array[0..8 - 1] of _word = ( 18431, 20479, 22527, 24575, 26623, 28671, 30719, 32767);

Table 4.6 Normalized direct mantissa used to compute xM/xmax i 0 1 2 3 4 5 6 7 */

gsm_H: array[0..11 - 1] of _word = (-134, -374, 0, 2054, 5741, 8192, 5741, 2054, 0, -374, -134);

Table 4.4 Coefficients of the weighting filter i 0 1 2 3 4 5 6 7 8 9 10 */

gsm_INVA: array[0..8 - 1] of _word = ( 13107, 13107, 13107, 13107, 19223, 17476, 31454, 29708);

Table 4.2 Tabulation of 1/A[1..8]

gsm_MAC: array[0..8 - 1] of _word = ( 31, 31, 15, 15, 7, 7, 3, 3 );
 
GSM_MAGIC = $D;

33 * 8 bits */

GSM_MAJOR = 1;
 
gsm_MIC: array[0..8 - 1] of _word = ( -32, -32, -16, -16, -8, -8, -4, -4 );
 
GSM_MINOR = 0;
 
gsm_NRFAC: array[0..8 - 1] of _word = ( 29128, 26215, 23832, 21846, 20165, 18725, 17476, 16384);

Table 4.5 Normalized inverse mantissa used to compute xM/xmax i 0 1 2 3 4 5 6 7 */

GSM_OPT_FAST = 2;
 
GSM_OPT_FRAME_CHAIN = 6;
 
GSM_OPT_FRAME_INDEX = 5;
 
GSM_OPT_LTP_CUT = 3;

not supported

GSM_OPT_VERBOSE = 1;
 
GSM_OPT_WAV49 = 4;

not supported

GSM_PATCHLEVEL = 10;

13 kbit/s RPE-LTP */ 1101

gsm_QLB: array[0..4 - 1] of _word = ( 3277, 11469, 21299, 32767 );

Table 4.3b Quantization levels of the LTP gain quantizer bc 0 1 2 3 */

MAX_LONGWORD = 2147483647;
 
MAX_WORD = 32767;
 
MIN_LONGWORD = (-2147483647 - 1);
 
MIN_WORD = (-32767 - 1);

half-byte to carry forward */

Author

(c) 2012 Lake of Soft


Generated by PasDoc 0.12.1 on 2012-10-09