Commit 503045da authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Merge branch 'optimizations_sba_path_1' into 'main'

Optimizations for SBA path in decoder [allow regression]

See merge request !1294
parents 71876747 79149552
Loading
Loading
Loading
Loading
+54 −20
Original line number Diff line number Diff line
@@ -1101,6 +1101,9 @@ void cldfbSynthesis_ivas_fx(
    Word32 **imagBuffer_fx,        /* i  : imag values                 Qx*/
    Word32 *timeOut_fx,            /* o  : output time domain samples  Qx - 1*/
    const Word16 samplesToProcess, /* i  : number of processed samples */
#ifdef OPT_SBA_AVOID_SPAR_RESCALE
    const Word16 shift,              /* i  : scale for state buffer */
#endif                               /* OPT_SBA_AVOID_SPAR_RESCALE */
    HANDLE_CLDFB_FILTER_BANK h_cldfb /* i  : filter bank state           */
)
{
@@ -1266,6 +1269,10 @@ void cldfbSynthesis_ivas_fx(
        }

        /* synthesis prototype filter */
#ifdef OPT_SBA_AVOID_SPAR_RESCALE
        IF( 0 == shift )
        {
#endif /* OPT_SBA_AVOID_SPAR_RESCALE */
            FOR( i = 0; i < L2; i++ )
            {
                accu0 = Madd_32_16( synthesisBuffer_fx[i], Mpy_32_16_1( new_samples_fx[L2 - 1 - i], p_filter[i] ), p_filter_sf );                       // Qx - 1
@@ -1285,6 +1292,33 @@ void cldfbSynthesis_ivas_fx(
                synthesisBuffer_fx[4 * L2 + i] = accu4;
                move32();
            }
#ifdef OPT_SBA_AVOID_SPAR_RESCALE
        }
        ELSE
        {

            FOR( i = 0; i < L2; i++ )
            {
                Word32 prod = L_shl_sat( Mpy_32_16_1( new_samples_fx[L2 - 1 - i], p_filter_sf ), shift );
                accu0 = Madd_32_16( synthesisBuffer_fx[i], prod, p_filter[i] );                       // Qx - 1
                accu1 = Madd_32_16( synthesisBuffer_fx[1 * L2 + i], prod, p_filter[( 1 * L2 + i )] ); // Qx - 1
                accu2 = Madd_32_16( synthesisBuffer_fx[2 * L2 + i], prod, p_filter[( 2 * L2 + i )] ); // Qx - 1
                accu3 = Madd_32_16( synthesisBuffer_fx[3 * L2 + i], prod, p_filter[( 3 * L2 + i )] ); // Qx - 1
                accu4 = Madd_32_16( synthesisBuffer_fx[4 * L2 + i], prod, p_filter[( 4 * L2 + i )] ); // Qx - 1

                synthesisBuffer_fx[i] = accu0;
                move32();
                synthesisBuffer_fx[1 * L2 + i] = accu1;
                move32();
                synthesisBuffer_fx[2 * L2 + i] = accu2;
                move32();
                synthesisBuffer_fx[3 * L2 + i] = accu3;
                move32();
                synthesisBuffer_fx[4 * L2 + i] = accu4;
                move32();
            }
        }
#endif /* OPT_SBA_AVOID_SPAR_RESCALE */

        FOR( i = 0; i < M1; i++ )
        {
+18 −8
Original line number Diff line number Diff line
@@ -3786,8 +3786,11 @@ ivas_error ivas_osba_dirac_td_binaural_jbm_fx(
    const UWord16 nSamplesAsked, /* i  : number of CLDFB slots requested           */
    UWord16 *nSamplesRendered,   /* o  : number of CLDFB slots rendered            */
    UWord16 *nSamplesAvailable,  /* o  : number of CLDFB slots still to render     */
    Word32 *output_fx[],         /* o  : rendered time signal                      */
    Word32 *output_fx[]          /* o  : rendered time signal                      */
#ifndef OPT_SBA_AVOID_SPAR_RESCALE
    ,
    Word16 out_len /*Store the length of values in each channel*/
#endif             /* OPT_SBA_AVOID_SPAR_RESCALE */
);

ivas_error ivas_osba_ism_metadata_dec_fx(
@@ -5343,15 +5346,22 @@ ivas_error ivas_sba_dec_render_fx(
    const UWord16 nSamplesAsked,    /* i  : number of CLDFB slots requested           */
    UWord16 *nSamplesRendered,      /* o  : number of CLDFB slots rendered            */
    UWord16 *nSamplesAvailableNext, /* o  : number of CLDFB slots still to render     */
    Word32 *output_fx[],            /* o  : rendered time signal                      Q11*/
    Word32 *output_fx[]             /* o  : rendered time signal                      Q11*/
#ifndef OPT_SBA_AVOID_SPAR_RESCALE
    ,
    Word16 out_len /*Store the length of values in each channel*/
#endif             /* OPT_SBA_AVOID_SPAR_RESCALE */
);

void ivas_spar_dec_upmixer_sf_fx(
    Decoder_Struct *st_ivas,    /* i/o: IVAS decoder handle                     */
    Word32 *output_fx[],        /* o  : output audio channels                   */
    const Word16 nchan_internal, /* i  : number of internal channels             */
    Word16 out_len );
    const Word16 nchan_internal /* i  : number of internal channels             */
#ifndef OPT_SBA_AVOID_SPAR_RESCALE
    ,
    Word16 out_len
#endif /* OPT_SBA_AVOID_SPAR_RESCALE */
);

ivas_error ivas_spar_md_enc_open_fx(
    ivas_spar_md_enc_state_t **hMdEnc_in,       /* i/o: SPAR MD encoder handle  */
+1 −0
Original line number Diff line number Diff line
@@ -174,4 +174,5 @@
#define FIX_ISSUE_1327                          /* Ittiam: Fix for issue 1327: Glitch when stereo is switching from TD to FD*/
#define NONBE_FIX_1402_WAVEADJUST               /* VA: BASOP iisue 1402: fix waveform adjustment decoder PLC */
#define FIX_ISSUE_1376                          /* VA: Fix for issue 1376 (issue with GSC excitation) */
#define OPT_SBA_AVOID_SPAR_RESCALE              /* Optimization made to spar decoder and IGF */
#endif
+7 −4
Original line number Diff line number Diff line
@@ -9755,6 +9755,9 @@ void cldfbSynthesis_ivas_fx(
    Word32 **imagBuffer_fx,        /* i  : imag values                 Qx*/
    Word32 *timeOut_fx,            /* o  : output time domain samples  Qx - 1*/
    const Word16 samplesToProcess, /* i  : number of processed samples */
#ifdef OPT_SBA_AVOID_SPAR_RESCALE
    const Word16 shift,              /* i  : scale for state buffer */
#endif                               /* OPT_SBA_AVOID_SPAR_RESCALE */
    HANDLE_CLDFB_FILTER_BANK h_cldfb /* i  : filter bank state           */
);
+17 −1
Original line number Diff line number Diff line
@@ -1932,7 +1932,11 @@ ivas_error acelp_core_dec_ivas_fx(
                }
            }

#ifdef OPT_SBA_AVOID_SPAR_RESCALE
            cldfbSynthesis_ivas_fx( realBuffer_fx, imagBuffer_fx, save_hb_synth_fx, -1, 0, st->cldfbSynHB );
#else  /* OPT_SBA_AVOID_SPAR_RESCALE */
            cldfbSynthesis_ivas_fx( realBuffer_fx, imagBuffer_fx, save_hb_synth_fx, -1, st->cldfbSynHB );
#endif /* OPT_SBA_AVOID_SPAR_RESCALE */

            Scale_sig32( save_hb_synth_fx, L_FRAME48k, negate( ( sub( Q_real, 1 ) ) ) );                                  // Q0
            Scale_sig32( st->cldfbSynHB->cldfb_state_fx, st->cldfbSynHB->p_filter_length, sub( Q10, sub( Q_real, 1 ) ) ); // Q10
@@ -1952,7 +1956,11 @@ ivas_error acelp_core_dec_ivas_fx(
            Scale_sig32( st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->p_filter_length, sub( sub( Q_real, 1 ), Q10 ) ); // Q_real-1
            st->cldfbSynHB->Q_cldfb_state = sub( Q_real, 1 );
            move16();
#ifdef OPT_SBA_AVOID_SPAR_RESCALE
            cldfbSynthesis_ivas_fx( pRealSave_fx, pImagSave_fx, synth_fx, -1, 0, st->cldfbSyn );
#else                                                                                                                 /* OPT_SBA_AVOID_SPAR_RESCALE */
            cldfbSynthesis_ivas_fx( pRealSave_fx, pImagSave_fx, synth_fx, -1, st->cldfbSyn );
#endif                                                                                                                /* OPT_SBA_AVOID_SPAR_RESCALE */
            Scale_sig32( synth_fx, L_FRAME48k, negate( sub( Q_real, 1 ) ) );                                          // Q0
            Scale_sig32( st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->p_filter_length, sub( Q10, sub( Q_real, 1 ) ) ); // Q10
            st->cldfbSynHB->Q_cldfb_state = Q10;
@@ -1999,7 +2007,11 @@ ivas_error acelp_core_dec_ivas_fx(
            Scale_sig32( synth_fx, L_FRAME48k, Q_real - 1 );
#endif

#ifdef OPT_SBA_AVOID_SPAR_RESCALE
            cldfbSynthesis_ivas_fx( realBuffer_fx, imagBuffer_fx, synth_fx, -1, 0, st->cldfbSyn );
#else  /* OPT_SBA_AVOID_SPAR_RESCALE */
            cldfbSynthesis_ivas_fx( realBuffer_fx, imagBuffer_fx, synth_fx, -1, st->cldfbSyn );
#endif /* OPT_SBA_AVOID_SPAR_RESCALE */
#ifdef MSAN_FIX
            scale_sig32( synth_fx, output_frame, negate( sub( Q_real, 1 ) ) ); // Q0
#else
@@ -2108,7 +2120,11 @@ ivas_error acelp_core_dec_ivas_fx(
        Scale_sig32( synth_fx, L_FRAME48k, Q_real - 1 );
#endif

#ifdef OPT_SBA_AVOID_SPAR_RESCALE
        cldfbSynthesis_ivas_fx( realBuffer_fx, imagBuffer_fx, synth_fx /*dummy*/, NS2SA_FX2( st->output_Fs, FRAME_SIZE_NS /*DELAY_CLDFB_NS*/ ), 0, st->cldfbSyn );
#else  /* OPT_SBA_AVOID_SPAR_RESCALE */
        cldfbSynthesis_ivas_fx( realBuffer_fx, imagBuffer_fx, synth_fx /*dummy*/, NS2SA_FX2( st->output_Fs, FRAME_SIZE_NS /*DELAY_CLDFB_NS*/ ), st->cldfbSyn );
#endif /* OPT_SBA_AVOID_SPAR_RESCALE */

#ifdef MSAN_FIX
        Scale_sig32( synth_fx, output_frame, negate( sub( Q_real, 1 ) ) ); // Q0
Loading