Commit 7f29d71a authored by multrus's avatar multrus
Browse files

[cleanup] accept FIX_137_SID_MD_BITS, FIX_QMETA_SID_5k2

parent 03271050
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -149,12 +149,10 @@
/* only BE switches wrt operation points tested in selection */

/*#define FIX_I4_OL_PITCH*/                             /* fix open-loop pitch used for EVS core switching */
#define FIX_137_SID_MD_BITS                             /* Dlb: Fix issue #137 , SID bitrate mismatch correction */
#define FIX_470_MASA_JBM_EXT                            /* Nokia: Issue 470, fix MASA EXT output with JBM */
#define FIX_564                                         /* Nokia: Issue 564: Fix gains in JBM path for SBA with parametric binaural renderer */
#define FIX_559_EXTL_IGF_MISMATCH                       /* VA: issue 559: fix mismatch between st->extl and st->igf observed as crash in PlanarSBA bitrate switching */
#define FIX_571_REVERB_NOT_ACTIVATED_ISM                /* Philips: Issue 571: Reverb not activated for discrete and parametric ISM */
#define FIX_QMETA_SID_5k2                               /* Nokia: Issue 137: enable using full 5.2k bitrate in MASA SID */


#define FIX_488_SYNC_DELAY                             /* Eri: Issue 488: Waveform and MD desynchronized in external renderer */
+0 −27
Original line number Diff line number Diff line
@@ -1230,9 +1230,7 @@ int16_t ivas_qmetadata_dec_sid_decode(
    float avg_direction_vector[3];
    float direction_vector[3];
    int16_t metadata_sid_bits; /* bits allocated to SID for metadata */
#ifdef FIX_QMETA_SID_5k2
    int16_t bits_delta, bits_dir;
#endif
#ifdef DEBUG_MODE_QMETADATA
    static FILE *pF = NULL;
    static FILE *pF_azi = NULL;
@@ -1251,22 +1249,12 @@ int16_t ivas_qmetadata_dec_sid_decode(

    if ( ivas_format == SBA_FORMAT )
    {
#ifndef FIX_137_SID_MD_BITS
        /* TODO: still use old sid frame size to keep bitexactness */
        metadata_sid_bits = (int16_t) ( 5000 /*IVAS_SID_5k2*/ - SID_2k40 ) / FRAMES_PER_SEC - ( SPAR_DTX_BANDS * 18 ) - 1; /* -1 for inactive mode header bit*/
#else
        metadata_sid_bits = (int16_t) ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - ( SPAR_DTX_BANDS * SPAR_SID_BITS_TAR_PER_BAND ) - 2 - SID_FORMAT_NBITS; /* -1 for inactive mode header bit*/

#endif
    }
    else
    {
#ifdef FIX_QMETA_SID_5k2
        metadata_sid_bits = ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS;
#else
        /* TODO: still use old sid frame size to keep bitexactness */
        metadata_sid_bits = ( 4400 /*IVAS_SID_5k2*/ - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS;
#endif
    }

    start_index = *index;
@@ -1309,7 +1297,6 @@ int16_t ivas_qmetadata_dec_sid_decode(
        q_direction->not_in_2D = 1;
    }

#ifdef FIX_QMETA_SID_5k2
    bits_dir = 0;
    if ( ivas_format != SBA_FORMAT )
    {
@@ -1372,7 +1359,6 @@ int16_t ivas_qmetadata_dec_sid_decode(
    }
    else
    {
#endif

        /* Decode diffuseness*/
        for ( b = start_band; b < nbands; b++ )
@@ -1382,9 +1368,7 @@ int16_t ivas_qmetadata_dec_sid_decode(
            q_direction->band_data[b].bits_sph_idx[0] = bits_direction_masa[diffuseness_index[b]];
            q_direction->band_data[b].azimuth_m_alphabet[0] = no_phi_masa[q_direction->band_data[b].bits_sph_idx[0] - 1][0];
        }
#ifdef FIX_QMETA_SID_5k2
    }
#endif

    for ( b = start_band; b < nbands; b++ )
    {
@@ -1430,14 +1414,10 @@ int16_t ivas_qmetadata_dec_sid_decode(
    {
        for ( b = start_band; b < nbands; b++ )
        {
#ifdef FIX_QMETA_SID_5k2
            if ( ivas_format == SBA_FORMAT )
            {
#endif
                q_direction->band_data[b].azimuth_m_alphabet[0] = 1 << ( min( 5, q_direction->band_data[b].bits_sph_idx[0] ) );
#ifdef FIX_QMETA_SID_5k2
            }
#endif

            q_direction->band_data[b].azimuth_index[0] = ivas_qmetadata_DecodeQuasiUniform( bitstream, index, q_direction->band_data[b].azimuth_m_alphabet[0] );
            q_direction->band_data[b].azimuth_index[0] = ivas_qmetadata_dereorder_generic( q_direction->band_data[b].azimuth_index[0] ) + ( q_direction->band_data[b].azimuth_m_alphabet[0] >> 1 );
@@ -1464,13 +1444,6 @@ int16_t ivas_qmetadata_dec_sid_decode(
    }


#if !( defined FIX_137_SID_MD_BITS && defined FIX_QMETA_SID_5k2 )
    /* TODO: temporary hack to keep BE */
    if ( ivas_format != SBA_FORMAT )
    {
        metadata_sid_bits = ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS;
    }
#endif
    /*Read filling bits*/
    while ( start_index - *index < metadata_sid_bits )
    {
+0 −23
Original line number Diff line number Diff line
@@ -845,9 +845,7 @@ ivas_error ivas_qmetadata_enc_encode_hr_384_512(
        }
#endif

#ifdef FIX_QMETA_SID_5k2
        q_direction->not_in_2D = 0;
#endif

        /*Coherence */
        if ( all_coherence_zero == 0 )
@@ -991,23 +989,13 @@ void ivas_qmetadata_enc_sid_encode(

    if ( ivas_format == SBA_FORMAT )
    {
#ifndef FIX_137_SID_MD_BITS
        /* TODO: still use old sid frame size to keep bitexactness */
        metadata_sid_bits = (int16_t) ( 5000 /*IVAS_SID_5k2*/ - SID_2k40 ) / FRAMES_PER_SEC - ( SPAR_DTX_BANDS * SPAR_SID_BITS_TAR_PER_BAND ) - 1; /* -1 for inactive mode header bit*/
#else
        metadata_sid_bits = (int16_t) ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - ( SPAR_DTX_BANDS * SPAR_SID_BITS_TAR_PER_BAND ) - 2 - SID_FORMAT_NBITS; /* -1 for inactive mode header bit*/

#endif
    }
    else
    {
#ifdef FIX_QMETA_SID_5k2

        metadata_sid_bits = ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS;
#else
        /* TODO: still use old sid frame size to keep bitexactness */
        metadata_sid_bits = ( 4400 /*IVAS_SID_5k2*/ - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS;
#endif
    }

#ifdef DEBUG_MODE_QMETADATA
@@ -1063,7 +1051,6 @@ void ivas_qmetadata_enc_sid_encode(
    /*Encode the quantized diffuseness in raw coding*/
    bits_dir = 0;
    bits_diff = 0;
#ifdef FIX_QMETA_SID_5k2
    if ( ivas_format != SBA_FORMAT )
    {
        for ( b = start_band; b < nbands; b++ )
@@ -1128,7 +1115,6 @@ void ivas_qmetadata_enc_sid_encode(
    }
    else
    {
#endif
        for ( b = start_band; b < nbands; b++ )
        {
            q_direction->band_data[b].energy_ratio_index[0] = max( q_direction->band_data[b].energy_ratio_index[0], 4 );
@@ -1162,9 +1148,7 @@ void ivas_qmetadata_enc_sid_encode(
                }
            }
        }
#ifdef FIX_QMETA_SID_5k2
    }
#endif
    assert( ( bits_delta >= 0 ) && "Bit budget in Qmetadata SID is violated!!!" );

    /*Code diffuseness*/
@@ -1246,13 +1230,6 @@ void ivas_qmetadata_enc_sid_encode(
    }
#endif

#if !( defined FIX_137_SID_MD_BITS && defined FIX_QMETA_SID_5k2 )
    /* TODO: temporary to keep BE */
    if ( ivas_format != SBA_FORMAT )
    {
        metadata_sid_bits = ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS;
    }
#endif
    /* fill bits*/
    assert( ( hMetaData->nb_bits_tot - bit_pos_start ) <= metadata_sid_bits && "Too many written bits!" );
    while ( ( hMetaData->nb_bits_tot - bit_pos_start ) < metadata_sid_bits )