Commit 4fe0ee55 authored by Tapani Pihlajakuja's avatar Tapani Pihlajakuja
Browse files

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

Merge remote-tracking branch 'origin/main' into float-1493-improve-stability-of-decisions-in-masa-metadata-reduction-in-encoder
parents 8080b6db ce71eae9
Loading
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -1598,17 +1598,27 @@ 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;
}
+0 −8
Original line number Diff line number Diff line
@@ -306,11 +306,7 @@ IF( NE_16( Opt_AMR_WB, 1 ) )

    IF( EQ_16( L_frame, L_FRAME16k ) )
    {
#ifndef FIX_2410_HARM_MODIF_FS
        modify_Fs_fx( fft_io, L_FRAME16k, 16000, fft_io, 12800, exc_mem1, 0 );
#else
        modify_Fs_fx( fft_io, L_FRAME16k, 16000, fft_io, 12800, exc_mem1, 0, NULL, NULL );
#endif
    }

    /* fft_rel(fft_io, L_FFT, LOG2_L_FFT); */
@@ -423,11 +419,7 @@ IF( NE_16( Opt_AMR_WB, 1 ) )

    IF( EQ_16( L_frame, L_FRAME16k ) )
    {
#ifndef FIX_2410_HARM_MODIF_FS
        modify_Fs_fx( fft_io, L_FFT, 12800, fft_io, 16000, exc_mem, 0 );
#else
        modify_Fs_fx( fft_io, L_FFT, 12800, fft_io, 16000, exc_mem, 0, NULL, NULL );
#endif
    }

    /* enr1 = dotp( fft_io, fft_io, L_frame ) / L_frame; */
+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()
+3 −0
Original line number Diff line number Diff line
@@ -1593,6 +1593,9 @@ 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 */
+14 −7
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[],
@@ -2954,15 +2956,8 @@ void acelp_fast_fx(
    BSTR_ENC_HANDLE hBstr,                                      /* i/o: encoder bitstream handle                */
    const Word16 cdk_index,                                     /* i  : codebook index                          */
    const Word16 dn_orig[L_SUBFR],                              /* i  : corr. between target and h[].      Q_dn */
#ifdef OPT_2416_ACELP_FAST                                      
    const Word16 Q_dncn,                                        /* i  : scaling factor of dn and cn             */  
#else
    Word16 Q_dn,
#endif
    const Word16 cn[L_SUBFR],                                   /* i  : residual after long term prediction q_cn*/
#ifndef OPT_2416_ACELP_FAST
    const Word16 q_cn,
#endif
    const Word16 H[L_SUBFR],                                    /* i  : impulse response of weighted synthesis filter  e(norm_s(H[0])+1) */
    Word16 code[L_SUBFR],                                       /* o  : algebraic (fixed) codebook excitation   */
    Word16 y[],                                                 /* o  : filtered fixed codebook excitation      */
@@ -3798,10 +3793,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 +4128,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                      */
Loading