Loading lib_dec/ivas_svd_dec_fx.c +23 −30 Original line number Diff line number Diff line Loading @@ -68,7 +68,6 @@ static void HouseholderReduction_fx( #ifdef MYCHANGES static void biDiagonalReductionLeft_64( Word64 singularVectors_Left_64[MAX_OUTPUT_CHANNELS][MAX_OUTPUT_CHANNELS], Word16 bitwindow, const Word16 nChannelsL, /* Q0 */ const Word16 nChannelsC, /* Q0 */ const Word16 currChannel, /* Q0 */ Loading @@ -78,7 +77,6 @@ static void biDiagonalReductionLeft_64( static void biDiagonalReductionRight_64( Word64 singularVectors_Left_64[MAX_OUTPUT_CHANNELS][MAX_OUTPUT_CHANNELS], Word16 bitwindow, const Word16 nChannelsL, /* Q0 */ const Word16 nChannelsC, /* Q0 */ const Word16 currChannel, /* Q0 */ Loading Loading @@ -908,10 +906,8 @@ static void HouseholderReduction_fx( } for (nCh=0;nCh<nChannelsC;nCh++) { Word16 bitwindow; bitwindow=1; biDiagonalReductionLeft_64( singularVectors_Left_64,bitwindow, singularVectors_Left_64, nChannelsL, nChannelsC, nCh, Loading @@ -924,9 +920,8 @@ static void HouseholderReduction_fx( secDiag_fx[nCh]=g_right_fx; /* from the previous channel */ move32(); secDiag_fx_e[nCh]=add(singularVectors_Left_e,g_right_e); bitwindow=2; biDiagonalReductionRight_64( singularVectors_Left_64,bitwindow, singularVectors_Left_64, nChannelsL, nChannelsC, nCh, Loading Loading @@ -1006,7 +1001,6 @@ static void HouseholderReduction_fx( static void biDiagonalReductionLeft_64( Word64 singularVectors_Left_64[MAX_OUTPUT_CHANNELS][MAX_OUTPUT_CHANNELS], Word16 bitwindow, const Word16 nChannelsL, /* Q0 */ const Word16 nChannelsC, /* Q0 */ const Word16 currChannel, /* Q0 */ Loading @@ -1015,7 +1009,8 @@ static void biDiagonalReductionLeft_64( ) { #define HEADROOM_LEFT_1 1 #define HEADROOM_LEFT_2 (HEADROOM_LEFT_1+1) Word16 iCh, jCh; Word32 norm_x; Loading @@ -1035,12 +1030,12 @@ static void biDiagonalReductionLeft_64( move64(); FOR( jCh = currChannel; jCh < nChannelsL; jCh++ ) /* nChannelsL */ { tmp=W_extract_l(W_shr(singularVectors_Left_64[jCh][currChannel],bitwindow)); tmp=W_extract_l(W_shr(singularVectors_Left_64[jCh][currChannel],HEADROOM_LEFT_1)); norm_64=W_add(norm_64,W_mult0_32_32(tmp,tmp)); } norm_x_e=W_norm(norm_64); norm_x=W_extract_h(W_shl(norm_64, norm_x_e )); norm_x_e = add(sub(shl(bitwindow, 1), norm_x_e), 1 ); norm_x_e = add(sub((HEADROOM_LEFT_1+HEADROOM_LEFT_1), norm_x_e), 1 ); } IF ( norm_x ) { Loading @@ -1059,24 +1054,23 @@ static void biDiagonalReductionLeft_64( { ( *g ) = L_negate( *g ); } factor2 = W_extract_l( W_shr( singularVectors_Left_64[currChannel][currChannel], bitwindow) ); tmp_e=sub( ( *g_e ), bitwindow) ; factor2 = W_extract_l( W_shr( singularVectors_Left_64[currChannel][currChannel], HEADROOM_LEFT_1) ); tmp_e=sub( ( *g_e ), HEADROOM_LEFT_1); tmpmul=W_mult0_32_32( ( *g ), factor2); tmpmul=W_shl(tmpmul, tmp_e); r_64=W_sub(tmpmul, norm_64); r_e=W_norm(r_64 ); r=W_extract_h( W_shl( r_64, r_e ) ); r_e = sub( add( 1, add(bitwindow, bitwindow )), r_e ); r_e = sub( add( 1, (HEADROOM_LEFT_1 + HEADROOM_LEFT_1 ) ), r_e ); invVal_e = r_e; invVal = BASOP_Util_Divide3232_Scale_newton( MAXVAL_WORD32, r, &invVal_e); tmp_e = add(31, sub(bitwindow, *g_e ) ); tmp_e = add(31, sub(HEADROOM_LEFT_1, *g_e ) ); singularVectors_Left_64[currChannel][currChannel] = W_sub( singularVectors_Left_64[currChannel][currChannel], W_shr( W_deposit32_h( *g ), tmp_e) ); // here, the exponent goes up. bitwindow=add(bitwindow, 1); // so does the bit window FOR ( iCh = add( currChannel, 1 ); iCh < nChannelsC; iCh++) { Word32 factor1; Loading @@ -1087,8 +1081,8 @@ static void biDiagonalReductionLeft_64( norm_64 = 0; for ( jCh = currChannel; jCh<nChannelsL; jCh++ ) { factor1 = W_extract_l( W_shr( singularVectors_Left_64[jCh][currChannel], bitwindow)); factor2 = W_extract_l( W_shr( singularVectors_Left_64[jCh][iCh], bitwindow)); factor1 = W_extract_l( W_shr( singularVectors_Left_64[jCh][currChannel], HEADROOM_LEFT_2)); factor2 = W_extract_l( W_shr( singularVectors_Left_64[jCh][iCh], HEADROOM_LEFT_2)); norm_64 = W_add( norm_64, W_mult0_32_32(factor1, factor2)); } norm_x_e = W_norm( norm_64); Loading @@ -1098,7 +1092,7 @@ static void biDiagonalReductionLeft_64( { Word16 magic_shift; magic_shift = add( add( norm_x_e, 23), r_e); factor1 = W_extract_l( W_shr(singularVectors_Left_64[jCh][currChannel], bitwindow ) ); factor1 = W_extract_l( W_shr(singularVectors_Left_64[jCh][currChannel], HEADROOM_LEFT_2 ) ); singularVectors_Left_64[jCh][iCh] = W_add( singularVectors_Left_64[jCh][iCh], W_shr(W_mult0_32_32( f, factor1 ), magic_shift ) ); } } Loading @@ -1113,7 +1107,6 @@ static void biDiagonalReductionLeft_64( static void biDiagonalReductionRight_64( Word64 singularVectors_Left_64[MAX_OUTPUT_CHANNELS][MAX_OUTPUT_CHANNELS], Word16 bitwindow, const Word16 nChannelsL, /* Q0 */ const Word16 nChannelsC, /* Q0 */ const Word16 currChannel, /* Q0 */ Loading @@ -1127,7 +1120,8 @@ static void biDiagonalReductionRight_64( Word64 norm_64; Word16 idx; #define HEADROOM_RIGHT_1 2 #define HEADROOM_RIGHT_2 (HEADROOM_RIGHT_1+1) ( *g ) =0; Loading @@ -1142,12 +1136,12 @@ static void biDiagonalReductionRight_64( FOR ( jCh = idx; jCh < nChannelsC; jCh++ ) { Word32 tmp; tmp = W_extract_l( W_shr( singularVectors_Left_64[currChannel][jCh], bitwindow) ); tmp = W_extract_l( W_shr( singularVectors_Left_64[currChannel][jCh], HEADROOM_RIGHT_1) ); norm_64 = W_add( norm_64, W_mult0_32_32( tmp, tmp) ); } norm_x_e = W_norm( norm_64); norm_x = W_extract_h( W_shl( norm_64, norm_x_e) ); norm_x_e = add( sub( shl( bitwindow, 1), norm_x_e), 1); norm_x_e = add( sub( ( HEADROOM_RIGHT_1 + HEADROOM_RIGHT_1 ), norm_x_e), 1); move16(); IF ( norm_x ) Loading Loading @@ -1177,8 +1171,8 @@ static void biDiagonalReductionRight_64( *g_e = tmp_g_e; move32(); move16(); factor2=W_extract_l( W_shr( singularVectors_Left_64[currChannel][idx], bitwindow) ); tmp_e = sub( tmp_g_e, bitwindow); factor2=W_extract_l( W_shr( singularVectors_Left_64[currChannel][idx], HEADROOM_RIGHT_1) ); tmp_e = sub( tmp_g_e, HEADROOM_RIGHT_1); tmpmul = W_mult0_32_32( tmp_g, factor2); tmpmul = W_shl(tmpmul, tmp_e); r_64 = W_sub( tmpmul, norm_64 ); Loading @@ -1190,8 +1184,7 @@ static void biDiagonalReductionRight_64( invVal = BASOP_Util_Divide3232_Scale_newton( MAXVAL_WORD32, maxWithSign_fx( r ), &invVal_e); magic_shift=32-tmp_g_e; singularVectors_Left_64[currChannel][idx]=W_sub( singularVectors_Left_64[currChannel][idx], W_shr( W_deposit32_h( tmp_g), magic_shift) ); bitwindow=add(bitwindow, 1); singularVectors_Left_64[currChannel][idx]=W_sub( singularVectors_Left_64[currChannel][idx], W_shr( W_deposit32_h( tmp_g), magic_shift) );// here, the exponent goes up FOR( iCh = idx; iCh < nChannelsL; iCh++ ) { Loading @@ -1200,8 +1193,8 @@ static void biDiagonalReductionRight_64( move64(); FOR ( jCh = idx; jCh<nChannelsC; jCh++ ) { factor1 = W_extract_l(W_shr( singularVectors_Left_64[iCh][jCh], bitwindow) ); factor2 = W_extract_l(W_shr( singularVectors_Left_64[currChannel][jCh], bitwindow) ); factor1 = W_extract_l(W_shr( singularVectors_Left_64[iCh][jCh], HEADROOM_RIGHT_2) ); factor2 = W_extract_l(W_shr( singularVectors_Left_64[currChannel][jCh], HEADROOM_RIGHT_2) ); norm_64 = W_add( norm_64, W_mult0_32_32( factor1, factor2) ); } Loading @@ -1212,7 +1205,7 @@ static void biDiagonalReductionRight_64( FOR( jCh = idx; jCh < nChannelsC; jCh++ ) { factor2 = W_extract_l( W_shr( singularVectors_Left_64[currChannel][jCh], bitwindow) ); factor2 = W_extract_l( W_shr( singularVectors_Left_64[currChannel][jCh], HEADROOM_RIGHT_2) ); singularVectors_Left_64[iCh][jCh] = W_add( singularVectors_Left_64[iCh][jCh], W_shr( W_mult0_32_32( f, factor2), magic_shift) ); } } Loading Loading
lib_dec/ivas_svd_dec_fx.c +23 −30 Original line number Diff line number Diff line Loading @@ -68,7 +68,6 @@ static void HouseholderReduction_fx( #ifdef MYCHANGES static void biDiagonalReductionLeft_64( Word64 singularVectors_Left_64[MAX_OUTPUT_CHANNELS][MAX_OUTPUT_CHANNELS], Word16 bitwindow, const Word16 nChannelsL, /* Q0 */ const Word16 nChannelsC, /* Q0 */ const Word16 currChannel, /* Q0 */ Loading @@ -78,7 +77,6 @@ static void biDiagonalReductionLeft_64( static void biDiagonalReductionRight_64( Word64 singularVectors_Left_64[MAX_OUTPUT_CHANNELS][MAX_OUTPUT_CHANNELS], Word16 bitwindow, const Word16 nChannelsL, /* Q0 */ const Word16 nChannelsC, /* Q0 */ const Word16 currChannel, /* Q0 */ Loading Loading @@ -908,10 +906,8 @@ static void HouseholderReduction_fx( } for (nCh=0;nCh<nChannelsC;nCh++) { Word16 bitwindow; bitwindow=1; biDiagonalReductionLeft_64( singularVectors_Left_64,bitwindow, singularVectors_Left_64, nChannelsL, nChannelsC, nCh, Loading @@ -924,9 +920,8 @@ static void HouseholderReduction_fx( secDiag_fx[nCh]=g_right_fx; /* from the previous channel */ move32(); secDiag_fx_e[nCh]=add(singularVectors_Left_e,g_right_e); bitwindow=2; biDiagonalReductionRight_64( singularVectors_Left_64,bitwindow, singularVectors_Left_64, nChannelsL, nChannelsC, nCh, Loading Loading @@ -1006,7 +1001,6 @@ static void HouseholderReduction_fx( static void biDiagonalReductionLeft_64( Word64 singularVectors_Left_64[MAX_OUTPUT_CHANNELS][MAX_OUTPUT_CHANNELS], Word16 bitwindow, const Word16 nChannelsL, /* Q0 */ const Word16 nChannelsC, /* Q0 */ const Word16 currChannel, /* Q0 */ Loading @@ -1015,7 +1009,8 @@ static void biDiagonalReductionLeft_64( ) { #define HEADROOM_LEFT_1 1 #define HEADROOM_LEFT_2 (HEADROOM_LEFT_1+1) Word16 iCh, jCh; Word32 norm_x; Loading @@ -1035,12 +1030,12 @@ static void biDiagonalReductionLeft_64( move64(); FOR( jCh = currChannel; jCh < nChannelsL; jCh++ ) /* nChannelsL */ { tmp=W_extract_l(W_shr(singularVectors_Left_64[jCh][currChannel],bitwindow)); tmp=W_extract_l(W_shr(singularVectors_Left_64[jCh][currChannel],HEADROOM_LEFT_1)); norm_64=W_add(norm_64,W_mult0_32_32(tmp,tmp)); } norm_x_e=W_norm(norm_64); norm_x=W_extract_h(W_shl(norm_64, norm_x_e )); norm_x_e = add(sub(shl(bitwindow, 1), norm_x_e), 1 ); norm_x_e = add(sub((HEADROOM_LEFT_1+HEADROOM_LEFT_1), norm_x_e), 1 ); } IF ( norm_x ) { Loading @@ -1059,24 +1054,23 @@ static void biDiagonalReductionLeft_64( { ( *g ) = L_negate( *g ); } factor2 = W_extract_l( W_shr( singularVectors_Left_64[currChannel][currChannel], bitwindow) ); tmp_e=sub( ( *g_e ), bitwindow) ; factor2 = W_extract_l( W_shr( singularVectors_Left_64[currChannel][currChannel], HEADROOM_LEFT_1) ); tmp_e=sub( ( *g_e ), HEADROOM_LEFT_1); tmpmul=W_mult0_32_32( ( *g ), factor2); tmpmul=W_shl(tmpmul, tmp_e); r_64=W_sub(tmpmul, norm_64); r_e=W_norm(r_64 ); r=W_extract_h( W_shl( r_64, r_e ) ); r_e = sub( add( 1, add(bitwindow, bitwindow )), r_e ); r_e = sub( add( 1, (HEADROOM_LEFT_1 + HEADROOM_LEFT_1 ) ), r_e ); invVal_e = r_e; invVal = BASOP_Util_Divide3232_Scale_newton( MAXVAL_WORD32, r, &invVal_e); tmp_e = add(31, sub(bitwindow, *g_e ) ); tmp_e = add(31, sub(HEADROOM_LEFT_1, *g_e ) ); singularVectors_Left_64[currChannel][currChannel] = W_sub( singularVectors_Left_64[currChannel][currChannel], W_shr( W_deposit32_h( *g ), tmp_e) ); // here, the exponent goes up. bitwindow=add(bitwindow, 1); // so does the bit window FOR ( iCh = add( currChannel, 1 ); iCh < nChannelsC; iCh++) { Word32 factor1; Loading @@ -1087,8 +1081,8 @@ static void biDiagonalReductionLeft_64( norm_64 = 0; for ( jCh = currChannel; jCh<nChannelsL; jCh++ ) { factor1 = W_extract_l( W_shr( singularVectors_Left_64[jCh][currChannel], bitwindow)); factor2 = W_extract_l( W_shr( singularVectors_Left_64[jCh][iCh], bitwindow)); factor1 = W_extract_l( W_shr( singularVectors_Left_64[jCh][currChannel], HEADROOM_LEFT_2)); factor2 = W_extract_l( W_shr( singularVectors_Left_64[jCh][iCh], HEADROOM_LEFT_2)); norm_64 = W_add( norm_64, W_mult0_32_32(factor1, factor2)); } norm_x_e = W_norm( norm_64); Loading @@ -1098,7 +1092,7 @@ static void biDiagonalReductionLeft_64( { Word16 magic_shift; magic_shift = add( add( norm_x_e, 23), r_e); factor1 = W_extract_l( W_shr(singularVectors_Left_64[jCh][currChannel], bitwindow ) ); factor1 = W_extract_l( W_shr(singularVectors_Left_64[jCh][currChannel], HEADROOM_LEFT_2 ) ); singularVectors_Left_64[jCh][iCh] = W_add( singularVectors_Left_64[jCh][iCh], W_shr(W_mult0_32_32( f, factor1 ), magic_shift ) ); } } Loading @@ -1113,7 +1107,6 @@ static void biDiagonalReductionLeft_64( static void biDiagonalReductionRight_64( Word64 singularVectors_Left_64[MAX_OUTPUT_CHANNELS][MAX_OUTPUT_CHANNELS], Word16 bitwindow, const Word16 nChannelsL, /* Q0 */ const Word16 nChannelsC, /* Q0 */ const Word16 currChannel, /* Q0 */ Loading @@ -1127,7 +1120,8 @@ static void biDiagonalReductionRight_64( Word64 norm_64; Word16 idx; #define HEADROOM_RIGHT_1 2 #define HEADROOM_RIGHT_2 (HEADROOM_RIGHT_1+1) ( *g ) =0; Loading @@ -1142,12 +1136,12 @@ static void biDiagonalReductionRight_64( FOR ( jCh = idx; jCh < nChannelsC; jCh++ ) { Word32 tmp; tmp = W_extract_l( W_shr( singularVectors_Left_64[currChannel][jCh], bitwindow) ); tmp = W_extract_l( W_shr( singularVectors_Left_64[currChannel][jCh], HEADROOM_RIGHT_1) ); norm_64 = W_add( norm_64, W_mult0_32_32( tmp, tmp) ); } norm_x_e = W_norm( norm_64); norm_x = W_extract_h( W_shl( norm_64, norm_x_e) ); norm_x_e = add( sub( shl( bitwindow, 1), norm_x_e), 1); norm_x_e = add( sub( ( HEADROOM_RIGHT_1 + HEADROOM_RIGHT_1 ), norm_x_e), 1); move16(); IF ( norm_x ) Loading Loading @@ -1177,8 +1171,8 @@ static void biDiagonalReductionRight_64( *g_e = tmp_g_e; move32(); move16(); factor2=W_extract_l( W_shr( singularVectors_Left_64[currChannel][idx], bitwindow) ); tmp_e = sub( tmp_g_e, bitwindow); factor2=W_extract_l( W_shr( singularVectors_Left_64[currChannel][idx], HEADROOM_RIGHT_1) ); tmp_e = sub( tmp_g_e, HEADROOM_RIGHT_1); tmpmul = W_mult0_32_32( tmp_g, factor2); tmpmul = W_shl(tmpmul, tmp_e); r_64 = W_sub( tmpmul, norm_64 ); Loading @@ -1190,8 +1184,7 @@ static void biDiagonalReductionRight_64( invVal = BASOP_Util_Divide3232_Scale_newton( MAXVAL_WORD32, maxWithSign_fx( r ), &invVal_e); magic_shift=32-tmp_g_e; singularVectors_Left_64[currChannel][idx]=W_sub( singularVectors_Left_64[currChannel][idx], W_shr( W_deposit32_h( tmp_g), magic_shift) ); bitwindow=add(bitwindow, 1); singularVectors_Left_64[currChannel][idx]=W_sub( singularVectors_Left_64[currChannel][idx], W_shr( W_deposit32_h( tmp_g), magic_shift) );// here, the exponent goes up FOR( iCh = idx; iCh < nChannelsL; iCh++ ) { Loading @@ -1200,8 +1193,8 @@ static void biDiagonalReductionRight_64( move64(); FOR ( jCh = idx; jCh<nChannelsC; jCh++ ) { factor1 = W_extract_l(W_shr( singularVectors_Left_64[iCh][jCh], bitwindow) ); factor2 = W_extract_l(W_shr( singularVectors_Left_64[currChannel][jCh], bitwindow) ); factor1 = W_extract_l(W_shr( singularVectors_Left_64[iCh][jCh], HEADROOM_RIGHT_2) ); factor2 = W_extract_l(W_shr( singularVectors_Left_64[currChannel][jCh], HEADROOM_RIGHT_2) ); norm_64 = W_add( norm_64, W_mult0_32_32( factor1, factor2) ); } Loading @@ -1212,7 +1205,7 @@ static void biDiagonalReductionRight_64( FOR( jCh = idx; jCh < nChannelsC; jCh++ ) { factor2 = W_extract_l( W_shr( singularVectors_Left_64[currChannel][jCh], bitwindow) ); factor2 = W_extract_l( W_shr( singularVectors_Left_64[currChannel][jCh], HEADROOM_RIGHT_2) ); singularVectors_Left_64[iCh][jCh] = W_add( singularVectors_Left_64[iCh][jCh], W_shr( W_mult0_32_32( f, factor2), magic_shift) ); } } Loading