Commit 6ecef305 authored by reutelhuber's avatar reutelhuber
Browse files

Merge branch '25-tbe-fb-bits-not-read-when-decoder-output-sampling-rate-is-not-48-khz' into 'main'

[non-BE] fix issue 25: properly skip reading of TBE FB bits

See merge request !70
parents 3d886cfc 95e4d4d1
Loading
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -152,12 +152,10 @@
#define SBA_CLEANING                                    /* SBA maintenance related to ticket #45 */ 

#define DIRAC_DRCT_GAIN_TUNING

#define FIX_34                                          /* Nokia: Fix bug in MASA format EXT output spherical indexing */

#define FIX_I68_MC_REVERB_FOR_514                       /* Fix HRTF processing for Jot reverb in case of 5.1.4 input format */

#define FIX_I54_LS_CONVERSION                           /* FhG: fix incorrect downmix matrix for 5_1_4 to 5_1_2 and upmix matrix for 7_1 to 7_1_4 */
#define FIX_I25_FBE_FB_BITS                             /* issue 25: properly skip reading of TBE FB bits when decoder output sampling rate is not 48 kHz */

/* ################## End DEVELOPMENT switches ######################### */
/* clang-format on */
+5 −0
Original line number Diff line number Diff line
@@ -2777,6 +2777,11 @@ void fb_tbe_dec(
    const float fb_exc[], /* i  : FB excitation from the SWB part         */
    float *hb_synth,      /* i/o: high-band synthesis                     */
    float *fb_synth_ref   /* o  : high-band synthesis 16-20 kHz           */
#ifdef FIX_I25_FBE_FB_BITS
    ,
    const int16_t output_frame /* i:  output frame length                      */
#endif

);

void calc_tilt_bwe(
+13 −5
Original line number Diff line number Diff line
@@ -319,7 +319,11 @@ ivas_error evs_dec(
            /* FB TBE decoder */
            if ( output_frame == L_FRAME48k && st->extl == FB_TBE )
            {
#ifdef FIX_I25_FBE_FB_BITS
                fb_tbe_dec( st, fb_exc, hb_synth, NULL, L_FRAME48k );
#else
                fb_tbe_dec( st, fb_exc, hb_synth, NULL );
#endif
            }
        }
        else if ( st->extl == SWB_BWE || st->extl == FB_BWE || ( st->output_Fs >= 32000 && st->core == ACELP_CORE && st->bwidth > NB && st->bws_cnt > 0 && !st->ppp_mode_dec && !( st->nelp_mode_dec == 1 && st->bfi == 1 ) ) )
@@ -600,7 +604,11 @@ ivas_error evs_dec(

                        if ( st->extl == FB_TBE && output_frame == L_FRAME48k )
                        {
#ifdef FIX_I25_FBE_FB_BITS
                            fb_tbe_dec( st, fb_exc, hb_synth, NULL, L_FRAME48k );
#else
                            fb_tbe_dec( st, fb_exc, hb_synth, NULL );
#endif
                        }
                    }
                    mvr2r( hb_synth, st->hBWE_TD->old_hb_synth, output_frame );
+13 −6
Original line number Diff line number Diff line
@@ -531,10 +531,17 @@ ivas_error ivas_core_dec(
            swb_tbe_dec( st, hStereoICBWE, bwe_exc_extended[n], voice_factors[n], old_syn_12k8_16k[n], tmp_buffer /*fb_exc*/, hb_synth[n], pitch_buf[n] );

            /* FB TBE decoder */
#ifdef FIX_I25_FBE_FB_BITS
            if ( st->extl == FB_TBE )
            {
                fb_tbe_dec( st, tmp_buffer /*fb_exc*/, hb_synth[n], tmp_buffer /*fb_synth_ref*/, output_frame );
            }
#else
            if ( output_frame == L_FRAME48k && st->extl == FB_TBE )
            {
                fb_tbe_dec( st, tmp_buffer /*fb_exc*/, hb_synth[n], tmp_buffer /*fb_synth_ref*/ );
            }
#endif
        }
        else if ( st->extl == SWB_BWE || st->extl == FB_BWE || ( output_Fs >= 32000 && st->core == ACELP_CORE && st->bwidth > NB && st->bws_cnt > 0 && !st->ppp_mode_dec && !( st->nelp_mode_dec == 1 && st->bfi == 1 ) ) )
        {
+32 −11
Original line number Diff line number Diff line
@@ -1977,6 +1977,10 @@ void fb_tbe_dec(
    const float fb_exc[], /* i  : FB excitation from the SWB part */
    float *hb_synth,      /* o  : high-band synthesis             */
    float *fb_synth_ref   /* o  : high-band synthesis 16-20 kHz   */
#ifdef FIX_I25_FBE_FB_BITS
    ,
    const int16_t output_frame /* i:  output frame length              */
#endif
)
{
    int16_t i;
@@ -1986,6 +1990,10 @@ void fb_tbe_dec(

    hBWE_TD = st->hBWE_TD;

#ifdef FIX_I25_FBE_FB_BITS
    if ( output_frame == L_FRAME48k )
    {
#endif
        /* decode FB slope information */
        if ( st->extl == FB_TBE && !st->bfi )
        {
@@ -2003,6 +2011,19 @@ void fb_tbe_dec(
        {
            ratio = hBWE_TD->prev_fbbwe_ratio;
        }
#ifdef FIX_I25_FBE_FB_BITS
    }
    else
    {
        /* update the position in the bitstream - needed in IVAS */
        if ( !st->bfi )
        {
            st->next_bit_pos += NUM_BITS_FB_FRAMEGAIN;
        }

        return;
    }
#endif

    fb_exc_energy = sum2_f( fb_exc, L_FRAME16k );