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

Unifies IGF_WriteWhiteningTile_fx function.

parent c3f8c23a
Loading
Loading
Loading
Loading
+51 −3
Original line number Diff line number Diff line
@@ -1295,7 +1295,7 @@ static void IGF_Whitening(
    return;
}


#ifndef FIX_2346_DUPLICATED_IGF_FUNCTIONS
/**********************************************************************/ /*
write whitening levels into bitstream
**************************************************************************/
@@ -1326,8 +1326,48 @@ static void IGF_WriteWhiteningTile_fx(

    return;
}
#else
/**********************************************************************/ /*
write whitening levels into bitstream
**************************************************************************/

/* o: Q0 | number of bits written     */
static Word16 IGF_WriteWhiteningTile_fx(
    BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle       */
    Word16* pBitOffset,    /* i  :     | ptr to bitOffset counter   */
    Word16 whiteningLevel  /* i  : Q0  | whitening levels to write  */
)
{
    Word16 totBitCount;
    Word16 startBitCount;

    totBitCount = 0;
    startBitCount = *pBitOffset;
    move16();
    move16();

    IF( EQ_16( whiteningLevel, IGF_WHITENING_MID ) )
    {
        IGF_write_bits( hBstr, pBitOffset, 0, 1 );
    }
    ELSE
    {
        IGF_write_bits( hBstr, pBitOffset, 1, 1 );
        IF( EQ_16( whiteningLevel, IGF_WHITENING_OFF ) )
        {
            IGF_write_bits( hBstr, pBitOffset, 0, 1 );
        }
        ELSE
        {
            IGF_write_bits( hBstr, pBitOffset, 1, 1 );
        }
    }
    totBitCount = sub( *pBitOffset, startBitCount );

    return totBitCount;
}

#endif
/**********************************************************************/ /*
writes the whitening levels
**************************************************************************/
@@ -3827,7 +3867,7 @@ static void IGF_Whitening_ivas_fx(
    return;
}


#ifndef FIX_2346_DUPLICATED_IGF_FUNCTIONS
/*-------------------------------------------------------------------*
 * IGF_WriteWhiteningTile_fx()
 *
@@ -3869,7 +3909,7 @@ static Word16 IGF_WriteWhiteningTile_ivas_fx(

    return totBitCount;
}

#endif

/*-------------------------------------------------------------------*
 * IGF_WriteWhiteningLevels_fx()
@@ -3940,7 +3980,11 @@ 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;
@@ -3977,7 +4021,11 @@ 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 ) )