Commit 11224eff authored by vaclav's avatar vaclav
Browse files

fix 782: correct OSBA function names; under FIX_782_OSBA_FUNCTION_NAMES

parent 006a21f5
Loading
Loading
Loading
Loading
Loading
+23 −12
Original line number Diff line number Diff line
@@ -5653,14 +5653,19 @@ void ivas_osba_enc(
    const int32_t input_Fs                                      /* i  : input sampling rate                       */
);

#ifdef FIX_782_OSBA_FUNCTION_NAMES
ivas_error ivas_osba_data_open(
#else
ivas_error ivas_masa_ism_data_open(
#endif
    Decoder_Struct *st_ivas                                     /* i/o: IVAS decoder handle                     */
);

#ifndef FIX_782_OSBA_FUNCTION_NAMES
ivas_error ivas_sba_ism_separate_object_renderer_open(
    Decoder_Struct *st_ivas /* i/o: IVAS decoder structure      */
);

#endif
ivas_error ivas_osba_dirac_td_binaural(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder structure                  */
    float *output[],                                            /* o  : output synthesis signal                 */
@@ -5680,9 +5685,15 @@ ivas_error ivas_osba_render(
    const int16_t output_frame                                  /* i  : output frame length per channel             */
);

#ifdef FIX_782_OSBA_FUNCTION_NAMES
void ivas_osba_data_close(
    SBA_ISM_DATA_HANDLE *hSbaIsmData                           /* i/o: OSBA rendering handle                    */
);
#else
void ivas_masa_ism_data_close(
    MASA_ISM_DATA_HANDLE *hMasaIsmData /* i/o: MASA_ISM rendering handle    */
);
#endif


/*----------------------------------------------------------------------------------*
+1 −0
Original line number Diff line number Diff line
@@ -162,6 +162,7 @@
#define FIX_730_DPID_NOT_SET_CORRECTLY                  /* Eri: issue 730: write dpid read from file in correct index, print informative error message when DPID specified is not found. */

#define FIX_RAM_COUNTING_5MS_RENDERING                  /* FhG: fix for correct RAM reporting with 5ms rendering */
#define FIX_782_OSBA_FUNCTION_NAMES                     /* VA: fix 782: correct OSBA function names */

/* #################### End BE switches ################################## */

+4 −0
Original line number Diff line number Diff line
@@ -760,7 +760,11 @@ ivas_error ivas_dec(
            {
                for ( n = 0; n < nchan_ism; n++ )
                {
#ifdef FIX_782_OSBA_FUNCTION_NAMES
                    delay_signal( output[n], output_frame, st_ivas->hSbaIsmData->delayBuffer[n], st_ivas->hSbaIsmData->delayBuffer_size );
#else
                    delay_signal( output[n], output_frame, st_ivas->hMasaIsmData->delayBuffer[n], st_ivas->hMasaIsmData->delayBuffer_size );
#endif
                }
            }

+18 −3
Original line number Diff line number Diff line
@@ -1557,13 +1557,16 @@ ivas_error ivas_init_decoder(
                return error;
            }

#ifdef FIX_782_OSBA_FUNCTION_NAMES
            if ( ( error = ivas_osba_data_open( st_ivas ) ) != IVAS_ERR_OK )
#else
            if ( ( error = ivas_masa_ism_data_open( st_ivas ) ) != IVAS_ERR_OK )
#endif
            {
                return error;
            }
        }


        /* set CNA/CNG flags */
        ivas_sba_set_cna_cng_flag( st_ivas );
    }
@@ -1669,7 +1672,7 @@ ivas_error ivas_init_decoder(

            st_ivas->nchan_transport = ivas_mc_ls_setup_get_num_channels( ivas_mc_map_output_config_to_mc_ls_setup( st_ivas->transport_config ) );
            st_ivas->nSCE = 0;
            st_ivas->nCPE = st_ivas->nchan_transport / 2;
            st_ivas->nCPE = st_ivas->nchan_transport / CPE_CHANNELS;

            st_ivas->element_mode_init = IVAS_CPE_MDCT;

@@ -1703,7 +1706,7 @@ ivas_error ivas_init_decoder(
            }

            st_ivas->nSCE = 0;
            st_ivas->nCPE = MC_PARAMUPMIX_MAX_TRANSPORT_CHANS / 2;
            st_ivas->nCPE = MC_PARAMUPMIX_MAX_TRANSPORT_CHANS / CPE_CHANNELS;
            st_ivas->nchan_transport = MC_PARAMUPMIX_MAX_TRANSPORT_CHANS;

            if ( ( error = ivas_mc_paramupmix_dec_open( st_ivas ) ) != IVAS_ERR_OK )
@@ -2069,6 +2072,7 @@ ivas_error ivas_init_decoder(
                return error;
            }
        }
#ifndef FIX_782_OSBA_FUNCTION_NAMES
        if ( st_ivas->ism_mode == ISM_SBA_MODE_DISC )
        {
            /* Allocate 'hIsmRendererData' handle and memory for delay buffer within 'hMasaIsmData' */
@@ -2077,6 +2081,7 @@ ivas_error ivas_init_decoder(
                return error;
            }
        }
#endif
    }

    /*-----------------------------------------------------------------*
@@ -2445,6 +2450,9 @@ void ivas_initialize_handles_dec(
    st_ivas->hHrtfParambin = NULL;
    st_ivas->hoa_dec_mtx = NULL;
    st_ivas->hMasaIsmData = NULL;
#ifdef FIX_782_OSBA_FUNCTION_NAMES
    st_ivas->hSbaIsmData = NULL;
#endif

    st_ivas->hHeadTrackData = NULL;
    st_ivas->hHrtfTD = NULL;
@@ -2653,8 +2661,14 @@ void ivas_destroy_dec(
        free( st_ivas->hMonoDmxRenderer );
        st_ivas->hMonoDmxRenderer = NULL;
    }

#ifdef FIX_782_OSBA_FUNCTION_NAMES
    /* OSBA structure */
    ivas_osba_data_close( &st_ivas->hSbaIsmData );
#else
    /* MASA ISM structure */
    ivas_masa_ism_data_close( &st_ivas->hMasaIsmData );
#endif

    /* OMASA structure */
    ivas_omasa_data_close( &st_ivas->hMasaIsmData );
@@ -2682,6 +2696,7 @@ void ivas_destroy_dec(

    /* CRend binaural renderer handle */
    ivas_HRTF_CRend_binary_close( &st_ivas->hSetOfHRTF );

    /* Fastconv HRTF memories */
    ivas_binaural_hrtf_close( &st_ivas->hHrtfFastConv );

+94 −7
Original line number Diff line number Diff line
@@ -43,6 +43,81 @@
#include "wmc_auto.h"


#ifdef FIX_782_OSBA_FUNCTION_NAMES
/*-------------------------------------------------------------------*
 * ivas_osba_data_open()
 *
 * Allocate and initialize SBA_ISM rendering handle
 *-------------------------------------------------------------------*/

ivas_error ivas_osba_data_open(
    Decoder_Struct *st_ivas /* i/o: IVAS decoder handle  */
)
{
    SBA_ISM_DATA_HANDLE hSbaIsmData;
    int16_t i;

    if ( ( hSbaIsmData = (SBA_ISM_DATA_HANDLE) malloc( sizeof( SBA_ISM_DATA ) ) ) == NULL )
    {
        return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for OSBA data\n" ) );
    }

    hSbaIsmData->delayBuffer_nchan = st_ivas->nchan_ism;
    hSbaIsmData->delayBuffer_size = (int16_t) ( ( st_ivas->hDecoderConfig->output_Fs / 50 ) / MAX_PARAM_SPATIAL_SUBFRAMES );

    if ( ( hSbaIsmData->delayBuffer = (float **) malloc( hSbaIsmData->delayBuffer_nchan * sizeof( float * ) ) ) == NULL )
    {
        return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for MASA ISM delay buffer \n" ) );
    }

    for ( i = 0; i < hSbaIsmData->delayBuffer_nchan; i++ )
    {
        if ( ( hSbaIsmData->delayBuffer[i] = (float *) malloc( hSbaIsmData->delayBuffer_size * sizeof( float ) ) ) == NULL )
        {
            return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for MASA ISM delay buffer \n" ) );
        }
        set_zero( hSbaIsmData->delayBuffer[i], hSbaIsmData->delayBuffer_size );
    }

    st_ivas->hSbaIsmData = hSbaIsmData;

    return IVAS_ERR_OK;
}


/*-------------------------------------------------------------------*
 * ivas_osba_data_close()
 *
 * Deallocate SBA_ISM rendering handle
 *-------------------------------------------------------------------*/

void ivas_osba_data_close(
    SBA_ISM_DATA_HANDLE *hSbaIsmData /* i/o: OSBA rendering handle    */
)
{
    int16_t i;

    if ( hSbaIsmData == NULL || *hSbaIsmData == NULL )
    {
        return;
    }

    if ( ( *hSbaIsmData )->delayBuffer != NULL )
    {
        for ( i = 0; i < ( *hSbaIsmData )->delayBuffer_nchan; i++ )
        {
            free( ( *hSbaIsmData )->delayBuffer[i] );
        }
        free( ( *hSbaIsmData )->delayBuffer );
        ( *hSbaIsmData )->delayBuffer = NULL;
    }

    free( *hSbaIsmData );
    *hSbaIsmData = NULL;

    return;
}
#else
/*-------------------------------------------------------------------*
 * ivas_masa_ism_data_open()
 *
@@ -130,12 +205,13 @@ ivas_error ivas_sba_ism_separate_object_renderer_open(

    return IVAS_ERR_OK;
}
#endif


/*--------------------------------------------------------------------------*
 * ivas_osba_dirac_td_binaural()
 *
 * Binaural rendering in OMASA format
 * Binaural rendering in OSBA format
 *--------------------------------------------------------------------------*/

ivas_error ivas_osba_dirac_td_binaural(
@@ -146,7 +222,6 @@ ivas_error ivas_osba_dirac_td_binaural(
{
    int16_t n;
    float data_separated_objects[MAX_NUM_OBJECTS][L_FRAME48k];

    ivas_error error;
    float *p_sepobj[MAX_NUM_OBJECTS];
    int16_t channel_offset;
@@ -164,13 +239,16 @@ ivas_error ivas_osba_dirac_td_binaural(
    }

#ifdef OSBA_SPLIT_RENDERING
    if ( st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_BINAURAL_SPLIT_CODED &&
         st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
    if ( st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_BINAURAL_SPLIT_CODED && st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
#endif
    {
        for ( n = 0; n < st_ivas->nchan_ism; n++ )
        {
#ifdef FIX_782_OSBA_FUNCTION_NAMES
            delay_signal( data_separated_objects[n], output_frame, st_ivas->hSbaIsmData->delayBuffer[n], st_ivas->hSbaIsmData->delayBuffer_size );
#else
            delay_signal( data_separated_objects[n], output_frame, st_ivas->hMasaIsmData->delayBuffer[n], st_ivas->hMasaIsmData->delayBuffer_size );
#endif
        }
    }

@@ -183,8 +261,7 @@ ivas_error ivas_osba_dirac_td_binaural(
    }
    else
    {
        ivas_dirac_dec_binaural( st_ivas, st_ivas->hCombinedOrientationData, &output[channel_offset], st_ivas->nchan_transport,
                                 MAX_PARAM_SPATIAL_SUBFRAMES );
        ivas_dirac_dec_binaural( st_ivas, st_ivas->hCombinedOrientationData, &output[channel_offset], st_ivas->nchan_transport, MAX_PARAM_SPATIAL_SUBFRAMES );
    }

#ifdef DEBUG_OSBA
@@ -266,6 +343,12 @@ ivas_error ivas_osba_dirac_td_binaural(
}


/*-------------------------------------------------------------------------*
 * ivas_osba_ism_metadata_dec()
 *
 * ISM metadata decoding in OSBA format.
 *-------------------------------------------------------------------------*/

ivas_error ivas_osba_ism_metadata_dec(
    Decoder_Struct *st_ivas,       /* i/o: IVAS decoder structure            */
    const int32_t ism_total_brate, /* i  : ISM total bitrate                 */
@@ -280,7 +363,6 @@ ivas_error ivas_osba_ism_metadata_dec(
    nchan_transport_ism = st_ivas->nchan_ism;
    *nchan_ism = st_ivas->nchan_ism;


    /* decode ISM metadata */
    if ( ( error = ivas_ism_metadata_dec( ism_total_brate, *nchan_ism, &nchan_transport_ism, st_ivas->hIsmMetaData, NULL, st_ivas->bfi,
                                          nb_bits_metadata, st_ivas->ism_mode, st_ivas->hISMDTX, NULL, &st_ivas->ism_extmeta_active, &st_ivas->ism_extmeta_cnt, st_ivas->hCPE[0]->hCoreCoder[0] ) ) != IVAS_ERR_OK )
@@ -291,6 +373,7 @@ ivas_error ivas_osba_ism_metadata_dec(
    return IVAS_ERR_OK;
}


/*-------------------------------------------------------------------------*
 * ivas_osba_render()
 *
@@ -329,7 +412,11 @@ ivas_error ivas_osba_render(
        for ( n = 0; n < nchan_ism; n++ )
        {
            mvr2r( output_f[n], tmp_ism_out[n], output_frame );
#ifdef FIX_782_OSBA_FUNCTION_NAMES
            delay_signal( tmp_ism_out[n], output_frame, st_ivas->hSbaIsmData->delayBuffer[n], st_ivas->hSbaIsmData->delayBuffer_size );
#else
            delay_signal( tmp_ism_out[n], output_frame, st_ivas->hMasaIsmData->delayBuffer[n], st_ivas->hMasaIsmData->delayBuffer_size );
#endif
        }

        if ( st_ivas->renderer_type == RENDERER_OSBA_AMBI )
Loading