# HG changeset patch # User Mychaela Falconia # Date 1460041687 0 # Node ID a32bdc16491eb05fe363f92fd8590b32f9252846 # Parent 3ef2a5f83a8e3127eb9b3a2cc20f4ff270e7f3e4 l1_ctl.c reconstruction complete, matches 20070608 object diff -r 3ef2a5f83a8e -r a32bdc16491e chipsetsw/layer1/cfile/l1_ctl.c --- a/chipsetsw/layer1/cfile/l1_ctl.c Thu Apr 07 14:53:25 2016 +0000 +++ b/chipsetsw/layer1/cfile/l1_ctl.c Thu Apr 07 15:08:07 2016 +0000 @@ -147,29 +147,96 @@ /* Automatic frequency compensation */ /************************************/ +/* + * FreeCalypso TCS211 reconstruction: the following 3 functions + * have been added in the LoCosto version of this module. + * We have conditioned them out in order to match the original + * TCS211 object; their uses have been conditioned out as well. + * + * These functions will need to re-enabled when their uses are + * re-enabled. + */ + +#if 0 + #define L1_WORD16_POS_MAX (32767) #define L1_WORD16_NEG_MAX (-32768) #define L1_WORD32_POS_MAX ((unsigned long)(1<<31)-1) #define L1_WORD32_NEG_MAX (-(unsigned long)(1<<31)) -/* - * FreeCalypso TCS211 reconstruction: the following 3 functions - * are new with the LoCosto version of this module. Their bodies - * used to be here (prefixed with INLINE for conditional inlining - * like Add_40b() and friends), but we have made the following - * changes: - * - * moved the function bodies to the end - * made the functions static - * added forward declarations below - * - * These changes have been made in order to aid the diffing - * of compiled objects. - */ - -static WORD16 Add_Sat_sign_16b(WORD16 val1, WORD16 val2); -static WORD32 Add_Sat_sign_32b(WORD32 val1, WORD32 val2); -static WORD32 Sat_Mult_20sign_16unsign(WORD32 val1, UWORD32 val2); +INLINE WORD16 Add_Sat_sign_16b(WORD16 val1, WORD16 val2) +{ + WORD32 temp; + WORD16 result; + + temp = (WORD32)((WORD32)val1 + (WORD32)val2); + if(temp > L1_WORD16_POS_MAX) + { + temp = L1_WORD16_POS_MAX; + } + if(temp < L1_WORD16_NEG_MAX) + { + temp = L1_WORD16_NEG_MAX; + } + result = (WORD16)((temp)&(0x0000FFFF)); + return(result); +} + +INLINE WORD32 Add_Sat_sign_32b(WORD32 val1, WORD32 val2) +{ + WORD32 temp_high_high; + UWORD32 temp_low_low; + UWORD16 carry; + WORD32 result; + WORD16 high_val1, high_val2; + UWORD16 low_val1, low_val2; + + high_val1 = (WORD16)(val1>>16); + high_val2 = (WORD16)(val2>>16); + low_val1 = (UWORD16)(val1&0x0000FFFF); + low_val2 = (UWORD16)(val2&0x0000FFFF); + + temp_high_high = (WORD32)high_val1 + (WORD32)high_val2; + temp_low_low = (UWORD32)low_val1 + (UWORD32)low_val2; + carry = (UWORD16)(temp_low_low >> 16); + temp_high_high = temp_high_high + (UWORD32)(carry); + + + result = val1 + val2; + if(temp_high_high > L1_WORD16_POS_MAX) + { + result = L1_WORD32_POS_MAX; + } + if(temp_high_high < L1_WORD16_NEG_MAX) + { + result = L1_WORD32_NEG_MAX; + } + + return(result); +} + +INLINE WORD32 Sat_Mult_20sign_16unsign(WORD32 val1, UWORD32 val2) +{ + WORD32 result; + + result = val1 * val2; + if(val1>0) /* val2 is > 0*/ + { + if(result < 0) /* overflow */ + { + result = L1_WORD32_POS_MAX; + } + } + if(val1<0) /* val2 is > 0*/ + { + if(result > 0) /* overflow */ + { + result = L1_WORD32_NEG_MAX; + } + } + return(result); +} +#endif INLINE WORD32 Add_40b( WORD32 guard1guard2, WORD32 lvar1, WORD32 lvar2, WORD16 *guardout ) { @@ -3197,82 +3264,3 @@ } } #endif /* #if (FF_L1_FAST_DECODING == 1) */ - -/* - * FreeCalypso TCS211 reconstruction: these functions used to be - * at the beginning of the module; we have moved them here in order - * to aid the diffing of compiled objects. - */ - -static WORD16 Add_Sat_sign_16b(WORD16 val1, WORD16 val2) -{ - WORD32 temp; - WORD16 result; - - temp = (WORD32)((WORD32)val1 + (WORD32)val2); - if(temp > L1_WORD16_POS_MAX) - { - temp = L1_WORD16_POS_MAX; - } - if(temp < L1_WORD16_NEG_MAX) - { - temp = L1_WORD16_NEG_MAX; - } - result = (WORD16)((temp)&(0x0000FFFF)); - return(result); -} - -static WORD32 Add_Sat_sign_32b(WORD32 val1, WORD32 val2) -{ - WORD32 temp_high_high; - UWORD32 temp_low_low; - UWORD16 carry; - WORD32 result; - WORD16 high_val1, high_val2; - UWORD16 low_val1, low_val2; - - high_val1 = (WORD16)(val1>>16); - high_val2 = (WORD16)(val2>>16); - low_val1 = (UWORD16)(val1&0x0000FFFF); - low_val2 = (UWORD16)(val2&0x0000FFFF); - - temp_high_high = (WORD32)high_val1 + (WORD32)high_val2; - temp_low_low = (UWORD32)low_val1 + (UWORD32)low_val2; - carry = (UWORD16)(temp_low_low >> 16); - temp_high_high = temp_high_high + (UWORD32)(carry); - - - result = val1 + val2; - if(temp_high_high > L1_WORD16_POS_MAX) - { - result = L1_WORD32_POS_MAX; - } - if(temp_high_high < L1_WORD16_NEG_MAX) - { - result = L1_WORD32_NEG_MAX; - } - - return(result); -} - -static WORD32 Sat_Mult_20sign_16unsign(WORD32 val1, UWORD32 val2) -{ - WORD32 result; - - result = val1 * val2; - if(val1>0) /* val2 is > 0*/ - { - if(result < 0) /* overflow */ - { - result = L1_WORD32_POS_MAX; - } - } - if(val1<0) /* val2 is > 0*/ - { - if(result > 0) /* overflow */ - { - result = L1_WORD32_NEG_MAX; - } - } - return(result); -}