diff options
Diffstat (limited to 'baseline/source/gsm_dec/gsm_dec.c')
| -rw-r--r-- | baseline/source/gsm_dec/gsm_dec.c | 762 |
1 files changed, 0 insertions, 762 deletions
diff --git a/baseline/source/gsm_dec/gsm_dec.c b/baseline/source/gsm_dec/gsm_dec.c deleted file mode 100644 index abde144..0000000 --- a/baseline/source/gsm_dec/gsm_dec.c +++ /dev/null | |||
| @@ -1,762 +0,0 @@ | |||
| 1 | /* | ||
| 2 | |||
| 3 | This program is part of the TACLeBench benchmark suite. | ||
| 4 | Version V 2.0 | ||
| 5 | |||
| 6 | Name: gsm_dec | ||
| 7 | |||
| 8 | Author: Jutta Degener and Carsten Bormann, | ||
| 9 | Technische Universitaet Berlin | ||
| 10 | |||
| 11 | Function: Decoding of GSM data | ||
| 12 | |||
| 13 | Source: included in MediaBench/gsm | ||
| 14 | |||
| 15 | Original name: gsm_decode | ||
| 16 | |||
| 17 | Changes: no major functional changes | ||
| 18 | |||
| 19 | License: see the accompanying COPYRIGHT file | ||
| 20 | |||
| 21 | */ | ||
| 22 | |||
| 23 | |||
| 24 | #include "extra.h" | ||
| 25 | #include "gsm.h" | ||
| 26 | #include "add.h" | ||
| 27 | #include "data.h" | ||
| 28 | #include "private.h" | ||
| 29 | |||
| 30 | #define SAMPLES 20 | ||
| 31 | |||
| 32 | /* | ||
| 33 | Forward declaration of global variables | ||
| 34 | */ | ||
| 35 | |||
| 36 | struct gsm_state gsm_dec_state; | ||
| 37 | gsm gsm_dec_state_ptr; | ||
| 38 | volatile int gsm_dec_result; | ||
| 39 | |||
| 40 | /* | ||
| 41 | Forward declaration of functions | ||
| 42 | */ | ||
| 43 | |||
| 44 | extern word gsm_dec_sub( word a, word b ); | ||
| 45 | extern word gsm_dec_asl( word a, int n ); | ||
| 46 | void gsm_dec_Decoding_of_the_coded_Log_Area_Ratios( | ||
| 47 | word *LARc, /* coded log area ratio [0..7] IN */ | ||
| 48 | word *LARpp ); /* out: decoded .. */ | ||
| 49 | |||
| 50 | void gsm_dec_Coefficients_0_12( word *LARpp_j_1, word *LARpp_j, word *LARp ); | ||
| 51 | |||
| 52 | void gsm_dec_LARp_to_rp( word *LARp ); /* [0..7] IN/OUT */ | ||
| 53 | |||
| 54 | extern int gsm_dec_decode( gsm, gsm_byte *, gsm_signal * ); | ||
| 55 | |||
| 56 | extern void gsm_dec_Decoder( struct gsm_state *S, | ||
| 57 | word *LARcr, /* [0..7] IN */ | ||
| 58 | word *Ncr, /* [0..3] IN */ | ||
| 59 | word *bcr, /* [0..3] IN */ | ||
| 60 | word *Mcr, /* [0..3] IN */ | ||
| 61 | word *xmaxcr, /* [0..3] IN */ | ||
| 62 | word *xMcr, /* [0..13*4] IN */ | ||
| 63 | word *s ); /* [0..159] OUT */ | ||
| 64 | |||
| 65 | extern void gsm_dec_Long_Term_Synthesis_Filtering( | ||
| 66 | struct gsm_state *S, word Ncr, word bcr, | ||
| 67 | word *erp, /* [0..39] IN */ | ||
| 68 | word *drp ); /* [-120..-1] IN, [0..40] OUT */ | ||
| 69 | |||
| 70 | void gsm_dec_RPE_Decoding( word xmaxcr, word Mcr, | ||
| 71 | word *xMcr, /* [0..12], 3 bits IN */ | ||
| 72 | word *erp ); /* [0..39] OUT */ | ||
| 73 | |||
| 74 | void gsm_dec_RPE_grid_positioning( word Mc, /* grid position IN */ | ||
| 75 | word *xMp, /* [0..12] IN */ | ||
| 76 | word *ep /* [0..39] OUT */ | ||
| 77 | ); | ||
| 78 | |||
| 79 | void gsm_dec_APCM_inverse_quantization( word *xMc, /* [0..12] IN */ | ||
| 80 | word mant, word exp, | ||
| 81 | word *xMp ); /* [0..12] OUT */ | ||
| 82 | |||
| 83 | extern word gsm_dec_asr( word a, int n ); | ||
| 84 | |||
| 85 | void gsm_dec_APCM_quantization_xmaxc_to_exp_mant( | ||
| 86 | word xmaxc, /* IN */ | ||
| 87 | word *exp_out, /* OUT */ | ||
| 88 | word *mant_out ); /* OUT */ | ||
| 89 | |||
| 90 | void gsm_dec_Postprocessing( struct gsm_state *S, word *s ); | ||
| 91 | |||
| 92 | void gsm_dec_Coefficients_13_26( word *LARpp_j_1, word *LARpp_j, | ||
| 93 | word *LARp ); | ||
| 94 | |||
| 95 | void gsm_dec_Coefficients_40_159( word *LARpp_j, word *LARp ); | ||
| 96 | |||
| 97 | void gsm_dec_Short_term_synthesis_filtering( struct gsm_state *S, | ||
| 98 | word *rrp, /* [0..7] IN */ | ||
| 99 | int k, /* k_end - k_start */ | ||
| 100 | word *wt, /* [0..k-1] IN */ | ||
| 101 | word *sr /* [0..k-1] OUT */ | ||
| 102 | ); | ||
| 103 | |||
| 104 | void gsm_dec_Short_Term_Synthesis_Filter( | ||
| 105 | struct gsm_state *S, word *LARcr, /* received log area ratios [0..7] IN */ | ||
| 106 | word *wt, /* received d [0..159] IN */ | ||
| 107 | word *s /* signal s [0..159] OUT */ | ||
| 108 | ); | ||
| 109 | |||
| 110 | void gsm_dec_Coefficients_27_39( word *LARpp_j_1, word *LARpp_j, word *LARp ); | ||
| 111 | |||
| 112 | gsm gsm_dec_create( void ); | ||
| 113 | void gsm_dec_init( void ); | ||
| 114 | void gsm_dec_main( void ); | ||
| 115 | //int main( void ); | ||
| 116 | |||
| 117 | /* add.c */ | ||
| 118 | |||
| 119 | word gsm_dec_sub( word a, word b ) | ||
| 120 | { | ||
| 121 | longword diff = ( longword )a - ( longword )b; | ||
| 122 | return saturate( diff ); | ||
| 123 | } | ||
| 124 | |||
| 125 | word gsm_dec_asl( word a, int n ) | ||
| 126 | { | ||
| 127 | if ( n >= 16 ) | ||
| 128 | return 0; | ||
| 129 | if ( n <= -16 ) | ||
| 130 | return -( a < 0 ); | ||
| 131 | if ( n < 0 ) | ||
| 132 | return gsm_dec_asr( a, -n ); | ||
| 133 | return a << n; | ||
| 134 | } | ||
| 135 | |||
| 136 | /* short_term.c */ | ||
| 137 | /* | ||
| 138 | SHORT TERM ANALYSIS FILTERING SECTION | ||
| 139 | */ | ||
| 140 | |||
| 141 | /* 4.2.8 */ | ||
| 142 | |||
| 143 | void gsm_dec_Decoding_of_the_coded_Log_Area_Ratios( | ||
| 144 | word *LARc, /* coded log area ratio [0..7] IN */ | ||
| 145 | word *LARpp ) /* out: decoded .. */ | ||
| 146 | { | ||
| 147 | word temp1 /* for STEP */; | ||
| 148 | long ltmp; /* for GSM_ADD */ | ||
| 149 | |||
| 150 | /* This procedure requires for efficient implementation | ||
| 151 | two tables. | ||
| 152 | |||
| 153 | INVA[1..8] = integer( (32768 * 8) / real_A[1..8]) | ||
| 154 | MIC[1..8] = minimum value of the LARc[1..8] | ||
| 155 | */ | ||
| 156 | |||
| 157 | /* Compute the LARpp[1..8] | ||
| 158 | */ | ||
| 159 | |||
| 160 | /* for (i = 1; i <= 8; i++, B++, MIC++, INVA++, LARc++, LARpp++) { | ||
| 161 | |||
| 162 | temp1 = GSM_ADD( *LARc, *MIC ) << 10; | ||
| 163 | temp2 = *B << 1; | ||
| 164 | temp1 = GSM_SUB( temp1, temp2 ); | ||
| 165 | |||
| 166 | temp1 = GSM_MULT_R( *INVA, temp1 ); | ||
| 167 | LARpp = GSM_ADD( temp1, temp1 ); | ||
| 168 | } | ||
| 169 | */ | ||
| 170 | |||
| 171 | #undef STEP | ||
| 172 | #define STEP(B, MIC, INVA) \ | ||
| 173 | temp1 = GSM_ADD(*LARc++, MIC) << 10; \ | ||
| 174 | temp1 = GSM_SUB(temp1, B << 1); \ | ||
| 175 | temp1 = GSM_MULT_R(INVA, temp1); \ | ||
| 176 | *LARpp++ = GSM_ADD(temp1, temp1); | ||
| 177 | |||
| 178 | STEP( 0, -32, 13107 ); | ||
| 179 | STEP( 0, -32, 13107 ); | ||
| 180 | STEP( 2048, -16, 13107 ); | ||
| 181 | STEP( 2560, -16, 13107 ); | ||
| 182 | |||
| 183 | STEP( 94, -8, 19223 ); | ||
| 184 | STEP( 1792, -8, 17476 ); | ||
| 185 | STEP( 341, -4, 31454 ); | ||
| 186 | STEP( 1144, -4, 29708 ); | ||
| 187 | |||
| 188 | /* NOTE: the addition of *MIC is used to restore the sign of *LARc. | ||
| 189 | */ | ||
| 190 | } | ||
| 191 | |||
| 192 | /* 4.2.9 */ | ||
| 193 | /* Computation of the quantized reflection coefficients | ||
| 194 | */ | ||
| 195 | |||
| 196 | /* 4.2.9.1 Interpolation of the LARpp[1..8] to get the LARp[1..8] | ||
| 197 | */ | ||
| 198 | |||
| 199 | /* | ||
| 200 | Within each frame of 160 analyzed speech samples the short term | ||
| 201 | analysis and synthesis filters operate with four different sets of | ||
| 202 | coefficients, derived from the previous set of decoded LARs(LARpp(j-1)) | ||
| 203 | and the actual set of decoded LARs (LARpp(j)) | ||
| 204 | |||
| 205 | (Initial value: LARpp(j-1)[1..8] = 0.) | ||
| 206 | */ | ||
