FreeCalypso > hg > tcs211-l1-reconst
changeset 83:43dd68d8d891
l1_ctl.c: new functions moved and made static to facilitate diffing
author | Mychaela Falconia <falcon@ivan.Harhan.ORG> |
---|---|
date | Wed, 30 Mar 2016 06:28:32 +0000 |
parents | ef6cf21cf9d6 |
children | 1cda9bc89011 |
files | chipsetsw/layer1/cfile/l1_ctl.c |
diffstat | 1 files changed, 97 insertions(+), 73 deletions(-) [+] |
line wrap: on
line diff
--- a/chipsetsw/layer1/cfile/l1_ctl.c Tue Mar 29 16:24:09 2016 +0000 +++ b/chipsetsw/layer1/cfile/l1_ctl.c Wed Mar 30 06:28:32 2016 +0000 @@ -152,79 +152,24 @@ #define L1_WORD32_POS_MAX ((unsigned long)(1<<31)-1) #define L1_WORD32_NEG_MAX (-(unsigned long)(1<<31)) -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); -} - +/* + * 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 WORD32 Add_40b( WORD32 guard1guard2, WORD32 lvar1, WORD32 lvar2, WORD16 *guardout ) { @@ -3165,3 +3110,82 @@ } } #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); +}