Commit 5158a2af authored by Jan Brouwer's avatar Jan Brouwer
Browse files

Merge branch '744_step3_code_changes' into...

Merge branch '744_step3_code_changes' into 922-use-precomputed-HRTF-average-LR-energies-and-IAC-in-all-renderers
parents 0ac38428 64cf79c4
Loading
Loading
Loading
Loading
Loading
+4 −7
Original line number Diff line number Diff line
@@ -718,7 +718,6 @@ int main(
#ifndef NONBE_FIX_BINARY_BINAURAL_READING
        IVAS_DEC_HRTF_HANDLE hHrtfTD = NULL;
#endif

        if ( ( error = IVAS_DEC_GetHrtfHandle( hIvasDec, &hHrtfTD ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nIVAS_DEC_GetHrtfHandle failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
@@ -733,11 +732,13 @@ int main(
#ifdef FIX_OLD_BINARY_FORMAT
                hrtfFileReader_close( &hrtfReader );
                strcat( arg.hrtfFileName, "new" );

                if ( hrtfFileReader_open( arg.hrtfFileName, &hrtfReader ) != IVAS_ERR_OK )
                {
                    fprintf( stderr, "\nError in loading HRTF binary file %s \n\n", arg.hrtfFileName );
                    goto cleanup;
                }

                if ( ( error = load_HRTF_binary( *hHrtfTD, hrtfReader ) ) != IVAS_ERR_OK )
                {
                    if ( error != IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA )
@@ -790,7 +791,7 @@ int main(
#endif

#ifndef NONBE_FIX_BINARY_BINAURAL_READING
        IVAS_DEC_HRTF_CREND_HANDLE *hSetOfHRTF = NULL;
        IVAS_DEC_HRTF_CREND_HANDLE hSetOfHRTF = NULL;
#endif
        if ( ( error = IVAS_DEC_GetHrtfCRendHandle( hIvasDec, &hSetOfHRTF ) ) != IVAS_ERR_OK )
        {
@@ -812,7 +813,7 @@ int main(
            }
        }
#else
        if ( ( error = create_SetOfHRTF_from_binary( *hSetOfHRTF, hrtfReader, arg.output_Fs ) ) != IVAS_ERR_OK )
        if ( ( error = create_SetOfHRTF_from_binary( hSetOfHRTF, hrtfReader, arg.output_Fs ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nError in loading HRTF binary file %s for CRend \n\n", arg.hrtfFileName );
            goto cleanup;
@@ -1002,11 +1003,7 @@ cleanup:
        IVAS_DEC_HRTF_CREND_HANDLE hSetOfHRTF = NULL;
#endif
        IVAS_DEC_GetHrtfCRendHandle( hIvasDec, &hSetOfHRTF );
#ifdef NONBE_FIX_BINARY_BINAURAL_READING
        destroy_SetOfHRTF( hSetOfHRTF );
#else
        destroy_SetOfHRTF( *hSetOfHRTF );
#endif
#ifdef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES
        IVAS_DEC_GetHrtfStatisticsHandle( hIvasDec, &hHrtfStatistics );
        destroy_hrtf_statistics( hHrtfStatistics );
+1 −21
Original line number Diff line number Diff line
@@ -194,19 +194,11 @@ ivas_error ivas_dirac_config(

    if ( ivas_format == SBA_FORMAT || ivas_format == SBA_ISM_FORMAT )
    {
#ifdef NONBE_FIX_907_VLBR_DIRAC_BAND_MAPPING
        ivas_dirac_config_bands( band_grouping, IVAS_MAX_NUM_BANDS, (int16_t) ( Fs * INV_CLDFB_BANDWIDTH + 0.5f ), dirac_to_spar_md_bands, hQMetaData->useLowerBandRes, hConfig->enc_param_start_band, hFbMdft, 1 );
#else
        ivas_dirac_config_bands( band_grouping, IVAS_MAX_NUM_BANDS, (int16_t) ( Fs * INV_CLDFB_BANDWIDTH + 0.5f ), dirac_to_spar_md_bands, hQMetaData->useLowerBandRes, hConfig->enc_param_start_band, hFbMdft );
#endif
    }
    else
    {
#ifdef NONBE_FIX_907_VLBR_DIRAC_BAND_MAPPING
        ivas_dirac_config_bands( band_grouping, hConfig->nbands, (int16_t) ( Fs * INV_CLDFB_BANDWIDTH + 0.5f ), NULL, 0, 0, hFbMdft, 1 );
#else
        ivas_dirac_config_bands( band_grouping, hConfig->nbands, (int16_t) ( Fs * INV_CLDFB_BANDWIDTH + 0.5f ), NULL, 0, 0, hFbMdft );
#endif
    }

    return error;
@@ -219,7 +211,6 @@ ivas_error ivas_dirac_config(
 * DirAC Configuration freq. band function; used also in MASA decoder
 *------------------------------------------------------------------------*/

#ifdef NONBE_FIX_907_VLBR_DIRAC_BAND_MAPPING
void ivas_dirac_config_bands(
    int16_t *band_grouping, /* o  : band grouping                          */
    const int16_t nbands,   /* i  : number of bands                        */
@@ -229,16 +220,6 @@ void ivas_dirac_config_bands(
    const int16_t enc_param_start_band,
    IVAS_FB_MIXER_HANDLE hFbMdft,
    const int8_t BandGroupLowRes )
#else
void ivas_dirac_config_bands(
    int16_t *band_grouping, /* o  : band grouping                          */
    const int16_t nbands,   /* i  : number of bands                        */
    const int16_t max_band, /* i  : maximal band index +1                  */
    int16_t *dirac_to_spar_md_bands,
    const int8_t useLowerBandRes,
    const int16_t enc_param_start_band,
    IVAS_FB_MIXER_HANDLE hFbMdft )
#endif
{
    int16_t i;
    {
@@ -289,9 +270,8 @@ void ivas_dirac_config_bands(
            {
                int16_t step = DIRAC_LOW_BANDRES_STEP;
                int16_t reduced_band;
#ifdef NONBE_FIX_907_VLBR_DIRAC_BAND_MAPPING

                if ( BandGroupLowRes )
#endif
                {
                    for ( band = enc_param_start_band + 2, reduced_band = enc_param_start_band + 1; band <= DIRAC_MAX_NBANDS; band += step, reduced_band++ )
                    {
+0 −24
Original line number Diff line number Diff line
@@ -2920,12 +2920,10 @@ int16_t check_bounds_s(
    const int16_t high                                          /* i  : High limit                              */
);

#ifdef FIX_CRASH_LONG_BRIR
void set_zero_l(
    float *vec,                                                 /* o  : input vector                            */
    const uint32_t lvec                                         /* i  : length of the vector                    */
);
#endif

ivas_error stereo_memory_enc(
    CPE_ENC_HANDLE hCPE,                                        /* i  : CPE encoder structure                   */
@@ -3631,7 +3629,6 @@ ivas_error ivas_dirac_config(
    const int16_t enc_dec                                       /* i  : encoder or decoder flag                 */
);

#ifdef NONBE_FIX_907_VLBR_DIRAC_BAND_MAPPING
void ivas_dirac_config_bands(
    int16_t *band_grouping,                                     /* o  : band grouping                           */
    const int16_t nbands,                                       /* i  : number of bands                         */ 
@@ -3642,19 +3639,6 @@ void ivas_dirac_config_bands(
    IVAS_FB_MIXER_HANDLE hFbMdft,                               /* i  : MDFT filterbank handle                                      */ 
    const int8_t BandGroupLowRes                                /* i  : flag indicating lower band grouping resolution for DirAC    */
);
#else
void ivas_dirac_config_bands(
    int16_t *band_grouping,                                     /* o  : band grouping                           */
    const int16_t nbands,                                       /* i  : number of bands                         */ 
    const int16_t max_band,                                     /* i  : maximal band index +1                   */
    int16_t *dirac_to_spar_md_bands,                            /* o  : mapping of DirAC parameter band index to SPAR FB band index */
    const int8_t useLowerBandRes,                               /* i  : flag indicating lower band resolution for DirAC             */
    const int16_t enc_param_start_band,                         /* i  : band index of first DirAC parameter band                    */
    IVAS_FB_MIXER_HANDLE hFbMdft
);
#endif



void ivas_get_dirac_sba_max_md_bits(
    const int32_t sba_total_brate,
@@ -5868,14 +5852,6 @@ ivas_error ivas_td_binaural_open(
    Decoder_Struct *st_ivas                                     /* i/o: IVAS decoder structure                  */
);

#ifndef FIX_910_REMOVE_DUPLICATION_TD_REND
ivas_error ivas_td_binaural_renderer(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder structure                  */
    float *output[],                                            /* i/o: SCE channels / Binaural synthesis       */
    const int16_t output_frame                                  /* i  : output frame length                     */
);

#endif
ivas_error ivas_td_binaural_renderer_sf(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder structure                  */
    float *output[],                                            /* i/o: SCE channels / Binaural synthesis       */
+2 −2
Original line number Diff line number Diff line
@@ -579,7 +579,7 @@ int16_t check_bounds_s(
    return value_adj;
}

#ifdef FIX_CRASH_LONG_BRIR

/*---------------------------------------------------------------------*
 * set_zero_l()
 *
@@ -600,7 +600,7 @@ void set_zero_l(

    return;
}
#endif


/****************************************************************************/
/* matrix functions                                                         */
+2 −8
Original line number Diff line number Diff line
@@ -151,16 +151,13 @@
/*#define FIX_I4_OL_PITCH*/                             /* fix open-loop pitch used for EVS core switching */
/*#define SPLIT_REND_WITH_HEAD_ROT  */                  /* Dlb,FhG: Split Rendering contributions 21 and 35 */

#define FIX_910_REMOVE_DUPLICATION_TD_REND              /* VA: issue 910: remove duplication of function ivas_td_binaural_renderer() */
#define FIX_940_DEBUGGING_VARIABLE                      /* Nokia: issue #940: remove debugging variable */
#define FIX_WARNING_AS_ERROR

#define FIX_CRASH_LONG_BRIR                             /* Orange : Fix crash when long BRIR is set */
#define FIX_638_ENERGIE_IAC_ROM_TABLES                  /* Orange : Missing left/right and coherence late reverb tables in binary format*/
#define FIX_OLD_BINARY_FORMAT                           /* Orange: temporary to maintain bitexactness */
#define FIX_WARNING_RENDER_CONFIG
#define FIX_INV_DIFFUSE_WEIGHT                          /* Orange : Fix error in energy compensation in late binaural reverb*/
#define FIX_20_MS_FRAME_LEN_TABLES_CONVERTER            /* Orange : generate_tables_converter tools can generate rom for 5 and 20 ms frame length */
#define FIX_911_REMOVE_CREND_DUPLICATION                /* VA: issue 911: resolve duplication of CRend binaural external renderer function */
#define FIX_938_GCC_12_WARNINGS                         /* VA: issue #938: remove set_f(.,.,0) call in which length is always 0 to remove GCC 12.0 warning */

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

@@ -172,9 +169,6 @@
#define NONBE_FIX_AVG_IAC_CLDFB_REVERB                        /* Orange: Add computation avg energy and iac tables for rom and binaural binary file */
#define NONBE_FIX_856_TCX_LTP_SYNTH_FILTER                    /* FhG: issue 856: correct filtering length for tcx-ltp synth filtering*/
#define NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES             /* Philips: Use pre-computed HRTF average L/R energies and IAC in all renderers */
#define NONBE_FIX_907_VLBR_DIRAC_BAND_MAPPING                 /* Dlb: issue 907: fix for band mapping at VLBR */
#define NONBE_FIX_869_MASA_PREREND_MERGE                      /* Nokia: issue: #869: MASA pre-rend not updating energy */
#define NONBE_FIX_931_IGF_STEREO_DEC_NOISE	                  /* FhG: issue #931: fix noise substitution in the stereo IGF decoder      */
#define NONBE_FIX_943_RECONFIG_IGF_AFTER_SETTING_BW           /* FhG: issue 943: fix crash in BW switchin from WB in MDCT-Stereo core encoder */

/* ##################### End NON-BE switches ########################### */
Loading