From e9560dbece41136ffedd786723717efaa2a3a9fd Mon Sep 17 00:00:00 2001 From: Joshua Bakita Date: Tue, 20 Oct 2020 16:30:44 -0400 Subject: 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 --- all_pairs/source/g723_enc/g723_enc.c | 39 ++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 20 deletions(-) (limited to 'all_pairs/source/g723_enc') diff --git a/all_pairs/source/g723_enc/g723_enc.c b/all_pairs/source/g723_enc/g723_enc.c index 209e3ce..646adcd 100644 --- a/all_pairs/source/g723_enc/g723_enc.c +++ b/all_pairs/source/g723_enc/g723_enc.c @@ -172,6 +172,9 @@ short g723_enc_fitab[16] = {0, 0, 0, 0x200, 0x200, 0x200, 0x600, 0xE00, 0xE00, 0x600, 0x200, 0x200, 0x200, 0, 0, 0 }; +static unsigned int g723_enc_out_buffer = 0; +static int g723_enc_out_bits = 0; +static int g723_enc_i = 0; /* Declaration of macros @@ -753,24 +756,21 @@ g723_enc_pack_output( unsigned char code, int bits ) { - static unsigned int out_buffer = 0; - static int out_bits = 0; unsigned char out_byte; - static int i = 0; - - out_buffer |= ( code << out_bits ); - out_bits += bits; - if ( out_bits >= 8 ) { - out_byte = out_buffer & 0xff; - out_bits -= 8; - out_buffer >>= 8; + + g723_enc_out_buffer |= ( code << g723_enc_out_bits ); + g723_enc_out_bits += bits; + if ( g723_enc_out_bits >= 8 ) { + out_byte = g723_enc_out_buffer & 0xff; + g723_enc_out_bits -= 8; + g723_enc_out_buffer >>= 8; //fwrite(&out_byte, sizeof (char), 1, fp_out); //fwrite(&out_byte, 1, 1, fp_out); - g723_enc_OUTPUT[i] = out_byte; - i = i + 1; + g723_enc_OUTPUT[g723_enc_i] = out_byte; + g723_enc_i = g723_enc_i + 1; } - return ( out_bits > 0 ); + return ( g723_enc_out_bits > 0 ); } /* @@ -815,6 +815,9 @@ void g723_enc_init() { int i; volatile int x = 0; + g723_enc_out_buffer = 0; + g723_enc_out_bits = 0; + g723_enc_i = 0; g723_enc_init_state( &g723_enc_state ); _Pragma( "loopbound min 256 max 256" ) @@ -872,16 +875,12 @@ void _Pragma( "entrypoint" ) g723_enc_main() int main( int argc, char **argv ) { - //SET_UP - int jobsComplete; - int maxJobs=9; - for (jobsComplete=0; jobsComplete