Loading lib_dec/ivas_svd_dec_fx.c +20 −45 Original line number Diff line number Diff line Loading @@ -882,12 +882,11 @@ static void HouseholderReduction_fx( printf("\n"); #ifdef MYCHANGES push_wmops("HouseholderReduction_fx 64"); #define SPECIAL 0 FOR( jCh = 0; jCh < nChannelsL; jCh++ ) { FOR( iCh = 0; iCh < nChannelsC; iCh++ ) { singularVectors_Left_64[jCh][iCh] = W_shr(W_deposit32_h(singularVectors_Left_fx[jCh][iCh]),32-SPECIAL); singularVectors_Left_64[jCh][iCh] = W_shr(W_deposit32_h(singularVectors_Left_fx[jCh][iCh]),32); } } for (nCh=0;nCh<nChannelsC;nCh++) Loading Loading @@ -969,7 +968,6 @@ static void HouseholderReduction_fx( printf("compare%d,%d: ",nCh,i); for (j=0;j<nChannelsC;j++) { Word16 n; printf("%08X ",singularVectors_Left_fx[i][j]); } printf("\n"); Loading @@ -985,7 +983,6 @@ static void HouseholderReduction_fx( printf("COMPARE%d,%d: ",nCh,i); for (j=0;j<nChannelsC;j++) { Word16 n; printf("%08X<%3d ",singularVectors_Left_fx[i][j],singularVectors_Left_fx_e[i][j]); } printf("\n"); Loading @@ -1011,12 +1008,10 @@ static void HouseholderReduction_fx( pop_wmops(); { int i,j; int magicnum; static int replacecnt=0; static int bettercnt=0; static int totalcnt=0; magicnum=singularVectors_Left_fx_e[0][0]+W_norm(singularVectors_Left_64[0][0])+1; for (i=0;i<nChannelsL;i++) { printf("EXPONENT%02d: IN%3d ",i,singularVectors_Left_e); Loading @@ -1024,13 +1019,12 @@ static void HouseholderReduction_fx( { Word16 n; Word32 tmp; Word32 minemant; unsigned int x,y; int mine,theirs; int k; int cnt; n=norm_l(singularVectors_Left_fx[i][j]); tmp=singularVectors_Left_fx[i][j]<<n; x=(unsigned int)tmp; minemant=singularVectors_Left_fx[i][j]<<n; x=(unsigned int)minemant; printf("[(%2d)",singularVectors_Left_fx_e[i][j]-n); theirs=singularVectors_Left_fx_e[i][j]-n; Loading @@ -1038,18 +1032,19 @@ static void HouseholderReduction_fx( tmp=W_extract_h(W_shl(singularVectors_Left_64[i][j],n)); y=(unsigned int)tmp; n=32+singularVectors_Left_e-n-SPECIAL; n=32+singularVectors_Left_e-n; mine=n; printf("MINE:%2d]",n); printf("%08X/%08X ",x,y); cnt=0; if (!((x^y)&0xff000000)) bettercnt++; if (mine==theirs) if (mine==theirs || minemant==singularVectors_Left_fx[i][j]) { singularVectors_Left_fx[i][j]=x; singularVectors_Left_fx_e[i][j]=mine; replacecnt++; printf("\x1b[0;32m"); } printf("%08X/%08X ",x,y); printf("\x1b[0m"); totalcnt++; } printf("\n"); Loading Loading @@ -1105,7 +1100,6 @@ static void biDiagonalReductionLeft_64( 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 ); printf("NORM: %016llX %08X<%2d\n",norm_64,norm_x,norm_x_e); } IF ( norm_x ) { Loading Loading @@ -1229,7 +1223,6 @@ static void biDiagonalReductionRight_64( abs_x_e = W_norm( abs_64); abs_x = W_extract_h( W_shl( abs_64, abs_x_e) ); abs_x_e = add( sub( add( bitwindow, bitwindow), abs_x_e), 1); printf("NORM: %016llx %08x<%2d ABS: %016llx %08x<%2d\n",norm_64,norm_x,norm_x_e,abs_64,abs_x,abs_x_e); IF ( norm_x ) { Loading Loading @@ -1259,19 +1252,14 @@ static void biDiagonalReductionRight_64( *g_e = tmp_g_e; move32(); move16(); printf("G: %08X<%2d\n",*g,*g_e); factor2=W_extract_l( W_shr( singularVectors_Left_64[currChannel][idx], bitwindow+1) ); tmp_e = sub( tmp_g_e, bitwindow+1); tmpmul = W_mult0_32_32( tmp_g, factor2); printf("factor2:%016llX-->%08llX tmpmul:%016llX ",singularVectors_Left_64[currChannel][idx],factor2,tmpmul); tmpmul = W_shl(tmpmul, tmp_e); printf("%016llX - %016llx\n",tmpmul,norm_64); r_64 = W_sub( W_shr(tmpmul,SPECIAL), W_shr(norm_64,SPECIAL) ); 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( shl( bitwindow, 1), 1), r_e ); printf("R: %016llX %08X<%2d\n",r_64,r,r_e); // r_e=2*bitwindow+1-r_e; invVal_e = r_e; Loading @@ -1280,36 +1268,30 @@ static void biDiagonalReductionRight_64( 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) ); printf("SING: %016llX\n",singularVectors_Left_64[currChannel][idx]); bitwindow=add(bitwindow, 1); FOR( iCh = idx; iCh < nChannelsC; iCh++ ) FOR( iCh = idx; iCh < nChannelsL; iCh++ ) { norm_64 = 0; move64(); FOR ( jCh = idx; jCh<nChannelsL; jCh++ ) FOR ( jCh = idx; jCh<nChannelsC; jCh++ ) { factor1 = W_extract_l(W_shr( singularVectors_Left_64[iCh][jCh], bitwindow+SPECIAL) ); factor2 = W_extract_l(W_shr( singularVectors_Left_64[currChannel][jCh], bitwindow+SPECIAL) ); factor1 = W_extract_l(W_shr( singularVectors_Left_64[iCh][jCh], bitwindow) ); factor2 = W_extract_l(W_shr( singularVectors_Left_64[currChannel][jCh], bitwindow) ); norm_64 = W_add( norm_64, W_mult0_32_32( factor1, factor2) ); } norm_x_e = W_norm( norm_64); norm_x = W_extract_h( W_shl( norm_64, norm_x_e) ); printf("norm: %016llX %08X<%2d\n",norm_64,norm_x,norm_x_e); f = Mpy_32_32( norm_x, invVal); f_e = add( invVal_e, sub( norm_x_e, r_e) ); // magic_shift = -3*currChannel+22-2*norm_x_e+4*r_e+3*f_e; // FIXME: HOW IS THIS WORKING?????!?!?!?!?!?!?!?!?!? magic_shift = 22-2*norm_x_e+4*r_e+3*f_e-2*SPECIAL; // FIXME: HOW IS THIS WORKING?????!?!?!?!?!?!?!?!?!? printf("F:%08X<%2d invVal:%08X<%2d\n",f,f_e,invVal,invVal_e); printf("sing%02d: (magic:%2d)",iCh,magic_shift); magic_shift = 22-2*norm_x_e+4*r_e+3*f_e; // FIXME: HOW IS THIS WORKING?????!?!?!?!?!?!?!?!?!? FOR( jCh = idx; jCh < nChannelsC; jCh++ ) { factor2 = W_extract_l( W_shr( singularVectors_Left_64[currChannel][jCh], bitwindow+SPECIAL) ); printf("[%016llX %08X ",singularVectors_Left_64[currChannel][jCh],factor2); printf("{%016llx+%016llx=%016llx} ",singularVectors_Left_64[iCh][jCh], W_mult0_32_32( f, factor2), singularVectors_Left_64[iCh][jCh]+W_mult0_32_32( f, factor2)>>magic_shift); factor2 = W_extract_l( W_shr( singularVectors_Left_64[currChannel][jCh], bitwindow) ); singularVectors_Left_64[iCh][jCh] = W_add( singularVectors_Left_64[iCh][jCh], W_shr( W_mult0_32_32( f, factor2), magic_shift) ); printf("%016llx]",singularVectors_Left_64[iCh][jCh]); } } // FIXME BEGIN: The following code has not yet been tested Loading Loading @@ -1386,12 +1368,6 @@ static void biDiagonalReductionLeft_fx( FOR( jCh = idx; jCh < nChannelsL; jCh++ ) /* nChannelsL */ { Word16 temp_e = norm_l( singularVectors[jCh][currChannel] ); Word32 tmp; // tmp=L_shl( singularVectors[jCh][currChannel],temp_e); tmp=singularVectors[jCh][currChannel]; tmp=L_shl( singularVectors[jCh][currChannel],temp_e); singularVectors[jCh][currChannel] = Mpy_32_32( L_shl( singularVectors[jCh][currChannel], temp_e ), invVal ); /* exp(sing_exp + (singularVectors_e - sig_x_e) */ move32(); singularVectors2_e[jCh][currChannel] = sub( add( invVal_e, sub( singularVectors2_e[jCh][currChannel], *sig_x_e ) ), temp_e ); Loading Loading @@ -1570,17 +1546,16 @@ static void biDiagonalReductionRight_fx( { norm_x = BASOP_Util_Add_Mant32Exp( norm_x, norm_x_e, Mpy_32_32( singularVectors[iCh][jCh], singularVectors[currChannel][jCh] ), add( singularVectors2_e[iCh][jCh], singularVectors2_e[currChannel][jCh] ), &norm_x_e ); /* exp(norm_x_e) */ } FOR( jCh = idx; jCh < nChannelsC; jCh++ ) /* nChannelsC */ { singularVectors[iCh][jCh] = BASOP_Util_Add_Mant32Exp( singularVectors[iCh][jCh], singularVectors2_e[iCh][jCh], Mpy_32_32( norm_x, secDiag[jCh] ), add( norm_x_e, secDiag_exp[jCh] ), &singularVectors2_e[iCh][jCh] ); /* exp(sing_exp2) */ move32(); } } FOR( jCh = idx; jCh < nChannelsC; jCh++ ) /* nChannelsC */ { singularVectors[currChannel][jCh] = Mpy_32_32( singularVectors[currChannel][jCh], ( *sig_x ) ); /* exp(sing_exp + sig_x_e) */ move32(); singularVectors2_e[currChannel][jCh] = add( singularVectors2_e[currChannel][jCh], *sig_x_e ); move16(); Loading Loading
lib_dec/ivas_svd_dec_fx.c +20 −45 Original line number Diff line number Diff line Loading @@ -882,12 +882,11 @@ static void HouseholderReduction_fx( printf("\n"); #ifdef MYCHANGES push_wmops("HouseholderReduction_fx 64"); #define SPECIAL 0 FOR( jCh = 0; jCh < nChannelsL; jCh++ ) { FOR( iCh = 0; iCh < nChannelsC; iCh++ ) { singularVectors_Left_64[jCh][iCh] = W_shr(W_deposit32_h(singularVectors_Left_fx[jCh][iCh]),32-SPECIAL); singularVectors_Left_64[jCh][iCh] = W_shr(W_deposit32_h(singularVectors_Left_fx[jCh][iCh]),32); } } for (nCh=0;nCh<nChannelsC;nCh++) Loading Loading @@ -969,7 +968,6 @@ static void HouseholderReduction_fx( printf("compare%d,%d: ",nCh,i); for (j=0;j<nChannelsC;j++) { Word16 n; printf("%08X ",singularVectors_Left_fx[i][j]); } printf("\n"); Loading @@ -985,7 +983,6 @@ static void HouseholderReduction_fx( printf("COMPARE%d,%d: ",nCh,i); for (j=0;j<nChannelsC;j++) { Word16 n; printf("%08X<%3d ",singularVectors_Left_fx[i][j],singularVectors_Left_fx_e[i][j]); } printf("\n"); Loading @@ -1011,12 +1008,10 @@ static void HouseholderReduction_fx( pop_wmops(); { int i,j; int magicnum; static int replacecnt=0; static int bettercnt=0; static int totalcnt=0; magicnum=singularVectors_Left_fx_e[0][0]+W_norm(singularVectors_Left_64[0][0])+1; for (i=0;i<nChannelsL;i++) { printf("EXPONENT%02d: IN%3d ",i,singularVectors_Left_e); Loading @@ -1024,13 +1019,12 @@ static void HouseholderReduction_fx( { Word16 n; Word32 tmp; Word32 minemant; unsigned int x,y; int mine,theirs; int k; int cnt; n=norm_l(singularVectors_Left_fx[i][j]); tmp=singularVectors_Left_fx[i][j]<<n; x=(unsigned int)tmp; minemant=singularVectors_Left_fx[i][j]<<n; x=(unsigned int)minemant; printf("[(%2d)",singularVectors_Left_fx_e[i][j]-n); theirs=singularVectors_Left_fx_e[i][j]-n; Loading @@ -1038,18 +1032,19 @@ static void HouseholderReduction_fx( tmp=W_extract_h(W_shl(singularVectors_Left_64[i][j],n)); y=(unsigned int)tmp; n=32+singularVectors_Left_e-n-SPECIAL; n=32+singularVectors_Left_e-n; mine=n; printf("MINE:%2d]",n); printf("%08X/%08X ",x,y); cnt=0; if (!((x^y)&0xff000000)) bettercnt++; if (mine==theirs) if (mine==theirs || minemant==singularVectors_Left_fx[i][j]) { singularVectors_Left_fx[i][j]=x; singularVectors_Left_fx_e[i][j]=mine; replacecnt++; printf("\x1b[0;32m"); } printf("%08X/%08X ",x,y); printf("\x1b[0m"); totalcnt++; } printf("\n"); Loading Loading @@ -1105,7 +1100,6 @@ static void biDiagonalReductionLeft_64( 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 ); printf("NORM: %016llX %08X<%2d\n",norm_64,norm_x,norm_x_e); } IF ( norm_x ) { Loading Loading @@ -1229,7 +1223,6 @@ static void biDiagonalReductionRight_64( abs_x_e = W_norm( abs_64); abs_x = W_extract_h( W_shl( abs_64, abs_x_e) ); abs_x_e = add( sub( add( bitwindow, bitwindow), abs_x_e), 1); printf("NORM: %016llx %08x<%2d ABS: %016llx %08x<%2d\n",norm_64,norm_x,norm_x_e,abs_64,abs_x,abs_x_e); IF ( norm_x ) { Loading Loading @@ -1259,19 +1252,14 @@ static void biDiagonalReductionRight_64( *g_e = tmp_g_e; move32(); move16(); printf("G: %08X<%2d\n",*g,*g_e); factor2=W_extract_l( W_shr( singularVectors_Left_64[currChannel][idx], bitwindow+1) ); tmp_e = sub( tmp_g_e, bitwindow+1); tmpmul = W_mult0_32_32( tmp_g, factor2); printf("factor2:%016llX-->%08llX tmpmul:%016llX ",singularVectors_Left_64[currChannel][idx],factor2,tmpmul); tmpmul = W_shl(tmpmul, tmp_e); printf("%016llX - %016llx\n",tmpmul,norm_64); r_64 = W_sub( W_shr(tmpmul,SPECIAL), W_shr(norm_64,SPECIAL) ); 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( shl( bitwindow, 1), 1), r_e ); printf("R: %016llX %08X<%2d\n",r_64,r,r_e); // r_e=2*bitwindow+1-r_e; invVal_e = r_e; Loading @@ -1280,36 +1268,30 @@ static void biDiagonalReductionRight_64( 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) ); printf("SING: %016llX\n",singularVectors_Left_64[currChannel][idx]); bitwindow=add(bitwindow, 1); FOR( iCh = idx; iCh < nChannelsC; iCh++ ) FOR( iCh = idx; iCh < nChannelsL; iCh++ ) { norm_64 = 0; move64(); FOR ( jCh = idx; jCh<nChannelsL; jCh++ ) FOR ( jCh = idx; jCh<nChannelsC; jCh++ ) { factor1 = W_extract_l(W_shr( singularVectors_Left_64[iCh][jCh], bitwindow+SPECIAL) ); factor2 = W_extract_l(W_shr( singularVectors_Left_64[currChannel][jCh], bitwindow+SPECIAL) ); factor1 = W_extract_l(W_shr( singularVectors_Left_64[iCh][jCh], bitwindow) ); factor2 = W_extract_l(W_shr( singularVectors_Left_64[currChannel][jCh], bitwindow) ); norm_64 = W_add( norm_64, W_mult0_32_32( factor1, factor2) ); } norm_x_e = W_norm( norm_64); norm_x = W_extract_h( W_shl( norm_64, norm_x_e) ); printf("norm: %016llX %08X<%2d\n",norm_64,norm_x,norm_x_e); f = Mpy_32_32( norm_x, invVal); f_e = add( invVal_e, sub( norm_x_e, r_e) ); // magic_shift = -3*currChannel+22-2*norm_x_e+4*r_e+3*f_e; // FIXME: HOW IS THIS WORKING?????!?!?!?!?!?!?!?!?!? magic_shift = 22-2*norm_x_e+4*r_e+3*f_e-2*SPECIAL; // FIXME: HOW IS THIS WORKING?????!?!?!?!?!?!?!?!?!? printf("F:%08X<%2d invVal:%08X<%2d\n",f,f_e,invVal,invVal_e); printf("sing%02d: (magic:%2d)",iCh,magic_shift); magic_shift = 22-2*norm_x_e+4*r_e+3*f_e; // FIXME: HOW IS THIS WORKING?????!?!?!?!?!?!?!?!?!? FOR( jCh = idx; jCh < nChannelsC; jCh++ ) { factor2 = W_extract_l( W_shr( singularVectors_Left_64[currChannel][jCh], bitwindow+SPECIAL) ); printf("[%016llX %08X ",singularVectors_Left_64[currChannel][jCh],factor2); printf("{%016llx+%016llx=%016llx} ",singularVectors_Left_64[iCh][jCh], W_mult0_32_32( f, factor2), singularVectors_Left_64[iCh][jCh]+W_mult0_32_32( f, factor2)>>magic_shift); factor2 = W_extract_l( W_shr( singularVectors_Left_64[currChannel][jCh], bitwindow) ); singularVectors_Left_64[iCh][jCh] = W_add( singularVectors_Left_64[iCh][jCh], W_shr( W_mult0_32_32( f, factor2), magic_shift) ); printf("%016llx]",singularVectors_Left_64[iCh][jCh]); } } // FIXME BEGIN: The following code has not yet been tested Loading Loading @@ -1386,12 +1368,6 @@ static void biDiagonalReductionLeft_fx( FOR( jCh = idx; jCh < nChannelsL; jCh++ ) /* nChannelsL */ { Word16 temp_e = norm_l( singularVectors[jCh][currChannel] ); Word32 tmp; // tmp=L_shl( singularVectors[jCh][currChannel],temp_e); tmp=singularVectors[jCh][currChannel]; tmp=L_shl( singularVectors[jCh][currChannel],temp_e); singularVectors[jCh][currChannel] = Mpy_32_32( L_shl( singularVectors[jCh][currChannel], temp_e ), invVal ); /* exp(sing_exp + (singularVectors_e - sig_x_e) */ move32(); singularVectors2_e[jCh][currChannel] = sub( add( invVal_e, sub( singularVectors2_e[jCh][currChannel], *sig_x_e ) ), temp_e ); Loading Loading @@ -1570,17 +1546,16 @@ static void biDiagonalReductionRight_fx( { norm_x = BASOP_Util_Add_Mant32Exp( norm_x, norm_x_e, Mpy_32_32( singularVectors[iCh][jCh], singularVectors[currChannel][jCh] ), add( singularVectors2_e[iCh][jCh], singularVectors2_e[currChannel][jCh] ), &norm_x_e ); /* exp(norm_x_e) */ } FOR( jCh = idx; jCh < nChannelsC; jCh++ ) /* nChannelsC */ { singularVectors[iCh][jCh] = BASOP_Util_Add_Mant32Exp( singularVectors[iCh][jCh], singularVectors2_e[iCh][jCh], Mpy_32_32( norm_x, secDiag[jCh] ), add( norm_x_e, secDiag_exp[jCh] ), &singularVectors2_e[iCh][jCh] ); /* exp(sing_exp2) */ move32(); } } FOR( jCh = idx; jCh < nChannelsC; jCh++ ) /* nChannelsC */ { singularVectors[currChannel][jCh] = Mpy_32_32( singularVectors[currChannel][jCh], ( *sig_x ) ); /* exp(sing_exp + sig_x_e) */ move32(); singularVectors2_e[currChannel][jCh] = add( singularVectors2_e[currChannel][jCh], *sig_x_e ); move16(); Loading