Commit 81c68191 authored by vaclav's avatar vaclav
Browse files

introduce function ivas_get_hodirac_flag()

parent a6a33f5c
Loading
Loading
Loading
Loading
+41 −7
Original line number Diff line number Diff line
@@ -48,6 +48,32 @@

static uint16_t deindex_sph_idx_general( const int16_t idx_sph, const int16_t no_bits, float *theta_dec, float *phi_dec, uint16_t *p_id_phi, const MC_LS_SETUP mc_format );


#ifdef HODIRAC
/*-------------------------------------------------------------------------
 * ivas_get_hodirac_flag()
 *
 * Return flag for HO-DirAC method at high bitrates
 *------------------------------------------------------------------------*/

/*! r: HO-DirAC flag */
int16_t ivas_get_hodirac_flag(
    const int32_t ivas_total_brate, /* i  : IVAS total bitrate      */
    const int16_t sba_order         /* i  : Ambisonic (SBA) order   */
)
{
    if ( sba_order > 1 && ivas_total_brate > IVAS_256k )
    {
        return 1;
    }
    else
    {
        return 0;
    }
}
#endif


/*-------------------------------------------------------------------------
 * ivas_dirac_sba_config()
 *
@@ -133,7 +159,7 @@ ivas_error ivas_dirac_config(

        spar_dirac_split_band = min( IVAS_MAX_NUM_BANDS, SPAR_DIRAC_SPLIT_START_BAND );
#ifdef HODIRAC
        if ( sba_order > 1 && ivas_total_brate > IVAS_256k )
        if ( ivas_get_hodirac_flag( ivas_total_brate, sba_order ) )
        {
            spar_dirac_split_band = 0;
        }
@@ -174,7 +200,7 @@ ivas_error ivas_dirac_config(
                hConfig->enc_param_start_band = spar_dirac_split_band;
            }
#ifdef HODIRAC
            if ( sba_order > 1 && ivas_total_brate > IVAS_256k )
            if ( ivas_get_hodirac_flag( ivas_total_brate, sba_order ) )
            {
                hConfig->dec_param_estim = FALSE;
                hConfig->enc_param_start_band = 0;
@@ -335,10 +361,16 @@ ivas_error ivas_dirac_sba_config(
    int16_t i;
    int16_t nbands_wb;
    int16_t nbands_coded;
#ifdef HODIRAC
    int16_t hodirac_flag;
#endif
    ivas_error error;

    error = IVAS_ERR_OK;
    hQMetaData->is_masa_ivas_format = 0;
#ifdef HODIRAC
    hodirac_flag = ivas_get_hodirac_flag( sba_total_brate, sba_order );
#endif

    if ( sba_mode == SBA_MODE_SPAR )
    {
@@ -376,7 +408,7 @@ ivas_error ivas_dirac_sba_config(
        {
            hQMetaData->useLowerBandRes = 0;
#ifdef HODIRAC
            if ( !( sba_order > 1 && sba_total_brate > IVAS_256k ) )
            if ( hodirac_flag == 0 )
#endif
            {
                nbands_coded = nbands - 1; /* always combine the last two bands */
@@ -386,7 +418,7 @@ ivas_error ivas_dirac_sba_config(
        {
            int16_t no_dirs = 1;
#ifdef HODIRAC
            if ( sba_order > 1 && sba_total_brate > IVAS_256k )
            if ( hodirac_flag )
            {
                no_dirs = 2;
            }
@@ -396,8 +428,9 @@ ivas_error ivas_dirac_sba_config(
            {
                return error;
            }

#ifdef HODIRAC_FIX_BR_SWITCHING_DTX
            if ( sba_order > 1 && sba_total_brate > IVAS_256k )
            if ( hodirac_flag )
            {
                int16_t dir, j;
                for ( dir = 0; dir < hQMetaData->no_directions; dir++ )
@@ -508,7 +541,7 @@ ivas_error ivas_dirac_sba_config(
            {
                int16_t no_dirs = 1;
#ifdef HODIRAC
                if ( sba_order > 1 && sba_total_brate > IVAS_256k )
                if ( hodirac_flag )
                {
                    no_dirs = 2;
                }
@@ -545,8 +578,9 @@ ivas_error ivas_dirac_sba_config(
            for ( i = 0; i < hQMetaData->no_directions; i++ )
            {
                hQMetaData->q_direction[i].cfg.search_effort = 1;

#ifdef HODIRAC
                if ( sba_order > 1 && sba_total_brate > IVAS_256k )
                if ( hodirac_flag )
                {
                    hQMetaData->q_direction[i].cfg.start_band = 0;
                }
+8 −0
Original line number Diff line number Diff line
@@ -3371,6 +3371,14 @@ void ivas_sba_dirac_stereo_config(
    STEREO_DFT_CONFIG_DATA_HANDLE hConfig                       /* o  : DFT stereo configuration                */
);

#ifdef HODIRAC
/*! r: HO-DirAC flag */
int16_t ivas_get_hodirac_flag(
    const int32_t ivas_total_brate,                             /* i  : IVAS total bitrate                      */
    const int16_t sba_order                                     /* i  : Ambisonic (SBA) order                   */
);
#endif

int16_t ivas_get_sba_dirac_stereo_flag(
    Decoder_Struct *st_ivas                                     /* i/o: IVAS decoder structure                  */
);
+1 −1
Original line number Diff line number Diff line
@@ -191,7 +191,7 @@
#define FIX_441_SBA_PARAMBIN_GAINS                      /* Nokia: Fix issue 441 by changing gains in SBA path of parametric binauralizer */


#define HODIRAC                                         /* FhG: Sector-based HO-DirAC method for SBA at high bitrates */
#define HODIRAC                                         /* FhG: Contribution 32: Sector-based HO-DirAC method for SBA at high bitrates */

#ifdef HODIRAC
#define SPAR_TUNING										/* Dlb: tune SPAR for better quality */
+5 −10
Original line number Diff line number Diff line
@@ -261,7 +261,7 @@ ivas_error ivas_dec(
            {
                ivas_dirac_dec_read_BS( ivas_total_brate, st, st_ivas->hDirAC, st_ivas->hQMetaData, &nb_bits_metadata[0], st_ivas->sba_mode,
#ifdef HODIRAC
                                        st_ivas->sba_analysis_order > 1 && ivas_total_brate > IVAS_256k,
                                        ivas_get_hodirac_flag( ivas_total_brate, st_ivas->sba_analysis_order ),
#endif
                                        0 );
            }
@@ -278,15 +278,10 @@ ivas_error ivas_dec(
            if ( st_ivas->hQMetaData != NULL )
            {
                st = ( st_ivas->nSCE > 0 ) ? st_ivas->hSCE[0]->hCoreCoder[0] : st_ivas->hCPE[0]->hCoreCoder[0];
                ivas_dirac_dec_read_BS(
                    ivas_total_brate,
                    st,
                    st_ivas->hDirAC,
                    st_ivas->hQMetaData,
                    &nb_bits_metadata[0],
                    st_ivas->sba_mode,

                ivas_dirac_dec_read_BS( ivas_total_brate, st, st_ivas->hDirAC, st_ivas->hQMetaData, &nb_bits_metadata[0], st_ivas->sba_mode,
#ifdef HODIRAC
                    st_ivas->sba_analysis_order > 1 && ivas_total_brate > IVAS_256k,
                                        ivas_get_hodirac_flag( ivas_total_brate, st_ivas->sba_analysis_order ),
#endif
                                        st_ivas->hSpar->dirac_to_spar_md_bands );
            }
+11 −4
Original line number Diff line number Diff line
@@ -140,6 +140,9 @@ ivas_error ivas_dirac_dec_config(
    int32_t output_Fs, ivas_total_brate;
    ivas_error error;
    int16_t nchan_transport_orig;
#ifdef HODIRAC
    int16_t hodirac_flag;
#endif
    DIRAC_CONFIG_FLAG flag_config;

    flag_config = ( flag_config_inp == DIRAC_RECONFIGURE_MODE ) ? DIRAC_RECONFIGURE : flag_config_inp;
@@ -148,6 +151,10 @@ ivas_error ivas_dirac_dec_config(
    hDirAC = NULL;
    output_Fs = st_ivas->hDecoderConfig->output_Fs;
    ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate;
#ifdef HODIRAC
    hodirac_flag = ivas_get_hodirac_flag( ivas_total_brate, st_ivas->sba_analysis_order );
#endif


    if ( flag_config == DIRAC_RECONFIGURE )
    {
@@ -782,7 +789,7 @@ ivas_error ivas_dirac_dec_config(
        if ( ( ivas_dirac_dec_output_synthesis_open( hDirAC, st_ivas->renderer_type, nchan_transport, output_Fs
#ifdef HODIRAC
                                                     ,
                                                     st_ivas->sba_analysis_order > 1 && ivas_total_brate > IVAS_256k
                                                     hodirac_flag
#endif
                                                     ) ) != IVAS_ERR_OK )
        {
@@ -797,7 +804,7 @@ ivas_error ivas_dirac_dec_config(
        if ( ( ivas_dirac_dec_output_synthesis_open( hDirAC, st_ivas->renderer_type, nchan_transport, output_Fs
#ifdef HODIRAC
                                                     ,
                                                     st_ivas->sba_analysis_order > 1 && ivas_total_brate > IVAS_256k
                                                     hodirac_flag
#endif
                                                     ) ) != IVAS_ERR_OK )
        {
@@ -896,7 +903,7 @@ ivas_error ivas_dirac_dec_config(
    ivas_dirac_dec_output_synthesis_init( hDirAC, nchan_out_woLFE
#ifdef HODIRAC
                                          ,
                                          st_ivas->sba_analysis_order > 1 && ivas_total_brate > IVAS_256k
                                          hodirac_flag
#endif
    );

@@ -908,7 +915,7 @@ ivas_error ivas_dirac_dec_config(
    if ( ( error = ivas_dirac_alloc_mem( hDirAC, st_ivas->renderer_type, &( hDirAC->stack_mem )
#ifdef HODIRAC
                                                                             ,
                                         st_ivas->sba_analysis_order > 1 && ivas_total_brate > IVAS_256k
                                         hodirac_flag
#endif
                                         ) ) != IVAS_ERR_OK )
    {
Loading