diff options
| author | Joshua Bakita <jbakita@cs.unc.edu> | 2020-10-20 16:30:44 -0400 |
|---|---|---|
| committer | Joshua Bakita <jbakita@cs.unc.edu> | 2020-10-20 16:30:44 -0400 |
| commit | e9560dbece41136ffedd786723717efaa2a3a9fd (patch) | |
| tree | bbb5cec16daa6f194a57f49cb0532b4eeaa91a41 /baseline/source/g723_enc | |
| parent | 2e4b1efc7e46b1278e162cb63632546af8f3e0e9 (diff) | |
Fix the 4 TACLeBench members that would not loop before
- anagram, audiobeam: Reset heap in _init() function
- g723_enc: Don't use static local variables
- huff_dec: Reset all global state in _init() function
Diffstat (limited to 'baseline/source/g723_enc')
| -rw-r--r-- | baseline/source/g723_enc/g723_enc.c | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/baseline/source/g723_enc/g723_enc.c b/baseline/source/g723_enc/g723_enc.c index 209e3ce..646adcd 100644 --- a/baseline/source/g723_enc/g723_enc.c +++ b/baseline/source/g723_enc/g723_enc.c | |||
| @@ -172,6 +172,9 @@ short g723_enc_fitab[16] = {0, 0, 0, 0x200, 0x200, 0x200, 0x600, 0xE00, | |||
| 172 | 0xE00, 0x600, 0x200, 0x200, 0x200, 0, 0, 0 | 172 | 0xE00, 0x600, 0x200, 0x200, 0x200, 0, 0, 0 |
| 173 | }; | 173 | }; |
| 174 | 174 | ||
| 175 | static unsigned int g723_enc_out_buffer = 0; | ||
| 176 | static int g723_enc_out_bits = 0; | ||
| 177 | static int g723_enc_i = 0; | ||
| 175 | 178 | ||
| 176 | /* | 179 | /* |
| 177 | Declaration of macros | 180 | Declaration of macros |
| @@ -753,24 +756,21 @@ g723_enc_pack_output( | |||
| 753 | unsigned char code, | 756 | unsigned char code, |
| 754 | int bits ) | 757 | int bits ) |
| 755 | { | 758 | { |
| 756 | static unsigned int out_buffer = 0; | ||
| 757 | static int out_bits = 0; | ||
| 758 | unsigned char out_byte; | 759 | unsigned char out_byte; |
| 759 | static int i = 0; | 760 | |
| 760 | 761 | g723_enc_out_buffer |= ( code << g723_enc_out_bits ); | |
| 761 | out_buffer |= ( code << out_bits ); | 762 | g723_enc_out_bits += bits; |
| 762 | out_bits += bits; | 763 | if ( g723_enc_out_bits >= 8 ) { |
| 763 | if ( out_bits >= 8 ) { | 764 | out_byte = g723_enc_out_buffer & 0xff; |
| 764 | out_byte = out_buffer & 0xff; | 765 | g723_enc_out_bits -= 8; |
| 765 | out_bits -= 8; | 766 | g723_enc_out_buffer >>= 8; |
| 766 | out_buffer >>= 8; | ||
| 767 | //fwrite(&out_byte, sizeof (char), 1, fp_out); | 767 | //fwrite(&out_byte, sizeof (char), 1, fp_out); |
| 768 | //fwrite(&out_byte, 1, 1, fp_out); | 768 | //fwrite(&out_byte, 1, 1, fp_out); |
| 769 | g723_enc_OUTPUT[i] = out_byte; | 769 | g723_enc_OUTPUT[g723_enc_i] = out_byte; |
| 770 | i = i + 1; | 770 | g723_enc_i = g723_enc_i + 1; |
| 771 | } | 771 | } |
| 772 | 772 | ||
| 773 | return ( out_bits > 0 ); | 773 | return ( g723_enc_out_bits > 0 ); |
| 774 | } | 774 | } |
| 775 | 775 | ||
| 776 | /* | 776 | /* |
| @@ -815,6 +815,9 @@ void g723_enc_init() | |||
| 815 | { | 815 | { |
| 816 | int i; | 816 | int i; |
| 817 | volatile int x = 0; | 817 | volatile int x = 0; |
| 818 | g723_enc_out_buffer = 0; | ||
| 819 | g723_enc_out_bits = 0; | ||
| 820 | g723_enc_i = 0; | ||
| 818 | g723_enc_init_state( &g723_enc_state ); | 821 | g723_enc_init_state( &g723_enc_state ); |
| 819 | 822 | ||
| 820 | _Pragma( "loopbound min 256 max 256" ) | 823 | _Pragma( "loopbound min 256 max 256" ) |
| @@ -872,16 +875,12 @@ void _Pragma( "entrypoint" ) g723_enc_main() | |||
| 872 | 875 | ||
| 873 | int main( int argc, char **argv ) | 876 | int main( int argc, char **argv ) |
| 874 | { | 877 | { |
| 875 | //SET_UP | 878 | SET_UP |
| 876 | int jobsComplete; | 879 | for_each_job { |
| 877 | int maxJobs=9; | ||
| 878 | for (jobsComplete=0; jobsComplete<maxJobs; jobsComplete++){ | ||
| 879 | // START_LOOP | ||
| 880 | g723_enc_init(); | 880 | g723_enc_init(); |
| 881 | g723_enc_main(); | 881 | g723_enc_main(); |
| 882 | // STOP_LOOP | ||
| 883 | } | 882 | } |
| 884 | //WRITE_TO_FILE | 883 | WRITE_TO_FILE |
| 885 | return ( g723_enc_return() ); | 884 | return ( g723_enc_return() ); |
| 886 | } | 885 | } |
| 887 | 886 | ||
