summaryrefslogtreecommitdiffstats
path: root/all_pairs/source/adpcm_dec
diff options
context:
space:
mode:
authorJoshua Bakita <bakitajoshua@gmail.com>2019-10-07 19:13:39 -0400
committerJoshua Bakita <bakitajoshua@gmail.com>2019-10-07 19:13:39 -0400
commit386b7d3366f1359a265da207a9cafa3edf553b64 (patch)
treec76120c2c138faed822e4ae386be6ef22a738a78 /all_pairs/source/adpcm_dec
parent54a3f7091a2146b29c73a6fdc4b62a5c4ad7a3d8 (diff)
Reorganize and commit all the modified TACLeBench code and run scripts
Diffstat (limited to 'all_pairs/source/adpcm_dec')
-rw-r--r--all_pairs/source/adpcm_dec/ChangeLog.txt32
-rw-r--r--all_pairs/source/adpcm_dec/adpcm_dec.c719
-rw-r--r--all_pairs/source/adpcm_dec/timedTest.txt100
3 files changed, 851 insertions, 0 deletions
diff --git a/all_pairs/source/adpcm_dec/ChangeLog.txt b/all_pairs/source/adpcm_dec/ChangeLog.txt
new file mode 100644
index 0000000..b9c4f96
--- /dev/null
+++ b/all_pairs/source/adpcm_dec/ChangeLog.txt
@@ -0,0 +1,32 @@
1File: minver.c
2Original provenience: SNU-RT Benchmark Suite for Worst Case Timing Analysis
3
42016-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
242016-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/all_pairs/source/adpcm_dec/adpcm_dec.c b/all_pairs/source/adpcm_dec/adpcm_dec.c
new file mode 100644
index 0000000..6811e69
--- /dev/null
+++ b/all_pairs/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
40void adpcm_dec_decode( int );
41int adpcm_dec_filtez( int *bpl, int *dlt );
42void adpcm_dec_upzero( int dlt, int *dlti, int *bli );
43int adpcm_dec_filtep( int rlt1, int al1, int rlt2, int al2 );
44
45int adpcm_dec_logscl( int il, int nbl );
46int adpcm_dec_scalel( int nbl, int shift_constant );
47int adpcm_dec_uppol2( int al1, int al2, int plt, int plt1, int plt2 );
48int adpcm_dec_uppol1( int al1, int apl2, int plt, int plt1 );
49
50int adpcm_dec_logsch( int ih, int nbh );
51void adpcm_dec_reset();
52int adpcm_dec_fabs( int n );
53int adpcm_dec_cos( int n );
54int adpcm_dec_sin( int n );
55
56void adpcm_dec_init();
57int adpcm_dec_return();
58void 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
75int adpcm_dec_test_data[SIZE * 2], adpcm_dec_result[SIZE * 2];
76
77/* Input data for the decoder usually generated by the encoder. */
78int 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 */
84int 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 */
93int adpcm_dec_accumc[11], adpcm_dec_accumd[11];
94
95/* outputs of decode() */
96int adpcm_dec_xout1, adpcm_dec_xout2;
97
98int adpcm_dec_xs, adpcm_dec_xd;
99
100/* variables for encoder (hi and lo) here */
101
102int adpcm_dec_il, adpcm_dec_szl, adpcm_dec_spl, adpcm_dec_sl, adpcm_dec_el;
103
104int 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
110int 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
122int 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
128int 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
135int adpcm_dec_nbl; /* delay line */
136int adpcm_dec_al1, adpcm_dec_al2;
137int adpcm_dec_plt, adpcm_dec_plt1, adpcm_dec_plt2;
138int adpcm_dec_rs;
139int adpcm_dec_dlt;
140int adpcm_dec_rlt, adpcm_dec_rlt1, adpcm_dec_rlt2;
141
142
143int adpcm_dec_detl;
144
145
146int adpcm_dec_deth;
147int adpcm_dec_sh; /* this comes from adaptive predictor */
148int adpcm_dec_eh;
149
150int adpcm_dec_qq2_code2_table[4] = {
151 -7408, -1616, 7408, 1616
152};
153
154int adpcm_dec_wh_code_table[4] = {
155 798, -214, 798, -214
156};
157
158
159int adpcm_dec_dh, adpcm_dec_ih;
160int adpcm_dec_nbh, adpcm