Commit 3094d9a1 authored by vaillancour's avatar vaillancour
Browse files

Merge main

 into 2431-use-of-calloc-in-basop
parents 1cc4b5ab 1a112a44
Loading
Loading
Loading
Loading
Loading
+70 −0
Original line number Diff line number Diff line
@@ -169,7 +169,74 @@ Word16 get_codec_mode(
    return codec_mode; /*Q0*/
}

#ifdef FIX_2385_GETTCXONLY
/*-------------------------------------------------------------------*
 * getTcxonly()
 *
 *
 *-------------------------------------------------------------------*/

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 = 0;
    move16();
    Word32 temp_flag;

    SWITCH( element_mode )
    {
        case EVS_MONO:
            if ( GT_32( total_brate, ACELP_32k ) )
            {
                tcxonly = 1;
                move16();
            }
            BREAK;
        case IVAS_SCE:
            temp_flag = MAX_ACELP_BRATE;
            move32();
            if ( is_ism_format )
            {
                temp_flag = MAX_ACELP_BRATE_ISM;
                move32();
            }
            if ( GT_32( total_brate, temp_flag ) )
            {
                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:
            temp_flag = IVAS_48k;
            move32();
            if ( MCT_flag )
            {
                temp_flag = IVAS_32k;
                move32();
            }
            if ( GE_32( total_brate, temp_flag ) )
            {
                tcxonly = 1;
                move16();
            }
            BREAK;
    }

    return tcxonly; /*Q0*/
}
#else
/*-------------------------------------------------------------------*
 * getTcxonly_ivas()
 *
@@ -244,6 +311,8 @@ Word16 getTcxonly_ivas_fx(

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

Word16 getTcxonly(
    const Word32 total_brate /* i  : total bitrate                       */
@@ -331,6 +400,7 @@ Word16 getTcxonly_fx(

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

/*-------------------------------------------------------------------*
 * getCtxHm()
+14 −0
Original line number Diff line number Diff line
@@ -1890,9 +1890,11 @@ void TonalMDCTConceal_Detect_ivas_fx(
    Word16 element_mode 
);

#ifndef HARMONIZE_2427_GETPLC
Word16 GetPLCModeDecision_ivas_fx(
    Decoder_State *st                                           /* i/o:    decoder memory state pointer         */
);
#endif // !HARMONIZE_2427_GETPLC

void ivas_DetectTonalComponents_fx(
    Word16 indexOfTonalPeak[],
@@ -3798,10 +3800,16 @@ ivas_error ivas_osba_render_sf_fx(
void ivas_osba_stereo_add_channels_fx(
    Word32 *tc_fx[],                                            /* i  : transport channels                          */
    Word32 *output_fx[],                                        /* i/o: output channels                             */
#ifdef FIX_2196_UNREACHABLE_CODE_IN_OSBA_STEREO_OUTPUT
    const Word32 gain,                                          /* i  : gain bed value Q11                          */
#else
    const Word32 gain_bed_fx,                                   /* i  : gain bed value Q11                          */
#endif
    const Word16 nchan_out,                                     /* i  : number of output channels                   */
    const Word16 nchan_ism,                                     /* i  : number of ISM channels                      */
#ifndef FIX_2196_UNREACHABLE_CODE_IN_OSBA_STEREO_OUTPUT
    const Word16 ism_mode,                                      /* i  : ISM mode                                    */
#endif
    const UWord16 n_samples_to_render                           /* i  : output frame length per channel             */
);

@@ -4127,11 +4135,17 @@ ivas_error ivas_param_ism_dec_open_fx(
    Decoder_Struct *st_ivas                                     /* i/o: IVAS decoder structure                      */
);

#ifdef FIX_FLOAT_1526_DIRAC_MEM_LEAK
void ivas_param_ism_dec_close_fx(
    PARAM_ISM_DEC_HANDLE *hParamIsmDec                          /* i/o: decoder ParamISM handle                     */
);
#else
void ivas_param_ism_dec_close_fx(
    PARAM_ISM_DEC_HANDLE *hParamIsmDec,                         /* i/o: decoder ParamISM handle                     */
    SPAT_PARAM_REND_COMMON_DATA_HANDLE *hSpatParamRendCom_out,  /* i/o: common spatial renderer data                */
    const AUDIO_CONFIG output_config                            /* i  : output audio configuration                  */
);
#endif

void ivas_ism_dec_digest_tc_fx(
    Decoder_Struct *st_ivas                                     /* i/o: IVAS decoder structure                      */
+11 −2
Original line number Diff line number Diff line
@@ -89,9 +89,17 @@
#define FIX_2425_REMOVE_RC_DUPLICATES                   /* VA: basop issue 2425: Remove duplicated RC encoder functions */
#define HARM_LEV_DURBIN                                 /* VA: basop issue 2423: harmonize levinson-Durbin algorithm */
#define HARMONIZE_TBE2                                  /* VA: basop issue 2399: Remove duplicated code: TBE, step 2 */
#define HARMONIZE_2427_GETPLC                           /* FhG: basop issue : 2427 Harmonizing getPLCDecision functions:*/
#define HARM_FD_BWE                                     /* VA: harmonize core-coder FD BWE function duplications */
#define FIX_2411_Harmonize_TNSANALYSIS_DETECTTNSFILT    /* FhG: basop issue 2411: harmonize TNSAnalysis*_fx(), DetectTnsFilt*_fx()*/
#define HARMONIZE_READ_DECODE_TNS                       /* FhG basop 2389: Harm between two pairs of functions. */
#define FIX_FLOAT_1526_DIRAC_MEM_LEAK                   /* FhG: float issue 1526: potential memory leak in DirAC handles in case of format switching */
#define FIX_2437_HARMONIZE_ENCODERINDEX                 /* FhG: basop issue 2437 EncoderIndex_ivas_fx() and EncoderIndex_fx()*/
#define FIX_2385_GETTCXONLY                             /* FhG: issue 2385 : harmonizing getTcxonly_ivas_fx() and getTcxonly_ivas_fx() functions */
#define FIX_2196_UNREACHABLE_CODE_IN_OSBA_STEREO_OUTPUT /* FhG: remove unreachable code in ivas_osba_stereo_add_channels */
#define FIX_OUTPUT_FRAME                                /* VA: harmonize "output_frame" parameter usage to correspond to FLP */
#define HARMONIZE_ISSUE_2435_WRITETNSDATA               /* FhG basop 2435: Harmonize WriteTnsData*_fx(), EncodeTnsData*_fx() */
#define HARM_2336_DOTP                                       /* VA: basop 2336; Harmonisation of some dot_product function + some BE optimisation */
#define FIX_2431_AVOID_CALLOC                           /* VA: basp issue 2431: avoid use of calloc() */

/* #################### End BE switches ################################## */
@@ -100,10 +108,11 @@
/* any switch which is non-be wrt. TS 26.251 V3.0 */


#define NONBE_MR2809

/* ##################### End NON-BE switches ########################### */

/* ################## End MAINTENANCE switches ######################### */

/* clang-format on */

#endif
+23 −7
Original line number Diff line number Diff line
@@ -3802,10 +3802,12 @@ Word16 get_cng_mode(
Word16 get_codec_mode(
    const Word32 total_brate /* i  : total bitrate   */
);
#ifndef FIX_2385_GETTCXONLY

Word16 getTcxonly(
    const Word32 total_brate /* i  : total bitrate                       */
);
#endif

Word16 getTcxonly_fx(
    const Word16 element_mode, /* i  : IVAS element mode                   */
@@ -5685,7 +5687,7 @@ void v_add_fx_me(
    const Word16 N,    /* i  : Vector length                                    */
    const Word16 hdrm  /* i  : headroom for when subtraction result > 1 or < -1 */
);

#ifndef HARM_2336_DOTP
void v_add_w64(
    const Word64 x1[], /* i  : Input vector 1                                   */
    const Word64 x2[], /* i  : Input vector 2                                   */
@@ -5693,7 +5695,7 @@ void v_add_w64(
    const Word16 N,    /* i  : Vector length                                    */
    const Word16 hdrm  /* i  : headroom for when subtraction result > 1 or < -1 */
);

#endif
void v_sub_fx(
    const Word32 x1[], /* i  : Input vector 1                                   */
    const Word32 x2[], /* i  : Input vector 2                                   */
@@ -5723,7 +5725,7 @@ Word32 dotp_fx32_o(
    const Word16 n,       /* i  : vector length                 */
    const Word16 log_len, /* i  : max factor added to result q after dot product (equal to log2(n))                 */
    Word16 *res_q );

#ifndef HARM_2336_DOTP
Word32 dotp_fx32_fac(
    const Word32 x[],     /* i  : vector x[]                    */
    const Word32 y[],     /* i  : vector y[]                    */
@@ -5731,7 +5733,7 @@ Word32 dotp_fx32_fac(
    const Word16 log_len, /* i  : max factor added to result q after dot product (equal to log2(n))                 */
    Word16 *res_q         /*stores resultant Q*/
);

#endif
Word32 dotp_fx_ivas_fx(
    const Word32 x[], /* i  : vector x[]                    */
    Word16 x_e,
@@ -5745,7 +5747,7 @@ Word32 dotp_fx_guarded(
    const Word32 y[], /* i  : vector y[]                    */
    const Word16 n    /* i  : vector length                 */
);

#ifndef HARM_2336_DOTP
Word32 dotp_me_fx(
    const Word32 x[], /* i  : vector x[]                    */
    const Word32 y[], /* i  : vector y[]                    */
@@ -5753,7 +5755,7 @@ Word32 dotp_me_fx(
    Word16 exp_x,
    Word16 exp_y,
    Word16 *exp_suma );

#endif
void lsf_end_dec_fx(
    Decoder_State *st,           /* i/o: decoder state structure                 */
    Word16 mode2_flag,           /* Q0 */
@@ -8192,6 +8194,7 @@ void GetParameters_fx(
    Word16 *pnBits             // Q0
);

#ifndef HARMONIZE_ISSUE_2435_WRITETNSDATA
void EncodeTnsData_ivas_fx(
    STnsConfig const *pTnsConfig, /* i  : TNS Configuration struct          */
    STnsData const *pTnsData,     /* i  : TNS data struct (quantized param) */
@@ -8199,6 +8202,15 @@ void EncodeTnsData_ivas_fx(
    Word16 *pnSize,               /* o  : number of written parameters      Q0*/
    Word16 *pnBits                /* o  : number of written bits            Q0*/
);
#else
void EncodeTnsData_ivas_fx(
    STnsConfig const *pTnsConfig, /* i  : TNS Configuration struct          */
    STnsData const *pTnsData,     /* i  : TNS data struct (quantized param) */
    Word16 *stream,               /* o  : internal data stream           Q0 */
    Word16 *pnSize,               /* o  : number of written parameters   Q0 */
    Word16 *pnBits                /* o  : number of written bits         Q0 */
);
#endif

void SetParameters(
    ParamsBitMap const *paramsBitMap,
@@ -8480,7 +8492,6 @@ void highPassFiltering_fx(
    const Word16 hp_filt[],   /* i:   Q15    high pass filter coefficients                       */
    const Word16 l_fir_fer ); /* i:        high pass filter length                               */


Word16 GetPLCModeDecision_fx(
    Decoder_State *st );

@@ -10275,6 +10286,7 @@ void configureFdCngEnc_ivas_fx(
    const Word16 bwidth,         /* Q0 */
    const Word32 total_brate     /* Q0 */
);
#ifndef FIX_2385_GETTCXONLY

Word16 getTcxonly_ivas_fx(
    const Word16 element_mode, /* i  : IVAS element mode                   */
@@ -10282,6 +10294,7 @@ Word16 getTcxonly_ivas_fx(
    const Word16 MCT_flag,     /* i  : hMCT handle allocated (1) or not (0)*/
    const Word16 is_ism_format /* i  : flag indicating ISM format          */
);
#endif

void SetModeIndex_ivas_fx(
    Encoder_State *st,              /* i  : Encoder state                          */
@@ -10814,6 +10827,7 @@ void ResetTnsData_flt(
void ClearTnsFilterCoefficients_flt(
    STnsFilter *pTnsFilter );

#ifndef HARMONIZE_ISSUE_2435_WRITETNSDATA
void EncodeTnsData(
    STnsConfig const *pTnsConfig, /* i  : TNS Configuration struct          */
    STnsData const *pTnsData,     /* i  : TNS data struct (quantized param) */
@@ -10821,6 +10835,7 @@ void EncodeTnsData(
    Word16 *pnSize,               /* o  : number of written parameters      */
    Word16 *pnBits                /* o  : number of written bits            */
);
#endif

void WriteTnsData(
    const STnsConfig *pTnsConfig, /* i  : TNS Configuration struct          */
@@ -10829,6 +10844,7 @@ void WriteTnsData(
    BSTR_ENC_HANDLE hBstr,        /* o  : bitstream                         */
    Word16 *pnBits                /* o  : number of written bits            */
);

#ifndef HARMONIZE_READ_DECODE_TNS
void ReadTnsData_ivas(
    STnsConfig const *pTnsConfig,
+28 −5
Original line number Diff line number Diff line
@@ -630,7 +630,7 @@ Word32 dotp_fx32_o(
    return W_extract_l( suma );
}


#ifndef HARM_2336_DOTP
Word32 dotp_fx32_fac(
    const Word32 x[],     /* i  : vector x[]                    */
    const Word32 y[],     /* i  : vector y[]                    */
@@ -686,6 +686,7 @@ void v_add_w64(

    return;
}
#endif


/*-------------------------------------------------------------------*
@@ -703,10 +704,18 @@ void v_sub_fx(
)
{
    Word16 i;

#ifdef HARM_2336_DOTP
    Word32 wtmp;
    assert( hdrm < 31 && hdrm > 0 );
    wtmp = L_shl_sat( 1, sub( 31, hdrm ) );
#endif
    FOR( i = 0; i < N; i++ )
    {
#ifndef HARM_2336_DOTP
        y[i] = L_sub( L_shr( x1[i], hdrm ), L_shr( x2[i], hdrm ) );
#else
        y[i] = Msub_32_32( Mpy_32_32( x1[i], wtmp ), x2[i], wtmp );
#endif
        move32();
    }

@@ -5143,7 +5152,7 @@ UWord32 mvl2s_r(

    return noClipping;
}

#ifndef HARM_2336_DOTP
Word32 dotp_me_fx(
    const Word32 x[], /* i  : vector x[]                    */
    const Word32 y[], /* i  : vector y[]                    */
@@ -5166,7 +5175,7 @@ Word32 dotp_me_fx(

    return suma;
}

#endif
Word32 dotp_fx_guarded(
    const Word32 x[], /* i  : vector x[]                    */
    const Word32 y[], /* i  : vector y[]                    */
@@ -5195,6 +5204,7 @@ Word32 dotp_fx_ivas_fx(
    const Word16 n, /* i  : vector length                 */
    Word16 *out_e )
{
#ifndef HARM_2336_DOTP
    Word16 i, exp;
    Word32 suma = 0;

@@ -5208,7 +5218,20 @@ Word32 dotp_fx_ivas_fx(

    *out_e = exp;
    move16();

#else
    Word16 i;
    Word32 suma;
    Word32 mul;
    Word16 mul_exp = add( x_e, y_e );
    suma = Mpy_32_32( x[0], y[0] );
    *out_e = mul_exp;
    move16();
    FOR( i = 1; i < n; i++ )
    {
        mul = Mpy_32_32( x[i], y[i] );
        suma = BASOP_Util_Add_Mant32Exp( suma, *out_e, mul, mul_exp, out_e ); // exp_x+exp_A
    }
#endif
    return suma;
}

Loading