diff options
Diffstat (limited to 'baseline/source/adpcm_dec')
| -rw-r--r-- | baseline/source/adpcm_dec/ChangeLog.txt | 32 | ||||
| -rw-r--r-- | baseline/source/adpcm_dec/adpcm_dec.c | 719 | ||||
| -rw-r--r-- | baseline/source/adpcm_dec/timedTest.txt | 100 |
3 files changed, 851 insertions, 0 deletions
diff --git a/baseline/source/adpcm_dec/ChangeLog.txt b/baseline/source/adpcm_dec/ChangeLog.txt new file mode 100644 index 0000000..b9c4f96 --- /dev/null +++ b/baseline/source/adpcm_dec/ChangeLog.txt | |||
| @@ -0,0 +1,32 @@ | |||
| 1 | File: minver.c | ||
| 2 | Original provenience: SNU-RT Benchmark Suite for Worst Case Timing Analysis | ||
| 3 | |||
| 4 | 2016-02-26: | ||
| 5 | - Added TACLeBench header to line 1 | ||
| 6 | - Rename global variable a to minver_a | ||
| 7 | - Rename global variable b to minver_b | ||
| 8 | - Rename global variable c to minver_c | ||
| 9 | - Rename global variable aa to minver_aa | ||
| 10 | - Rename global variable a_i to minver_a_i | ||
| 11 | - Rename global variable e to minver_e | ||
| 12 | - Rename global variable det to minver_det | ||
| 13 | - Renamed function minver to minver_minver | ||
| 14 | - Renamed function mmul to minver_mmul | ||
| 15 | - Renamed function fabs to minver_fabs | ||
| 16 | - Renamed function main to minver_main | ||
| 17 | - Created new function main, calling minver_init, minver_main and | ||
| 18 | returning minver_return | ||
| 19 | - Reordered functions in source code: initialization- and | ||
| 20 | return-value-related functions first, followed by algorithm core | ||
| 21 | functions, followed by main functions | ||
| 22 | - Applied code formatting with astyle as in the example | ||
| 23 | |||
| 24 | 2016-03-09: | ||
| 25 | - Removed static keyword for global variables | ||
| 26 | - Renamed global variables, prepended adpcm_dec | ||
| 27 | |||
| 28 | 2016-05-23: | ||
| 29 | - Check sum added and checked against the expected value | ||
| 30 | |||
| 31 | 2016-05-25: | ||
| 32 | - Corrected expected value \ No newline at end of file | ||
diff --git a/baseline/source/adpcm_dec/adpcm_dec.c b/baseline/source/adpcm_dec/adpcm_dec.c new file mode 100644 index 0000000..6811e69 --- /dev/null +++ b/baseline/source/adpcm_dec/adpcm_dec.c | |||
| @@ -0,0 +1,719 @@ | |||
| 1 | /* | ||
| 2 | |||
| 3 | This program is part of the TACLeBench benchmark suite. | ||
| 4 | Version V 1.x | ||
| 5 | |||
| 6 | Name: adpcm_dec | ||
| 7 | |||
| 8 | Author: Sung-Soo Lim | ||
| 9 | |||
| 10 | Function: | ||
| 11 | CCITT G.722 ADPCM (Adaptive Differential Pulse Code Modulation) | ||
| 12 | algorithm. | ||
| 13 | 16khz sample rate data is stored in the array test_data[SIZE]. | ||
| 14 | Results are stored in the array compressed[SIZE] and result[SIZE]. | ||
| 15 | Execution time is determined by the constant SIZE (default value | ||
| 16 | is 2000). | ||
| 17 | |||
| 18 | Source: SNU-RT Benchmark Suite | ||
| 19 | |||
| 20 | Changes: adpcm benchmark was split into decode and encode benchmark | ||
| 21 | |||
| 22 | License: may be used, modified, and re-distributed freely, but | ||
| 23 | the SNU-RT Benchmark Suite must be acknowledged | ||
| 24 | |||
| 25 | */ | ||
| 26 | |||
| 27 | /* | ||
| 28 | This program is derived from the SNU-RT Benchmark Suite for Worst | ||
| 29 | Case Timing Analysis by Sung-Soo Lim | ||
| 30 | |||
| 31 | Original source: C Algorithms for Real-Time DSP by P. M. Embree | ||
| 32 | */ | ||
| 33 | |||
| 34 | /* | ||
| 35 | Forward declaration of functions | ||
| 36 | */ | ||
| 37 | |||
| 38 | #include "../extra.h" | ||
| 39 | |||
| 40 | void adpcm_dec_decode( int ); | ||
| 41 | int adpcm_dec_filtez( int *bpl, int *dlt ); | ||
| 42 | void adpcm_dec_upzero( int dlt, int *dlti, int *bli ); | ||
| 43 | int adpcm_dec_filtep( int rlt1, int al1, int rlt2, int al2 ); | ||
| 44 | |||
| 45 | int adpcm_dec_logscl( int il, int nbl ); | ||
| 46 | int adpcm_dec_scalel( int nbl, int shift_constant ); | ||
| 47 | int adpcm_dec_uppol2( int al1, int al2, int plt, int plt1, int plt2 ); | ||
| 48 | int adpcm_dec_uppol1( int al1, int apl2, int plt, int plt1 ); | ||
| 49 | |||
| 50 | int adpcm_dec_logsch( int ih, int nbh ); | ||
| 51 | void adpcm_dec_reset(); | ||
| 52 | int adpcm_dec_fabs( int n ); | ||
| 53 | int adpcm_dec_cos( int n ); | ||
| 54 | int adpcm_dec_sin( int n ); | ||
| 55 | |||
| 56 | void adpcm_dec_init(); | ||
| 57 | int adpcm_dec_return(); | ||
| 58 | void adpcm_dec_main(); | ||
| 59 | //int main( void ); | ||
| 60 | |||
| 61 | |||
| 62 | /* | ||
| 63 | Declaration of macros | ||
| 64 | */ | ||
| 65 | /* common sampling rate for sound cards on IBM/PC */ | ||
| 66 | #define SAMPLE_RATE 11025 | ||
| 67 | #define PI 3141 | ||
| 68 | #define SIZE 3 | ||
| 69 | #define IN_END 4 | ||
| 70 | |||
| 71 | /* | ||
| 72 | Declaration of global variables | ||
| 73 | */ | ||
| 74 | |||
| 75 | int adpcm_dec_test_data[SIZE * 2], adpcm_dec_result[SIZE * 2]; | ||
| 76 | |||
| 77 | /* Input data for the decoder usually generated by the encoder. */ | ||
| 78 | int adpcm_dec_compressed[SIZE] = { 0, 253, 32 }; | ||
| 79 | |||
| 80 | /* G722 C code */ | ||
| 81 | |||
| 82 | /* QMF filter coefficients: | ||
| 83 | scaled by a factor of 4 compared to G722 CCITT recommendation */ | ||
| 84 | int adpcm_dec_h[24] = { | ||
| 85 | 12, -44, -44, 212, 48, -624, 128, 1448, | ||
| 86 | -840, -3220, 3804, 15504, 15504, 3804, -3220, -840, | ||
| 87 | 1448, 128, -624, 48, 212, -44, -44, 12 | ||
| 88 | }; | ||
| 89 | |||
| 90 | //int xl,xh; | ||
| 91 | |||
| 92 | /* variables for receive quadrature mirror filter here */ | ||
| 93 | int adpcm_dec_accumc[11], adpcm_dec_accumd[11]; | ||
| 94 | |||
| 95 | /* outputs of decode() */ | ||
| 96 | int adpcm_dec_xout1, adpcm_dec_xout2; | ||
| 97 | |||
| 98 | int adpcm_dec_xs, adpcm_dec_xd; | ||
| 99 | |||
| 100 | /* variables for encoder (hi and lo) here */ | ||
| 101 | |||
| 102 | int adpcm_dec_il, adpcm_dec_szl, adpcm_dec_spl, adpcm_dec_sl, adpcm_dec_el; | ||
| 103 | |||
| 104 | int adpcm_dec_qq4_code4_table[16] = { | ||
| 105 | 0, -20456, -12896, -8968, -6288, -4240, -2584, -1200, | ||
| 106 | 20456, 12896, 8968, 6288, 4240, 2584, 1200, 0 | ||
| 107 | }; | ||
| 108 | |||
| 109 | |||
| 110 | int adpcm_dec_qq6_code6_table[64] = { | ||
| 111 | -136, -136, -136, -136, -24808, -21904, -19008, -16704, | ||
| 112 | -14984, -13512, -12280, -11192, -10232, -9360, -8576, -7856, | ||
| 113 | -7192, -6576, -6000, -5456, -4944, -4464, -4008, -3576, | ||
| 114 | -3168, -2776, -2400, -2032, -1688, -1360, -1040, -728, | ||
| 115 | 24808, 21904, 19008, 16704, 14984, 13512, 12280, 11192, | ||
| 116 | 10232, 9360, 8576, 7856, 7192, 6576, 6000, 5456, | ||
| 117 | 4944, 4464, 4008, 3576, 3168, 2776, 2400, 2032, | ||
| 118 | 1688, 1360, 1040, 728, 432, 136, -432, -136 | ||
| 119 | }; | ||
| 120 | |||
| 121 | |||
| 122 | int adpcm_dec_wl_code_table[16] = { | ||
| 123 | -60, 3042, 1198, 538, 334, 172, 58, -30, | ||
| 124 | 3042, 1198, 538, 334, 172, 58, -30, -60 | ||
| 125 | }; | ||
| 126 | |||
| 127 | |||
| 128 | int adpcm_dec_ilb_table[32] = { | ||
| 129 | 2048, 2093, 2139, 2186, 2233, 2282, 2332, 2383, | ||
| 130 | 2435, 2489, 2543, 2599, 2656, 2714, 2774, 2834, | ||
| 131 | 2896, 2960, 3025, 3091, 3158, 3228, 3298, 3371, | ||
| 132 | 3444, 3520, 3597, 3676, 3756, 3838, 3922, 4008 | ||
| 133 | }; | ||
| 134 | |||
| 135 | int adpcm_dec_nbl; /* delay line */ | ||
| 136 | int adpcm_dec_al1, adpcm_dec_al2; | ||
| 137 | int adpcm_dec_plt, adpcm_dec_plt1, adpcm_dec_plt2; | ||
| 138 | int adpcm_dec_rs; | ||
| 139 | int adpcm_dec_dlt; | ||
| 140 | int adpcm_dec_rlt, adpcm_dec_rlt1, adpcm_dec_rlt2; | ||
| 141 | |||
| 142 | |||
| 143 | int adpcm_dec_detl; | ||
| 144 | |||
| 145 | |||
| 146 | int adpcm_dec_deth; | ||
| 147 | int adpcm_dec_sh; /* this comes from adaptive predictor */ | ||
| 148 | int adpcm_dec_eh; | ||
| 149 | |||
| 150 | int adpcm_dec_qq2_code2_table[4] = { | ||
| 151 | -7408, -1616, 7408, 1616 | ||
| 152 | }; | ||
| 153 | |||
| 154 | int adpcm_dec_wh_code_table[4] = { | ||
| 155 | 798, -214, 798, -214 | ||
| 156 | }; | ||
| 157 | |||
| 158 | |||
| 159 | int adpcm_dec_dh, adpcm_dec_ih; | ||
| 160 | int adpcm_dec_nbh, adpcm_dec_szh; | ||
| 161 | int adpcm_dec_sph, adpcm_dec_ph, adpcm_dec_yh, adpcm_dec_rh; | ||
| 162 | |||
| 163 | int adpcm_dec_delay_dhx[6]; | ||
| 164 | |||
| 165 | int adpcm_dec_delay_bph[6]; | ||
| 166 | |||
