Commit 6f2d744f authored by Devansh Kandpal's avatar Devansh Kandpal
Browse files

Fixed memory allocation errors for Binaural Room Reverb cases

parent f42ce80b
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -693,11 +693,11 @@ stages:
    - *check-up-to-date-in-comparison-jobs

    - exit_code_target=0
    - python3 -m pytest $TEST_SUITE -v --update_ref 1 --create_ref -n auto --ref_encoder_path $MERGE_TARGET_ENCODER_PATH --ref_decoder_path $MERGE_TARGET_DECODER_PATH --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH -k "not model" > $PYTEST_LOG_TARGET_BRANCH || exit_code_target=$?
    - python3 -m pytest $TEST_SUITE -v --update_ref 1 --create_ref -n auto --ref_encoder_path $MERGE_TARGET_ENCODER_PATH --ref_decoder_path $MERGE_TARGET_DECODER_PATH --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH > $PYTEST_LOG_TARGET_BRANCH || exit_code_target=$?

    - exit_code=0
    - rm -rf .pytest_cache || true
    - python3 -m pytest --tb=no -q $TEST_SUITE -v --keep_files --create_cut --html=$HTML_REPORT --self-contained-html --junit-xml=$XML_REPORT --ref_encoder_path $MERGE_TARGET_ENCODER_PATH --ref_decoder_path $MERGE_TARGET_DECODER_PATH --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH -n auto --testcase_timeout $testcase_timeout -k "not model" > pytest_log.txt || exit_code=$?
    - python3 -m pytest --tb=no -q $TEST_SUITE -v --keep_files --create_cut --html=$HTML_REPORT --self-contained-html --junit-xml=$XML_REPORT --ref_encoder_path $MERGE_TARGET_ENCODER_PATH --ref_decoder_path $MERGE_TARGET_DECODER_PATH --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH -n auto --testcase_timeout $testcase_timeout > pytest_log.txt || exit_code=$?

    - if [ $exit_code -ne 0 ]; then
    -   exit_code=$EXIT_CODE_NON_BE
@@ -2214,7 +2214,7 @@ ivas-pytest-on-merge-request:

    ### prepare pytest
    # create references
    - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR -v --update_ref 1 -k "not model"
    - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR -v --update_ref 1

    ### Run test using branch scripts and input
    - if [ $ref_using_target == 1 ]; then git checkout $source_branch_commit_sha; fi
@@ -2222,7 +2222,7 @@ ivas-pytest-on-merge-request:
    ### run pytest
    - exit_code=0
    - testcase_timeout=600
    - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR -v --html=report.html --self-contained-html --junit-xml=report-junit.xml --testcase_timeout=$testcase_timeout -k "not model" || exit_code=$?
    - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR -v --html=report.html --self-contained-html --junit-xml=report-junit.xml --testcase_timeout=$testcase_timeout || exit_code=$?
    - zero_errors=$(cat report-junit.xml | grep -c 'errors="0"') || true

    - *merge-request-comparison-check
+6 −4
Original line number Diff line number Diff line
@@ -2520,16 +2520,18 @@ ivas_error ivas_binaural_reverb_init(
    {
        float t60_temp[CLDFB_NO_CHANNELS_MAX];
        float ene_temp[CLDFB_NO_CHANNELS_MAX];

        revTimes = t60;
        revEne = ene;

        if ( ( error = ivas_reverb_prepare_cldfb_params( roomAcoustics, hHrtfStatistics, sampling_rate, t60_temp, ene_temp ) ) != IVAS_ERR_OK )
        {
            return error;
        }
        floatToFixed_arrL32( t60_temp, t60, Q15, CLDFB_NO_CHANNELS_MAX );
        floatToFixed_arrL32( ene_temp, ene, Q15, CLDFB_NO_CHANNELS_MAX );
        revTimes = t60;
        revEne = ene;

        preDelay = (int16_t) roundf( 48000.0f * roomAcoustics->acousticPreDelay / CLDFB_NO_CHANNELS_MAX );
        floatToFixed_arrL( t60_temp, t60, Q31, CLDFB_NO_CHANNELS_MAX );
        floatToFixed_arrL( ene_temp, ene, Q31, CLDFB_NO_CHANNELS_MAX );
    }
    else
    {
+17 −17
Original line number Diff line number Diff line
@@ -110,20 +110,20 @@ ivas_error ivas_reverb_prepare_cldfb_params(
    {
        fc[idx] = ( idx + 0.5f ) * ( MAX_SAMPLING_RATE / ( 2 * CLDFB_NO_CHANNELS_MAX ) );
    }
    Word32 *fc_fx = (Word32 *) malloc( pInput_params->nBands * sizeof( Word32 * ) );
    Word32 *pOutput_t60_fx = (Word32 *) malloc( pInput_params->nBands * sizeof( Word32 * ) );
    Word16 *pOutput_t60_e = (Word16 *) malloc( pInput_params->nBands * sizeof( Word16 * ) );
    Word32 *pOutput_ene_fx = (Word32 *) malloc( pInput_params->nBands * sizeof( Word32 * ) );
    Word16 *pOutput_ene_e = (Word16 *) malloc( pInput_params->nBands * sizeof( Word16 * ) );
    Word32 *pOutput_fc_fx = (Word32 *) malloc( CLDFB_NO_CHANNELS_MAX * sizeof( Word32 ) );
    Word32 *pOutput_t60_fx = (Word32 *) malloc( CLDFB_NO_CHANNELS_MAX * sizeof( Word32 ) );
    Word16 *pOutput_t60_e = (Word16 *) malloc( CLDFB_NO_CHANNELS_MAX * sizeof( Word16 ) );
    Word32 *pOutput_ene_fx = (Word32 *) malloc( CLDFB_NO_CHANNELS_MAX * sizeof( Word32 ) );
    Word16 *pOutput_ene_e = (Word16 *) malloc( CLDFB_NO_CHANNELS_MAX * sizeof( Word16 ) );
    Word32 delay_diff_fx;

    for ( int i = 0; i < pInput_params->nBands; i++ )
    for ( int i = 0; i < CLDFB_NO_CHANNELS_MAX; i++ )
    {
        fc_fx[i] = (Word32) fc[i] * ONE_IN_Q16;
        pOutput_fc_fx[i] = (Word32) fc[i] * ONE_IN_Q16;
    }

    ivas_reverb_interpolate_acoustic_data_fx( pInput_params->nBands, pInput_params->pFc_input_fx, pInput_params->pAcoustic_rt60_fx, pInput_params->pAcoustic_dsr_fx,
                                              CLDFB_NO_CHANNELS_MAX, fc_fx, pOutput_t60_fx, pOutput_ene_fx, pOutput_t60_e, pOutput_ene_e );
                                              CLDFB_NO_CHANNELS_MAX, pOutput_fc_fx, pOutput_t60_fx, pOutput_ene_fx, pOutput_t60_e, pOutput_ene_e );

    /* adjust DSR for the delay difference */
    delay_diff_fx = L_sub( pInput_params->inputPreDelay_fx, pInput_params->acousticPreDelay_fx );
@@ -134,7 +134,7 @@ ivas_error ivas_reverb_prepare_cldfb_params(
        pOutput_t60[i] = (float) fabs( me2f( pOutput_t60_fx[i], pOutput_t60_e[i] ) );
        pOutput_ene[i] = (float) fabs( me2f( pOutput_ene_fx[i], pOutput_ene_e[i] ) );
    }
    free( fc_fx );
    free( pOutput_fc_fx );
    free( pOutput_t60_fx );
    free( pOutput_t60_e );
    free( pOutput_ene_fx );
@@ -336,13 +336,13 @@ static ivas_error ivas_reverb_get_fastconv_hrtf_set_energies(

#ifdef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES

    Word32 *input_fc_fx = (Word32 *) malloc( 60 * sizeof( Word32 * ) );
    Word32 *input_fc_fx = (Word32 *) malloc( 60 * sizeof( Word32 ) );

    Word32 *output_fc_fx = (Word32 *) malloc( 257 * sizeof( Word32 * ) );
    Word16 *avg_pwr_left_e = (Word16 *) malloc( 257 * sizeof( Word16 * ) );
    Word16 *avg_pwr_right_e = (Word16 *) malloc( 257 * sizeof( Word16 * ) );
    Word32 *avg_pwr_left_fx = (Word32 *) malloc( 257 * sizeof( Word32 * ) );
    Word32 *avg_pwr_right_fx = (Word32 *) malloc( 257 * sizeof( Word32 * ) );
    Word32 *output_fc_fx = (Word32 *) malloc( 257 * sizeof( Word32 ) );
    Word16 *avg_pwr_left_e = (Word16 *) malloc( 257 * sizeof( Word16 ) );
    Word16 *avg_pwr_right_e = (Word16 *) malloc( 257 * sizeof( Word16 ) );
    Word32 *avg_pwr_left_fx = (Word32 *) malloc( 257 * sizeof( Word32 ) );
    Word32 *avg_pwr_right_fx = (Word32 *) malloc( 257 * sizeof( Word32 ) );

    for ( int i = 0; i < 60; i++ )
    {
@@ -357,7 +357,7 @@ static ivas_error ivas_reverb_get_fastconv_hrtf_set_energies(
    ivas_reverb_interpolate_acoustic_data_fx( FFT_SPECTRUM_SIZE, input_fc_fx, avg_pwr_l, avg_pwr_r,
                                              CLDFB_NO_CHANNELS_MAX, output_fc_fx, avg_pwr_left_fx, avg_pwr_right_fx, avg_pwr_left_e, avg_pwr_right_e );

    for ( int i = 0; i < 257; i++ )
    for ( int i = 0; i < 60; i++ )
    {
        avg_pwr_left[i] = (float) fabs( me2f( avg_pwr_left_fx[i], avg_pwr_left_e[i] ) );
        avg_pwr_right[i] = (float) fabs( me2f( avg_pwr_right_fx[i], avg_pwr_right_e[i] ) );
@@ -368,7 +368,7 @@ static ivas_error ivas_reverb_get_fastconv_hrtf_set_energies(
    free( avg_pwr_left_e );
    free( avg_pwr_right_e );
    free( avg_pwr_left_fx );
    free( avg_pwr_left_fx );
    free( avg_pwr_right_fx );

#else
    if ( ( error = ivas_reverb_get_cldfb_hrtf_set_properties( input_audio_config, hHrtfFastConv, use_brir, sampling_rate, avg_pwr_left_fft, avg_pwr_right_fft ) ) != IVAS_ERR_OK )