Commit 2124631f authored by Jouni Paulus's avatar Jouni Paulus
Browse files

fixes to handling of inputs with lower sampling rate: OMASA_FIX_LOW_FS.

increase bitstream index buffer size to avoid reallocation that currently fails: OMASA_BIT_BUFF_SZ.
parent 06554bba
Loading
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -434,7 +434,11 @@ int16_t get_ivas_max_num_indices(
        }
        else if ( ivas_total_brate <= IVAS_256k )
        {
#ifdef OMASA_BIT_BUFF_SZ
            return 1300;
#else
            return 1150;
#endif
        }
        else if ( ivas_total_brate <= IVAS_384k )
        {
+2 −0
Original line number Diff line number Diff line
@@ -167,6 +167,8 @@
#define MASAISM_EDIT_OBJECTS                            /* Nokia: Temporary command line editing of object directions in the decoder */
#define FIX_356_ISM_METADATA_SYNC_OMASA // temp. fix
#define OMASA_BRSW_MONO_FIX                             /* Nokia: fix renderer config under rateswitching and MONO output */
#define OMASA_FIX_LOW_FS                                /* Nokia: fixes related to lower input signal sampling rates */
#define OMASA_BIT_BUFF_SZ                               /* Nokia: increase bitstream index buffer initial size */
#endif

/* ################## End DEVELOPMENT switches ######################### */
+7 −0
Original line number Diff line number Diff line
@@ -298,6 +298,11 @@ ivas_error ivas_enc(

        flag_omasa_ener_brate = 0;

#ifdef OMASA_FIX_LOW_FS
        /* Estimate TF-tile energy for the input MASA stream */
        ivas_masa_estimate_energy( st_ivas->hMasa, &( data_f[hEncoderConfig->nchan_ism] ), input_frame, st_ivas->nchan_transport );
#endif

        if ( ( error = ivas_omasa_enc_config( st_ivas ) ) != IVAS_ERR_OK )
        {
            return error;
@@ -313,8 +318,10 @@ ivas_error ivas_enc(
        set_s( nb_bits_metadata, 0, MAX_SCE + 1 );
        idx_separated_object = 0;

#ifndef OMASA_FIX_LOW_FS
        /* Estimate TF-tile energy for the input MASA stream */
        ivas_masa_estimate_energy( st_ivas->hMasa, &( data_f[hEncoderConfig->nchan_ism] ), input_frame, st_ivas->nchan_transport );
#endif

        /* put audio object data in SCE's */
        if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC )
+16 −1
Original line number Diff line number Diff line
@@ -745,6 +745,9 @@ ivas_error ivas_masa_enc_config(
    ivas_error error;
#ifdef MASA_AND_OBJECTS
    int32_t ism_total_brate;
#ifdef OMASA_FIX_LOW_FS
    int32_t masa_total_brate;
#endif
#endif

    error = IVAS_ERR_OK;
@@ -900,8 +903,16 @@ ivas_error ivas_masa_enc_config(

#ifdef MASA_AND_OBJECTS
    st_ivas->hQMetaData->q_direction->cfg.inactiveBands = 0;

#ifdef OMASA_FIX_LOW_FS
    masa_total_brate = ivas_total_brate;
    if ( ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode == ISM_MASA_MODE_DISC )
    {
        masa_total_brate = calculate_cpe_brate_MASA_ISM( st_ivas->ism_mode, ivas_total_brate, st_ivas->hEncoderConfig->nchan_ism );
    }
    if ( masa_total_brate >= IVAS_384k && ( ivas_format == MASA_FORMAT || ivas_format == MASA_ISM_FORMAT ) )
#else
    if ( ivas_total_brate > IVAS_256k && ivas_format == MASA_FORMAT )
#endif
#else
    if ( ivas_total_brate > IVAS_256k )
#endif
@@ -933,8 +944,12 @@ ivas_error ivas_masa_enc_config(
            st_ivas->hQMetaData->q_direction->cfg.inactiveBands = 0;
        }
    }
#ifdef OMASA_FIX_LOW_FS
    masa_sample_rate_band_correction( &( hMasa->config ), hMasa->data.band_mapping, hQMetaData, maxBand, masa_total_brate >= IVAS_384k, NULL );

#else
    masa_sample_rate_band_correction( &( hMasa->config ), hMasa->data.band_mapping, hQMetaData, maxBand, ivas_total_brate > IVAS_256k, NULL );
#endif

    if ( hMasa->config.numTwoDirBands >= hMasa->config.numCodingBands )
    {
+10 −2
Original line number Diff line number Diff line
@@ -60,7 +60,6 @@ static void computeIntensityVector_enc( const int16_t *band_grouping, float Cldf

static void computeReferencePower_omasa( const int16_t *band_grouping, float Cldfb_RealBuffer[FOA_CHANNELS][CLDFB_NO_CHANNELS_MAX], float Cldfb_ImagBuffer[FOA_CHANNELS][CLDFB_NO_CHANNELS_MAX], float *reference_power, const int16_t enc_param_start_band, const int16_t num_freq_bands );


/*--------------------------------------------------------------------------*
 * ivas_omasa_enc_open()
 *
@@ -532,10 +531,14 @@ void ivas_omasa_enc(
        }

        /* force computation into high resolution */
#ifndef OMASA_FIX_LOW_FS
        n_bands_orig = hOMasa->nbands;
#endif
        n_subframes_orig = hOMasa->nSubframes;

#ifndef OMASA_FIX_LOW_FS
        hOMasa->nbands = MASA_FREQUENCY_BANDS;
#endif
        hOMasa->nSubframes = MAX_PARAM_SPATIAL_SUBFRAMES;

        /* Estimate MASA parameters from the objects */
@@ -553,14 +556,20 @@ void ivas_omasa_enc(
        }

        /* restore resolution parameters */
#ifndef OMASA_FIX_LOW_FS
        hOMasa->nbands = n_bands_orig;
#endif
        hOMasa->nSubframes = n_subframes_orig;

        /* perform MASA+ISM merge in full resolution */
        numCodingBands_orig = hMasa->config.numCodingBands;
        joinedSubframes_orig = hMasa->config.joinedSubframes;

#ifndef OMASA_FIX_LOW_FS
        hMasa->config.numCodingBands = MASA_FREQUENCY_BANDS;
#else
        hMasa->config.numCodingBands = hOMasa->nbands;
#endif
        hMasa->config.joinedSubframes = 0;

        ivas_merge_masa_metadata( hMasa, hOMasaMeta ); /* => merge result in hMasa->masaMetadata */
@@ -926,7 +935,6 @@ static void ivas_omasa_param_est_enc(
            }
            ivas_qmetadata_direction_vector_to_azimuth_elevation( dir_v, &azimuth_m_values[block_m_idx][band_m_idx], &elevation_m_values[block_m_idx][band_m_idx] );
        }

        /* Set coherences to zero, as this mode is used at lowest bit rates where the coherences are not transmitted */
        for ( band_m_idx = 0; band_m_idx < hOMasa->nbands; band_m_idx++ )
        {