Commit 3809a87b authored by thomas dettbarn's avatar thomas dettbarn
Browse files

less bugs, more debug output.

parent f5535544
Loading
Loading
Loading
Loading
+23 −14
Original line number Diff line number Diff line
@@ -885,12 +885,17 @@ static void HouseholderReduction_fx(
    Word16 singularVectors_Left_fx_e[MAX_OUTPUT_CHANNELS][MAX_OUTPUT_CHANNELS];
#ifdef	 MYCHANGES
	push_wmops("HouseholderReduction_fx 64");
	printf("\n");
	printf("DAFUQ0: %08X\n",singularVectors_Left_fx[0][0]);
    FOR( jCh = 0; jCh < nChannelsL; jCh++ )
    {
	printf("CONV ");
        FOR( iCh = 0; iCh < nChannelsC; iCh++ )
        {
            singularVectors_Left_64[jCh][iCh] = W_shr(W_deposit32_h(singularVectors_Left_fx[jCh][iCh]),32);
		printf("%08X --> %016llX    ",singularVectors_Left_fx[jCh][iCh],singularVectors_Left_64[jCh][iCh]);
        }
	printf("\n");
    }
	for (nCh=0;nCh<nChannelsC;nCh++)
	{
@@ -913,6 +918,7 @@ static void HouseholderReduction_fx(
	}	
	pop_wmops();
#endif
	printf("DAFUQ1: %08X\n",singularVectors_Left_fx[0][0]);
	push_wmops("HouseholderReduction_fx 32");
    FOR( jCh = 0; jCh < nChannelsL; jCh++ )
    {
@@ -922,6 +928,7 @@ static void HouseholderReduction_fx(
            move16();
        }
    }
	printf("DAFUQ2: %08X\n",singularVectors_Left_fx[0][0]);

    /* Bidiagonal Reduction for every channel */
    FOR( nCh = 0; nCh < nChannelsC; nCh++ ) /* nChannelsC */
@@ -996,6 +1003,7 @@ static void biDiagonalReductionLeft_64(
        norm_x=W_extract_h(W_shl(norm_64, tmpe ));
        norm_x_e = add(sub(shl(singularVectors_e, 1), tmpe), 3 );
    }
	printf("\n");
    IF ( norm_x )
    {
        Word16 invVal_e;
@@ -1025,12 +1033,17 @@ static void biDiagonalReductionLeft_64(
        r=W_extract_h(W_shl(r_64,tmpe2));
        r_e = sub(sub(add(add(1,singularVectors_e),g_e),tmpe),tmpe2);

		printf("MYR: \x1b[1;33m-%08X  %08X<%02X   ",-r,r,r_e);
        invVal_e = r_e;
        invVal = BASOP_Util_Divide3232_Scale_newton( MAXVAL_WORD32, r, &invVal_e);
		printf(" inv: -%08X %08X<%02X\x1b[0m\n",-invVal,invVal,invVal_e);
		

        tmpe=add(32,sub(singularVectors_e,g_e));	// TODO: maybe the other way around??
        tmp64=W_shr(W_deposit32_h(g),tmpe);
	printf("MY PROBLEM: \x1b[1;31m singularVectors_Left_64[currChannel][currChannel]:%016llX - %016llX = ",singularVectors_Left_64[currChannel][currChannel],tmp64);
	singularVectors_Left_64[currChannel][currChannel]=W_sub(singularVectors_Left_64[currChannel][currChannel],tmp64);	// exponent +1
	printf(" = %016llX\x1b[0m\n",singularVectors_Left_64[currChannel][currChannel]);


        tmpe=add(singularVectors_e,2);
@@ -1041,7 +1054,7 @@ static void biDiagonalReductionLeft_64(
            Word32 tmp3;

   		 
            tmp2=W_extract_l(W_shr(singularVectors_Left_64[jCh][iCh],tmpe));
            tmp2=W_extract_l(W_shr(singularVectors_Left_64[currChannel][iCh],tmpe));
            norm_64=W_mult0_32_32(tmp,tmp2);
            for (jCh=currChannel+1;jCh<nChannelsL; jCh++)
            {
@@ -1053,6 +1066,7 @@ static void biDiagonalReductionLeft_64(
            norm_x=W_shl(norm_64,norm_x_e);
            f=Mpy_32_32(norm_x,invVal);
            f_e=add(invVal_e, sub(norm_x_e, r_e ));
		printf("\nMYF: \x1b[1;33m%08X<%2X\x1b[0m\n",f,f_e);

            for (jCh=currChannel;jCh<nChannelsL; jCh++)
            {
@@ -1273,6 +1287,7 @@ static void biDiagonalReductionLeft_fx(
		if (eins_e==zwei_e) printf(" okay "); else printf(" FAIL ");
		printf("\n");
	}
	printf("DAFUQ3: %08X\n",singularVectors[0][0]);

        IF( norm_x ) /*(fabsf(*sig_x) > EPSILON * fabsf(*sig_x)) { */
        {
@@ -1300,7 +1315,6 @@ static void biDiagonalReductionLeft_fx(
		{
			Word16 tmpe,tmpe2;
			Word64 tmpmul;
			printf("R64:");
			tmpe=sub(g_e,exponent0)-2;
			tmpmul=W_mult0_32_32(g,singularVectors[currChannel][currChannel]);
			tmpmul=W_shl(tmpmul,tmpe);
@@ -1314,10 +1328,6 @@ static void biDiagonalReductionLeft_fx(



			printf("[%08X<%2X  %08X<%2X]",eins,eins_e,zwei,zwei_e);
			if (eins==zwei) printf(" okay "); else printf("      ");
			if (eins_e==zwei_e) printf(" okay "); else printf(" FAIL ");
			printf("\n");
//			r=eins;
//			r_e=eins_e;
		}
@@ -1329,26 +1339,24 @@ static void biDiagonalReductionLeft_fx(

			tmpe=sub(exponent0,g_e);

			printf("SIGMA::%08X<%2X %08X   s:%08X<%2x ",g,g_e, -g, singularVectors[currChannel][currChannel],singularVectors2_e[currChannel][currChannel]);
			tmp64=W_sub(W_deposit32_l(singularVectors[currChannel][currChannel]),W_shl(W_deposit32_l(tmp),tmpe));
			printf("[%016llx] ",tmp64);
			tmp=W_extract_l(W_shr(tmp64,1));
			//tmp=tmp+singularVectors[currChannel][currChannel];
			printf("(%08X)",tmp);
		} 
//		else 
		{

			printf("MY PROBLEM: %08X<%2X - %08X<%2X = ",singularVectors[currChannel][currChannel], singularVectors2_e[currChannel][currChannel],g,g_e);
		    singularVectors[currChannel][currChannel] = BASOP_Util_Add_Mant32Exp( singularVectors[currChannel][currChannel], singularVectors2_e[currChannel][currChannel], -g, g_e, &singularVectors2_e[currChannel][currChannel] ); /* sing_exp */
			printf("%08X<%2X\n",singularVectors[currChannel][currChannel],singularVectors2_e[currChannel][currChannel]);
		    move32();
		}
		if (currChannel==0)
		{
			printf("s:%08X<%2x\n",singularVectors[currChannel][currChannel],singularVectors2_e[currChannel][currChannel]);
		}

            invVal_e = r_e;
            move16();
		printf("\nMYR: -%08X  %08X<%02X   ",-r,r,r_e);
            invVal = BASOP_Util_Divide3232_Scale_newton( MAXVAL_WORD32, maxWithSign_fx( r ), &invVal_e );
		printf(" inv: -%08X %08X<%02X\n",-invVal,invVal,invVal_e);

            FOR( iCh = currChannel + 1; iCh < nChannelsC; iCh++ ) /* nChannelsC */
            {
@@ -1363,6 +1371,7 @@ static void biDiagonalReductionLeft_fx(

                f = Mpy_32_32( norm_x, invVal ); /* invVal_e + (norm_x_e - r_e) */
                f_e = add( invVal_e, sub( norm_x_e, r_e ) );
		printf("\nMYF: %08X<%2X\n",f,f_e);

                FOR( jCh = currChannel; jCh < nChannelsL; jCh++ ) /* nChannelsL */
                {