Commit 25b87f3a authored by lefort's avatar lefort
Browse files

Merge branch 'main' into 1386-stereo_downmix_evs_quality_improvements_pha

parents 3dae95c1 c89d638e
Loading
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++ )
        {
+2 −3
Original line number Diff line number Diff line
@@ -295,10 +295,9 @@ IF( NE_16( Opt_AMR_WB, 1 ) )
    /* calculate the spectrum of random excitation signal */
    Copy( exc2, fft_io, L_frame );

    Word16 Q_new_inp, mem_decim_size; // TO be removed
    IF( EQ_16( L_frame, L_FRAME16k ) )
    {
        modify_Fs_fx( fft_io, L_FRAME16k, 16000, fft_io, 12800, exc_mem1, 0, &Q_new_inp, &mem_decim_size );
        modify_Fs_fx( fft_io, L_FRAME16k, 16000, fft_io, 12800, exc_mem1, 0 );
    }

    /* fft_rel(fft_io, L_FFT, LOG2_L_FFT); */
@@ -411,7 +410,7 @@ IF( NE_16( Opt_AMR_WB, 1 ) )

    IF( EQ_16( L_frame, L_FRAME16k ) )
    {
        modify_Fs_fx( fft_io, L_FFT, 12800, fft_io, 16000, exc_mem, 0, &Q_new_inp, &mem_decim_size );
        modify_Fs_fx( fft_io, L_FFT, 12800, fft_io, 16000, exc_mem, 0 );
    }

    /* enr1 = dotp( fft_io, fft_io, L_frame ) / L_frame; */
+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  */
+8 −26
Original line number Diff line number Diff line
@@ -330,9 +330,7 @@ Word16 modify_Fs_fx( /* o : length of output Q0 */
                     Word16 sigOut_fx[],      /* o  : decimated signal    Q0  */
                     const Word32 fout,       /* i  : frequency of output Q0  */
                     Word16 mem_fx[],         /* i/o: filter memory       Q0  */
                     const Word16 nblp,       /* i  : flag indicating if NB low-pass is applied */
                     Word16 *Q_new_inp,       // TO be removed
                     Word16 *mem_decim_size   // TO be removed
                     const Word16 nblp        /* i  : flag indicating if NB low-pass is applied */
)
{
    Word16 i;
@@ -364,17 +362,13 @@ Word16 modify_Fs_fx( /* o : length of output Q0 */
    /*-------------------------------------------------------------------*
     * Find the resampling configuration
     *-------------------------------------------------------------------*/
    *Q_new_inp = 0;
    move16();

    /* check if fin and fout are the same */
    IF( EQ_32( fin, fout ) )
    {
        /* just copy the signal_fx and quit */
        Copy( sigIn_fx, sigOut_fx, lg );
        *mem_decim_size = 0;
        *Q_new_inp = 0;
        move16();
        move16();

        return lg;
    }
    ELSE
@@ -439,8 +433,6 @@ Word16 modify_Fs_fx( /* o : length of output Q0 */
        }

        mem_len = shl( filt_len, 1 );
        *mem_decim_size = mem_len;
        move16();
        signal_fx = signal_tab_fx + 2 * L_FILT_MAX + sub( L_FRAME48k, add( mem_len, lg ) );
        signal_ana_fx = signal_fx;
        mem_len_ana = mem_len;
@@ -508,7 +500,7 @@ Word16 modify_Fs_fx( /* o : length of output Q0 */
    }
    /* interpolation */

    datastep = shr( div_s( shl( fac_den, 7 ), shl( fac_num, 10 ) ), 12 );
    datastep = shr( div_s( shl( fac_den, 8 ), shl( fac_num, 11 ) ), 12 );
    /* equivalent to 'datastep = fac_den % fac_num' */
    temp_n = i_mult2( datastep, fac_num ); /*Q0*/
    fracstep = sub( fac_den, temp_n );
@@ -550,9 +542,6 @@ Word16 modify_Fs_fx( /* o : length of output Q0 */
                FOR( i = 0; i < lg_out; i++ )
                {
                    sigOut_fx[i] = round_fx( L_shl( L_mult( sigOut_fx[i], num_den ), 1 ) ); /*Q0*/
                    *Q_new_inp = -1;
                    move16();
                    move16();
                }
            }
            ELSE
@@ -562,16 +551,17 @@ Word16 modify_Fs_fx( /* o : length of output Q0 */
                test();
                if ( GT_32( fin, 16000 ) && ( EQ_16( lg_out, L_FRAME ) || EQ_16( lg_out, L_FRAME16k ) || EQ_16( lg_out, 512 ) ) )
                {
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
                    num_den = shl_o( num_den, 1, &Overflow );
                    //*Q_new_inp = 2;
#else
                    num_den = shl( num_den, 1 );
#endif
                }
                FOR( i = 0; i < lg_out; i++ )
                {
                    sigOut_fx[i] = mult_r( sigOut_fx[i], num_den ); /*Q0*/
                    move16();
                }
                *Q_new_inp = -1;
                move16();
            }
        }
        ELSE
@@ -579,13 +569,10 @@ Word16 modify_Fs_fx( /* o : length of output Q0 */
            IF( EQ_16( fac_num, 8 ) )
            {
                num_den = 26214;
                move16();
                FOR( i = 0; i < lg_out; i++ )
                {
                    sigOut_fx[i] = mult_r( sigOut_fx[i], num_den ); /*Q-1*/
                    move16();
                    *Q_new_inp = -2;
                    move16();
                }
            }
            ELSE
@@ -594,9 +581,6 @@ Word16 modify_Fs_fx( /* o : length of output Q0 */
                FOR( i = 0; i < lg_out; i++ )
                {
                    sigOut_fx[i] = round_fx( L_mac( L_deposit_h( sigOut_fx[i] ), sigOut_fx[i], num_den ) ); /*Q0*/
                    *Q_new_inp = -1;
                    move16();
                    move16();
                }
            }
        }
@@ -607,8 +591,6 @@ Word16 modify_Fs_fx( /* o : length of output Q0 */
        {
            sigOut_fx[i] = mult_r( sigOut_fx[i], 16384 );
            move16(); /*Q-1*/
            *Q_new_inp = -2;
            move16();
        }
    }
    /* update the filter memory */
+1 −0
Original line number Diff line number Diff line
@@ -174,5 +174,6 @@
#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 */
#define NONBE_FIX_1386_STEREO_DMX_EVS_PHA       /* Orange: Fix for stereo DMX / PHA mode : Change the filter taps resolution (Q31->Q30), improve precision for the IR window, for the ILD & IPD smoothing in sub-bands, for the ISD counters and for ICCr. */
#endif
Loading