Commit 6a3fd792 authored by vaclav's avatar vaclav
Browse files

Merge branch 'maintenance' into 'main'

Maintenance 20260421

See merge request !2969
parents 259afce8 41f18d1d
Loading
Loading
Loading
Loading
Loading
+2 −9
Original line number Diff line number Diff line
@@ -396,13 +396,6 @@ Word16 sr2fscale_fx(
    return extract_l( Mpy_32_16_1( sr_core, FSCALE_DENOM_BY_12800_Q15 ) ); /*Q0*/
}

Word16 sr2fscale(
    const Word32 sr_core /* i  : internal sampling rate    */
)
{

    return (Word16) ( ( FSCALE_DENOM * sr_core ) / 12800 );
}

Word32 getCoreSamplerateMode2(
    const Word16 element_mode,      /* i  : IVAS element mode              Q0*/
@@ -1030,8 +1023,8 @@ void init_tcx_window_cfg_fx(
    }
    /*Mid-OLA*/
    /*compute minimum length for "half" window: lookahead - 5ms. It must be also multiple of 2*/
    hTcxCfg->tcx_mdct_window_half_length = extract_l( L_shr( L_mult0( L_LOOK_12k8 - NS2SA( 12800, 5000000L ), sr2fscale( sr_core ) ), LD_FSCALE_DENOM ) );    /*Q0*/
    hTcxCfg->tcx_mdct_window_half_lengthFB = extract_l( L_shr( L_mult0( L_LOOK_12k8 - NS2SA( 12800, 5000000L ), sr2fscale( input_Fs ) ), LD_FSCALE_DENOM ) ); /*Q0*/
    hTcxCfg->tcx_mdct_window_half_length = extract_l( L_shr( L_mult0( L_LOOK_12k8 - NS2SA( 12800, 5000000L ), sr2fscale_fx( sr_core ) ), LD_FSCALE_DENOM ) );    /*Q0*/
    hTcxCfg->tcx_mdct_window_half_lengthFB = extract_l( L_shr( L_mult0( L_LOOK_12k8 - NS2SA( 12800, 5000000L ), sr2fscale_fx( input_Fs ) ), LD_FSCALE_DENOM ) ); /*Q0*/
    move16();
    move16();
    assert( GT_16( hTcxCfg->tcx_mdct_window_half_length, 16 ) && "Half window can not be large enough!" );
+1 −187
Original line number Diff line number Diff line
@@ -285,7 +285,7 @@ void hp20( Word16 signal[], /* i/o: signal to filter any *
}


void hp20_fx_32_opt(
void hp20_fx_32(
    Word32 signal_fx[],
    const Word16 lg,
    Word32 mem_fx[],
@@ -448,189 +448,3 @@ void hp20_fx_32_opt(

    return;
}


void hp20_fx_32(
    Word32 signal_fx[],
    const Word16 lg,
    Word32 mem_fx[],
    const Word32 Fs )
{
    Word16 i;
    Word32 a1_fx, a2_fx, b1_fx, b2_fx;
    Word16 Qx0, Qx1, Qx2, Qy1, Qprev_y1, Qy2, Qprev_y2, Qmin;
    Word64 x0_fx64, x1_fx64, x2_fx64, y0_fx64, y1_fx64, y2_fx64, R1, R2, R3, R4, R5;

    IF( EQ_32( Fs, 8000 ) )
    {
        /* hp filter 20Hz at 3dB for 8000KHz input sampling rate
           [b,a] = butter(2, 20.0/4000.0, 'high');
           b = [0.988954248067140  -1.977908496134280   0.988954248067140]
           a =[1.000000000000000  -1.977786483776764   0.978030508491796]*/
        a1_fx = 1061816033l /* 1.977786483776764 Q29*/;
        a2_fx = -525076131l /*-0.978030508491796 Q29*/;
        b1_fx = -1061881538l /*-1.977908496134280 Q29*/;
        b2_fx = 530940769l /* 0.988954248067140 Q29*/;
    }
    ELSE IF( EQ_32( Fs, 16000 ) )
    {
        /* hp filter 20Hz at 3dB for 16000KHz sampling rate
           [b,a] = butter(2, 20.0/8000.0, 'high');
           b =[ 0.994461788958195  -1.988923577916390   0.994461788958195]
           a =[1.000000000000000  -1.988892905899653   0.988954249933127] */
        a1_fx = 1067778748l /* 1.988892905899653 Q29*/;
        a2_fx = -530940770l /*-0.988954249933127 Q29*/;
        b1_fx = -1067795215l /*-1.988923577916390 Q29*/;
        b2_fx = 533897608l /* 0.994461788958195 Q29*/;
    }
    ELSE IF( EQ_32( Fs, 32000 ) )
    {
        /* hp filter 20Hz at 3dB for 32000KHz sampling rate
           [b,a] = butter(2, 20.0/16000.0, 'high');
           b =[0.997227049904470  -1.994454099808940   0.997227049904470]
           a =[1.000000000000000  -1.994446410541927   0.994461789075954]*/
        a1_fx = 1070760263l /* 1.994446410541927 Q29*/;
        a2_fx = -533897608l /*-0.994461789075954 Q29*/;
        b1_fx = -1070764392l /*-1.994454099808940 Q29*/;
        b2_fx = 535382196l /* 0.997227049904470 Q29*/;
    }
    ELSE
    {
        /* hp filter 20Hz at 3dB for 48000KHz sampling rate
           [b,a] = butter(2, 20.0/24000.0, 'high');
           b =[ 0.998150511190452  -1.996301022380904   0.998150511190452]
           a =[1.000000000000000  -1.996297601769122   0.996304442992686]*/
        a1_fx = 1071754114l /* 1.996297601769122 Q29*/;
        a2_fx = -534886875l /*-0.996304442992686 Q29*/;
        b1_fx = -1071755951l /*-1.996301022380904 Q29*/;
        b2_fx = 535877975l /* 0.998150511190452 Q29*/;
    }
    move32();
    move32();
    move32();
    move32();

    Qprev_y1 = extract_l( mem_fx[4] );
    Qprev_y2 = extract_l( mem_fx[5] );
    y1_fx64 = W_deposit32_l( mem_fx[0] );
    y2_fx64 = W_deposit32_l( mem_fx[1] );
    x0_fx64 = W_deposit32_l( mem_fx[2] );
    x1_fx64 = W_deposit32_l( mem_fx[3] );

    FOR( i = 0; i < lg; i++ )
    {
        x2_fx64 = x1_fx64;
        move64();
        x1_fx64 = x0_fx64;
        move64();
        x0_fx64 = W_deposit32_l( signal_fx[i] );

        Qy1 = W_norm( y1_fx64 );
        if ( y1_fx64 == 0 )
        {
            Qy1 = 62;
            move16();
        }
        Qy1 = sub( Qy1, 34 );
        R1 = W_mult0_32_32( W_shl_sat_l( y1_fx64, Qy1 ), a1_fx );
        Qy1 = add( Qy1, Qprev_y1 );

        Qy2 = W_norm( y2_fx64 );
        if ( y2_fx64 == 0 )
        {
            Qy2 = 62;
            move16();
        }
        Qy2 = sub( Qy2, 34 );
        R2 = W_mult0_32_32( W_shl_sat_l( y2_fx64, Qy2 ), a2_fx );
        Qy2 = add( Qy2, Qprev_y2 );

        Qx0 = W_norm( x0_fx64 );
        if ( x0_fx64 == 0 )
        {
            Qx0 = 62;
            move16();
        }
        Qx0 = sub( Qx0, 34 );
        R3 = W_mult0_32_32( W_shl_sat_l( x0_fx64, Qx0 ), b2_fx );

        Qx1 = W_norm( x1_fx64 );
        if ( x1_fx64 == 0 )
        {
            Qx1 = 62;
            move16();
        }
        Qx1 = sub( Qx1, 34 );
        R4 = W_mult0_32_32( W_shl_sat_l( x1_fx64, Qx1 ), b1_fx );

        Qx2 = W_norm( x2_fx64 );
        if ( x2_fx64 == 0 )
        {
            Qx2 = 62;
            move16();
        }
        Qx2 = sub( Qx2, 34 );
        R5 = W_mult0_32_32( W_shl_sat_l( x2_fx64, Qx2 ), b2_fx );

        Qmin = s_min( Qy1, Qy2 );

        y0_fx64 = W_add( W_shr( R1, sub( Qy1, Qmin ) ), W_shr( R2, sub( Qy2, Qmin ) ) );

        Qmin = s_min( Qmin, Qx0 );
        Qmin = s_min( Qmin, Qx1 );
        Qmin = s_min( Qmin, Qx2 );

        y0_fx64 = W_add( W_shr( y0_fx64, sub( s_min( Qy1, Qy2 ), Qmin ) ), W_add( W_shr( R3, sub( Qx0, Qmin ) ), W_add( W_shr( R4, sub( Qx1, Qmin ) ), W_shr( R5, sub( Qx2, Qmin ) ) ) ) );

        y0_fx64 = W_shr( y0_fx64, 29 );

        signal_fx[i] = W_extract_l( W_shr( y0_fx64, Qmin ) );
        move32();
        IF( signal_fx[i] < 0 )
        {
            signal_fx[i] = L_add( signal_fx[i], 1 );
            move32();
        }

        y2_fx64 = y1_fx64;
        y1_fx64 = y0_fx64;
        Qprev_y2 = Qprev_y1;
        Qprev_y1 = Qmin;
        move64();
        move64();
        move16();
        move16();
    }

    Qy1 = W_norm( y1_fx64 );
    test();
    IF( y1_fx64 != 0 && LT_16( Qy1, 32 ) )
    {
        y1_fx64 = W_shr( y1_fx64, sub( 32, Qy1 ) );
        Qprev_y1 = sub( Qprev_y1, sub( 32, Qy1 ) );
    }

    Qy2 = W_norm( y2_fx64 );
    test();
    IF( y2_fx64 != 0 && LT_16( Qy2, 32 ) )
    {
        y2_fx64 = W_shr( y2_fx64, sub( 32, Qy2 ) );
        Qprev_y2 = sub( Qprev_y2, sub( 32, Qy2 ) );
    }

    mem_fx[0] = W_extract_l( y1_fx64 );
    mem_fx[1] = W_extract_l( y2_fx64 );
    mem_fx[2] = W_extract_l( x0_fx64 );
    mem_fx[3] = W_extract_l( x1_fx64 );
    mem_fx[4] = Qprev_y1;
    mem_fx[5] = Qprev_y2;

    move32();
    move32();
    move32();
    move32();
    move32();
    move32();

    return;
}
+14 −1
Original line number Diff line number Diff line
@@ -1385,7 +1385,7 @@ void initMdctStereoDecData_fx(
    const Word16 bwidth                                         /* i  : audio bandwidth                  */
);

void stereo_tdm_downmix_ivas_fx(
void stereo_tdm_downmix_fx(
    STEREO_TD_ENC_DATA_HANDLE hStereoTD,                        /* i  : TD stereo IVAS encoder structure        */
    Word16 *Left_in_fx,                                         /* Qx */
    Word16 *Right_in_fx,                                        /* Qx */
@@ -1689,6 +1689,15 @@ void ivas_mdct_core_invQ_fx(
    const Word16 MCT_flag                                       /* i  : hMCT handle allocated (1) or not (0)    */
);

void ivas_mdct_core_reconstruct_fx(
    CPE_DEC_HANDLE hCPE,                                        /* i/o: CPE decoder structure                   */
    Word32 *x_fx[][NB_DIV],                                     /* i/o: synthesis @internal_FS           Q(q_x) */
    Word16 signal_outFB_fx[CPE_CHANNELS][L_FRAME_PLUS],         /* o  : synthesis @output_FS              e_sig */
    Word16 fUseTns[CPE_CHANNELS][NB_DIV],                       /* i  : flage TNS enabled                       */
    const Word16 MCT_flag,                                      /* i  : hMCT handle allocated (1) or not (0)    */
    Word16 q_x,
    Word16 e_sig[CPE_CHANNELS] );

void ivas_mdct_tcx10_bit_distribution_fx(
    Word16 target_bitsTCX10[NB_DIV],                            /* o  : target bit distribution                 */
    const Word16 nbits_tcx,                                     /* i  : TCX bits                                */
@@ -3604,6 +3613,10 @@ void ivas_omasa_decode_masa_to_total_fx(
    const Word16 nblocks 
);

void ivas_get_stereo_panning_gains_fx(
    const Word16 aziDeg,
    const Word16 eleDeg,
    Word16 panningGains[2] );

/*----------------------------------------------------------------------------------*
 * TD Binaural Object renderer
+11 −12
Original line number Diff line number Diff line
@@ -52,17 +52,16 @@
    val2 = shr( ( cbp )[2], 4 );                       \
    val3 = add( add( shr( lshl( ( cbp )[2], 12 ), 4 ), lshr( lshl( ( cbp )[1], 12 ), 8 ) ), s_and( ( cbp )[0], 0xF ) );

#define SPC      0.0234952f
#define SPC_plus SPC * 1.001f

/*-------------------------------------------------------------------*
 * Local functions
 *-------------------------------------------------------------------*/
Word16 root_search_fx( Word16 low, Word16 high, Word32 *v_low, Word32 *coef, Word16 order );
Word32 calc_weight( Word16 delta1, Word16 delta2, Word16 *n1 );
Word32 polynomial_eval_fx( Word16 f, Word32 *coef, Word16 order );
void E_LPC_isf_isp_conversion( const Word16 isf[], Word16 isp[], const Word16 m );
void E_LPC_lsp_lsf_conversion( const Word16 lsp[], Word16 lsf[], const Word16 m );
Word16 E_LPC_f_lsp_pol_get( const Word16 lsp[], Word32 f[], const Word16 n, const Word16 past_Ovf, const Word16 isMODE1 );

static Word16 root_search_fx( Word16 low, Word16 high, Word32 *v_low, Word32 *coef, Word16 order );
static Word32 calc_weight( Word16 delta1, Word16 delta2, Word16 *n1 );
static Word32 polynomial_eval_fx( Word16 f, Word32 *coef, Word16 order );
static Word16 E_LPC_f_lsp_pol_get( const Word16 lsp[], Word32 f[], const Word16 n, const Word16 past_Ovf, const Word16 isMODE1 );
static Word32 poscos_fx( Word16 w );

static Word16 chebyshev( Word16 x, Word32 *f, const Word16 n, const Word16 shift )
{
@@ -940,7 +939,7 @@ void lsp2lpc_fx(
 *   R.A.Salami    October 1990                              *
 *-----------------------------------------------------------*
 */
Word16 E_LPC_f_lsp_pol_get( const Word16 lsp[], Word32 f[], const Word16 n, const Word16 past_Ovf, const Word16 isMODE1 )
static Word16 E_LPC_f_lsp_pol_get( const Word16 lsp[], Word32 f[], const Word16 n, const Word16 past_Ovf, const Word16 isMODE1 )
{
    /* All computation in Q23 */
    const Word16 *plsp;
@@ -3593,7 +3592,7 @@ Word32 poscos_fx(
/* _ ( Word16) root in Q15, or 0xffff if no root is found */
/*===================================================================*/

Word16 root_search_fx(
static Word16 root_search_fx(
    Word16 low,
    Word16 high,
    Word32 *v_low,
@@ -3713,7 +3712,7 @@ and delta2 */
/* (alpha/(sqrt(delta1*delta2)) */
/*===================================================================*/

Word32 calc_weight(
static Word32 calc_weight(
    Word16 delta1,
    Word16 delta2,
    Word16 *n1 )
@@ -3765,7 +3764,7 @@ Word32 calc_weight(
/*===================================================================*/

/* 40-32 bit conversion */
Word32 polynomial_eval_fx(
static Word32 polynomial_eval_fx(
    Word16 f,
    Word32 *coef,
    Word16 order )
+46 −239

File changed.

Preview size limit exceeded, changes collapsed.

Loading