Commit 1b190fcd authored by TYAGIRIS's avatar TYAGIRIS
Browse files

SBA : fix at very low bitrates for band mapping in DirAC decoder

parent 5924d993
Loading
Loading
Loading
Loading
Loading
+32 −7
Original line number Diff line number Diff line
@@ -199,11 +199,19 @@ ivas_error ivas_dirac_config(

    if ( ivas_format == SBA_FORMAT || ivas_format == SBA_ISM_FORMAT )
    {
#ifdef NONBE_FIX_VLBR_DIRAC_BAND_MAPPING
        ivas_dirac_config_bands( band_grouping, IVAS_MAX_NUM_BANDS, (int16_t) ( Fs * INV_CLDFB_BANDWIDTH + 0.5f ), dirac_to_spar_md_bands, hQMetaData->useLowerBandRes, hConfig->enc_param_start_band, hFbMdft, 1 );
#else
        ivas_dirac_config_bands( band_grouping, IVAS_MAX_NUM_BANDS, (int16_t) ( Fs * INV_CLDFB_BANDWIDTH + 0.5f ), dirac_to_spar_md_bands, hQMetaData->useLowerBandRes, hConfig->enc_param_start_band, hFbMdft );
#endif
    }
    else
    {
#ifdef NONBE_FIX_VLBR_DIRAC_BAND_MAPPING
        ivas_dirac_config_bands( band_grouping, hConfig->nbands, (int16_t) ( Fs * INV_CLDFB_BANDWIDTH + 0.5f ), NULL, 0, 0, hFbMdft, 1 );
#else
        ivas_dirac_config_bands( band_grouping, hConfig->nbands, (int16_t) ( Fs * INV_CLDFB_BANDWIDTH + 0.5f ), NULL, 0, 0, hFbMdft );
#endif
    }

    return error;
@@ -215,7 +223,17 @@ ivas_error ivas_dirac_config(
 *
 * DirAC Configuration freq. band function; used also in MASA decoder
 *------------------------------------------------------------------------*/

#ifdef NONBE_FIX_VLBR_DIRAC_BAND_MAPPING
void ivas_dirac_config_bands(
    int16_t *band_grouping, /* o  : band grouping                          */
    const int16_t nbands,   /* i  : number of bands                        */
    const int16_t max_band, /* i  : maximal band index +1                  */
    int16_t *dirac_to_spar_md_bands,
    const int8_t useLowerBandRes,
    const int16_t enc_param_start_band,
    IVAS_FB_MIXER_HANDLE hFbMdft,
    const int8_t BandGroupLowRes )
#else
void ivas_dirac_config_bands(
    int16_t *band_grouping, /* o  : band grouping                          */
    const int16_t nbands,   /* i  : number of bands                        */
@@ -224,6 +242,7 @@ void ivas_dirac_config_bands(
    const int8_t useLowerBandRes,
    const int16_t enc_param_start_band,
    IVAS_FB_MIXER_HANDLE hFbMdft )
#endif
{
    int16_t i;
    {
@@ -274,6 +293,10 @@ void ivas_dirac_config_bands(
            {
                int16_t step = DIRAC_LOW_BANDRES_STEP;
                int16_t reduced_band;
#ifdef NONBE_FIX_VLBR_DIRAC_BAND_MAPPING
                if ( BandGroupLowRes )
#endif
                {
                    for ( band = enc_param_start_band + 2, reduced_band = enc_param_start_band + 1; band <= DIRAC_MAX_NBANDS; band += step, reduced_band++ )
                    {
                        band_grouping[reduced_band] = band_grouping[band];
@@ -282,6 +305,8 @@ void ivas_dirac_config_bands(
                    {
                        band_grouping[reduced_band] = max_band;
                    }
                }

                for ( band = enc_param_start_band + ( DIRAC_MAX_NBANDS - enc_param_start_band ) / 2 - 1, reduced_band = DIRAC_MAX_NBANDS - 1; band >= enc_param_start_band; band--, reduced_band -= step )
                {
                    dirac_to_spar_md_bands[reduced_band] = dirac_to_spar_md_bands[band];
+15 −0
Original line number Diff line number Diff line
@@ -3634,6 +3634,18 @@ ivas_error ivas_dirac_config(
    const int16_t enc_dec                                       /* i  : encoder or decoder flag                 */
);

#ifdef NONBE_FIX_VLBR_DIRAC_BAND_MAPPING
void ivas_dirac_config_bands(
    int16_t *band_grouping,                                     /* o  : band grouping                           */
    const int16_t nbands,                                       /* i  : number of bands                         */ 
    const int16_t max_band,                                     /* i  : maximal band index +1                   */
    int16_t *dirac_to_spar_md_bands,                            /* o  : mapping of DirAC parameter band index to SPAR FB band index */
    const int8_t useLowerBandRes,                               /* i  : flag indicating lower band resolution for DirAC             */
    const int16_t enc_param_start_band,                         /* i  : band index of first DirAC parameter band                    */
    IVAS_FB_MIXER_HANDLE hFbMdft,
    const int8_t BandGroupLowRes                                /* i  : flag indicating lower band grouping resolution for DirAC                    */
);
#else
void ivas_dirac_config_bands(
    int16_t *band_grouping,                                     /* o  : band grouping                           */
    const int16_t nbands,                                       /* i  : number of bands                         */ 
@@ -3643,6 +3655,9 @@ void ivas_dirac_config_bands(
    const int16_t enc_param_start_band,                         /* i  : band index of first DirAC parameter band                    */
    IVAS_FB_MIXER_HANDLE hFbMdft
);
#endif



void ivas_get_dirac_sba_max_md_bits(
    const int32_t sba_total_brate,
+1 −1
Original line number Diff line number Diff line
@@ -169,7 +169,7 @@
#define NONBE_FIX_897_USAN_WITH_MASA_RENDERING                /* Nokia: issue #897: USAN null pointer in MASA external renderer to Ambisonics */
#define NONBE_FIX_903_OSBA_TO_STEREO                          /* VA: issue 903: fix OSBA to stereo rendering issue */
#define NONBE_FIX_811_DFT_DOUBLE_TO_FLOAT                     /* FhG: issue 811: change double precision functions to float in DFT Stereo */

#define NONBE_FIX_VLBR_DIRAC_BAND_MAPPING
/* ##################### End NON-BE switches ########################### */

/* ################## End DEVELOPMENT switches ######################### */
+9 −2
Original line number Diff line number Diff line
@@ -1317,7 +1317,11 @@ void ivas_qmetadata_to_dirac(
            /* SID/zero-frame: 1 direction, 5 bands, nblocks re-generated out of SID decoder*/
            start_band = 0;
            hDirAC->hConfig->nbands = 5;
#ifdef NONBE_FIX_VLBR_DIRAC_BAND_MAPPING
            ivas_dirac_config_bands( hDirAC->band_grouping, hDirAC->hConfig->nbands, nbands, NULL, 0, 0, NULL, 1 );
#else
            ivas_dirac_config_bands( hDirAC->band_grouping, hDirAC->hConfig->nbands, nbands, NULL, 0, 0, NULL );
#endif
            nbands = 5;
        }
        else
@@ -1331,9 +1335,11 @@ void ivas_qmetadata_to_dirac(
            {
                hDirAC->hConfig->nbands = q_direction->cfg.nbands;
            }

#ifdef NONBE_FIX_VLBR_DIRAC_BAND_MAPPING
            ivas_dirac_config_bands( hDirAC->band_grouping, hDirAC->hConfig->nbands, nbands, dirac_to_spar_md_bands, hQMetaData->useLowerBandRes, hDirAC->hConfig->enc_param_start_band, hDirAC->hFbMdft, 0 );
#else
            ivas_dirac_config_bands( hDirAC->band_grouping, hDirAC->hConfig->nbands, nbands, dirac_to_spar_md_bands, hQMetaData->useLowerBandRes, hDirAC->hConfig->enc_param_start_band, hDirAC->hFbMdft );

#endif
            nbands = hDirAC->hConfig->nbands;
            if ( hQMetaData->q_direction[0].cfg.nblocks == 0 )
            {
@@ -1391,6 +1397,7 @@ void ivas_qmetadata_to_dirac(
                {
                    qBand_idx = band;
                }

                diffuseness = 1.0f - q_direction->band_data[qBand_idx].energy_ratio[0];
#ifdef DEBUG_MODE_DIRAC
                dbgwrite( &diffuseness, sizeof( float ), 1, 1, "./res/dirac_dec_diffuseness.dat" );
+10 −1
Original line number Diff line number Diff line
@@ -1395,8 +1395,13 @@ ivas_error ivas_init_decoder(
                st_ivas->hQMetaData->numTwoDirBands = (uint8_t) st_ivas->hQMetaData->q_direction[0].cfg.nbands;
            }

#ifdef NONBE_FIX_VLBR_DIRAC_BAND_MAPPING
            ivas_dirac_config_bands( band_grouping, IVAS_MAX_NUM_BANDS, (int16_t) ( st_ivas->hDecoderConfig->output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ),
                                     st_ivas->hSpar->dirac_to_spar_md_bands, st_ivas->hQMetaData->useLowerBandRes, st_ivas->hSpar->enc_param_start_band, 0, 1 );
#else
            ivas_dirac_config_bands( band_grouping, IVAS_MAX_NUM_BANDS, (int16_t) ( st_ivas->hDecoderConfig->output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ),
                                     st_ivas->hSpar->dirac_to_spar_md_bands, st_ivas->hQMetaData->useLowerBandRes, st_ivas->hSpar->enc_param_start_band, 0 );
#endif
        }
        st_ivas->sba_dirac_stereo_flag = ivas_get_sba_dirac_stereo_flag( st_ivas );

@@ -1552,9 +1557,13 @@ ivas_error ivas_init_decoder(
                set_c( (int8_t *) st_ivas->hQMetaData->twoDirBands, (int8_t) 1, st_ivas->hQMetaData->q_direction[0].cfg.nbands );
                st_ivas->hQMetaData->numTwoDirBands = (uint8_t) st_ivas->hQMetaData->q_direction[0].cfg.nbands;
            }

#ifdef NONBE_FIX_VLBR_DIRAC_BAND_MAPPING
            ivas_dirac_config_bands( band_grouping, IVAS_MAX_NUM_BANDS, (int16_t) ( st_ivas->hDecoderConfig->output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ),
                                     st_ivas->hSpar->dirac_to_spar_md_bands, st_ivas->hQMetaData->useLowerBandRes, st_ivas->hSpar->enc_param_start_band, 0, 1 );
#else
            ivas_dirac_config_bands( band_grouping, IVAS_MAX_NUM_BANDS, (int16_t) ( st_ivas->hDecoderConfig->output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ),
                                     st_ivas->hSpar->dirac_to_spar_md_bands, st_ivas->hQMetaData->useLowerBandRes, st_ivas->hSpar->enc_param_start_band, 0 );
#endif
        }

        for ( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ )
Loading