Commit d9f3c80a authored by vaclav's avatar vaclav
Browse files

reduction of code size

parent a79f064f
Loading
Loading
Loading
Loading
+52 −72
Original line number Diff line number Diff line
@@ -87,6 +87,15 @@ void bw_detect(
    const float *pt, *pt1;
    float max_NB, max_WB, max_SWB, max_FB, mean_NB, mean_WB, mean_SWB, mean_FB;
    int16_t cldfb_bin_width = 4;
#ifdef BWD_COUNT_FIX
    int16_t bwd_count_wider_bw;

    bwd_count_wider_bw = BWD_COUNT_WIDER_BW;
    if ( st->element_mode == IVAS_CPE_MDCT && ( st->element_brate > IVAS_64k || mct_on ) )
    {
        bwd_count_wider_bw = BWD_COUNT_WIDER_BW_MDCT;
    }
#endif

    if ( st->input_Fs > 8000 )
    {
@@ -403,70 +412,31 @@ void bw_detect(
             *---------------------------------------------------------------------*/

            /* switching to a higher BW */
#ifdef BWD_COUNT_FIX
            if ( st->element_mode == IVAS_CPE_MDCT && ( st->element_brate > IVAS_64k || mct_on ) )
            {
                if ( st->last_input_bwidth == NB )
                {
                    if ( st->count_WB > BWD_COUNT_WIDER_BW_MDCT )
                    {
                        st->input_bwidth = WB;
                        st->count_WB = BWD_COUNT_MAX;

                        if ( st->count_SWB > BWD_COUNT_WIDER_BW_MDCT )
                        {
                            st->input_bwidth = SWB;
                            st->count_SWB = BWD_COUNT_MAX;

                            if ( st->count_FB > BWD_COUNT_WIDER_BW_MDCT )
                            {
                                st->input_bwidth = FB;
                                st->count_FB = BWD_COUNT_MAX;
                            }
                        }
                    }
                }

                if ( st->last_input_bwidth == WB && st->input_Fs > 16000 )
                {
                    if ( st->count_SWB > BWD_COUNT_WIDER_BW_MDCT )
                    {
                        st->input_bwidth = SWB;
                        st->count_SWB = BWD_COUNT_MAX;

                        if ( st->count_FB > BWD_COUNT_WIDER_BW_MDCT )
                        {
                            st->input_bwidth = FB;
                            st->count_FB = BWD_COUNT_MAX;
                        }
                    }
                }

                if ( st->last_input_bwidth == SWB && st->input_Fs > 32000 )
                {
                    if ( st->count_FB > BWD_COUNT_WIDER_BW_MDCT )
                    {
                        st->input_bwidth = FB;
                        st->count_FB = BWD_COUNT_MAX;
                    }
                }
            }
            else
            {
#endif
            if ( st->last_input_bwidth == NB )
            {
#ifdef BWD_COUNT_FIX
                if ( st->count_WB > bwd_count_wider_bw )
#else
                if ( st->count_WB > BWD_COUNT_WIDER_BW )
#endif
                {
                    st->input_bwidth = WB;
                    st->count_WB = BWD_COUNT_MAX;

#ifdef BWD_COUNT_FIX
                    if ( st->count_SWB > bwd_count_wider_bw )
#else
                    if ( st->count_SWB > BWD_COUNT_WIDER_BW )
#endif
                    {
                        st->input_bwidth = SWB;
                        st->count_SWB = BWD_COUNT_MAX;

#ifdef BWD_COUNT_FIX
                        if ( st->count_FB > bwd_count_wider_bw )
#else
                        if ( st->count_FB > BWD_COUNT_WIDER_BW )
#endif
                        {
                            st->input_bwidth = FB;
                            st->count_FB = BWD_COUNT_MAX;
@@ -477,12 +447,20 @@ void bw_detect(

            if ( st->last_input_bwidth == WB && st->input_Fs > 16000 )
            {
#ifdef BWD_COUNT_FIX
                if ( st->count_SWB > bwd_count_wider_bw )
#else
                if ( st->count_SWB > BWD_COUNT_WIDER_BW )
#endif
                {
                    st->input_bwidth = SWB;
                    st->count_SWB = BWD_COUNT_MAX;

#ifdef BWD_COUNT_FIX
                    if ( st->count_FB > bwd_count_wider_bw )
#else
                    if ( st->count_FB > BWD_COUNT_WIDER_BW )
#endif
                    {
                        st->input_bwidth = FB;
                        st->count_FB = BWD_COUNT_MAX;
@@ -492,15 +470,17 @@ void bw_detect(

            if ( st->last_input_bwidth == SWB && st->input_Fs > 32000 )
            {
#ifdef BWD_COUNT_FIX
                if ( st->count_FB > bwd_count_wider_bw )
#else
                if ( st->count_FB > BWD_COUNT_WIDER_BW )
#endif
                {
                    st->input_bwidth = FB;
                    st->count_FB = BWD_COUNT_MAX;
                }
            }
#ifdef BWD_COUNT_FIX
            }
#endif


            /* switching to a lower BW */
            if ( st->last_input_bwidth == FB )