Commit 6f096955 authored by fotopoulou's avatar fotopoulou
Browse files

cleanup inactive code

parent 60a0d1f4
Loading
Loading
Loading
Loading
Loading
+2 −151
Original line number Diff line number Diff line
@@ -455,7 +455,6 @@ ivas_error ivas_dec(
        }
    }
#ifdef OSBA_DISC_OBJ_MCT
    // Todo OSBA merge: This was added as a whole block so probably something is wrong.
    else if ( st_ivas->ivas_format == SBA_ISM_FORMAT )
    {
        int16_t nchan_ism, nchan_transport_ism;
@@ -467,7 +466,7 @@ ivas_error ivas_dec(
        dirac_bs_md_write_idx = 0;
        if ( st_ivas->hDirAC != NULL )
        {
            dirac_bs_md_write_idx = st_ivas->hDirAC->dirac_bs_md_write_idx; /* Store the write-index for this frame */
            dirac_bs_md_write_idx = st_ivas->hDirAC->dirac_bs_md_write_idx; /* Store the write-index for this frame *//*TODOfto:this seems not to be needed?*/
        }
#ifdef ENABLE_ISM_MD_CODING
        /* set ISM parameters and decode ISM metadata in OSBA format */
@@ -483,170 +482,22 @@ ivas_error ivas_dec(
            return error;
        }

#if 0
        /* Configuration of combined-format bit-budget distribution */
        ivas_set_surplus_brate_dec( st_ivas, &ism_total_brate );

        if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ )
        {
            /* set ISM parameters and decode ISM metadata in OSBA format */
            if ( ( error = ivas_omasa_ism_metadata_dec( st_ivas, ism_total_brate, &nchan_ism, &nchan_transport_ism, dirac_bs_md_write_idx, &nb_bits_metadata[1] ) ) != IVAS_ERR_OK )
            {
                return error;
            }

            /* the separated object */
            st = st_ivas->hSCE[0]->hCoreCoder[0];
            st->bit_stream = &( st_ivas->bit_stream[0] );
            if ( ( error = ivas_sce_dec( st_ivas, 0, &output[st_ivas->nchan_transport], output_frame, nb_bits_metadata[1] ) ) != IVAS_ERR_OK )
            {
                return error;
            }

            /* prepare for SBA content decoding */
            if ( st_ivas->nchan_transport == 1 )
            {
                st = st_ivas->hSCE[1]->hCoreCoder[0];
            }
            else
            {
        st = st_ivas->hCPE[0]->hCoreCoder[0];
            }
#if 1
            st->bit_stream = &( st_ivas->bit_stream[( ism_total_brate / FRAMES_PER_SEC )] );
#else
            st->bit_stream = st_ivas->hSCE[0]->hCoreCoder[0]->bit_stream; //& ( st_ivas->bit_stream[( st_ivas->hSCE[0]->hCoreCoder[0]->total_brate / FRAMES_PER_SEC )] );
#endif
        }
        else if ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ )
        {
            // TBD !!!!!
        }

        if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC )
        {
#endif
#if 1 /*TODOfto: no MD for now*/

#endif
#if 0
        /* decode ISM channels */
        for ( n = 0; n < nchan_transport_ism; n++ )
        {
            if ( ( error = ivas_sce_dec( st_ivas, n, &output[st_ivas->nchan_transport + n], output_frame, nb_bits_metadata[1] ) ) != IVAS_ERR_OK )
            {
                return error;
            }
        }

        if ( st_ivas->nchan_transport == 1 )
        {
            st = st_ivas->hSCE[nchan_transport_ism]->hCoreCoder[0];
        }
        else
        {
            st = st_ivas->hCPE[0]->hCoreCoder[0];
        }
#else
        st = st_ivas->hCPE[0]->hCoreCoder[0];
#endif
        //  st->bit_stream = &( st_ivas->bit_stream[( ism_total_brate / FRAMES_PER_SEC )] );
        // st->next_bit_pos = SBA_PLANAR_BITS + SBA_ORDER_BITS;

#if 0
        /* decode SBA transport channels */
        if ( st_ivas->nchan_transport == 1 )
        {
            if ( ( error = ivas_sce_dec( st_ivas, nchan_transport_ism, &output[0], output_frame, nb_bits_metadata[0] ) ) != IVAS_ERR_OK )
            {
                return error;
            }
        }
        else if ( st_ivas->nCPE == 1 )
        {
            if ( ( error = ivas_cpe_dec( st_ivas, 0, output, output_frame, nb_bits_metadata[0] ) ) != IVAS_ERR_OK )
            {
                return error;
            }
        }
        else if ( st_ivas->nCPE > 1 )
        {
    
            if ( ( error = ivas_mct_dec( st_ivas, output, output_frame, nb_bits_metadata[0] ) ) != IVAS_ERR_OK )
            {
                return error;
            }
        }
#else
        if ( ( error = ivas_mct_dec( st_ivas, output, output_frame, nb_bits_metadata[0]+nb_bits_metadata[1] )) != IVAS_ERR_OK )
        {
            return error;
        }
#endif

        /* HP filtering */
        for ( n = 0; n < getNumChanSynthesis( st_ivas ); n++ )
        for ( n = 0; n < getNumChanSynthesis( st_ivas ); n++ ) /*TODOfto:check what needs to be filtered here*/
        {
            hp20( output[n], output_frame, st_ivas->mem_hp20_out[n], output_Fs );
        }

#if 1

        {
            int16_t nchan = st_ivas->nchan_transport + st_ivas->nchan_ism;
            for ( int t = 0; t < output_frame; t++ )
            {
                for ( int c = 0; c < nchan; c++ )
                {
                    int16_t val = (int16_t) ( output[c][t] + 0.5f );
                    dbgwrite( &val, sizeof( int16_t ), 1, 1, "int_dec_core_out.raw" );
                }
            }
        }
#endif

        nchan_remapped = ivas_sba_remapTCs( output, st_ivas, output_frame );


        if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM )
        {
            ivas_sba_mix_matrix_determiner( st_ivas->hSpar, output, st_ivas->bfi, nchan_remapped, output_frame );
        }
#if 0
        /* Set the number of objects for the parametric rendering */
        if ( st_ivas->hDirAC != NULL )
        {
            st_ivas->hDirAC->numIsmDirections = 0;
            if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC && st_ivas->ism_mode != ISM_MASA_MODE_MASA_ONE_OBJ )
            {
                st_ivas->hDirAC->numIsmDirections = st_ivas->nchan_ism;
            }
        }
#endif
#if 0
        if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM )
        {
            /* loudness correction */
            ivas_dirac_dec_binaural_gain( output, nchan_remapped, output_frame );
        }

        /* Loudspeakers, Ambisonics or Binaural rendering */
        if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC )
        {
            if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC && st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC )
            {
                if ( ( error = ivas_omasa_dirac_td_binaural( st_ivas, output, output_frame ) ) != IVAS_ERR_OK )
                {
                    return error;
                }
            }
            else
            {
                ivas_dirac_dec_binaural( st_ivas, st_ivas->hCombinedOrientationData, output, st_ivas->nchan_transport );
            }
        }
        else
#endif
        if ( st_ivas->ism_mode == ISM_SBA_MODE_DISC && st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV )
        {
            if ( ( error = ivas_omasa_dirac_td_binaural( st_ivas, output, output_frame ) ) != IVAS_ERR_OK )
+3 −27
Original line number Diff line number Diff line
@@ -180,16 +180,9 @@ ivas_error ivas_dec_setup(
#ifdef OSBA_DISC_OBJ_MCT
        else if ( st_ivas->ivas_format == SBA_ISM_FORMAT )
        {
            int32_t sba_total_brate;

            /* the number of objects is written at the end of the bitstream, in the SBA metadata */
            st_ivas->nchan_ism = 2 * st_ivas->bit_stream[ivas_total_brate / FRAMES_PER_SEC - 1] + st_ivas->bit_stream[ivas_total_brate / FRAMES_PER_SEC - 2] + 1;
#if 0 /*TODOfto: why is this?*/
            if ( st_ivas->sba_analysis_order == 0 )
            {
                st_ivas->sba_analysis_order = SBA_FOA_ORDER;
            }
#else

            /* read Ambisonic (SBA) planar flag */
            st_ivas->sba_planar = st_ivas->bit_stream[num_bits_read];
            num_bits_read += SBA_PLANAR_BITS;
@@ -213,7 +206,7 @@ ivas_error ivas_dec_setup(
            {
                ivas_sba_config( ivas_total_brate, st_ivas->sba_analysis_order, -1, &( st_ivas->nchan_transport ), st_ivas->sba_planar, &st_ivas->nSCE, &st_ivas->nCPE, &st_ivas->element_mode_init );
            }
#endif

            /*correct number of CPEs for discrete ISM coding*/
            if ( st_ivas->ini_frame > 0 && st_ivas->ism_mode == ISM_SBA_MODE_DISC )
            {
@@ -1065,7 +1058,6 @@ ivas_error ivas_init_decoder(
        ivas_sba_set_cna_cng_flag( st_ivas );
    }
#ifdef OSBA_DISC_OBJ_MCT
    // Todo OSBA merge: This part should be verified as it was a large added block. Some fixes done already.
    else if ( st_ivas->ivas_format == SBA_ISM_FORMAT )
    {
        st_ivas->ism_extmeta_active = -1;
@@ -1108,11 +1100,8 @@ ivas_error ivas_init_decoder(


        int32_t temp_brate[MAX_SCE];
#ifndef OSBA_DISC_OBJ_MCT
        st_ivas->nSCE = st_ivas->nchan_ism; /* number of objects */
#else

        st_ivas->nCPE += st_ivas->nchan_ism >> 1;
#endif


        st_ivas->element_mode_init = IVAS_CPE_MDCT;
@@ -1503,7 +1492,6 @@ ivas_error ivas_init_decoder(
        }
    }
#ifdef OSBA_DISC_OBJ_MCT
#if 1 /*TODOfto leave for later*/
    if ( st_ivas->ivas_format == SBA_ISM_FORMAT )
    {
        if ( ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV ) && st_ivas->ism_mode == ISM_SBA_MODE_DISC )
@@ -1519,20 +1507,8 @@ ivas_error ivas_init_decoder(
            {
                return error;
            }
#if 0           
        }

        if ( st_ivas->renderer_type == RENDERER_DIRAC && ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) )
        {
            /* Allocate 'hIsmRendererData' handle and memory for delay buffer within 'hMasaIsmData' */
            if ( ( error = ivas_masa_ism_separate_object_renderer_open( st_ivas ) ) != IVAS_ERR_OK )
            {
                return error;
            }
#endif
    }
    }
#endif
#endif

    /*-----------------------------------------------------------------*
+0 −58
Original line number Diff line number Diff line
@@ -214,20 +214,6 @@ ivas_error ivas_omasa_dirac_td_binaural(
#endif
        // v_multc( data_separated_objects[n], gain, data_separated_objects[n], output_frame );
    }
#if 1

    {
        int16_t nchan = st_ivas->hOutSetup.nchan_out_woLFE;
        for ( int t = 0; t < output_frame; t++ )
        {
            for ( int c = 0; c < 4; c++ )
            {
                int16_t val = (int16_t) ( data_separated_objects[c][t] + 0.5f );
                dbgwrite( &val, sizeof( int16_t ), 1, 1, "sep_obj.raw" );
            }
        }
    }
#endif

    for ( n = 0; n < st_ivas->nchan_ism; n++ )
    {
@@ -235,21 +221,6 @@ ivas_error ivas_omasa_dirac_td_binaural(
    }


#if 1

    {
        int16_t nchan = st_ivas->hOutSetup.nchan_out_woLFE;
        for ( int t = 0; t < output_frame; t++ )
        {
            for ( int c = 0; c < 4; c++ )
            {
                int16_t val = (int16_t) ( data_separated_objects[c][t] + 0.5f );
                dbgwrite( &val, sizeof( int16_t ), 1, 1, "sep_obj_delay.raw" );
            }
        }
    }
#endif

#ifdef SBA_AND_OBJECTS
    if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV )
    {
@@ -264,39 +235,10 @@ ivas_error ivas_omasa_dirac_td_binaural(
#endif


#if 1

    {
        int16_t nchan = st_ivas->hOutSetup.nchan_out_woLFE;
        for ( int t = 0; t < output_frame; t++ )
        {
            for ( int c = 4; c < 4 + nchan; c++ )
            {
                int16_t val = (int16_t) ( output[c][t] + 0.5f );
                dbgwrite( &val, sizeof( int16_t ), 1, 1, "int_dec_bin_hoa.raw" );
            }
        }
    }
#endif

    if ( ( error = ivas_td_binaural_renderer( st_ivas, p_sepobj, output_frame ) ) != IVAS_ERR_OK )
    {
        return error;
    }
#if 1

    {
        int16_t nchan = st_ivas->hOutSetup.nchan_out_woLFE;
        for ( int t = 0; t < output_frame; t++ )
        {
            for ( int c = 0; c < nchan; c++ )
            {
                int16_t val = (int16_t) ( p_sepobj[c][t] + 0.5f );
                dbgwrite( &val, sizeof( int16_t ), 1, 1, "int_dec_bin_obj.raw" );
            }
        }
    }
#endif

    for ( n = 0; n < BINAURAL_CHANNELS; n++ )
    {
+0 −56
Original line number Diff line number Diff line
@@ -376,43 +376,7 @@ ivas_error ivas_enc(
                return error;
            }
#endif
#if 0
            /* Encode ISMs metadata */
            if ( ( error = ivas_ism_enc( st_ivas, data_f, input_frame, &nb_bits_metadata[1] /*, 0 */ ) ) != IVAS_ERR_OK ) /*TODOfto: not needed for now*/
            {
                return error;
            }
#endif
#if 0

            if ( st_ivas->nchan_transport == 1 )
            {
                st = st_ivas->hSCE[st_ivas->nSCE - 1]->hCoreCoder[0];
                hMetaData = st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData;

                /* update pointer to the buffer of indices (ISM indices were alredy written) */
                hMetaData->ind_list = st_ivas->hSCE[st_ivas->nSCE - 2]->hMetaData->ind_list + st_ivas->hSCE[st_ivas->nSCE - 2]->hMetaData->nb_ind_tot;
                st->hBstr->ind_list = st_ivas->hSCE[st_ivas->nSCE - 2]->hCoreCoder[0]->hBstr->ind_list + st_ivas->hSCE[st_ivas->nSCE - 2]->hCoreCoder[0]->hBstr->nb_ind_tot;
            }
            else
            {
                st = st_ivas->hCPE[0]->hCoreCoder[0];
                hMetaData = st_ivas->hCPE[st_ivas->nCPE - 1]->hMetaData;

                /* update pointer to the buffer of indices (ISM indices were alredy written) */
                hMetaData->ind_list = st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData->ind_list + st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData->nb_ind_tot;
                st->hBstr->ind_list = st_ivas->hSCE[st_ivas->nSCE - 1]->hCoreCoder[0]->hBstr->ind_list + st_ivas->hSCE[st_ivas->nSCE - 1]->hCoreCoder[0]->hBstr->nb_ind_tot;
            }
#endif

#if 0 // TODOfto: why is this needed for ISM_NONE?
            /* write number of objects - unary coding */
            for ( n = 1; n < hEncoderConfig->nchan_ism; n++ )
            {
                push_indice( hMetaData, IND_ISM_NUM_OBJECTS, 1, 1 );
            }
            push_indice( hMetaData, IND_ISM_NUM_OBJECTS, 0, 1 );
#endif
            /* Write SBA planar flag */
            push_indice( st->hBstr, IND_SMODE, hEncoderConfig->sba_planar, SBA_PLANAR_BITS );

@@ -428,11 +392,6 @@ ivas_error ivas_enc(
            /* get SBA TCs */
            ivas_sba_getTCs( &data_f[n], st_ivas, input_frame );

            //  if ( st_ivas->hEncoderConfig->ivas_total_brate >= IVAS_256k )
            // {
            //   st_ivas->nchan_transport += n;
            //}

            /* encode SBA transport channels */
            if ( st_ivas->nchan_transport == 1 )
            {
@@ -450,21 +409,6 @@ ivas_error ivas_enc(
            }
            else if ( st_ivas->nCPE > 1 ) /* FOA/HOA format */
            {
#if 1

                {
                    int16_t nchan = st_ivas->nchan_transport + st_ivas->hEncoderConfig->nchan_ism;
                    for ( int t = 0; t < input_frame; t++ )
                    {
                        for ( int c = 0; c < nchan; c++ )
                        {
                            int16_t val = (int16_t) ( data_f[c][t] + 0.5f );
                            dbgwrite( &val, sizeof( int16_t ), 1, 1, "int_enc_core_in.raw" );
                        }
                    }
                }
#endif

                if ( ( error = ivas_mct_enc( st_ivas, data_f, input_frame, nb_bits_metadata[0] ) ) != IVAS_ERR_OK )
                {
                    return error;
+0 −13
Original line number Diff line number Diff line
@@ -630,19 +630,6 @@ ivas_error ivas_init_encoder(
        }
        else
        {


#if 0
            /* allocate and initialize ISM core-coder handles */
            for ( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ )
            {
                if ( ( error = create_sce_enc( st_ivas, sce_id, sep_object_brate_osba[k - 2][st_ivas->nSCE - 1] ) ) != IVAS_ERR_OK )
                {
                    return error;
                }
            }
#endif

            /* allocate and initialize MCT core coder */

            st_ivas->nCPE += st_ivas->hEncoderConfig->nchan_ism >> 1;
Loading