Commit 437b5b9c authored by Mohammadreza Naghibzadeh's avatar Mohammadreza Naghibzadeh
Browse files

Merge remote-tracking branch 'refs/remotes/origin/main' into...

Merge remote-tracking branch 'refs/remotes/origin/main' into basop-2262-fd-cng-buffer-is-not-updated

# Conflicts:
#	lib_com/options.h
parents a2adc11e 7d03a381
Loading
Loading
Loading
Loading
+0 −10
Original line number Diff line number Diff line
@@ -1598,27 +1598,17 @@ ivas_error cldfb_save_memory(
    }
    hs->memory_length = cldfb_get_memory_length( hs );
    move16();
#ifdef FIX_2431_AVOID_CALLOC
    hs->memory = (Word16 *) malloc( ( hs->memory_length + CLDFB_MEM_EXPONENTS + 1 ) * sizeof( Word16 ) );
    IF( hs->memory == NULL )
    {
        return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for CLDFB\n" );
    }
#else
    hs->memory = (Word16 *) calloc( hs->memory_length + CLDFB_MEM_EXPONENTS + 1, sizeof( Word16 ) );
#endif

    /* save the memory */
    Copy( hs->FilterStates, hs->memory, hs->memory_length );
    Copy( hs->FilterStates_e, hs->memory + hs->memory_length, CLDFB_MEM_EXPONENTS );
    hs->memory[hs->memory_length + CLDFB_MEM_EXPONENTS] = hs->FilterStates_eg;
    move16();
#ifndef FIX_2431_AVOID_CALLOC
    IF( hs->memory == NULL )
    {
        return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for CLDFB\n" );
    }
#endif

    return IVAS_ERR_OK;
}
+4 −0
Original line number Diff line number Diff line
@@ -872,7 +872,11 @@ void cng_params_upd_fx(
            Word16 index = 0;
            move32();
            move16();
#ifdef HARM_2456_APPLY_SCALE
            index = apply_scale_ind( &att_fx, bwidth, last_active_brate, scaleTableStereo, SIZE_SCALE_TABLE_STEREO );
#else
            apply_scale_ivas_fx( &att_fx, bwidth, last_active_brate, scaleTableStereo, SIZE_SCALE_TABLE_STEREO, &index );
#endif
            att_fx = pow_10_q23[index]; // Q23
            move32();
            tmp = extract_h( att_fx ); // Q7
+0 −166
Original line number Diff line number Diff line
@@ -169,7 +169,6 @@ Word16 get_codec_mode(
    return codec_mode; /*Q0*/
}

#ifdef FIX_2385_GETTCXONLY
/*-------------------------------------------------------------------*
 * getTcxonly()
 *
@@ -236,171 +235,6 @@ Word16 getTcxonly_fx(

    return tcxonly; /*Q0*/
}
#else
/*-------------------------------------------------------------------*
 * getTcxonly_ivas()
 *
 *
 *-------------------------------------------------------------------*/

Word16 getTcxonly_ivas_fx(
    const Word16 element_mode, /* i  : IVAS element mode                    Q0*/
    const Word32 total_brate,  /* i  : total bitrate                        Q0*/
    const Word16 MCT_flag,     /* i  : hMCT handle allocated (1) or not (0) Q0*/
    const Word16 is_ism_format /* i  : flag indicating ISM format           Q0*/
)
{
    Word16 tcxonly = 0;
    move16();
    Word32 temp_flag;
    if ( MCT_flag )
    {
        temp_flag = IVAS_32k;
        move32();
    }
    else
    {
        temp_flag = IVAS_48k;
        move32();
    }

    SWITCH( element_mode )
    {
        case EVS_MONO:
            if ( GT_32( total_brate, ACELP_32k ) )
            {
                tcxonly = 1;
                move16();
            }
            BREAK;
        case IVAS_SCE:
            if ( is_ism_format )
            {
                if ( GT_32( total_brate, MAX_ACELP_BRATE_ISM ) )
                {
                    tcxonly = 1;
                    move16();
                }
            }
            else
            {
                if ( GT_32( total_brate, MAX_ACELP_BRATE ) )
                {
                    tcxonly = 1;
                    move16();
                }
            }
            BREAK;

        case IVAS_CPE_DFT:
        case IVAS_CPE_TD:
            if ( GT_32( total_brate, MAX_ACELP_BRATE ) )
            {
                tcxonly = 1;
                move16();
            }
            BREAK;
        case IVAS_CPE_MDCT:
            if ( GE_32( total_brate, temp_flag ) )
            {
                tcxonly = 1;
                move16();
            }
            BREAK;
    }

    return tcxonly; /*Q0*/
}
#endif /* FIX_2385_GETTCXONLY */
#ifndef FIX_2385_GETTCXONLY

Word16 getTcxonly(
    const Word32 total_brate /* i  : total bitrate                       */
)
{

    Word16 tcxonly;
    tcxonly = 0;
    move16();
    if ( GT_32( total_brate, 32000 ) )
    {
        tcxonly = 1;
        move16();
    }
    return tcxonly; /*Q0*/
}

Word16 getTcxonly_fx(
    const Word16 element_mode, /* i  : IVAS element mode                    Q0*/
    const Word32 total_brate,  /* i  : total bitrate                        Q0*/
    const Word16 MCT_flag,     /* i  : hMCT handle allocated (1) or not (0) Q0*/
    const Word16 is_ism_format /* i  : flag indicating ISM format           Q0*/
)
{
    Word16 tcxonly;
    tcxonly = 0;
    move16();

    SWITCH( element_mode )
    {
        case EVS_MONO:
            if ( GT_32( total_brate, ACELP_32k ) )
            {
                tcxonly = 1;
                move16();
            }
            BREAK;
        case IVAS_SCE:
            IF( is_ism_format )
            {
                if ( GT_32( total_brate, MAX_ACELP_BRATE_ISM ) )
                {
                    tcxonly = 1;
                    move16();
                }
            }
            ELSE
            {
                if ( GT_32( total_brate, MAX_ACELP_BRATE ) )
                {
                    tcxonly = 1;
                    move16();
                }
            }
            BREAK;

        case IVAS_CPE_DFT:
        case IVAS_CPE_TD:
            if ( GT_32( total_brate, MAX_ACELP_BRATE ) )
            {
                tcxonly = 1;
                move16();
            }
            BREAK;
        case IVAS_CPE_MDCT:
            IF( MCT_flag )
            {

                if ( GE_32( total_brate, IVAS_32k ) )
                {
                    tcxonly = 1;
                    move16();
                }
            }
            ELSE
            {
                if ( GE_32( total_brate, IVAS_48k ) )
                {
                    tcxonly = 1;
                    move16();
                }
            }
            BREAK;
    }

    return tcxonly; /*Q0*/
}
#endif /* FIX_2385_GETTCXONLY */

/*-------------------------------------------------------------------*
 * getCtxHm()
+3 −0
Original line number Diff line number Diff line
@@ -1753,9 +1753,11 @@ Word16 apply_scale_ind(
        *scale = L_add( *scale, L_deposit_h( scaleTable[i].scale ) );
        move32();
    }

    return i;
}

#ifndef HARM_2456_APPLY_SCALE
void apply_scale_ivas_fx(
    Word32 *scale,                 /* o  : scalefactor             */
    const Word16 bwmode,           /* i  : audio bandwidth         */
@@ -1782,6 +1784,7 @@ void apply_scale_ivas_fx(
    *index = i;
    move16();
}
#endif
/*-------------------------------------------------------------------
 * bandcombinepow()
 *
+0 −2
Original line number Diff line number Diff line
@@ -1575,9 +1575,7 @@ typedef enum
#define DEG_360_IN_Q22                          ( 360 << Q22 )              /* Q22 */
#define DEG_180_IN_Q22                          ( 180 << Q22 )              /* Q22 */
#define DEG_90_IN_Q22                           ( 90 << Q22 )               /* Q22 */
#ifdef FIX_2235_TD_RENDERER_WORD16
#define DEG_90_IN_Q8                            ( 90 << Q8 )                /* Q8  */
#endif
#define ONE_BY_360_Q31                          ( 5965232 )                 /* Q31 */
#define ONE_BY_360_Q15                          ( 91 )                      /* Q15 */
#define ONE_BY_180_Q31                          ( 11930465 )                /* Q31 */
Loading