Commit c2d2b14e authored by vaclav's avatar vaclav
Browse files

merge OMASA_BRATE_TD into OMASA_BRATE

parent 78b6266d
Loading
Loading
Loading
Loading
+4 −7
Original line number Diff line number Diff line
@@ -157,14 +157,11 @@
#define FIX_268                                         /* Issue 268: Add low cost dry-run of memory analysis */
#define LOW_RATE_TRANS_FIX                              /* Eri: Fix for critical item during transitions */


#define MASA_AND_OBJECTS                                /* Nokia: Combination of MASA and objects */
#ifdef MASA_AND_OBJECTS
#define MASAISM_EDIT_OBJECTS                    /* Nokia: Temporary command line editing of object directions in the decoder */


#define OMASA_BRATE                                     /* VA: combined format bit-budget distribution */
#define OMASA_BRATE_TD // support of bitrate adaptation in TD stereo

#define MASAISM_EDIT_OBJECTS                            /* Nokia: Temporary command line editing of object directions in the decoder */
#endif


+1 −3
Original line number Diff line number Diff line
@@ -171,7 +171,6 @@ ivas_error ivas_cpe_dec(
            }
            else
            {

#endif
                stereo_dft_config( hCPE->hStereoDft == NULL ? NULL : hCPE->hStereoDft->hConfig, st_ivas->hQMetaData->bits_frame_nominal * FRAMES_PER_SEC, &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal );
#ifdef MASA_AND_OBJECTS
@@ -296,7 +295,7 @@ ivas_error ivas_cpe_dec(
        /* signal bitrate for BW selection in the SCh */
        sts[0]->bits_frame_channel = 0;
        sts[1]->bits_frame_channel = (int16_t) ( hCPE->element_brate / FRAMES_PER_SEC );
#ifdef OMASA_BRATE_TD
#ifdef OMASA_BRATE
        sts[1]->bits_frame_channel += (int16_t) ( hCPE->brate_surplus / FRAMES_PER_SEC );
#endif
        if ( st_ivas->hQMetaData != NULL )
@@ -361,7 +360,6 @@ ivas_error ivas_cpe_dec(
                }
            }
            else

            {
                /* subtract metadata bitbudget */ /* IVAS_fmToDo: TBC whether it is not better to distribute the metadata bits equally between 2 channels */
                sts[0]->bits_frame_channel -= nb_bits_metadata;
+1 −1
Original line number Diff line number Diff line
@@ -767,7 +767,7 @@ ivas_error stereo_memory_dec(
        if ( hCPE->hCoreCoder[0]->bfi == 0 )
        {
            st = hCPE->hCoreCoder[1];
#ifdef OMASA_BRATE_TD
#ifdef OMASA_BRATE
            hCPE->hStereoTD->tdm_LRTD_flag = get_indice_st( hCPE->hCoreCoder[0], hCPE->element_brate + hCPE->brate_surplus, (int16_t) ( ( hCPE->element_brate / FRAMES_PER_SEC ) - nb_bits_metadata + ( hCPE->brate_surplus / FRAMES_PER_SEC ) - TDM_SECONDARY_SIGNALLING - TDM_RATIO_BITS - TDM_LP_REUSE_BITS - TDM_LR_CONTENT_BITS ), TDM_LR_CONTENT_BITS );
#else
            hCPE->hStereoTD->tdm_LRTD_flag = get_indice_st( hCPE->hCoreCoder[0], hCPE->element_brate, (int16_t) ( ( hCPE->element_brate / FRAMES_PER_SEC ) - nb_bits_metadata - TDM_SECONDARY_SIGNALLING - TDM_RATIO_BITS - TDM_LP_REUSE_BITS - TDM_LR_CONTENT_BITS ), TDM_LR_CONTENT_BITS );
+10 −10
Original line number Diff line number Diff line
@@ -94,7 +94,7 @@ void tdm_configure_dec(
    int16_t tdm_tmp_SM_LRTD_flag;
    int16_t mod_ct, core, bits_offset;
    int16_t idx_LRTD_pri_side, tdm_inst_ratio_idx;
#ifdef OMASA_BRATE_TD
#ifdef OMASA_BRATE
    int32_t element_brate_adapt;
    int16_t bstr_last_pos;
#endif
@@ -102,7 +102,7 @@ void tdm_configure_dec(
    hStereoTD = hCPE->hStereoTD;
    sts = hCPE->hCoreCoder;

#ifdef OMASA_BRATE_TD
#ifdef OMASA_BRATE
    element_brate_adapt = hCPE->element_brate + hCPE->brate_surplus;
    bstr_last_pos = (int16_t) ( hCPE->element_brate / FRAMES_PER_SEC ) - nb_bits_metadata + (int16_t) ( hCPE->brate_surplus / FRAMES_PER_SEC );
#endif
@@ -132,7 +132,7 @@ void tdm_configure_dec(

    /* Get few parameters needed to decode the bitrate allocated to each channel */
    /* Get the coder_type of the secondary channel (last parameter on 2 bits) */
#ifdef OMASA_BRATE_TD
#ifdef OMASA_BRATE
    sts[1]->coder_type = get_indice_st( sts[0], element_brate_adapt, bstr_last_pos - TDM_SECONDARY_SIGNALLING, TDM_SECONDARY_SIGNALLING );
#else
    sts[1]->coder_type = get_indice_st( sts[0], hCPE->element_brate, (int16_t) ( ( hCPE->element_brate / FRAMES_PER_SEC ) - nb_bits_metadata - TDM_SECONDARY_SIGNALLING ), TDM_SECONDARY_SIGNALLING );
@@ -164,7 +164,7 @@ void tdm_configure_dec(
     *----------------------------------------------------------------*/

    /* Get the correlation ratio */
#ifdef OMASA_BRATE_TD
#ifdef OMASA_BRATE
    *tdm_ratio_idx = get_indice_st( sts[0], element_brate_adapt, (int16_t) ( bstr_last_pos - TDM_SECONDARY_SIGNALLING - TDM_RATIO_BITS ), TDM_RATIO_BITS );
#else
    *tdm_ratio_idx = get_indice_st( sts[0], hCPE->element_brate, (int16_t) ( ( hCPE->element_brate / FRAMES_PER_SEC ) - nb_bits_metadata - TDM_SECONDARY_SIGNALLING - TDM_RATIO_BITS ), TDM_RATIO_BITS );
@@ -174,7 +174,7 @@ void tdm_configure_dec(
    if ( sts[1]->coder_type == INACTIVE )
    {
        /* Get the flag on the LPC reusage type (primary channel of ave LPC */
#ifdef OMASA_BRATE_TD
#ifdef OMASA_BRATE
        hStereoTD->tdm_use_IAWB_Ave_lpc = get_indice_st( sts[0], element_brate_adapt, bstr_last_pos - TDM_SECONDARY_SIGNALLING - TDM_RATIO_BITS - TDM_LP_REUSE_BITS, TDM_LP_REUSE_BITS );
#else
        hStereoTD->tdm_use_IAWB_Ave_lpc = get_indice_st( sts[0], hCPE->element_brate, (int16_t) ( ( hCPE->element_brate / FRAMES_PER_SEC ) - nb_bits_metadata - TDM_SECONDARY_SIGNALLING - TDM_RATIO_BITS - TDM_LP_REUSE_BITS ), TDM_LP_REUSE_BITS );
@@ -184,7 +184,7 @@ void tdm_configure_dec(
    else
    {
        /* Get the flag on the LPC reusage */
#ifdef OMASA_BRATE_TD
#ifdef OMASA_BRATE
        hStereoTD->tdm_lp_reuse_flag = get_indice_st( sts[0], element_brate_adapt, bstr_last_pos - TDM_SECONDARY_SIGNALLING - TDM_RATIO_BITS - TDM_LP_REUSE_BITS, TDM_LP_REUSE_BITS );
#else
        hStereoTD->tdm_lp_reuse_flag = get_indice_st( sts[0], hCPE->element_brate, (int16_t) ( ( hCPE->element_brate / FRAMES_PER_SEC ) - nb_bits_metadata - TDM_SECONDARY_SIGNALLING - TDM_RATIO_BITS - TDM_LP_REUSE_BITS ), TDM_LP_REUSE_BITS );
@@ -244,7 +244,7 @@ void tdm_configure_dec(
        int16_t tmpS = 20;
        if ( hStereoTD->tdm_LRTD_flag == 0 )
        {
#ifdef OMASA_BRATE_TD
#ifdef OMASA_BRATE
            tmpS = get_indice_st( sts[0], element_brate_adapt, bstr_last_pos - TDM_SIGNAL_BITS_READ_FROM_THE_END_OF_BS + STEREO_BITS_TCA_CHAN + STEREO_BITS_TCA_CORRSTATS, STEREO_BITS_TCA_GD );
#else
            tmpS = get_indice_st( sts[0], hCPE->element_brate, (int16_t) ( ( hCPE->element_brate / FRAMES_PER_SEC ) - nb_bits_metadata - TDM_SIGNAL_BITS_READ_FROM_THE_END_OF_BS + STEREO_BITS_TCA_CHAN + STEREO_BITS_TCA_CORRSTATS ), STEREO_BITS_TCA_GD );
@@ -257,7 +257,7 @@ void tdm_configure_dec(
    {
        if ( hStereoTD->tdm_LRTD_flag == 0 )
        {
#ifdef OMASA_BRATE_TD
#ifdef OMASA_BRATE
            hCPE->hStereoTCA->refChanIndx = get_indice_st( sts[0], element_brate_adapt, bstr_last_pos - TDM_SIGNAL_BITS_READ_FROM_THE_END_OF_BS, STEREO_BITS_TCA_CHAN );
            hCPE->hStereoTCA->indx_ica_NCShift = get_indice_st( sts[0], element_brate_adapt, bstr_last_pos - TDM_SIGNAL_BITS_READ_FROM_THE_END_OF_BS + STEREO_BITS_TCA_CHAN, STEREO_BITS_TCA_CORRSTATS );
            hCPE->hStereoTCA->indx_ica_gD = get_indice_st( sts[0], element_brate_adapt, bstr_last_pos - TDM_SIGNAL_BITS_READ_FROM_THE_END_OF_BS + STEREO_BITS_TCA_CHAN + STEREO_BITS_TCA_CORRSTATS, STEREO_BITS_TCA_GD );
@@ -285,7 +285,7 @@ void tdm_configure_dec(
#endif

    /* set the BW of the secondary channel */
#ifdef OMASA_BRATE_TD
#ifdef OMASA_BRATE
    if ( hStereoTD->tdm_LRTD_flag && sts[1]->bits_frame_channel > IVAS_16k4 / FRAMES_PER_SEC )
#else
    if ( hStereoTD->tdm_LRTD_flag && hCPE->element_brate > IVAS_13k2 )
@@ -304,7 +304,7 @@ void tdm_configure_dec(
     * bitbudget distribution between channels (taking into account also metadata bitbudget)
     *----------------------------------------------------------------*/

#ifdef OMASA_BRATE_TD
#ifdef OMASA_BRATE
    tdm_bit_alloc( hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC + hCPE->brate_surplus,
                   hStereoTD->tdm_lp_reuse_flag, &( sts[0]->total_brate ), &( sts[1]->total_brate ),
                   &hStereoTD->tdm_low_rate_mode, sts[1]->coder_type, *tdm_ratio_idx, hStereoTD->tdm_Pitch_reuse_flag,
+1 −1
Original line number Diff line number Diff line
@@ -396,7 +396,7 @@ ivas_error ivas_cpe_enc(
        /* signal the bitrate for BW selection in the SCh */
        sts[0]->bits_frame_channel = 0;
        sts[1]->bits_frame_channel = (int16_t) ( hCPE->element_brate / FRAMES_PER_SEC );
#ifdef OMASA_BRATE_TD
#ifdef OMASA_BRATE
        sts[1]->bits_frame_channel += (int16_t) ( hCPE->brate_surplus / FRAMES_PER_SEC );
#endif
        if ( st_ivas->hQMetaData != NULL )
Loading