Commit 069a9b80 authored by vaclav's avatar vaclav
Browse files

- introduce hISMDTX handle

- make ivas_ism_get_sce_id_dtx() generic
parent 04925ae7
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -952,6 +952,7 @@ ivas_error ivas_ism_dtx_open(
void ivas_param_ism_metadata_dtx_enc(
    BSTR_ENC_HANDLE hBstr,                                      /* i/o: bitstream handle                    */
    ISM_METADATA_HANDLE hIsmMeta[],                             /* i  : ISM metadata handles                */
    ISM_DTX_HANDLE hISMDTX,                                     /* i/o: ISM DTX handle                      */
    PARAM_ISM_CONFIG_HANDLE hParamIsm                           /* i  : Param ISM Enc Handle                */
);

@@ -959,8 +960,10 @@ void ivas_param_ism_metadata_dtx_dec(
    Decoder_Struct *st_ivas                                     /* i/o: IVAS decoder structure              */
);

void ivas_param_ism_get_sce_id_dtx(
    Encoder_Struct *st_ivas,                                    /* i/o: IVAS encoder structure              */
void ivas_ism_get_sce_id_dtx(
    ISM_DTX_HANDLE hISMDTX,                                     /* i/o: ISM DTX handle                      */
    SCE_ENC_HANDLE hSCE[MAX_SCE],                               /* i/o: SCE encoder structure               */
    const int16_t nchan_transport,                              /* i  : number of transport channels        */
    const int16_t input_frame                                   /* i  : input frame length per channel      */
);

+0 −9
Original line number Diff line number Diff line
@@ -146,15 +146,6 @@ typedef struct ivas_param_ism_data_structure
    int16_t flag_noisy_speech;
    int16_t noisy_speech_buffer[PARAM_ISM_HYS_BUF_SIZE];

#ifdef PARAM_ISM_DTX_CNG
    int16_t paramISM_DTX_CNG_FLAG;
    int16_t sce_id_dtx;
    int16_t dtx_speech_buffer_enc[PARAM_ISM_HYS_BUF_SIZE];

    float long_term_energy_stereo_dmx_enc[PARAM_ISM_MAX_DMX][PARAM_ISM_HYS_BUF_SIZE];
    float coh;
#endif

} PARAM_ISM_CONFIG_DATA, *PARAM_ISM_CONFIG_HANDLE;


+30 −23
Original line number Diff line number Diff line
@@ -157,6 +157,9 @@ static void ivas_ism_get_proto_matrix(

static void ivas_param_ism_compute_mixing_matrix(
    DIRAC_DEC_HANDLE hDirAC, /* i/o: decoder DirAC handle */
#ifdef PARAM_ISM_DTX_CNG
    ISM_DTX_DATA_DEC hISMDTX, /* i  : ISM DTX handle                */
#endif
    float Cldfb_RealBuffer_in[PARAM_ISM_MAX_DMX][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX],
    float Cldfb_ImagBuffer_in[PARAM_ISM_MAX_DMX][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX],
    float direct_response[MAX_NUM_OBJECTS][PARAM_ISM_MAX_CHAN],
@@ -185,7 +188,7 @@ static void ivas_param_ism_compute_mixing_matrix(
    assert( nchan_transport == 2 );

#ifdef PARAM_ISM_DTX_CNG
    if ( hDirAC->hParamIsm->flag_noisy_speech || hDirAC->hParamIsm->paramISM_DTX_CNG_FLAG )
    if ( hDirAC->hParamIsm->flag_noisy_speech || hISMDTX.dtx_flag )
#else
    if ( hDirAC->hParamIsm->flag_noisy_speech )
#endif
@@ -211,7 +214,7 @@ static void ivas_param_ism_compute_mixing_matrix(
            set_zero( cy_diag_tmp[w], nchan_out_woLFE );

#ifdef PARAM_ISM_DTX_CNG
            if ( hDirAC->hParamIsm->flag_noisy_speech || hDirAC->hParamIsm->paramISM_DTX_CNG_FLAG )
            if ( hDirAC->hParamIsm->flag_noisy_speech || hISMDTX.dtx_flag )
#else
            if ( hDirAC->hParamIsm->flag_noisy_speech )
#endif
@@ -254,7 +257,7 @@ static void ivas_param_ism_compute_mixing_matrix(
            for ( w = 0; w < num_wave; w++ )
            {
#ifdef PARAM_ISM_DTX_CNG
                if ( hDirAC->hParamIsm->flag_noisy_speech || hDirAC->hParamIsm->paramISM_DTX_CNG_FLAG )
                if ( hDirAC->hParamIsm->flag_noisy_speech || hISMDTX.dtx_flag )
#else
                if ( hDirAC->hParamIsm->flag_noisy_speech )
#endif
@@ -545,7 +548,7 @@ ivas_error ivas_param_ism_dec_open(
    }

#ifdef PARAM_ISM_DTX_CNG
    hDirAC->hParamIsm->paramISM_DTX_CNG_FLAG = 0;
    st_ivas->hISMDTX.dtx_flag = 0;
#endif

    st_ivas->hDirAC = hDirAC;
@@ -796,11 +799,11 @@ void ivas_param_ism_dec(
    {
        ivas_param_ism_dec_dequant_DOA( hDirAC );
        ivas_param_ism_dec_dequant_powrat( hDirAC );
        hDirAC->hParamIsm->paramISM_DTX_CNG_FLAG = 0;
        st_ivas->hISMDTX.dtx_flag = 0;
    }
    else
    {
        hDirAC->hParamIsm->paramISM_DTX_CNG_FLAG = 1;
        st_ivas->hISMDTX.dtx_flag = 1;
    }
#else
    ivas_param_ism_dec_dequant_DOA( hDirAC );
@@ -868,7 +871,11 @@ void ivas_param_ism_dec(
    }

    /* Compute mixing matrix */
#ifdef PARAM_ISM_DTX_CNG
    ivas_param_ism_compute_mixing_matrix( hDirAC, st_ivas->hISMDTX, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, direct_response, nchan_transport, nchan_out_woLFE, 0, CLDFB_NO_COL_MAX, mixing_matrix );
#else
    ivas_param_ism_compute_mixing_matrix( hDirAC, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, direct_response, nchan_transport, nchan_out_woLFE, 0, CLDFB_NO_COL_MAX, mixing_matrix );
#endif

    /* subframe loop for synthesis*/
    for ( subframe_idx = 0; subframe_idx < hDirAC->nb_subframes; subframe_idx++ )
@@ -988,11 +995,11 @@ void ivas_param_ism_params_to_masa_param_mapping(
    {
        ivas_param_ism_dec_dequant_DOA( hDirAC );
        ivas_param_ism_dec_dequant_powrat( hDirAC );
        hDirAC->hParamIsm->paramISM_DTX_CNG_FLAG = 0;
        st_ivas->hISMDTX.dtx_flag = 0;
    }
    else
    {
        hDirAC->hParamIsm->paramISM_DTX_CNG_FLAG = 1;
        st_ivas->hISMDTX.dtx_flag = 1;
    }
#else
    ivas_param_ism_dec_dequant_DOA( hDirAC );
@@ -1002,7 +1009,7 @@ void ivas_param_ism_params_to_masa_param_mapping(
    if ( hDirAC->hParamIsm->num_obj > 1 )
    {
#ifdef PARAM_ISM_DTX_CNG
        if ( hDirAC->hParamIsm->paramISM_DTX_CNG_FLAG )
        if ( st_ivas->hISMDTX.dtx_flag )
        {
            float energy_ratio;
            energy_ratio = powf( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->coherence, 2.0f );
@@ -1449,7 +1456,7 @@ void ivas_param_ism_metadata_dtx_dec(
    hParamIsm->flag_noisy_speech = get_next_indice( st0, 1 );

    /* read sce id */
    hParamIsm->sce_id_dtx = get_next_indice( st0, 1 );
    st_ivas->hISMDTX.sce_id_dtx = get_next_indice( st0, 1 );

    /* get the DOA'S */
    for ( i = 0; i < hParamIsm->num_obj; i++ )
+9 −8
Original line number Diff line number Diff line
@@ -68,7 +68,7 @@ static ivas_error ivas_ism_preprocessing(
        /* reset the bitstream to atleast read the cng type and bandwidth for non transmitted SCE */
        st->bit_stream = st_ivas->hSCE[0]->hCoreCoder[0]->bit_stream;

        if (sce_id == st_ivas->hDirAC->hParamIsm->sce_id_dtx)
        if ( sce_id == st_ivas->hISMDTX.sce_id_dtx )
        {
            st->read_sid_info = 1; /*  read the sid info from bitstream  */
        }
@@ -88,6 +88,7 @@ static ivas_error ivas_ism_preprocessing(
}
#endif


/*--------------------------------------------------------------------------*
 * ivas_sce_dec()
 *
+16 −0
Original line number Diff line number Diff line
@@ -414,6 +414,19 @@ typedef struct stereo_icbwe_dec_data_structure
} STEREO_ICBWE_DEC_DATA, *STEREO_ICBWE_DEC_HANDLE;


#ifdef PARAM_ISM_DTX_CNG
/*----------------------------------------------------------------------------------*
 * ISM DTX structure
 *----------------------------------------------------------------------------------*/

typedef struct
{
    int16_t dtx_flag;
    int16_t sce_id_dtx;

} ISM_DTX_DATA_DEC;
#endif

/*----------------------------------------------------------------------------------*
 * DirAC decoder structure
 *----------------------------------------------------------------------------------*/
@@ -1936,6 +1949,9 @@ typedef struct Decoder_Struct

    /* multichannel modules */
    ISM_METADATA_HANDLE hIsmMetaData[MAX_NUM_OBJECTS];      /* ISM metadata handles (storage for one frame of read ISM metadata) */
#ifdef PARAM_ISM_DTX_CNG
    ISM_DTX_DATA_DEC hISMDTX;                               /* ISM DTX structure */
#endif
    ISM_RENDERER_HANDLE hIsmRendererData;                   /* ISM renderer handle */
    DIRAC_DEC_HANDLE hDirAC;                                /* DirAC handle */
    SPAR_DEC_HANDLE hSpar;                                  /* SPAR handle */
Loading