Commit 62fc6aca authored by Dominik Weckbecker's avatar Dominik Weckbecker 💬
Browse files

fix logic in convert_ambi_format

parent aeda0320
Loading
Loading
Loading
Loading
Loading
+42 −40
Original line number Diff line number Diff line
@@ -203,52 +203,54 @@ int16_t convert_ambi_format( float *in[], float *out[], int16_t order, AMBI_FMT
    }

    if ( in_format == AMBI_FMT_ACN_SN3D && ch_norm_in != ch_norm_out )
    { 
        if ( ch_ord_in != ch_ord_out )
        {
            renormalize_channels( in, p_tmp, order, ch_norm_in, ch_norm_out );
            reorder_channels( p_tmp, out, order, ch_ord_in, ch_ord_out );
        }

#if 0
        else
        {
		static FILE* f_foa = 0;
		if (f_foa == 0)
			f_foa = fopen("renorm.raw","wb");

		for (int16_t  j=0; j < 960;j++)
            renormalize_channels( in, out, order, ch_norm_in, ch_norm_out );
        }
    }
    else if( in_format == AMBI_FMT_ACN_SN3D && ch_ord_in != ch_ord_out )
    {
        reorder_channels( in, out, order, ch_ord_in, ch_ord_out );
    }
    else if ( out_format == AMBI_FMT_ACN_SN3D && ch_norm_in != ch_norm_out )
    {
			for ( int n = 0; n < 16; n++)
        if ( ch_ord_in != ch_ord_out )
        {
				int16_t s1 = out[n][j];
				fwrite(&s1,sizeof(int16_t),1,f_foa);
            reorder_channels( in, p_tmp, order, ch_ord_in, ch_ord_out );
            renormalize_channels( p_tmp, out, order, ch_norm_in, ch_norm_out );
        }
        else
        {
            renormalize_channels( in, out, order, ch_norm_in, ch_norm_out );
        }
    }
#endif

    if ( ch_ord_in != ch_ord_out )
    else if ( out_format == AMBI_FMT_ACN_SN3D && ch_ord_in != ch_ord_out )
    {
        reorder_channels( p_tmp, out, order, ch_ord_in, ch_ord_out );
        reorder_channels( in, out, order, ch_ord_in, ch_ord_out );
    }

#if 0
    else if ( out_format == AMBI_FMT_ACN_SN3D && in_format == AMBI_FMT_ACN_SN3D)
    {
		static FILE* f_foa = 0;
		if (f_foa == 0)
			f_foa = fopen("reorder.raw","wb");
        int16_t i_chan = 0;
        int16_t n_chan = ( order + 1 ) * ( order + 1 );

		for (int16_t  j=0; j < 960;j++)
        for ( i_chan = 0; i_chan < n_chan; i_chan++ )
        {
			for ( int n = 0; n < 16; n++)
            int16_t i = 0;
            for ( i = 0; i < L_FRAME48k; i++ )
            {
				int16_t s1 = out[n][j];
				fwrite(&s1,sizeof(int16_t),1,f_foa);
                out[i_chan][i] = in[i_chan][i];
            }
        }
    }
#endif

    if ( out_format == AMBI_FMT_ACN_SN3D && ch_norm_in != ch_norm_out )
    else
    {
        renormalize_channels( in, out, order, ch_norm_in, ch_norm_out );
         assert ( 0 && "This should never happen!");
    }

    return 0;