Commit dbd85715 authored by Michael Sturm's avatar Michael Sturm
Browse files

Introduces further changes from review comments

parent e9266362
Loading
Loading
Loading
Loading
+0 −38
Original line number Diff line number Diff line
@@ -3768,20 +3768,11 @@ void IGFDecApplyMono( const IGF_DEC_INSTANCE_HANDLE hInstance, /**< in: | in
                                                                                   igf_spec + hGrid->minSrcSubband,
                                                                                   sub( hGrid->startLine, hGrid->minSrcSubband ) );
                hPrivateData->n_noise_bands = IGF_replaceTCXNoise_1( igf_spec,
#ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS
                                                                     0,
#endif
                                                                     hPrivateData->headroom_TCX_noise_white,
                                                                     hInstance->infoTCXNoise_evs,
                                                                     hGrid->minSrcSubband,
                                                                     hGrid->startLine,
#ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS
                                                                     &hPrivateData->totalNoiseNrg,
                                                                     NULL,
                                                                     EVS_MONO );
#else
                                                                     &hPrivateData->totalNoiseNrg );
#endif
                move16();
                move16();

@@ -3798,20 +3789,11 @@ void IGFDecApplyMono( const IGF_DEC_INSTANCE_HANDLE hInstance, /**< in: | in
                                                                             sub( hGrid->startLine, hGrid->minSrcSubband ) );

                hPrivateData->n_noise_bands_off = IGF_replaceTCXNoise_1( hPrivateData->pSpecFlat,
#ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS
                                                                         0,
#endif
                                                                         hPrivateData->headroom_TCX_noise,
                                                                         hInstance->infoTCXNoise_evs,
                                                                         hGrid->minSrcSubband,
                                                                         hGrid->startLine,
#ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS
                                                                         &hPrivateData->totalNoiseNrg_off,
                                                                         NULL,
                                                                         EVS_MONO );
#else
                                                                         &hPrivateData->totalNoiseNrg_off );
#endif
                move16();
                move16();

@@ -3827,23 +3809,13 @@ void IGFDecApplyMono( const IGF_DEC_INSTANCE_HANDLE hInstance, /**< in: | in
                  igf_spec_e,
                  hPrivateData->pSpecFlat,
                  hPrivateData->pSpecFlat_exp,
#ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS
                  specMed_e,
                  EVS_MONO );
#else
                  specMed_e );
#endif
        IGF_calc( hPrivateData,
                  igfGridIdx,
                  spectrum,
                  *spectrum_e,
                  igf_spec,
#ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS
                  igf_spec_e,
                  EVS_MONO );
#else
                  igf_spec_e );
#endif
        IGF_appl( hPrivateData,
                  igfGridIdx,
                  spectrum,
@@ -4646,11 +4618,7 @@ void IGFDecSetMode_ivas_fx(
    hIGFDec->isIGFActive = 0;
    move16();

#ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS
    IF( IGFCommonFuncsIGFConfiguration( total_brate, bwidth, element_mode, &hPrivateData->igfInfo, rf_mode ) )
#else
    IF( IGFCommonFuncsIGFConfiguration_ivas_fx( total_brate, bwidth, element_mode, &hPrivateData->igfInfo, rf_mode ) )
#endif
    {
        IGFSCFDecoderOpen( &hPrivateData->hArithSCFdec, &hPrivateData->igfInfo, total_brate, bwidth, element_mode, rf_mode );

@@ -4672,15 +4640,9 @@ void IGFDecSetMode_ivas_fx(
        IF( NE_16( hPrivateData->igfInfo.bitRateIndex, IGF_BITRATE_FB_96000 ) && NE_16( hPrivateData->igfInfo.bitRateIndex, IGF_BITRATE_FB_96000_CPE ) &&
            NE_16( hPrivateData->igfInfo.bitRateIndex, IGF_BITRATE_FB_128000 ) && NE_16( hPrivateData->igfInfo.bitRateIndex, IGF_BITRATE_FB_128000_CPE ) )
        {
#ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS
            IGF_RefineGrid( &hPrivateData->igfInfo.grid[IGF_GRID_LB_NORM], element_mode );
            IGF_RefineGrid( &hPrivateData->igfInfo.grid[IGF_GRID_LB_TRAN], element_mode );
            IGF_RefineGrid( &hPrivateData->igfInfo.grid[IGF_GRID_LB_SHORT], element_mode );
#else
            IGF_RefineGrid_ivas_fx( &hPrivateData->igfInfo.grid[IGF_GRID_LB_NORM] );
            IGF_RefineGrid_ivas_fx( &hPrivateData->igfInfo.grid[IGF_GRID_LB_TRAN] );
            IGF_RefineGrid_ivas_fx( &hPrivateData->igfInfo.grid[IGF_GRID_LB_SHORT] );
#endif
        }
        /* IGFDecOutInformation(hIGFDec); */
    }
+44 −73
Original line number Diff line number Diff line
@@ -310,11 +310,7 @@ static void IGF_WriteEnvelope(
            IGFSCFEncoderSaveContextState_fx( &hPrivateData->hIGFSCFArithEnc, igfGridIdx );
        }

#ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS
        *pBitOffset = IGFSCFEncoderEncode_fx( &hPrivateData->hIGFSCFArithEnc, hBstr, *pBitOffset, &hPrivateData->igfScfQuantized[hGrid->startSfb], igfGridIdx, EVS_MONO, isIndepFlag );
#else
        *pBitOffset = IGFSCFEncoderEncode_fx( &hPrivateData->hIGFSCFArithEnc, hBstr, *pBitOffset, &hPrivateData->igfScfQuantized[hGrid->startSfb], igfGridIdx, isIndepFlag );
#endif
        move16();

        if ( NULL == hBstr )
@@ -1036,9 +1032,10 @@ Word16 IGF_getCrest(

        /*see IGF_getSFM for more comment */
#ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS
        IF( GT_16( element_mode, EVS_MONO ) )
        if( GT_16( element_mode, EVS_MONO ) )
        {
            powSpec_exp = powerSpectrum_exp[i]; /* exponent is a vector in IVAS (and a scalar in EVS) */
            move16();
        }
        x = sub( sub( powSpec_exp, norm_l( powerSpectrum[i] ) ), 1 ); /*Q0*/
#else
@@ -1227,7 +1224,7 @@ Word16 IGF_getSFM(
    move16();
    W_denom = 0;
    move64();
    IF( EQ_16( element_mode, EVS_MONO ) )
    if ( EQ_16( element_mode, EVS_MONO ) )
    {
        denom = L_shr( 2147483 /*0,001 in Q31 - float is "1", here*/, s_min( en_exp, 31 ) );
        denom = L_max( denom, 1 );
@@ -1236,7 +1233,7 @@ Word16 IGF_getSFM(
        W_denom = W_deposit32_l( denom );
        move64();
    }
    ELSE
    else
    {
        denom = 65536; // 1.f in Q16
        move32();
@@ -1253,18 +1250,17 @@ Word16 IGF_getSFM(

    Word64 W_denom = W_deposit32_l( denom );
#endif
    FOR( i = start; i < stop; i++ )
    {
    /*ln(x * 2^-Qx * 2^xExp) = ln(x) - Qx + xExp*/

    /* n       = sub(sub(31,norm_l(tmp32)),1);  */ /*<- ld    */
    /* n       = sub(n,31);                     */ /*<- -Qx   */
    /* n       = add(n,*energy_exp);            */ /*<- +xExp */
#ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS
        IF( GT_16( element_mode, EVS_MONO ) )
    if ( EQ_16( element_mode, EVS_MONO ) )
    {
            en_exp = energy_exp[i]; /* exponent is a vector in IVAS (and a scalar in EVS) */
        }
#endif
        FOR( i = start; i < stop; i++ )
        {
#ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS
            n = sub( sub( en_exp, norm_l( energy[i] ) ), 1 ); /*<-- short form*/
#else
            n = sub( sub( *energy_exp, norm_l( energy[i] ) ), 1 ); /*<-- short form*/
@@ -1278,20 +1274,30 @@ Word16 IGF_getSFM(

            n = s_max( 0, n );
            num = L_add( num, L_deposit_l( n ) ); /*Q0*/

#ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS
        IF( EQ_16( element_mode, EVS_MONO ) )
        {
            W_denom = W_add( W_deposit32_l( energy[i] ), W_denom );
        }
        ELSE
#ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS
    }
    else
    {
        FOR( i = start; i < stop; i++ )
        {
            en_exp = energy_exp[i]; /* exponent is a vector in IVAS (and a scalar in EVS) */
            move16();
            n = sub( sub( en_exp, norm_l( energy[i] ) ), 1 ); /*<-- short form*/

            if ( energy[i] == 0 ) /*special case: energy is zero*/
            {
                n = 0;
                move16();
            }

            n = s_max( 0, n );
            num = L_add( num, L_deposit_l( n ) ); /*Q0*/
            denom = BASOP_Util_Add_Mant32Exp( energy[i], en_exp, denom, denom_exp, &denom_exp );
        }
#else
        W_denom = W_add( W_deposit32_l( energy[i] ), W_denom );
#endif
    }
#endif

#ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS
    IF( EQ_16( element_mode, EVS_MONO ) )
@@ -1528,16 +1534,8 @@ static void IGF_Whitening(
            FOR( p = 0; p < nT; p++ )
            {
                /*tmp  = IGF_getSFM(powerSpectrum, hGrid->tile[p], hGrid->tile[p+1]) / IGF_getCrest(powerSpectrum, hGrid->tile[p], hGrid->tile[p+1]);*/
#ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS
                SFM = IGF_getSFM( &SFM_exp, powerSpectrum, &powerSpectrum_exp, hGrid->tile[p], hGrid->tile[p + 1], EVS_MONO );
#else
                SFM = IGF_getSFM( &SFM_exp, powerSpectrum, &powerSpectrum_exp, hGrid->tile[p], hGrid->tile[p + 1] );
#endif
#ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS
                crest = IGF_getCrest( &crest_exp, powerSpectrum, &powerSpectrum_exp, hGrid->tile[p], hGrid->tile[p + 1], EVS_MONO );
#else
                crest = IGF_getCrest( &crest_exp, powerSpectrum, powerSpectrum_exp, hGrid->tile[p], hGrid->tile[p + 1] );
#endif

                tmp = BASOP_Util_Divide1616_Scale( SFM, crest, &s ); /*   Q15 */
                s = add( s, sub( SFM_exp, crest_exp ) );
@@ -1863,16 +1861,13 @@ static void IGF_Whitening(
                IF( isTNSActive && GT_16( element_mode, EVS_MONO ) )
                {
                    FOR( sb = hGrid->tile[p]; sb < hGrid->tile[p + 1]; sb++ )
                    {
                        IF( LT_32( powerSpectrum[sb], 1 ) )
                    {
                        hPrivateData->logSpec[sb] = 0; /* max(0,FLT_MIN_EXP=-125 )*/
                        }
                        ELSE
                        move16();
                        IF( GE_32( powerSpectrum[sb], 1 ) )
                        {
                            hPrivateData->logSpec[sb] = extract_l( L_max( 0, L_shr( L_add( BASOP_Util_Log2( powerSpectrum[sb] ), L_shl( powerSpectrum_e[sb], Q25 ) ), Q25 ) ) );
                        }
                        move16();
                    }
                }

@@ -2181,7 +2176,7 @@ static void IGF_Whitening(
        /* reset filter */
        FOR( p = 0; p < IGF_MAX_TILES; p++ )
        {
            hPrivateData->prevSFM_FIR[p] = L_deposit_l( 0 );
            hPrivateData->prevSFM_FIR[p] = 0;
            hPrivateData->prevSFM_IIR[p] = 0;
            move32();
            move16();
@@ -4550,11 +4545,7 @@ static Word16 IGF_WriteEnvelope_ivas(
            IGFSCFEncoderSaveContextState_fx( &hPrivateData->hIGFSCFArithEnc, igfGridIdx );
        }

#ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS
        *pBitOffset = IGFSCFEncoderEncode_fx( &hPrivateData->hIGFSCFArithEnc, hBstr, *pBitOffset, &hPrivateData->igfScfQuantized[hGrid->startSfb], igfGridIdx, IVAS_SCE, isIndepFlag );
#else
        *pBitOffset = IGFSCFEncoderEncode_ivas_fx( &hPrivateData->hIGFSCFArithEnc, hBstr, *pBitOffset, &hPrivateData->igfScfQuantized[hGrid->startSfb], igfGridIdx, isIndepFlag );
#endif
        move16();

        if ( NULL == hBstr )
@@ -5142,11 +5133,7 @@ static Word16 IGF_WriteWhiteningLevels_ivas_fx(
        {
            IGF_write_bits( hBstr, pBitOffset, 0, 1 );
        }
#ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS
        IGF_WriteWhiteningTile_fx( hBstr, pBitOffset, hPrivateData->igfCurrWhiteningLevel[0] );
#else
        IGF_WriteWhiteningTile_ivas_fx( hBstr, pBitOffset, hPrivateData->igfCurrWhiteningLevel[0] );
#endif
        p = 1;
        move16();
        tmp32 = 0;
@@ -5183,11 +5170,7 @@ static Word16 IGF_WriteWhiteningLevels_ivas_fx(
            IGF_write_bits( hBstr, pBitOffset, 1, 1 );
            FOR( p = 1; p < nTiles; p++ )
            {
#ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS
                IGF_WriteWhiteningTile_fx( hBstr, pBitOffset, hPrivateData->igfCurrWhiteningLevel[p] );
#else
                IGF_WriteWhiteningTile_ivas_fx( hBstr, pBitOffset, hPrivateData->igfCurrWhiteningLevel[p] );
#endif
            }
        }
        ELSE IF( NE_16( hPrivateData->igfInfo.bitRateIndex, IGF_BITRATE_SWB_48000_CPE ) && NE_16( hPrivateData->igfInfo.bitRateIndex, IGF_BITRATE_FB_48000_CPE ) )
@@ -5262,23 +5245,11 @@ Word16 IGFEncWriteBitstream_ivas_fx(
    }


#ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS
    IGF_WriteEnvelope( hIGFEnc, hBstr, pBitOffset, igfGridIdx, isIndepFlag, &igfAllZero, IVAS_SCE );
#else
    IGF_WriteEnvelope_ivas( hIGFEnc, hBstr, pBitOffset, igfGridIdx, isIndepFlag, &igfAllZero );
#endif

#ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS
    IGF_WriteWhiteningLevels_fx( hIGFEnc, hBstr, pBitOffset, igfGridIdx, isIndepFlag );
#else
    IGF_WriteWhiteningLevels_ivas_fx( hIGFEnc, hBstr, pBitOffset, igfGridIdx, isIndepFlag );
#endif

#ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS
    IGF_WriteFlatteningTrigger_fx( hIGFEnc, hBstr, pBitOffset );
#else
    IGF_WriteFlatteningTrigger_ivas_fx( hIGFEnc, hBstr, pBitOffset );
#endif

    hIGFEnc->infoTotalBitsPerFrameWritten = sub( *pBitOffset, startBitCount );
    hIGFEnc->infoTotalBitsWritten = add( hIGFEnc->infoTotalBitsWritten, hIGFEnc->infoTotalBitsPerFrameWritten );
+16 −23
Original line number Diff line number Diff line
@@ -130,35 +130,28 @@ static void arith_encode_bits(
    Word16 i;
    Word16 bit;

    FOR( i = nBits - 1; i >= 0; --i ) /* nBits > 0 */
#ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS
    if( EQ_16( element_mode, EVS_MONO ) )
    {
#endif
        for( i = nBits - 1; i >= 0; --i ) /* nBits > 0 */
        {
            bit = s_and( shr( x, i ), 1 );
            hPrivateData->ptrBitIndex = ari_encode_14bits_sign_fx( ptr, hPrivateData->ptrBitIndex, MAX16B /* disable the bit count limitation */, &hPrivateData->acState_fx, bit );
            move16();
        }
#ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS
        IF( EQ_16( element_mode, EVS_MONO ) )
        {
            hPrivateData->ptrBitIndex = ari_encode_14bits_sign_fx( ptr,
                                                                   hPrivateData->ptrBitIndex,
                                                                   32767, /* disable the bit count limitation */
                                                                   &hPrivateData->acState_fx,
                                                                   bit );
    }
        ELSE
    else
    {
            hPrivateData->ptrBitIndex = ari_encode_14bits_sign_ivas_fx( ptr,
                                                                        hPrivateData->ptrBitIndex,
                                                                        32767, /* disable the bit count limitation */
                                                                        &hPrivateData->acState,
                                                                        bit );
        }
#else
        hPrivateData->ptrBitIndex = ari_encode_14bits_sign_fx( ptr,
                                                               hPrivateData->ptrBitIndex,
                                                               32767, /* disable the bit count limitation */
                                                               &hPrivateData->acState_fx,
                                                               bit );
#endif
        for( i = nBits - 1; i >= 0; --i ) /* nBits > 0 */
        {
            bit = s_and( shr( x, i ), 1 );
            hPrivateData->ptrBitIndex = ari_encode_14bits_sign_ivas_fx( ptr, hPrivateData->ptrBitIndex, MAX16B /* disable the bit count limitation */, &hPrivateData->acState, bit );
            move16();
        }
    }
#endif

    return;
}