Commit efe63d59 authored by vaclav's avatar vaclav
Browse files

Merge remote-tracking branch 'remotes/origin/main' into 484-jitter-leftovers

parents 9dcdba30 b74476db
Loading
Loading
Loading
Loading
+25 −1
Original line number Diff line number Diff line
@@ -593,7 +593,11 @@ int main(

    if ( arg.hrtfReaderEnabled )
    {
#ifdef UPDATE_SBA_FILTER
        IVAS_DEC_HRTF_HANDLE hHrtfTD = NULL;
#else
        IVAS_DEC_HRTF_HANDLE hHrtfTD;
#endif

        IVAS_DEC_GetHrtfHandle( hIvasDec, &hHrtfTD );

@@ -604,7 +608,11 @@ int main(
        }


#ifdef UPDATE_SBA_FILTER
        IVAS_DEC_HRTF_CREND_HANDLE hSetOfHRTF = NULL;
#else
        IVAS_DEC_HRTF_CREND_HANDLE hSetOfHRTF;
#endif
        IVAS_DEC_GetHrtfCRendHandle( hIvasDec, &hSetOfHRTF );

        if ( ( error = create_SetOfHRTF_from_binary( hSetOfHRTF, hrtfReader, arg.output_Fs ) ) != IVAS_ERR_OK )
@@ -612,14 +620,22 @@ int main(
            fprintf( stderr, "\nError in loading HRTF binary file %s for CRend \n\n", arg.hrtfCRendFileName );
            goto cleanup;
        }
#ifdef UPDATE_SBA_FILTER
        IVAS_DEC_HRTF_FASTCONV_HANDLE hHrtfFastConv = NULL;
#else
        IVAS_DEC_HRTF_FASTCONV_HANDLE hHrtfFastConv;
#endif
        IVAS_DEC_GetHrtfFastConvHandle( hIvasDec, &hHrtfFastConv );

        if ( ( error = load_fastconv_HRTF_from_binary( hHrtfFastConv, hrtfReader ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nError in loading HRTF binary file %s for FastConv \n\n", arg.hrtfCRendFileName );
        }
#ifdef UPDATE_SBA_FILTER
        IVAS_DEC_HRTF_PARAMBIN_HANDLE hHrtfParambin = NULL;
#else
        IVAS_DEC_HRTF_PARAMBIN_HANDLE hHrtfParambin;
#endif
        IVAS_DEC_GetHrtfParamBinHandle( hIvasDec, &hHrtfParambin );

        if ( ( error = load_parambin_HRTF_from_binary( hHrtfParambin, hrtfReader ) ) != IVAS_ERR_OK )
@@ -702,10 +718,18 @@ cleanup:

    if ( arg.hrtfReaderEnabled )
    {
#ifdef UPDATE_SBA_FILTER
        IVAS_DEC_HRTF_HANDLE hHrtfTD = NULL;
#else
        IVAS_DEC_HRTF_HANDLE hHrtfTD;
#endif
        IVAS_DEC_GetHrtfHandle( hIvasDec, &hHrtfTD );
        dealloc_HRTF_binary( hHrtfTD );
#ifdef UPDATE_SBA_FILTER
        IVAS_DEC_HRTF_CREND_HANDLE hSetOfHRTF = NULL;
#else
        IVAS_DEC_HRTF_CREND_HANDLE hSetOfHRTF;
#endif
        IVAS_DEC_GetHrtfCRendHandle( hIvasDec, &hSetOfHRTF );
        destroy_SetOfHRTF( hSetOfHRTF );
    }
@@ -1788,7 +1812,6 @@ static ivas_error decodeG192(
            }
        }


        /* Write current frame */
        if ( decodedGoodFrame )
        {
@@ -1874,6 +1897,7 @@ static ivas_error decodeG192(
     *------------------------------------------------------------------------------------------*/

    memset( pcmBuf, 0, delayNumSamples_orig[0] * nOutChannels * sizeof( int16_t ) );

    if ( ( error = AudioFileWriter_write( afWriter, pcmBuf, delayNumSamples_orig[0] * nOutChannels ) ) != IVAS_ERR_OK )
    {
        fprintf( stderr, "\nError writing output file: %s\n", ivas_error_to_string( error ) );
+8 −0
Original line number Diff line number Diff line
@@ -2240,5 +2240,13 @@ enum
    VOIP_RTPDUMP
};

#ifdef FIX_489_COV_SMOOTHING
typedef enum _COV_SMOOTHING_TYPE
{
    COV_SMOOTH_SPAR,
    COV_SMOOTH_MC
} COV_SMOOTHING_TYPE;
#endif

/* clang-format on */
#endif /* CNST_H */
+14 −1
Original line number Diff line number Diff line
@@ -69,10 +69,17 @@ int32_t get_delay(
        {
            delay = IVAS_ENC_DELAY_NS;

#ifdef FIX_356_ISM_METADATA_SYNC
            if ( ivas_format == ISM_FORMAT || ivas_format == MASA_FORMAT )
            {
                delay = 0; /* All delay is compensated in the decoder with MASA/ISM */
            }
#else
            if ( ivas_format == MASA_FORMAT )
            {
                delay = 0; /* All delay is compensated in the decoder with MASA */
            }
#endif
        }

        if ( ivas_format == SBA_FORMAT )
@@ -104,11 +111,17 @@ int32_t get_delay(
                delay += IVAS_FB_DEC_DELAY_NS;
            }


#ifdef FIX_356_ISM_METADATA_SYNC
            if ( ivas_format == ISM_FORMAT || ivas_format == MASA_FORMAT )
            {
                delay += IVAS_ENC_DELAY_NS; /* Compensate also the encoder delay in the decoder with ISM/MASA */
            }
#else
            if ( ivas_format == MASA_FORMAT )
            {
                delay += IVAS_ENC_DELAY_NS; /* Compensate also the encoder delay in the decoder with MASA */
            }
#endif
        }
    }

+10 −0
Original line number Diff line number Diff line
@@ -1513,7 +1513,11 @@ typedef enum

#define BINAURAL_MAXBANDS                       60                          /* Max number of bands */
#define BINAURAL_CONVBANDS                      50                          /* Bands upto which convolution is performed */
#ifdef UPDATE_SBA_FILTER
#define BINAURAL_NTAPS                           5
#else
#define BINAURAL_NTAPS                           7
#endif
#define BINAURAL_NTAPS_MAX                      96

#define HRTF_SH_ORDER                           3
@@ -1531,7 +1535,13 @@ typedef enum
{
    BINAURAL_INPUT_AUDIO_CONFIG_INVALID,
    BINAURAL_INPUT_AUDIO_CONFIG_COMBINED,       /* 5_1, 5_1_2, 5_1_4, 7_1, 7_1_4 */
#ifdef UPDATE_SBA_FILTER    
    BINAURAL_INPUT_AUDIO_CONFIG_HOA3,            /*  HOA3 */
    BINAURAL_INPUT_AUDIO_CONFIG_HOA2,            /* HOA2 */
    BINAURAL_INPUT_AUDIO_CONFIG_FOA,            /* FOA */
#else    
    BINAURAL_INPUT_AUDIO_CONFIG_HOA,            /* FOA, HOA2, HOA3 */
#endif    
    BINAURAL_INPUT_AUDIO_CONFIG_UNDEFINED       /* Not used */

} BINAURAL_INPUT_AUDIO_CONFIG;
+41 −1
Original line number Diff line number Diff line
@@ -35,6 +35,9 @@
#ifdef DEBUGGING
#include "debug.h"
#endif
#ifdef FIX_489_COV_SMOOTHING
#include "cnst.h"
#endif
#include "ivas_prot.h"
#include "wmc_auto.h"
#include "prot.h"
@@ -50,7 +53,12 @@ static void ivas_set_up_cov_smoothing(
    ivas_cov_smooth_state_t *hCovState,
    ivas_filterbank_t *pFb,
    const float max_update_rate,
    const int16_t min_pool_size,
    const int16_t min_pool_size
#ifdef FIX_489_COV_SMOOTHING
    ,
    const COV_SMOOTHING_TYPE smooth_mode /* i  : flag multichannel vs SPAR       */
#endif
    ,
    const int32_t ivas_total_brate )
{
    int16_t j, k;
@@ -88,7 +96,30 @@ static void ivas_set_up_cov_smoothing(
            }
        }
    }
#ifdef FIX_489_COV_SMOOTHING
    else if ( smooth_mode == COV_SMOOTH_MC )
    {
        for ( j = 0; j < pFb->filterbank_num_bands; j++ )
        {
            float update_factor;
            update_factor = 0.0f;

            for ( k = 0; k < pFb->fb_bin_to_band.pFb_active_bins_per_band[j]; k++ )
            {
                update_factor += pFb->fb_bin_to_band.pFb_bin_to_band[j][k];
            }

            hCovState->pSmoothing_factor[j] = update_factor / min_pool_size;

            if ( hCovState->pSmoothing_factor[j] > max_update_rate )
            {
                hCovState->pSmoothing_factor[j] = max_update_rate;
            }
        }
    }
#endif
    else
    {
        for ( j = 0; j < pFb->filterbank_num_bands; j++ )
        {
            float update_factor;
@@ -108,6 +139,8 @@ static void ivas_set_up_cov_smoothing(
                hCovState->pSmoothing_factor[j] = max_update_rate;
            }
        }
    }

    hCovState->prior_bank_idx = -1;

    return;
@@ -126,6 +159,9 @@ ivas_error ivas_spar_covar_smooth_enc_open(
    ivas_filterbank_t *pFb,                      /* i/o: FB handle                      */
    const int16_t nchan_inp                      /* i  : number of input channels       */
    ,
#ifdef FIX_489_COV_SMOOTHING
    COV_SMOOTHING_TYPE smooth_mode, /* i : Smooth covariance for SPAR or MC */
#endif
    const int32_t ivas_total_brate /* i  : IVAS total bitrate             */
)
{
@@ -155,7 +191,11 @@ ivas_error ivas_spar_covar_smooth_enc_open(
    }


#ifdef FIX_489_COV_SMOOTHING
    ivas_set_up_cov_smoothing( hCovState, pFb, cov_smooth_cfg->max_update_rate, cov_smooth_cfg->min_pool_size, smooth_mode, ivas_total_brate );
#else
    ivas_set_up_cov_smoothing( hCovState, pFb, cov_smooth_cfg->max_update_rate, cov_smooth_cfg->min_pool_size, ivas_total_brate );
#endif

    *hCovState_out = hCovState;

Loading