diff options
| author | Joshua Bakita <bakitajoshua@gmail.com> | 2019-10-07 19:13:39 -0400 |
|---|---|---|
| committer | Joshua Bakita <bakitajoshua@gmail.com> | 2019-10-07 19:13:39 -0400 |
| commit | 386b7d3366f1359a265da207a9cafa3edf553b64 (patch) | |
| tree | c76120c2c138faed822e4ae386be6ef22a738a78 /baseline/source/adpcm_enc | |
| parent | 54a3f7091a2146b29c73a6fdc4b62a5c4ad7a3d8 (diff) | |
Reorganize and commit all the modified TACLeBench code and run scripts
Diffstat (limited to 'baseline/source/adpcm_enc')
| -rw-r--r-- | baseline/source/adpcm_enc/ChangeLog.txt | 34 | ||||
| -rw-r--r-- | baseline/source/adpcm_enc/adpcm_enc.c | 758 |
2 files changed, 792 insertions, 0 deletions
diff --git a/baseline/source/adpcm_enc/ChangeLog.txt b/baseline/source/adpcm_enc/ChangeLog.txt new file mode 100644 index 0000000..0029192 --- /dev/null +++ b/baseline/source/adpcm_enc/ChangeLog.txt | |||
| @@ -0,0 +1,34 @@ | |||
| 1 | File: adpcm_enc.c | ||
| 2 | Original provenience: C Algorithms for Real-Time DSP by P. M. Embree | ||
| 3 | |||
| 4 | 2016-03-07: | ||
| 5 | - Rename adpcm_encode to adpcm_enc | ||
| 6 | - Add generic TACLeBench header | ||
| 7 | - Remove #define Seoul_Mate around main | ||
| 8 | - Remove swedish comment after setting frequency to 2000 | ||
| 9 | - Introduce adpcm_enc_init, adpcm_main, adpcm_return | ||
| 10 | - Make test_data and compressed global variables | ||
| 11 | 2016-04-26: | ||
| 12 | - Remove forward declarations of functions gaussian, iir_filter, fir_filter, | ||
| 13 | fft, setup_codec, key_down, int_enable, int_disable, flags, getinput, | ||
| 14 | sendout, which are never defined | ||
| 15 | - Remove commented declarations of invqxl and invqah | ||
| 16 | - Remove unused structure COMPLEX | ||
| 17 | - Remove prefix my_ from functions names my_fabs, my_cos, my_sin, my_abs | ||
| 18 | - Prefix all global symbols with benchmark name | ||
| 19 | - Remove variables accumc and accumd together with their initialization loop, | ||
| 20 | since they are never read | ||
| 21 | - Remove unused variables xs and xd | ||
| 22 | - Remove unused array wl_table | ||
| 23 | - Remove unused variable rs and rh | ||
| 24 | - Remove unused variables and their initializations (only required for decoder): | ||
| 25 | ilr, yl, rl, dec_deth, dec_del_bpl, dec_plt, dec_plt1, dec_plt2, dec_szl, | ||
| 26 | dec_spl, dec_sl, dec_rlt1, dec_rlt2, dec_rlt, dec_al1, dec_al2, dl, dec_nbl, | ||
| 27 | dec_yh, dec_dh, dec_nbh, dec_rh2, dec_ah1, dec_ah2, dec_ph, dec_sph, dec_sh, | ||
| 28 | dec_rh, dec_ph1, dec_ph2, | ||
| 29 | - Add addition on each element of input data with volatile variable to | ||
| 30 | avoid constant-propagation optimizations through the compoiler | ||
| 31 | - Add computation of check sum | ||
| 32 | - Add return return statement: zero if check sum is correct | ||
| 33 | 2016-05-20: | ||
| 34 | - Apply code formatting with astyle | ||
diff --git a/baseline/source/adpcm_enc/adpcm_enc.c b/baseline/source/adpcm_enc/adpcm_enc.c new file mode 100644 index 0000000..d9fb09a --- /dev/null +++ b/baseline/source/adpcm_enc/adpcm_enc.c | |||
| @@ -0,0 +1,758 @@ | |||
| 1 | /* | ||
| 2 | |||
| 3 | This program is part of the TACLeBench benchmark suite. | ||
| 4 | Version V 2.0 | ||
| 5 | |||
| 6 | Name: adpcm_enc | ||
| 7 | |||
| 8 | Author: Sung-Soo Lim | ||
| 9 | |||
| 10 | Function: CCITT G.722 ADPCM (Adaptive Differential Pulse Code Modulation) | ||
| 11 | algorithm. 16khz sample rate data is stored in the array test_data[SIZE]. | ||
| 12 | Results are stored in the array compressed[SIZE]. | ||
| 13 | Execution time is determined by the constant SIZE (default value is 2000). | ||
| 14 | |||
| 15 | |||
| 16 | Source: C Algorithms for Real-Time DSP by P. M. Embree | ||
| 17 | and SNU-RT Benchmark Suite for Worst Case Timing Analysis | ||
| 18 | collected and modified by S.-S. Lim <sslim@archi.snu.ac.kr> | ||
| 19 | |||
| 20 | Original name: adpcm_encoder | ||
| 21 | |||
| 22 | Changes: no major functional changes | ||
| 23 | |||
| 24 | License: may be used, modified, and re-distributed freely, but the | ||
| 25 | SNU-RT Benchmark Suite must be acknowledged | ||
| 26 | |||
| 27 | */ | ||
| 28 | |||
| 29 | |||
| 30 | /* common sampling rate for sound cards on IBM/PC */ | ||
| 31 | |||
| 32 | #include "../extra.h" | ||
| 33 | #define SAMPLE_RATE 11025 | ||
| 34 | |||
| 35 | #define PI 3141 | ||
| 36 | #define SIZE 3 | ||
| 37 | #define IN_END 4 | ||
| 38 | |||
| 39 | |||
| 40 | /* | ||
| 41 | Forward declaration of functions | ||
| 42 | */ | ||
| 43 | |||
| 44 | int adpcm_enc_encode( int, int ); | ||
| 45 | int adpcm_enc_filtez( int *bpl, int *dlt ); | ||
| 46 | void adpcm_enc_upzero( int dlt, int *dlti, int *bli ); | ||
| 47 | int adpcm_enc_filtep( int rlt1, int al1, int rlt2, int al2 ); | ||
| 48 | int adpcm_enc_quantl( int el, int detl ); | ||
| 49 | int adpcm_enc_logscl( int il, int nbl ); | ||
| 50 | int adpcm_enc_scalel( int nbl, int shift_constant ); | ||
| 51 | int adpcm_enc_uppol2( int al1, int al2, int plt, int plt1, int plt2 ); | ||
| 52 | int adpcm_enc_uppol1( int al1, int apl2, int plt, int plt1 ); | ||
| 53 | int adpcm_enc_logsch( int ih, int nbh ); | ||
| 54 | void adpcm_enc_reset(); | ||
| 55 | int adpcm_enc_fabs( int n ); | ||
| 56 | int adpcm_enc_cos( int n ); | ||
| 57 | int adpcm_enc_sin( int n ); | ||
| 58 | int adpcm_enc_abs( int n ); | ||
| 59 | void adpcm_enc_init(void); | ||
| 60 | void adpcm_enc_main(void); | ||
| 61 | int adpcm_enc_return(void); | ||
| 62 | //int main(void); | ||
| 63 | |||
| 64 | /* | ||
| 65 | Forward declaration of global variables | ||
| 66 | */ | ||
| 67 | |||
| 68 | int adpcm_enc_test_data[SIZE * 2], adpcm_enc_compressed[SIZE]; | ||
| 69 | |||
| 70 | |||
| 71 | /* G722 C code */ | ||
| 72 | |||
| 73 | /* variables for transimit quadrature mirror filter here */ | ||
| 74 | int adpcm_enc_tqmf[24]; | ||
| 75 | |||
| 76 | /* QMF filter coefficients: | ||
| 77 | scaled by a factor of 4 compared to G722 CCITT recommendation */ | ||
| 78 | int adpcm_enc_h[24] = { | ||
| 79 | 12, -44, -44, 212, 48, -624, 128, 1448, | ||
| 80 | -840, -3220, 3804, 15504, 15504, 3804, -3220, -840, | ||
| 81 | 1448, 128, -624, 48, 212, -44, -44, 12 | ||
| 82 | }; | ||
| 83 | |||
| 84 | int adpcm_enc_xl, adpcm_enc_xh; | ||
| 85 | |||
| 86 | /* variables for encoder (hi and lo) here */ | ||
| 87 | |||
| 88 | int adpcm_enc_il, adpcm_enc_szl, adpcm_enc_spl, adpcm_enc_sl, adpcm_enc_el; | ||
| 89 | |||
| 90 | int adpcm_enc_qq4_code4_table[16] = { | ||
| 91 | 0, -20456, -12896, -8968, -6288, -4240, -2584, -1200, | ||
| 92 | 20456, 12896, 8968, 6288, 4240, 2584, 1200, 0 | ||
| 93 | }; | ||
| 94 | |||
| 95 | int adpcm_enc_qq5_code5_table[32] = { | ||
| 96 | -280, -280, -23352, -17560, -14120, -11664, -9752, -8184, | ||
| 97 | -6864, -5712, -4696, -3784, -2960, -2208, -1520, -880, | ||
| 98 | 23352, 17560, 14120, 11664, 9752, 8184, 6864, 5712, | ||
| 99 | 4696, 3784, 2960, 2208, 1520, 880, 280, -280 | ||
| 100 | }; | ||
| 101 | |||
| 102 | int adpcm_enc_qq6_code6_table[64] = { | ||
| 103 | -136, -136, -136, -136, -24808, -21904, -19008, -16704, | ||
| 104 | -14984, -13512, -12280, -11192, -10232, -9360, -8576, -7856, | ||
| 105 | -7192, -6576, -6000, -5456, -4944, -4464, -4008, -3576, | ||
| 106 | -3168, -2776, -2400, -2032, -1688, -1360, -1040, -728, | ||
| 107 | 24808, 21904, 19008, 16704, 14984, 13512, 12280, 11192, | ||
| 108 | 10232, 9360, 8576, 7856, 7192, 6576, 6000, 5456, | ||
| 109 | 4944, 4464, 4008, 3576, 3168, 2776, 2400, 2032, | ||
| 110 | 1688, 1360, 1040, 728, 432, 136, -432, -136 | ||
| 111 | }; | ||
| 112 | |||
| 113 | int adpcm_enc_delay_bpl[6]; | ||
| 114 | |||
| 115 | int adpcm_enc_delay_dltx[6]; | ||
| 116 | |||
| 117 | int adpcm_enc_wl_code_table[16] = { | ||
| 118 | -60, 3042, 1198, 538, 334, 172, 58, -30, | ||
| 119 | 3042, 1198, 538, 334, 172, 58, -30, -60 | ||
| 120 | }; | ||
| 121 | |||
| 122 | int adpcm_enc_ilb_table[32] = { | ||
| 123 | 2048, 2093, 2139, 2186, 2233, 2282, 2332, 2383, | ||
| 124 | 2435, 2489, 2543, 2599, 2656, 2714, 2774, 2834, | ||
| 125 | 2896, 2960, 3025, 3091, 3158, 3228, 3298, 3371, | ||
| 126 | 3444, 3520, 3597, 3676, 3756, 3838, 3922, 4008 | ||
| 127 | }; | ||
| 128 | |||
| 129 | int adpcm_enc_nbl; /* delay line */ | ||
| 130 | int adpcm_enc_al1, adpcm_enc_al2; | ||
| 131 | int adpcm_enc_plt, adpcm_enc_plt1, adpcm_enc_plt2; | ||
| 132 | int adpcm_enc_dlt; | ||
| 133 | int adpcm_enc_rlt, adpcm_enc_rlt1, adpcm_enc_rlt2; | ||
| 134 | |||
| 135 | /* decision levels - pre-multiplied by 8, 0 to indicate end */ | ||
| 136 | int adpcm_enc_decis_levl[30] = { | ||
| 137 | 280, 576, 880, 1200, 1520, 1864, 2208, 2584, | ||
| 138 | 2960, 3376, 3784, 4240, 4696, 5200, 5712, 6288, | ||
| 139 | 6864, 7520, 8184, 8968, 9752, 10712, 11664, 12896, | ||
| 140 | 14120, 15840, 17560, 20456, 23352, 32767 | ||
| 141 | }; | ||
| 142 | |||
| 143 | int adpcm_enc_detl; | ||
| 144 | |||
| 145 | /* quantization table 31 long to make quantl look-up easier, | ||
| 146 | last entry is for mil=30 case when wd is max */ | ||
| 147 | int adpcm_enc_quant26bt_pos[31] = { | ||
| 148 | 61, 60, 59, 58, 57, 56, 55, 54, | ||
| 149 | 53, 52, 51, 50, 49, 48, 47, 46, | ||
| 150 | 45, 44, 43, 42, 41, 40, 39, 38, | ||
| 151 | 37, 36, 35, 34, 33, 32, 32 | ||
| 152 | }; | ||
| 153 | |||
| 154 | /* quantization table 31 long to make quantl look-up easier, | ||
| 155 | last entry is for mil=30 case when wd is max */ | ||
| 156 | int adpcm_enc_quant26bt_neg[31] = { | ||
