Commit cd7a111a authored by thomas dettbarn's avatar thomas dettbarn
Browse files

gave left64 and righ64 the same bitwindow.

parent cdcdb04c
Loading
Loading
Loading
Loading
+48 −13
Original line number Diff line number Diff line
@@ -917,7 +917,8 @@ static void HouseholderReduction_fx(
			printf("compare%d \x1b[1;32mend\x1b[0m\n",nCh);
		}

                bitwindow=nCh+1;
//                bitwindow=nCh+1;
		bitwindow=1;
		biDiagonalReductionRight_64(
			singularVectors_Left_64,bitwindow,
			secDiag_fx,secDiag_fx_e,
@@ -1005,21 +1006,54 @@ static void HouseholderReduction_fx(
	pop_wmops();
	{
		int i,j;
		int magicnum;
		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("FINALLY%02d> ",i);
			for (j=0;j<nChannelsC;j++)
			{
				Word16 n;
				Word32 x;
				n=W_norm(singularVectors_Left_64[i][j]);
				x=W_extract_h(W_shl(singularVectors_Left_64[i][j],n-1));
				printf("%08X^%08X=%08X ",x,singularVectors_Left_fx[i][j],singularVectors_Left_fx[i][j]^x);
				Word32 bestmatch;
				Word32 retval;
				int better;
				unsigned int x;
				int k;
				bestmatch=8;
				x=(unsigned int)singularVectors_Left_fx[i][j];
				retval=x;
				better=0;
				for (k=0;k<64;k++)
				{
					int leadingzeros;
					unsigned int y;
					Word32 z;
					int l;
					
					z=W_extract_l(W_shr(singularVectors_Left_64[i][j],k));	
					y=x^(unsigned int)z;
					leadingzeros=0;
					for (l=0;l<32;l++)
					{
						if (y&0x80000000) break;
						leadingzeros++;
						y<<=1;
					}
			printf("\n");
					if (bestmatch<leadingzeros)
					{
						bestmatch=leadingzeros;
						retval=z;
						better=1;
					}
	
				}
				totalcnt++;
				if (retval!=singularVectors_Left_fx[i][j]) bettercnt++;
				singularVectors_Left_fx[i][j]=retval;
			}
		}
		printf("\nbetter %d/%d\n",bettercnt,totalcnt);
	}
    /* SingularVecotr Accumulation */
    singularVectorsAccumulationRight_fx( singularVectors_Left_fx, singularVectors_Right_fx, secDiag_fx, singularVectors_Left_fx_e, secDiag_fx_e, nChannelsC );
@@ -1084,8 +1118,8 @@ static void biDiagonalReductionLeft_64(
        {
           g = L_negate( g );
        }
        factor2 = W_extract_l( W_shr( singularVectors_Left_64[currChannel][currChannel], bitwindow-1) );
        tmp_e=sub( sub( g_e, bitwindow), 1);	// bitwindow=singularvectors_e+1 --> g_e-sin_e-2 <=> g_e-bitwindow-3
        factor2 = W_extract_l( W_shr( singularVectors_Left_64[currChannel][currChannel], bitwindow) );
        tmp_e=sub( g_e, bitwindow) ;
        tmpmul=W_mult0_32_32( g, factor2);
        tmpmul=W_shl(tmpmul, tmp_e);
        r_64=W_sub(tmpmul, norm_64);
@@ -1102,7 +1136,7 @@ static void biDiagonalReductionLeft_64(
        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 = currChannel+1; iCh < nChannelsC; iCh++)
        FOR ( iCh = add( currChannel, 1 ); iCh < nChannelsC; iCh++)
        {
	    Word32 factor1;
            Word32 factor2;
@@ -1252,7 +1286,8 @@ static void biDiagonalReductionRight_64(
                norm_x = W_extract_h( 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) );
                magic_shift = -3*currChannel+22-2*norm_x_e+4*r_e+3*f_e;		// FIXME: HOW IS THIS WORKING?????!?!?!?!?!?!?!?!?!?
//                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;		// FIXME: HOW IS THIS WORKING?????!?!?!?!?!?!?!?!?!?
                FOR( jCh = idx; jCh < nChannelsC; jCh++ )
                {
                    factor2 = W_extract_l( W_shr( singularVectors_Left_64[currChannel][jCh], bitwindow) );