Commit dce645c2 authored by Marek Szczerba's avatar Marek Szczerba
Browse files

Merge branch 'main' into basop-2059-reverb-structure-memory-non-optimality

parents 2ca58757 ce71eae9
Loading
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -1713,9 +1713,13 @@ static ivas_error initOnFirstGoodFrame(
        if ( arg.rtpOutSR && srRtp != NULL )
        {
            FILE *fParamsSR = NULL;
            char srParamsFile[FILENAME_MAX], *ext = ".sr.txt";
            strncpy( srParamsFile, arg.outputWavFilename, FILENAME_MAX - sizeof( ext ) );
            strncat( srParamsFile, ext, sizeof( ext ) + 1 );
            char srParamsFile[FILENAME_MAX];
            const char *ext = ".sr.txt";

            strncpy( srParamsFile, arg.outputWavFilename, FILENAME_MAX - strlen( ext ) - 1 );
            srParamsFile[FILENAME_MAX - strlen( ext ) - 1] = '\0';
            strncat( srParamsFile, ext, strlen( ext ) );
            srParamsFile[FILENAME_MAX - 1] = '\0';

            /* Write the Split Rendering Params passed from SDP to srParamsFile */
            fParamsSR = fopen( srParamsFile, "w" );
+2 −2
Original line number Diff line number Diff line
@@ -57,7 +57,7 @@ Word16 get_next_coeff_unmapped(
    return *idx;
}

Word16 update_mixed_context(
Word16 update_mixed_context_fx(
    Word16 ctx, /* Q0 */
    Word16 a    /* Q0 */
)
@@ -78,7 +78,7 @@ Word16 update_mixed_context(
    return add( shl( s_and( ctx, 0xf ), 4 ), add( t, 13 ) );
}

Word32 update_mixed_context_ivas_fx(
Word32 update_mixed_context_fx_32(
    Word32 ctx, /* Q0 */
    Word16 a    /* Q0 */
)
+10 −2
Original line number Diff line number Diff line
@@ -996,10 +996,8 @@ ivas_error openCldfb(
        return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for CLDFB" );
    }

#ifdef FIX_2319_CLDFB_INIT_FLAGS
    hs->flags = 0;
    move16();
#endif

    hs->type = type;
    move16();
@@ -1600,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;
}
+2 −2
Original line number Diff line number Diff line
@@ -306,7 +306,7 @@ IF( NE_16( Opt_AMR_WB, 1 ) )

    IF( EQ_16( L_frame, L_FRAME16k ) )
    {
        modify_Fs_fx( fft_io, L_FRAME16k, 16000, fft_io, 12800, exc_mem1, 0 );
        modify_Fs_fx( fft_io, L_FRAME16k, 16000, fft_io, 12800, exc_mem1, 0, NULL, NULL );
    }

    /* fft_rel(fft_io, L_FFT, LOG2_L_FFT); */
@@ -419,7 +419,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 );
        modify_Fs_fx( fft_io, L_FFT, 12800, fft_io, 16000, exc_mem, 0, NULL, NULL );
    }

    /* enr1 = dotp( fft_io, fft_io, L_frame ) / L_frame; */
+72 −3
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()
@@ -997,8 +1067,7 @@ void init_tcx_cfg_ivas_fx(

    IF( hTcxCfg->fIsTNSAllowed )
    {
        InitTnsConfigs_ivas_fx( bwidth, hTcxCfg->tcx_coded_lines, hTcxCfg->tnsConfig, infoIGFStopFreq, total_brate, element_mode, MCT_flag );

        InitTnsConfigs_fx( bwidth, hTcxCfg->tcx_coded_lines, hTcxCfg->tnsConfig, infoIGFStopFreq, total_brate, element_mode, MCT_flag );
        SetAllowTnsOnWhite( hTcxCfg->tnsConfig, (Word8) EQ_16( element_mode, IVAS_CPE_MDCT ) );
    }

@@ -1253,7 +1322,7 @@ void init_tcx_cfg_fx(

    IF( hTcxCfg->fIsTNSAllowed )
    {
        InitTnsConfigs( bwidth, hTcxCfg->tcx_coded_lines, hTcxCfg->tnsConfig, infoIGFStopFreq, total_brate, element_mode, MCT_flag );
        InitTnsConfigs_fx( bwidth, hTcxCfg->tcx_coded_lines, hTcxCfg->tnsConfig, infoIGFStopFreq, total_brate, element_mode, MCT_flag );

        SetAllowTnsOnWhite( hTcxCfg->tnsConfig, (Word8) EQ_16( element_mode, IVAS_CPE_MDCT ) );
    }
Loading