Commit c79eb941 authored by fotopoulou's avatar fotopoulou
Browse files

Merge branch 'ivas-float-update' into 2172_ref_fix-crash-with-igf-and-bw-switching-with-dtx

parents 979448ea 643ad52c
Loading
Loading
Loading
Loading
Loading
+9 −8
Original line number Diff line number Diff line
@@ -106,6 +106,7 @@
    <ClCompile Include="..\lib_lc3plus\attack_detector.c" />
    <ClCompile Include="..\lib_lc3plus\plc_compute_stab_fac.c" />
    <ClCompile Include="..\lib_lc3plus\constants.c" />
    <ClCompile Include="..\lib_lc3plus\com_entropy.c" />
    <ClCompile Include="..\lib_lc3plus\cutoff_bandwidth.c" />
    <ClCompile Include="..\lib_lc3plus\dct4.c" />
    <ClCompile Include="..\lib_lc3plus\dec_entropy.c" />
@@ -116,7 +117,7 @@
    <ClCompile Include="..\lib_lc3plus\estimate_global_gain.c" />
    <ClCompile Include="..\lib_lc3plus\lc3plus_fft.c" />
    <ClCompile Include="..\lib_lc3plus\imdct.c" />
    <ClCompile Include="..\lib_lc3plus\lc3.c" />
    <ClCompile Include="..\lib_lc3plus\lc3plus.c" />
    <ClCompile Include="..\lib_lc3plus\ltpf_coder.c" />
    <ClCompile Include="..\lib_lc3plus\ltpf_decoder.c" />
    <ClCompile Include="..\lib_lc3plus\mdct.c" />
@@ -153,9 +154,9 @@
    <ClCompile Include="..\lib_lc3plus\resamp12k8.c" />
    <ClCompile Include="..\lib_lc3plus\residual_coding.c" />
    <ClCompile Include="..\lib_lc3plus\residual_decoding.c" />
    <ClCompile Include="..\lib_lc3plus\setup_dec_lc3.c" />
    <ClCompile Include="..\lib_lc3plus\setup_enc_lc3.c" />
    <ClCompile Include="..\lib_lc3plus\setup_com_lc3.c" />
    <ClCompile Include="..\lib_lc3plus\setup_dec_lc3plus.c" />
    <ClCompile Include="..\lib_lc3plus\setup_enc_lc3plus.c" />
    <ClCompile Include="..\lib_lc3plus\setup_com_lc3plus.c" />
    <ClCompile Include="..\lib_lc3plus\sns_compute_scf.c" />
    <ClCompile Include="..\lib_lc3plus\sns_interpolate_scf.c" />
    <ClCompile Include="..\lib_lc3plus\sns_quantize_scf.c" />
@@ -169,9 +170,9 @@
    <ClInclude Include="..\lib_lc3plus\defines.h" />
    <ClInclude Include="..\lib_lc3plus\file_io.h" />
    <ClInclude Include="..\lib_lc3plus\functions.h" />
    <ClInclude Include="..\lib_lc3plus\lc3.h" />
    <ClInclude Include="..\lib_lc3plus\setup_dec_lc3.h" />
    <ClInclude Include="..\lib_lc3plus\setup_enc_lc3.h" />
    <ClInclude Include="..\lib_lc3plus\lc3plus.h" />
    <ClInclude Include="..\lib_lc3plus\setup_dec_lc3plus.h" />
    <ClInclude Include="..\lib_lc3plus\setup_enc_lc3plus.h" />
    <ClInclude Include="..\lib_lc3plus\structs.h" />
    <ClInclude Include="..\lib_lc3plus\tinywavein_c.h" />
    <ClInclude Include="..\lib_lc3plus\tinywaveout_c.h" />
+23 −0
Original line number Diff line number Diff line
@@ -70,6 +70,10 @@
#define IVAS_MAX16B_FLT 32767.0f
#define IVAS_MIN16B_FLT ( -32768.0f )

#ifdef NONBE_1359_FIX_IVASREND_OMASA_BINAURAL_LOUDNESS
#define OMASA_TDREND_MATCHING_GAIN_DB ( -2.0f )
#endif

#if !defined( DEBUGGING ) && !defined( WMOPS )
static
#endif
@@ -1170,20 +1174,39 @@ int main(
        }
    }

#ifndef NONBE_1359_FIX_IVASREND_OMASA_BINAURAL_LOUDNESS
    /* Set the total number of objects */
#endif
    if ( args.inConfig.numAudioObjects > 0 )
    {
#ifdef NONBE_1359_FIX_IVASREND_OMASA_BINAURAL_LOUDNESS
        /* Set the total number of objects */
#endif
        if ( ( error = IVAS_REND_SetTotalNumberOfObjects( hIvasRend, args.inConfig.numAudioObjects ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nError in IVAS_REND_SetTotalNumberOfObjects(): %s\n", ivas_error_to_string( error ) );
            goto cleanup;
        }

#ifdef NONBE_1359_FIX_IVASREND_OMASA_BINAURAL_LOUDNESS
        /* Set the metadata delay for objects */
#endif
        if ( ( error = IVAS_REND_SetIsmMetadataDelay( hIvasRend, args.syncMdDelay ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nError in IVAS_REND_SetIsmMetadataDelay(): %s\n", ivas_error_to_string( error ) );
            goto cleanup;
        }
#ifdef NONBE_1359_FIX_IVASREND_OMASA_BINAURAL_LOUDNESS

        /* For OMASA input and BINAURAL output, apply a gain to objects to match the loudness with MASA part */
        if ( args.inConfig.numMasaBuses > 0 && args.outConfig.audioConfig == IVAS_AUDIO_CONFIG_BINAURAL )
        {
            for ( i = 0; i < args.inConfig.numAudioObjects; ++i )
            {
                args.inConfig.audioObjects[i].gain_dB += OMASA_TDREND_MATCHING_GAIN_DB;
            }
        }
#endif
    }

    IVAS_REND_LfePanMtx lfePanMatrix;
+4 −0
Original line number Diff line number Diff line
@@ -185,9 +185,13 @@
#define FIX_NCHAN_BUFFERS                               /* VA: issue 1322: Correct the number of float buffers (channels) at the decoder */
#define FIX_RENDERER_STACK                              /* VA: issue 1322: reduction of renderers' buffers size */
#define JBM_MEMORY_OPT                                  /* VA: issue 916: optimization of RAM in the JBM decoder */
/*#define NONBE_1324_TC_BUFFER_MEMOERY_KEEP*/           /* VA: issue 1324: do not reset TSM memory in JBM bitrate switching */
#define FIX_1370_EXTERNAL_ORIENTATION_CHECK             /* Nokia: add sanity check for Euler angles for external orientations */
#define FIX_1413_IGF_INIT_PRINTOUT                      /* FhG: use correct variable for IGF initiliazation */
#define CODE_IMPROVEMENTS
#define NONBE_1359_FIX_IVASREND_OMASA_BINAURAL_LOUDNESS /* Nokia: issue 1339: Apply scaling to the object-part of OMASA for binaural rendering in IVAS_rend. */
#define NONBE_1362_FIX_OMASA_TO_MASA1_RENDERING         /* Nokia: Fix OMASA to MASA1 rendering in IVAS_rend */
#define FIX_1383_HEAD_TRACK_SANITIZER                   /* Nok: issue 1383: Fix head tracking struc values reading in renderer */
#define FIX_1411_IGF_CRASH_BW_SWITCHING                 /* FhG: Fix for issue 1411: fixes crash that can happen for IGF with BW switching and DTX*/

// object-editing feature porting
+32 −1
Original line number Diff line number Diff line
@@ -2422,7 +2422,10 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure(
    const int16_t n_samples_granularity     /* i  : new granularity of the renderer/buffer  */
)
{

#ifdef NONBE_1324_TC_BUFFER_MEMOERY_KEEP
    int16_t ch_idx, num_tc_buffer_mem, n_samples_still_available;
    float tc_buffer_mem[MAX_INTERN_CHANNELS][L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES - 1];
#endif
#ifdef JBM_MEMORY_OPT
    ivas_error error;
#else
@@ -2433,6 +2436,26 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure(

    hTcBuffer = st_ivas->hTcBuffer;

#ifdef NONBE_1324_TC_BUFFER_MEMOERY_KEEP
    num_tc_buffer_mem = 0;
    n_samples_still_available = 0;

    if ( st_ivas->hDecoderConfig->Opt_tsm )
    {
        /* save samples of the TC buffer from the previous frame */
        num_tc_buffer_mem = min( hTcBuffer->nchan_transport_internal, nchan_transport_internal );
        n_samples_still_available = hTcBuffer->n_samples_buffered - hTcBuffer->n_samples_rendered;

        /* what is remaining from last frame needs always be smaller than the new granularity */
        assert( n_samples_still_available < n_samples_granularity );

        for ( ch_idx = 0; ch_idx < num_tc_buffer_mem; ch_idx++ )
        {
            mvr2r( hTcBuffer->tc_buffer_old[ch_idx] + hTcBuffer->n_samples_flushed, tc_buffer_mem[ch_idx], n_samples_still_available );
        }
    }

#endif
    /* if granularity changes, adapt subframe_nb_slots */
    if ( n_samples_granularity != hTcBuffer->n_samples_granularity )
    {
@@ -2550,6 +2573,14 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure(
    }
#endif

#ifdef NONBE_1324_TC_BUFFER_MEMOERY_KEEP
    /* propagate samples of the TC buffer from the previous frame */
    for ( ch_idx = 0; ch_idx < num_tc_buffer_mem; ch_idx++ )
    {
        mvr2r( tc_buffer_mem[ch_idx], hTcBuffer->tc_buffer_old[ch_idx], n_samples_still_available );
    }

#endif
    return IVAS_ERR_OK;
}

+32 −1
Original line number Diff line number Diff line
@@ -33,7 +33,7 @@
#include "options.h"
#include "isar_lc3plus_common.h"
#include "ivas_error.h"
#include "lc3.h"
#include "lc3plus.h"

/*-----------------------------------------------------------------------------------------*
 * Function ISAR_LC3PLUS_LC3plusErrToIvasErr()
@@ -57,6 +57,13 @@ ivas_error ISAR_LC3PLUS_LC3plusErrToIvasErr(
    return IVAS_ERR_INTERNAL;
}


/*-----------------------------------------------------------------------------------------*
 * Function IVAS_LC3PLUS_LC3plusRtpErrToIvasErr()
 *
 *
 *-----------------------------------------------------------------------------------------*/

ivas_error IVAS_LC3PLUS_LC3plusRtpErrToIvasErr(
    const LC3PLUS_RTP_ERR lc3PlusRtpError )
{
@@ -85,3 +92,27 @@ ivas_error IVAS_LC3PLUS_LC3plusRtpErrToIvasErr(

    return IVAS_ERR_UNKNOWN;
}

/*-----------------------------------------------------------------------------------------*
 * Function IVAS_LC3PLUS_UsToLC3plusFrameDuration()
 *
 *
 *-----------------------------------------------------------------------------------------*/

LC3PLUS_FrameDuration IVAS_LC3PLUS_UsToLC3plusFrameDuration(
    const int16_t lc3PlusFrameDurationUs )
{
    switch ( lc3PlusFrameDurationUs )
    {
        case 2500:
            return LC3PLUS_FRAME_DURATION_2p5MS;
        case 5000:
            return LC3PLUS_FRAME_DURATION_5MS;
        case 10000:
            return LC3PLUS_FRAME_DURATION_10MS;
        default:
            break;
    }

    return LC3PLUS_FRAME_DURATION_UNDEFINED;
}
Loading