Commit 149606df authored by vaclav's avatar vaclav
Browse files

fix use of TD decorrelator in OMASA bitrate switching

parent 96a0c742
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -196,6 +196,10 @@ ivas_error ivas_dec_setup(
                            }
                        }
#ifdef OMASA_BRATE_SW
                        if ( st_ivas->hDiracDecBin != NULL )
                        {
                            st_ivas->hDiracDecBin->useTdDecorr = ivas_dirac_binaural_get_useTdDecorr_flag( st_ivas->ivas_format, st_ivas->hCPE[0]->element_brate, st_ivas->nchan_transport );
                        }
                    }
                    else
                    {
+11 −6
Original line number Diff line number Diff line
@@ -252,12 +252,6 @@ ivas_error ivas_omasa_dec_config(

        ivas_ism_metadata_close( st_ivas->hIsmMetaData, n_MD );

        /* CLDFB instances */
        if ( ( error = ivas_cldfb_dec_reconfig( st_ivas, 2, numCldfbAnalyses_old, numCldfbSyntheses_old ) ) != IVAS_ERR_OK )
        {
            return error;
        }

        st_ivas->hCPE[0]->element_brate = ivas_total_brate - ism_total_brate;

        /* objects renderer reconfig. */
@@ -334,6 +328,17 @@ ivas_error ivas_omasa_dec_config(
                }
            }
        }

        if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC )
        {
            st_ivas->hDiracDecBin->useTdDecorr = ivas_dirac_binaural_get_useTdDecorr_flag( st_ivas->ivas_format, st_ivas->hCPE[0]->element_brate, st_ivas->nchan_transport );
        }

        /* CLDFB instances */
        if ( ( error = ivas_cldfb_dec_reconfig( st_ivas, 2, numCldfbAnalyses_old, numCldfbSyntheses_old ) ) != IVAS_ERR_OK )
        {
            return error;
        }
#endif
    }

+49 −0
Original line number Diff line number Diff line
@@ -109,6 +109,51 @@ static void matrixTransp2Mul( float Are[BINAURAL_CHANNELS][BINAURAL_CHANNELS], f
static float configure_reqularization_factor( const IVAS_FORMAT ivas_format, const int32_t ivas_brate );
#endif


#ifdef OMASA_BRATE_SW
/*-------------------------------------------------------------------------
 * ivas_dirac_binaural_get_useTdDecorr_flag()
 *
 * Get useTdDecorr flag
 *------------------------------------------------------------------------*/

/*! r: useTdDecorr flag */
int16_t ivas_dirac_binaural_get_useTdDecorr_flag(
    const IVAS_FORMAT ivas_format,  /* i  : IVAS format                     */
    const int32_t ivas_total_brate, /* i  : total IVAS bitrate              */
    const int16_t nchan_transport   /* i  : number of transport channels    */
)
{
    int16_t useTdDecorr;

    useTdDecorr = 0;
    if ( ivas_format == SBA_FORMAT )
    {
        if ( nchan_transport == 1 )
        {
            useTdDecorr = 1;
        }
    }
    else if ( ivas_format == MASA_FORMAT )
    {
        if ( ( ivas_total_brate < IVAS_48k && nchan_transport == 1 ) || ivas_total_brate < MASA_STEREO_MIN_BITRATE )
        {
            useTdDecorr = 1;
        }
    }
    else if ( ivas_format == MC_FORMAT )
    {
        if ( ivas_total_brate < IVAS_48k && nchan_transport == 1 )
        {
            useTdDecorr = 1;
        }
    }

    return useTdDecorr;
}
#endif


/*-------------------------------------------------------------------------
 * ivas_dirac_dec_init_binaural_data()
 *
@@ -173,6 +218,9 @@ ivas_error ivas_dirac_dec_init_binaural_data(

    hBinaural->useSubframeMode = 1;

#ifdef OMASA_BRATE_SW
    hBinaural->useTdDecorr = ivas_dirac_binaural_get_useTdDecorr_flag( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport );
#else
    hBinaural->useTdDecorr = 0;
    if ( st_ivas->ivas_format == SBA_FORMAT )
    {
@@ -195,6 +243,7 @@ ivas_error ivas_dirac_dec_init_binaural_data(
            hBinaural->useTdDecorr = 1;
        }
    }
#endif

    for ( bin = 0; bin < nBins; bin++ )
    {
+9 −0
Original line number Diff line number Diff line
@@ -156,6 +156,15 @@ void ivas_dirac_dec_binaural(
    const int16_t nchan_transport                               /* i  : number of transport channels                            */
);

#ifdef OMASA_BRATE_SW
/*! r: useTdDecorr flag */
int16_t ivas_dirac_binaural_get_useTdDecorr_flag(
    const IVAS_FORMAT ivas_format,                              /* i  : IVAS format                             */
    const int32_t ivas_total_brate,                             /* i  : total IVAS bitrate                      */
    const int16_t nchan_transport                               /* i  : number of transport channels            */
);
#endif

ivas_error ivas_dirac_dec_init_binaural_data(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder structure                  */
    HRTFS_PARAMBIN_HANDLE hHrtfParambin                         /* i  : HRTF structure for rendering            */