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

writing traces.

parent a18e470a
Loading
Loading
Loading
Loading
+162 −6
Original line number Diff line number Diff line
@@ -854,6 +854,7 @@ static void ApplyRotation_fx(
 *
 *
 *-------------------------------------------------------------------------*/
FILE *f_debug=NULL;

static void HouseholderReduction_fx(
    Word32 singularVectors_Left_fx[][MAX_OUTPUT_CHANNELS],  /* exp(singularVectors_Left_e) */
@@ -894,6 +895,7 @@ static void HouseholderReduction_fx(
    Word16 iCh, jCh;
    Word16 singularVectors_Left_fx_e[MAX_OUTPUT_CHANNELS][MAX_OUTPUT_CHANNELS];
#ifdef MERGE_REQUEST_1926_SPEEDUP_ivas_svd_dec_fx_NONBE
	if (f_debug==NULL) f_debug=fopen("MYCODE.trace","wb");
    FOR( jCh = 0; jCh < nChannelsL; jCh++ )
    {
        FOR( iCh = 0; iCh < nChannelsC; iCh++ )
@@ -901,8 +903,34 @@ static void HouseholderReduction_fx(
            singularVectors_Left_64[jCh][iCh] = W_shr( W_deposit32_h( singularVectors_Left_fx[jCh][iCh] ), 32 );
        }
    }
    {
	    unsigned int x;
	    x=0xd00faffe;fwrite(&x,sizeof(int),1,f_debug);
	    fwrite(&nChannelsL,sizeof(short),1,f_debug);
	    fwrite(&nChannelsC,sizeof(short),1,f_debug);
	    fwrite(&singularVectors_Left_e,sizeof(short),1,f_debug);
    }
    for ( nCh = 0; nCh < nChannelsC; nCh++ )
    {

	    {
		    fwrite(&nCh,sizeof(short),1,f_debug);

		    FOR( jCh = 0; jCh < nChannelsL; jCh++ )
		    {
			    FOR( iCh = 0; iCh < nChannelsC; iCh++ )
			    {
				    Word16 n;
                                    Word32 y;
				    n=W_norm(singularVectors_Left_64[jCh][iCh]);
				    y=W_extract_h(W_shl(singularVectors_Left_64[jCh][iCh],n));
				    fwrite(&n,sizeof(Word16),1,f_debug);
				    fwrite(&y,sizeof(Word32),1,f_debug);

			    }
		    }

	    }
	    biDiagonalReductionLeft_64(
			    singularVectors_Left_64,
			    nChannelsL,
@@ -916,6 +944,23 @@ 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 );
       	    {

		    FOR( jCh = 0; jCh < nChannelsL; jCh++ )
		    {
			    FOR( iCh = 0; iCh < nChannelsC; iCh++ )
			    {
				    Word16 n;
                                    Word32 y;
				    n=W_norm(singularVectors_Left_64[jCh][iCh]);
				    y=W_extract_h(W_shl(singularVectors_Left_64[jCh][iCh],n));
				    fwrite(&n,sizeof(Word16),1,f_debug);
				    fwrite(&y,sizeof(Word32),1,f_debug);

			    }
		    }

	    }
 biDiagonalReductionRight_64(
            singularVectors_Left_64,
            nChannelsL,
@@ -923,6 +968,27 @@ static void HouseholderReduction_fx(
            nCh,
            &g_right_fx,
            &g_right_e );
       	    {
		    fwrite(&singularValues_fx[nCh],sizeof(int),1,f_debug);
	            fwrite(&singularValues_fx_e[nCh],sizeof(short),1,f_debug);
		    fwrite(&secDiag_fx[nCh],sizeof(int),1,f_debug);
	            fwrite(&secDiag_fx_e[nCh],sizeof(short),1,f_debug);

		    FOR( jCh = 0; jCh < nChannelsL; jCh++ )
		    {
			    FOR( iCh = 0; iCh < nChannelsC; iCh++ )
			    {
				    Word16 n;
                                    Word32 y;
				    n=W_norm(singularVectors_Left_64[jCh][iCh]);
				    y=W_extract_h(W_shl(singularVectors_Left_64[jCh][iCh],n));
				    fwrite(&n,sizeof(Word16),1,f_debug);
				    fwrite(&y,sizeof(Word32),1,f_debug);

			    }
		    }

	    }
        {
            Word16 L_temp_e;
            Word32 L_temp;
@@ -950,6 +1016,7 @@ static void HouseholderReduction_fx(
        }
    }
#else
	if (f_debug==NULL) f_debug=fopen("MAINCODE.trace","wb");

    FOR( jCh = 0; jCh < nChannelsL; jCh++ )
    {
@@ -959,12 +1026,75 @@ static void HouseholderReduction_fx(
            move16();
        }
    }
    {
	    unsigned int x;
	    x=0xd00faffe;fwrite(&x,sizeof(int),1,f_debug);
	    fwrite(&nChannelsL,sizeof(short),1,f_debug);
	    fwrite(&nChannelsC,sizeof(short),1,f_debug);
	    fwrite(&singularVectors_Left_e,sizeof(short),1,f_debug);
    }

    /* Bidiagonal Reduction for every channel */
    FOR( nCh = 0; nCh < nChannelsC; nCh++ ) /* nChannelsC */
    {
	    {
		    fwrite(&nCh,sizeof(short),1,f_debug);

		    FOR( jCh = 0; jCh < nChannelsL; jCh++ )
		    {
			    FOR( iCh = 0; iCh < nChannelsC; iCh++ )
			    {
				    Word16 n;
                                    Word32 y;
				    n=singularVectors_Left_fx_e[jCh][iCh];
				    y=singularVectors_Left_fx[jCh][iCh];
				    fwrite(&n,sizeof(Word16),1,f_debug);
				    fwrite(&y,sizeof(Word32),1,f_debug);

			    }
		    }

	    }
        biDiagonalReductionLeft_fx( singularVectors_Left_fx, singularValues_fx, secDiag_fx, singularVectors_Left_fx_e, singularValues_fx_e, secDiag_fx_e, nChannelsL, nChannelsC, nCh, &sig_x_fx, &sig_x_fx_e, &g_fx );
       	    {

		    FOR( jCh = 0; jCh < nChannelsL; jCh++ )
		    {
			    FOR( iCh = 0; iCh < nChannelsC; iCh++ )
			    {
				    Word16 n;
                                    Word32 y;
				    n=singularVectors_Left_fx_e[jCh][iCh];
				    y=singularVectors_Left_fx[jCh][iCh];
				    fwrite(&n,sizeof(Word16),1,f_debug);
				    fwrite(&y,sizeof(Word32),1,f_debug);

			    }
		    }

	    }
 biDiagonalReductionRight_fx( singularVectors_Left_fx, secDiag_fx, singularVectors_Left_fx_e, secDiag_fx_e, nChannelsL, nChannelsC, nCh, &sig_x_fx, &sig_x_fx_e, &g_fx );
	    {

		    fwrite(&singularValues_fx[nCh],sizeof(int),1,f_debug);
	            fwrite(&singularValues_fx_e[nCh],sizeof(short),1,f_debug);
		    fwrite(&secDiag_fx[nCh],sizeof(int),1,f_debug);
	            fwrite(&secDiag_fx_e[nCh],sizeof(short),1,f_debug);
		    FOR( jCh = 0; jCh < nChannelsL; jCh++ )
		    {
			    FOR( iCh = 0; iCh < nChannelsC; iCh++ )
			    {
				    Word16 n;
                                    Word32 y;
				    n=singularVectors_Left_fx_e[jCh][iCh];
				    y=singularVectors_Left_fx[jCh][iCh];
				    fwrite(&n,sizeof(Word16),1,f_debug);
				    fwrite(&y,sizeof(Word32),1,f_debug);

			    }
		    }

	    }

        Word16 L_temp_e;
        Word32 L_temp = BASOP_Util_Add_Mant32Exp( L_abs( singularValues_fx[nCh] ), singularValues_fx_e[nCh], L_abs( secDiag_fx[nCh] ), secDiag_fx_e[nCh], &L_temp_e ); /* exp(L_temp_e) */
@@ -1034,6 +1164,15 @@ static void biDiagonalReductionLeft_64(
        norm_x_e0 = W_norm( norm_64 );
        norm_x = W_extract_h( W_shl( norm_64, norm_x_e ) );
    }
{
	Word32 sig_x;
	Word16 sig_x_e;

	sig_x=(norm_x!=0);
	sig_x_e=0;
	fwrite(&sig_x,sizeof(Word32),1,f_debug);
	fwrite(&sig_x_e,sizeof(Word16),1,f_debug);
}
    IF( norm_x )
    {
        Word32 factor2;
@@ -1065,7 +1204,13 @@ static void biDiagonalReductionLeft_64(


        tmp_e = sub( 32, *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.
        singularVectors_Left_64[currChannel][currChannel] = W_sub( singularVectors_Left_64[currChannel][currChannel], W_shr( W_deposit32_h( *g ), tmp_e ) );
{
	fwrite(&norm_x,sizeof(Word32),1,f_debug);
	fwrite(&norm_x_e,sizeof(Word16),1,f_debug);
	fwrite(g,sizeof(Word32),1,f_debug);
	fwrite(g_e,sizeof(Word16),1,f_debug);
}

        FOR( iCh = add( currChannel, 1 ); iCh < nChannelsC; iCh++ )
        {
@@ -1254,6 +1399,10 @@ static void biDiagonalReductionLeft_fx(
        {
            ( *sig_x ) = BASOP_Util_Add_Mant32Exp( *sig_x, *sig_x_e, L_abs( singularVectors[jCh][currChannel] ), singularVectors2_e[jCh][currChannel], sig_x_e ); /* exp(sig_x_e) */
        }
{
	fwrite(sig_x,sizeof(Word32),1,f_debug);
	fwrite(sig_x_e,sizeof(Word16),1,f_debug);
}

        IF( ( *sig_x ) ) /*(fabsf(*sig_x) > EPSILON * fabsf(*sig_x)) { */
        {
@@ -1314,6 +1463,13 @@ static void biDiagonalReductionLeft_fx(
            }
            ( *g ) = L_temp;
            move32();
{
	fwrite(&norm_x,sizeof(Word32),1,f_debug);
	fwrite(&norm_x_e,sizeof(Word16),1,f_debug);
	fwrite(g,sizeof(Word32),1,f_debug);
	fwrite(&L_temp_e,sizeof(Word16),1,f_debug);
}


            r = BASOP_Util_Add_Mant32Exp( Mpy_32_32( ( *g ), singularVectors[currChannel][idx] ), singularVectors2_e[currChannel][idx], -norm_x, norm_x_e, &r_e );                                      /* exp(r_e) */
            singularVectors[currChannel][idx] = BASOP_Util_Add_Mant32Exp( singularVectors[currChannel][idx], singularVectors2_e[currChannel][idx], -( *g ), 0, &singularVectors2_e[currChannel][idx] ); /* sing_exp */
+11 −0
Original line number Diff line number Diff line
@@ -150,6 +150,17 @@ ivas_error AudioFileWriter_write(
    int16_t *samples,
    uint32_t numSamples )
{

	extern FILE *f_debug;

	if (f_debug!=NULL)
	{
		unsigned int x;
		x=0xbeebbeeb;fwrite(&x,sizeof(int),1,f_debug);
		fwrite(&numSamples,sizeof(int),1,f_debug);
		fwrite(samples,sizeof(short),numSamples,f_debug);
		
	}
    ivas_error error = IVAS_ERR_OK;
    if ( self->rawFile )
    {