Commit 2f8d643c authored by Michael Sturm's avatar Michael Sturm
Browse files

Unifies IGF_RefineGrid function.

parent 6021a710
Loading
Loading
Loading
Loading
+28 −4
Original line number Diff line number Diff line
@@ -2982,6 +2982,7 @@ static void IGF_getWhiteSpectralData_ivas(
/**********************************************************************/ /*
refines the IGF grid
**************************************************************************/
#ifndef FIX_2346_DUPLICATED_IGF_FUNCTIONS
static void IGF_RefineGrid( H_IGF_GRID hGrid                             /**< in/out: | IGF grid handle  */
)
{
@@ -3027,6 +3028,10 @@ static void IGF_RefineGrid( H_IGF_GRID hGrid /**< in
}

static void IGF_RefineGrid_ivas_fx( H_IGF_GRID hGrid /**< in/out: | IGF grid handle  */
#else
static void IGF_RefineGrid( H_IGF_GRID hGrid,         /**< in/out: | IGF grid handle        */
                            const Word16 element_mode /**< in    : | IVAS element mode type */
#endif
)
{
    Word16 a[IGF_MAX_SFB + 1];
@@ -3049,12 +3054,19 @@ static void IGF_RefineGrid_ivas_fx( H_IGF_GRID hGrid /**< in/out: | IGF grid han
        delta = mac_r( 0x00195000, 29491 /*0.45f Q16*/, shl_sat( delta, 5 ) );
        a[tmp] = add( hGrid->swb_offset[sfb], shr( delta, 6 ) );
        move16();
#ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS
        IF( GT_16( element_mode, EVS_MONO ) )
        {
#endif
            // Rounding off delta values >=t+0.5 to t+1
            IF( GE_16( sub( delta, shl( shr( delta, 6 ), 6 ) ), MID ) )
            {
                a[tmp] = add( a[tmp], 1 );
                move16();
            }
#ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS
        }
#endif
        IF( s_and( a[tmp], 1 ) != 0 )
        {
            a[tmp] = sub( a[tmp], 1 );
@@ -4009,9 +4021,15 @@ void IGFDecSetMode(
        test();
        IF( ( LE_16( hPrivateData->igfInfo.bitRateIndex, IGF_BITRATE_SWB_48000 ) ) || ( LE_16( hPrivateData->igfInfo.bitRateIndex, IGF_BITRATE_FB_48000 ) ) )
        {
#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( &hPrivateData->igfInfo.grid[IGF_GRID_LB_NORM] );
            IGF_RefineGrid( &hPrivateData->igfInfo.grid[IGF_GRID_LB_TRAN] );
            IGF_RefineGrid( &hPrivateData->igfInfo.grid[IGF_GRID_LB_SHORT] );
#endif
        }
    }
    ELSE
@@ -4070,9 +4088,15 @@ 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); */
    }