Commit 1dfcc439 authored by Jan Kiene's avatar Jan Kiene
Browse files

Merge commit '366c8fbb' into main-pc

parents 2b9ec3df 366c8fbb
Loading
Loading
Loading
Loading
Loading
+95 −0
Original line number Diff line number Diff line
@@ -2807,7 +2807,14 @@ static ivas_error decodeVoIP(
        }
        vec_pos_update = ( vec_pos_update + 1 ) % vec_pos_len;
        frame++;
#ifdef NONBE_FIX_864_JBM_RENDER_FRAMESIZE
        if ( vec_pos_update == 0 )
        {
            systemTime_ms += vec_pos_len * systemTimeInc_ms;
        }
#else
        systemTime_ms += systemTimeInc_ms;
#endif

#ifdef WMOPS
        update_mem();
@@ -2815,6 +2822,94 @@ static ivas_error decodeVoIP(
#endif
    }


#ifdef NONBE_FIX_864_JBM_RENDER_FRAMESIZE
    int16_t nSamplesFlushed = 0;

    /* decode and get samples */
#ifdef SPLIT_REND_WITH_HEAD_ROT
    if ( ( error = IVAS_DEC_Flush( hIvasDec, nOutSamples, IVAS_DEC_PCM_INT16, (void *) pcmBuf, &nSamplesFlushed ) ) != IVAS_ERR_OK )
#else
    if ( ( error = IVAS_DEC_Flush( hIvasDec, nOutSamples, pcmBuf, &nSamplesFlushed ) ) != IVAS_ERR_OK )
#endif
    {
        fprintf( stderr, "\nError in IVAS_DEC_VoIP_Flush: %s\n", IVAS_DEC_GetErrorMessage( error ) );
        goto cleanup;
    }

    if ( nSamplesFlushed )
    {
        /* Write current frame */
        if ( ( error = AudioFileWriter_write( afWriter, pcmBuf, nSamplesFlushed * nOutChannels ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nOutput audio file writer error\n" );
            goto cleanup;
        }

        /* Write ISm metadata to external file(s) */
        if ( decodedGoodFrame && arg.outputConfig == IVAS_AUDIO_CONFIG_EXTERNAL )
        {
            if ( bsFormat == IVAS_DEC_BS_OBJ || bsFormat == IVAS_DEC_BS_MASA_ISM || bsFormat == IVAS_DEC_BS_SBA_ISM )
            {
                if ( ( error = IVAS_DEC_GetNumObjects( hIvasDec, &numObj ) ) != IVAS_ERR_OK )
                {
                    fprintf( stderr, "\nError in IVAS_DEC_GetNumObjects: %s\n", IVAS_DEC_GetErrorMessage( error ) );
                    goto cleanup;
                }

                for ( i = 0; i < numObj; ++i )
                {
                    IVAS_ISM_METADATA IsmMetadata;

                    if ( ( error = IVAS_DEC_GetObjectMetadata( hIvasDec, &IsmMetadata, 0, i ) ) != IVAS_ERR_OK )
                    {
                        fprintf( stderr, "\nError in IVAS_DEC_GetObjectMetadata: %s\n", IVAS_DEC_GetErrorMessage( error ) );
                        goto cleanup;
                    }

                    if ( ( IsmFileWriter_writeFrame( IsmMetadata, ismWriters[i] ) ) != IVAS_ERR_OK )
                    {
                        fprintf( stderr, "\nError writing ISM metadata to file %s\n", IsmFileWriter_getFilePath( ismWriters[i] ) );
                        goto cleanup;
                    }
                }
            }

            if ( bsFormat == IVAS_DEC_BS_MASA || bsFormat == IVAS_DEC_BS_MASA_ISM )
            {
                IVAS_MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta;
#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT
                int16_t fullDelayNumSamples[3];
                float delayMs;

                /* delayNumSamples is zeroed, and delayNumSamples_orig is updated only on first good frame, so need to re-fetch delay info */
                if ( ( error = IVAS_DEC_GetDelay( hIvasDec, fullDelayNumSamples, &delayTimeScale ) ) != IVAS_ERR_OK )
                {
                    fprintf( stderr, "\nUnable to get delay of decoder: %s\n", ivas_error_to_string( error ) );
                }
#endif
                if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &hMasaExtOutMeta, 0 ) ) != IVAS_ERR_OK )
                {
                    fprintf( stderr, "\nError in IVAS_DEC_GetMasaMetadata: %s\n", IVAS_DEC_GetErrorMessage( error ) );
                    goto cleanup;
                }

#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT
                delayMs = (float) ( fullDelayNumSamples[0] ) / (float) ( delayTimeScale );
                if ( ( error = MasaFileWriter_writeFrame( masaWriter, hMasaExtOutMeta, &delayMs ) ) != IVAS_ERR_OK )
#else
                if ( ( error = MasaFileWriter_writeFrame( masaWriter, hMasaExtOutMeta ) ) != IVAS_ERR_OK )
#endif
                {
                    fprintf( stderr, "\nError writing MASA metadata to file: %s\n", MasaFileWriter_getFilePath( masaWriter ) );
                    goto cleanup;
                }
            }
        }
    }
#endif


    /*------------------------------------------------------------------------------------------*
     * Add zeros at the end to have equal length of synthesized signals
     *------------------------------------------------------------------------------------------*/
+4 −0
Original line number Diff line number Diff line
@@ -50,6 +50,7 @@
/*#define DEBUG_FORCE_DIR*/                       /* Force modes/parameters by reading from external binary files */
/*#define DBG_WAV_WRITER*/                    /* Enable dbgwrite_wav() function for generating ".wav" files */
#define SUPPORT_FORCE_TCX10_TCX20             /* VA: Enable -force tcx10|tcx20 command-line option */
/*#define DEBUG_MODE_JBM */                     /* define to output JBM relevant parameters */
#endif

#define SUPPORT_JBM_TRACEFILE                   /* Support for JBM tracefile, which is needed for 3GPP objective/subjective testing, but not relevant for real-world implementations */
@@ -67,6 +68,7 @@
#ifndef BASOP_NOGLOB_DEV_USE_GLOBALS
#define BASOP_NOGLOB_DECLARE_LOCAL
#endif
#define FIX_732_MS_PERIODOG_FLOOR                /* Eri: Issue-732: Dynamic range of msPeriodog leads to minimum value 1e-5 being truncated to zero. This uses the smallest non-zero value instead. */

#define FIX_867_CLDFB_NRG_SCALE

@@ -114,6 +116,8 @@
#define FIX_1733_CLDFB_BUG
#define FIX_1740_MISING_POP_WMOPS               /* VA: fix issue 1740: missing pop_wmops() */

#define NONBE_FIX_864_JBM_RENDER_FRAMESIZE                    /* FhG: issue #864: fix different behaviour of JBM TSM with different render frame sizes */

/* #################### Start BASOP porting switches ############################ */

#define FIX_1372_ISAR_POST_REND
+1 −1
Original line number Diff line number Diff line
@@ -557,7 +557,7 @@ void con_acelp_fx(
    tmp_32 = Mpy_32_16_1( st->Mode2_lp_gainc /*Q16*/, alpha /*Q14*/ ); /*Q31-16 = Q15*/
    s_32 = norm_l( tmp_32 );
    tmp_32 = L_shl( tmp_32, s_32 );
    tmp_16 = round_fx( tmp_32 );
    tmp_16 = round_fx_sat( tmp_32 );
    s_16 = negate( s_32 );
    s_16 = sub( s_16, -1 - 15 ); /*->Q15*/

+33 −0
Original line number Diff line number Diff line
@@ -1500,6 +1500,9 @@ void perform_noise_estimation_dec_ivas_fx(
    Word32 enr, enr_tot, enr_tot0;
    Word16 enr_e, enr_ratio, alpha;
    Word32 *msPeriodog;
#ifdef FIX_732_MS_PERIODOG_FLOOR
    Word32 msPeriodog_floor;
#endif
    Word32 *msNoiseEst;
    Word32 *reIter;
    Word32 rescale_fac = 0;
@@ -1508,6 +1511,10 @@ void perform_noise_estimation_dec_ivas_fx(
    Word16 q_shift;
    Word32 max_l;
    Word16 norm_shift;
#ifdef FIX_732_MS_PERIODOG_FLOOR
    Word16 check = 0;
    move16();
#endif

    /* pointer initialization */
    periodog = hFdCngDec->hFdCngCom->periodog;   /*Q31 - hFdCngDec->hFdCngCom->periodog_exp*/
@@ -1706,12 +1713,38 @@ void perform_noise_estimation_dec_ivas_fx(
                msPeriodog[p] = L_add( msPeriodog[p], L_tmp ); /*Q31 - hFdCngDec->msPeriodog_exp*/
                move32();

#ifdef FIX_732_MS_PERIODOG_FLOOR
                msPeriodog_floor = L_max( 1, L_shr( 21474 /*Q31*/, hFdCngDec->msPeriodog_exp ) ); /*Q31 - hFdCngDec->msPeriodog_exp*/
                IF( LT_32( msPeriodog[p], msPeriodog_floor ) )
#else
                IF( LT_32( msPeriodog[p], L_shr( 21474 /*Q31*/, hFdCngDec->msPeriodog_exp ) ) )
#endif
                {
#ifdef FIX_732_MS_PERIODOG_FLOOR
                    msPeriodog[p] = msPeriodog_floor;
                    move32();
#else
                    msPeriodog[p] = L_shr( 21474 /*Q31*/, hFdCngDec->msPeriodog_exp ); /*Q31 - hFdCngDec->msPeriodog_exp*/
                    move32();
#endif
                }
            }
#ifdef FIX_732_MS_PERIODOG_FLOOR
            FOR( p = 0; p < npart; p++ )
            {
                IF( GT_32( msPeriodog[p], 1 ) )
                {
                    check = 1;
                    move16();
                    BREAK;
                }
            }
            IF( check == 0 )
            {
                hFdCngDec->msPeriodog_exp = 14; /* msPeriodog buffer will have minimum value as 1e-5f */
                move16();
            }
#endif
        }

        /* calculate total energy (short-term and long-term) */
+0 −1
Original line number Diff line number Diff line
@@ -30,7 +30,6 @@

*******************************************************************************************************/

#define MERGE_REQUEST_1564_SPEEDUP_ivas_dirac_dec_output_synthesis_cov_param_mc_synthesise_slot_fx_NONBE

#include <stdint.h>
#include <string.h>
Loading