Loading lib_dec/ivas_svd_dec_fx.c +68 −9 Original line number Diff line number Diff line Loading @@ -1238,7 +1238,8 @@ static void biDiagonalReductionRight_64( invVal = BASOP_Util_Divide3232_Scale_newton( MAXVAL_WORD32, maxWithSign_fx( r ), &invVal_e); // tmpe=add(31,sub(singularVectors_e,g_e)); // TODO: maybe the other way around?? tmpe=sub(30,singularVectors_e); // tmpe=sub(30,singularVectors_e); //// NOT CORRECT YET!!!!!! ////////////////////////////////// switch(currChannel) { case 0: tmpe=30; break; Loading @@ -1246,11 +1247,8 @@ static void biDiagonalReductionRight_64( default: tmpe=32-(*g_e);break; } tmp64=W_shr(W_deposit32_h(*g),tmpe); printf("SING%d: \x1b[1;37m",currChannel); printf("%016llx-%016llx=",singularVectors_Left_64[currChannel][idx],tmp64); singularVectors_Left_64[currChannel][idx]=W_sub(singularVectors_Left_64[currChannel][idx],tmp64); // exponent +1 printf("%016llx",singularVectors_Left_64[currChannel][idx]); printf("\x1b[0m (tmpe:%d invval_e:%d norm_x_e:%d g_e:%d abs_x_e:%d\n",tmpe,invVal_e,norm_x_e, *g_e, abs_x_e); tmpe=add(singularVectors_e,2); Loading @@ -1259,7 +1257,7 @@ static void biDiagonalReductionRight_64( Word16 magic_shift; Word32 tmp2; Word32 tmp3; tmp2=W_extract_l(W_shr(singularVectors_Left_64[iCh][currChannel],tmpe)); int norm_x_e1; norm_64=0; move64(); for (jCh=idx;jCh<nChannelsC; jCh++) Loading @@ -1270,13 +1268,51 @@ static void biDiagonalReductionRight_64( } norm_x_e=W_norm(norm_64); norm_x=W_extract_h(W_shl(norm_64,norm_x_e)); norm_x_e1=norm_x_e; f=Mpy_32_32(norm_x,invVal); f_e=add(invVal_e, sub(norm_x_e, r_e )); magic_shift=norm_x_e+27; // f=BASOP_Util_Divide3232_Scale_newton( norm_x, r, &invVal_e ); // f_e = add( invVal_e, sub(norm_x_e, r_e ) ); switch(currChannel) { case 0:magic_shift=norm_x_e+27;break; case 1:magic_shift=norm_x_e+17;break; default:magic_shift=norm_x_e+17;break; } // magic_shift=-32-30*norm_x_e-norm_x_e2+32*invVal_e+32*f_e; for (jCh=idx;jCh<nChannelsC; jCh++) { Word16 s_e; static FILE *f_debug1=NULL; { int x; if (f_debug1==NULL) { f_debug1=fopen("magic_mine.bin","wb"); } x=currChannel;fwrite(&x,sizeof(int),1,f_debug1); x=iCh;fwrite(&x,sizeof(int),1,f_debug1); x=jCh;fwrite(&x,sizeof(int),1,f_debug1); fwrite(&norm_x,sizeof(int),1,f_debug1); fwrite(&norm_x_e,sizeof(short),1,f_debug1); fwrite(&norm_x_e2,sizeof(short),1,f_debug1); fwrite(&invVal_e,sizeof(short),1,f_debug1); fwrite(&f,sizeof(int),1,f_debug1); fwrite(&f_e,sizeof(short),1,f_debug1); fwrite(&singularVectors_Left_64[currChannel][jCh],sizeof(long long),1,f_debug1); fwrite(&singularVectors_Left_64[iCh][jCh],sizeof(long long),1,f_debug1); } s_e=W_norm(singularVectors_Left_64[currChannel][jCh]); // tmp2=W_extract_h(W_shl(singularVectors_Left_64[currChannel][jCh],s_e)); tmp2=W_extract_l(W_shr(singularVectors_Left_64[currChannel][jCh],tmpe)); singularVectors_Left_64[iCh][jCh]=W_add(singularVectors_Left_64[iCh][jCh],W_shr(W_mult0_32_32(f,tmp2),magic_shift)); fwrite(&singularVectors_Left_64[iCh][jCh],sizeof(long long),1,f_debug1); } } invVal_e = 0; Loading Loading @@ -1683,11 +1719,34 @@ 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) */ } printf("norm%d: ",currChannel); printf(" %08X<%2X",norm_x,norm_x_e); printf("\n"); norm_x = BASOP_Util_Divide3232_Scale_newton( norm_x, r, &invVal_e ); norm_x_e = add( invVal_e, sub(norm_x_e, r_e ) ); printf("f%d: ",currChannel); printf("%08X<%2X",norm_x,norm_x_e); printf("\n"); 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, singularVectors[currChannel][jCh] ), add( norm_x_e, singularVectors2_e[currChannel][jCh] ), &singularVectors2_e[iCh][jCh] ); /* exp(sing_exp2) */ { static FILE *f_debug2=NULL; int x; if (f_debug2==NULL) { f_debug2=fopen("magic_expected.bin","wb"); } x=currChannel;fwrite(&x,sizeof(int),1,f_debug2); x=iCh;fwrite(&x,sizeof(int),1,f_debug2); x=jCh;fwrite(&x,sizeof(int),1,f_debug2); fwrite(&norm_x,sizeof(int),1,f_debug2); fwrite(&norm_x_e,sizeof(short),1,f_debug2); fwrite(&singularVectors[iCh][jCh],sizeof(int),1,f_debug2); } printf("magic%d,%d,%d: expected=0x%08X;\n",currChannel,iCh,jCh,singularVectors[iCh][jCh]); move32(); } } Loading Loading
lib_dec/ivas_svd_dec_fx.c +68 −9 Original line number Diff line number Diff line Loading @@ -1238,7 +1238,8 @@ static void biDiagonalReductionRight_64( invVal = BASOP_Util_Divide3232_Scale_newton( MAXVAL_WORD32, maxWithSign_fx( r ), &invVal_e); // tmpe=add(31,sub(singularVectors_e,g_e)); // TODO: maybe the other way around?? tmpe=sub(30,singularVectors_e); // tmpe=sub(30,singularVectors_e); //// NOT CORRECT YET!!!!!! ////////////////////////////////// switch(currChannel) { case 0: tmpe=30; break; Loading @@ -1246,11 +1247,8 @@ static void biDiagonalReductionRight_64( default: tmpe=32-(*g_e);break; } tmp64=W_shr(W_deposit32_h(*g),tmpe); printf("SING%d: \x1b[1;37m",currChannel); printf("%016llx-%016llx=",singularVectors_Left_64[currChannel][idx],tmp64); singularVectors_Left_64[currChannel][idx]=W_sub(singularVectors_Left_64[currChannel][idx],tmp64); // exponent +1 printf("%016llx",singularVectors_Left_64[currChannel][idx]); printf("\x1b[0m (tmpe:%d invval_e:%d norm_x_e:%d g_e:%d abs_x_e:%d\n",tmpe,invVal_e,norm_x_e, *g_e, abs_x_e); tmpe=add(singularVectors_e,2); Loading @@ -1259,7 +1257,7 @@ static void biDiagonalReductionRight_64( Word16 magic_shift; Word32 tmp2; Word32 tmp3; tmp2=W_extract_l(W_shr(singularVectors_Left_64[iCh][currChannel],tmpe)); int norm_x_e1; norm_64=0; move64(); for (jCh=idx;jCh<nChannelsC; jCh++) Loading @@ -1270,13 +1268,51 @@ static void biDiagonalReductionRight_64( } norm_x_e=W_norm(norm_64); norm_x=W_extract_h(W_shl(norm_64,norm_x_e)); norm_x_e1=norm_x_e; f=Mpy_32_32(norm_x,invVal); f_e=add(invVal_e, sub(norm_x_e, r_e )); magic_shift=norm_x_e+27; // f=BASOP_Util_Divide3232_Scale_newton( norm_x, r, &invVal_e ); // f_e = add( invVal_e, sub(norm_x_e, r_e ) ); switch(currChannel) { case 0:magic_shift=norm_x_e+27;break; case 1:magic_shift=norm_x_e+17;break; default:magic_shift=norm_x_e+17;break; } // magic_shift=-32-30*norm_x_e-norm_x_e2+32*invVal_e+32*f_e; for (jCh=idx;jCh<nChannelsC; jCh++) { Word16 s_e; static FILE *f_debug1=NULL; { int x; if (f_debug1==NULL) { f_debug1=fopen("magic_mine.bin","wb"); } x=currChannel;fwrite(&x,sizeof(int),1,f_debug1); x=iCh;fwrite(&x,sizeof(int),1,f_debug1); x=jCh;fwrite(&x,sizeof(int),1,f_debug1); fwrite(&norm_x,sizeof(int),1,f_debug1); fwrite(&norm_x_e,sizeof(short),1,f_debug1); fwrite(&norm_x_e2,sizeof(short),1,f_debug1); fwrite(&invVal_e,sizeof(short),1,f_debug1); fwrite(&f,sizeof(int),1,f_debug1); fwrite(&f_e,sizeof(short),1,f_debug1); fwrite(&singularVectors_Left_64[currChannel][jCh],sizeof(long long),1,f_debug1); fwrite(&singularVectors_Left_64[iCh][jCh],sizeof(long long),1,f_debug1); } s_e=W_norm(singularVectors_Left_64[currChannel][jCh]); // tmp2=W_extract_h(W_shl(singularVectors_Left_64[currChannel][jCh],s_e)); tmp2=W_extract_l(W_shr(singularVectors_Left_64[currChannel][jCh],tmpe)); singularVectors_Left_64[iCh][jCh]=W_add(singularVectors_Left_64[iCh][jCh],W_shr(W_mult0_32_32(f,tmp2),magic_shift)); fwrite(&singularVectors_Left_64[iCh][jCh],sizeof(long long),1,f_debug1); } } invVal_e = 0; Loading Loading @@ -1683,11 +1719,34 @@ 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) */ } printf("norm%d: ",currChannel); printf(" %08X<%2X",norm_x,norm_x_e); printf("\n"); norm_x = BASOP_Util_Divide3232_Scale_newton( norm_x, r, &invVal_e ); norm_x_e = add( invVal_e, sub(norm_x_e, r_e ) ); printf("f%d: ",currChannel); printf("%08X<%2X",norm_x,norm_x_e); printf("\n"); 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, singularVectors[currChannel][jCh] ), add( norm_x_e, singularVectors2_e[currChannel][jCh] ), &singularVectors2_e[iCh][jCh] ); /* exp(sing_exp2) */ { static FILE *f_debug2=NULL; int x; if (f_debug2==NULL) { f_debug2=fopen("magic_expected.bin","wb"); } x=currChannel;fwrite(&x,sizeof(int),1,f_debug2); x=iCh;fwrite(&x,sizeof(int),1,f_debug2); x=jCh;fwrite(&x,sizeof(int),1,f_debug2); fwrite(&norm_x,sizeof(int),1,f_debug2); fwrite(&norm_x_e,sizeof(short),1,f_debug2); fwrite(&singularVectors[iCh][jCh],sizeof(int),1,f_debug2); } printf("magic%d,%d,%d: expected=0x%08X;\n",currChannel,iCh,jCh,singularVectors[iCh][jCh]); move32(); } } Loading