Commit 2d997da3 authored by lefort's avatar lefort
Browse files

Merge branch '744-fix-sofa-to-rom-tables-and-binaural-binary-files' of...

Merge branch '744-fix-sofa-to-rom-tables-and-binaural-binary-files' of https://forge.3gpp.org/rep/ivas-codec-pc/ivas-codec into 744-fix-sofa-to-rom-tables-and-binaural-binary-files
parents 15ed03a8 eda08a04
Loading
Loading
Loading
Loading
+34 −12
Original line number Diff line number Diff line
@@ -766,7 +766,8 @@ int main(
            }
            else
            {
                dealloc_HRTF_binary( hHrtfTD );
                free( *hHrtfTD );
                *hHrtfTD = NULL;
            }
        }
#else
@@ -816,47 +817,72 @@ int main(
#endif
        }

#ifdef FIX_BINARY_BINAURAL_READING
        IVAS_DEC_HRTF_FASTCONV_HANDLE *hHrtfFastConv = NULL;
#else
        IVAS_DEC_HRTF_FASTCONV_HANDLE hHrtfFastConv = NULL;
#endif
        if ( ( error = IVAS_DEC_GetHrtfFastConvHandle( hIvasDec, &hHrtfFastConv ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nIVAS_DEC_GetHrtfFastConvHandle failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
            goto cleanup;
        }

        if ( ( error = load_fastconv_HRTF_from_binary( hHrtfFastConv, hrtfReader ) ) != IVAS_ERR_OK )
        {
#ifdef FIX_BINARY_BINAURAL_READING
        if ( ( error = load_fastconv_HRTF_from_binary( *hHrtfFastConv, hrtfReader ) ) != IVAS_ERR_OK )
        {
            if ( error != IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA )
            {
                fprintf( stderr, "\nError in loading HRTF binary file %s \n\n", arg.hrtfFileName );
                goto cleanup;
            }
            else
            {
                free( *hHrtfFastConv );
                *hHrtfFastConv = NULL;
            }
        }
#else
        if ( ( error = load_fastconv_HRTF_from_binary( hHrtfFastConv, hrtfReader ) ) != IVAS_ERR_OK )
        {

            fprintf( stderr, "\nError in loading HRTF binary file %s \n\n", arg.hrtfFileName );
            goto cleanup;
#endif
        }
#endif

#ifdef FIX_BINARY_BINAURAL_READING
        IVAS_DEC_HRTF_PARAMBIN_HANDLE *hHrtfParambin = NULL;
#else
        IVAS_DEC_HRTF_PARAMBIN_HANDLE hHrtfParambin = NULL;
#endif
        if ( ( error = IVAS_DEC_GetHrtfParamBinHandle( hIvasDec, &hHrtfParambin ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nIVAS_DEC_GetHrtfParamBinHandle failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
            goto cleanup;
        }

        if ( ( error = load_parambin_HRTF_from_binary( hHrtfParambin, hrtfReader ) ) != IVAS_ERR_OK )
        {
#ifdef FIX_BINARY_BINAURAL_READING
        if ( ( error = load_parambin_HRTF_from_binary( *hHrtfParambin, hrtfReader ) ) != IVAS_ERR_OK )
        {
            if ( error != IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA )
            {
                fprintf( stderr, "\nError in loading HRTF binary file %s \n\n", arg.hrtfFileName );
                goto cleanup;
            }
            else
            {
                free( *hHrtfParambin );
                *hHrtfParambin = NULL;
            }
        }
#else
        if ( ( error = load_parambin_HRTF_from_binary( hHrtfParambin, hrtfReader ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nError in loading HRTF binary file %s \n\n", arg.hrtfFileName );
            goto cleanup;
#endif
        }
#endif
    }


@@ -925,11 +951,7 @@ cleanup:
        IVAS_DEC_HRTF_HANDLE hHrtfTD = NULL;
#endif
        IVAS_DEC_GetHrtfHandle( hIvasDec, &hHrtfTD );
#ifdef FIX_BINARY_BINAURAL_READING
        dealloc_HRTF_binary( hHrtfTD );
#else
        dealloc_HRTF_binary( hHrtfTD );
#endif
        dealloc_HRTF_binary( *hHrtfTD );
        IVAS_DEC_HRTF_CREND_HANDLE hSetOfHRTF = NULL;
        IVAS_DEC_GetHrtfCRendHandle( hIvasDec, &hSetOfHRTF );
        destroy_SetOfHRTF( hSetOfHRTF );
+1 −1
Original line number Diff line number Diff line
@@ -169,7 +169,7 @@ ivas_error ivas_dirac_config(

        if ( hQMetaData != NULL )
        {
            if ( enc_dec == ENC || ( ivas_format != SBA_FORMAT && ivas_format != SBA_ISM_FORMAT ) ) /* Todo: This condition should probably be corrected in main */
            if ( enc_dec == ENC )
            {
                hConfig->nbands = hQMetaData->q_direction[0].cfg.nbands;
            }
+10 −12
Original line number Diff line number Diff line
@@ -83,7 +83,7 @@ static void ivas_reorder_array( float in_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH][

static void ivas_get_Wscaling_factor( float *pppCov_mat_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], float pred_coeffs_re[IVAS_SPAR_MAX_CH - 1][IVAS_MAX_NUM_BANDS], float ***mixer_mat, const int16_t start_band, const int16_t end_band, const int16_t dtx_vad, const int16_t num_ch, const int16_t *pNum_dmx, const int16_t bands_bw, const int16_t active_w, const int16_t active_w_vlbr, float *pWscale, const int16_t dyn_active_w_flag );

static void ivas_calc_post_pred_per_band( float *pppCov_mat_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], float ***mixer_mat, const int16_t num_ch, const int16_t num_dmx, const int16_t band_idx, float postpred_cov_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH] );
static void ivas_calc_post_pred_per_band( float *pppCov_mat_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], float ***mixer_mat, const int16_t num_ch, const int16_t band_idx, float postpred_cov_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH] );

static int16_t ivas_is_mat_inv( float in_re[MAX_MAT_DIM][MAX_MAT_DIM], const int16_t dim );

@@ -682,7 +682,7 @@ static void ivas_get_Wscaling_factor(
{
    int16_t b, ch;
    float dm_f_local, abs_val;
    float postpred_cov_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH];
    float postpred_cov_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH] = { 0 };

    if ( dtx_vad == 0 )
    {
@@ -701,7 +701,10 @@ static void ivas_get_Wscaling_factor(
        {
            float Gw_sq, g_sq = 0;

            ivas_calc_post_pred_per_band( cov_real, mixer_mat, num_ch, pNum_dmx[b * bands_bw], b, postpred_cov_re );
            if ( num_ch != pNum_dmx[b * bands_bw] )
            {
                ivas_calc_post_pred_per_band( cov_real, mixer_mat, num_ch, b, postpred_cov_re );
            }

            Gw_sq = cov_real[0][0][b] / max( postpred_cov_re[0][0], IVAS_FLT_EPS );

@@ -877,7 +880,6 @@ static void ivas_calc_post_pred_per_band(
    float *cov_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH],
    float ***mixer_mat,
    const int16_t num_ch,
    const int16_t num_dmx,
    const int16_t band_idx,
    float postpred_cov_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH] )
{
@@ -886,9 +888,6 @@ static void ivas_calc_post_pred_per_band(
    float temp_mat[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH];
    float tmp_re;

    // NOTE: What is this doing?
    if ( num_dmx != num_ch )
    {
    for ( i = 0; i < num_ch; i++ )
    {
        for ( j = 0; j < num_ch; j++ )
@@ -896,7 +895,6 @@ static void ivas_calc_post_pred_per_band(
            dmx_mat_conj[i][j] = mixer_mat[j][i][band_idx];
        }
    }
    }

    for ( i = 0; i < num_ch; i++ )
    {
@@ -1255,7 +1253,7 @@ void ivas_calc_c_p_coeffs(

    if ( num_dmx != num_ch )
    {
        ivas_calc_post_pred_per_band( cov_real, mixer_mat, num_ch, num_dmx, band_idx, postpred_cov_re );
        ivas_calc_post_pred_per_band( cov_real, mixer_mat, num_ch, band_idx, postpred_cov_re );

        if ( num_dmx != 1 )
        {
+4 −0
Original line number Diff line number Diff line
@@ -159,6 +159,9 @@
#define ROM_TO_RAM                                     /*Dlb : ROM optimization in SR mode*/     
#define FIX_712_713_SPLIT_REND_MASA_MC                 /*Dlb : Fix for issue 712 and 713*/
#endif
#define FIX_705_REND_CONF_FALSE_WARNING                 /* Eri: Bug in MSVC ftell() for UNIX-style line endings trigger false warning messages in renderer configuration. */

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

#define IGF_MEMORY_ALLOC_OPT                            /* FhG: Issue 157: allocate IGF encoder structure only when needed */
#define FIX_732_PLANAR_SBA_OSBA                         /* Dlb : issue 732: fix for crash in planar mode in OSBA format*/
@@ -169,6 +172,7 @@
#define FIX_632_USAN_ERROR_NULL_POINTER                 /* FhG: issue 632 USAN offset to null pointer proto_diffuse_buffer_f in dirac rendering*/
#define FIX_759_CODE_COVERAGE_OSBA                      /* VA: issue 759: remove obsolete code in the OSBA encoder */
#define FIX_708_AEID_COMMAND_LINE                       /* VA: issue 708: improve AEID command-line robustness */
#define FIX_518_ISM_BRIR_EXTREND                        /* FhG: fix issue #518, cleanup ISM to BINAURAL_ROOM_IR rendering in the external renderer */


#define FIX_INV_DIFFUSE_WEIGHT                          /* Orange : Fix error in energy compensation in late binaural reverb*/
+1 −11
Original line number Diff line number Diff line
@@ -202,16 +202,6 @@ void ivas_spar_dump_signal_wav(
    {
        for ( i = 0; i < no_channel; i++, k++ )
        {
#if 0
            if ( ppPcm )
            {
                tmp_value = roundf( ppPcm[i][j] * PCM16_TO_FLT_FAC );
            }
            else
            {
                tmp_value = roundf( pcm_array[i][j] * PCM16_TO_FLT_FAC );
            }
#else
            if ( ppPcm )
            {
                tmp_value = roundf( ppPcm[i][j] );
@@ -220,7 +210,7 @@ void ivas_spar_dump_signal_wav(
            {
                tmp_value = roundf( pcm_array[i][j] );
            }
#endif

            if ( tmp_value > MAX16B_FLT )
            {
                largest_value = (float) fabs( tmp_value ) > largest_value ? (float) fabs( tmp_value ) : largest_value;
Loading