Commit a6e2340b authored by Dominik Weckbecker's avatar Dominik Weckbecker 💬
Browse files

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

Merge remote-tracking branch 'origin/main' into 2139-edited-object-gains-not-evaluated-in-the-ism-gain-calculation
parents be20b1dc 2aa01294
Loading
Loading
Loading
Loading
Loading
+53 −5
Original line number Diff line number Diff line
@@ -3108,6 +3108,13 @@ void getMetadataFromFileReader(
        fprintf( stderr, "\nError (%s) while reading ISM metadata from: %s\n\n", ivas_error_to_string( error ), IsmFileReader_getFilePath( ismReader ) );
        exit( -1 );
    }
#ifdef FIX_2084_FLOATING_POINT_LEFTOVERS
    objectMetadataBuffer->positions[objIdx].azimuth_fx = ismMetadata.azimuth_fx;
    objectMetadataBuffer->positions[objIdx].elevation_fx = ismMetadata.elevation_fx;
    objectMetadataBuffer->positions[objIdx].radius_fx = ismMetadata.radius_fx;
    objectMetadataBuffer->positions[objIdx].yaw_fx = ismMetadata.yaw_fx;
    objectMetadataBuffer->positions[objIdx].pitch_fx = ismMetadata.pitch_fx;
#else
    objectMetadataBuffer->positions[objIdx].azimuth_fx = (Word32) ( ismMetadata.azimuth * ( 1 << 22 ) );
    objectMetadataBuffer->positions[objIdx].elevation_fx = (Word32) ( ismMetadata.elevation * ( 1 << 22 ) );
    objectMetadataBuffer->positions[objIdx].radius_fx = (Word16) ( ismMetadata.radius * ( 1 << 9 ) );
@@ -3119,6 +3126,7 @@ void getMetadataFromFileReader(
    objectMetadataBuffer->positions[objIdx].radius = ismMetadata.radius;
    objectMetadataBuffer->positions[objIdx].yaw = ismMetadata.yaw;
    objectMetadataBuffer->positions[objIdx].pitch = ismMetadata.pitch;
#endif
    objectMetadataBuffer->positions[objIdx].non_diegetic_flag = ismMetadata.non_diegetic_flag;

    return;
@@ -3172,20 +3180,50 @@ static void IsmPositionProvider_getNextFrame(
        /* Otherwise fall back to default position */
        else
        {
#ifdef FIX_2084_FLOATING_POINT_LEFTOVERS
            objectMetadataBuffer->positions[objIdx].azimuth_fx = 0;
            objectMetadataBuffer->positions[objIdx].elevation_fx = 0;
            objectMetadataBuffer->positions[objIdx].radius_fx = 512; // 1.f in Q9
            objectMetadataBuffer->positions[objIdx].yaw_fx = 0;
            objectMetadataBuffer->positions[objIdx].pitch_fx = 0;
            objectMetadataBuffer->positions[objIdx].non_diegetic_flag = 0;
#else
            objectMetadataBuffer->positions[objIdx].azimuth = 0.0f;
            objectMetadataBuffer->positions[objIdx].elevation = 0.0f;
            objectMetadataBuffer->positions[objIdx].radius = 1.0f;
            objectMetadataBuffer->positions[objIdx].yaw = 0.0f;
            objectMetadataBuffer->positions[objIdx].pitch = 0.0f;
            objectMetadataBuffer->positions[objIdx].azimuth_fx = 0;
            objectMetadataBuffer->positions[objIdx].elevation_fx = 0;
            objectMetadataBuffer->positions[objIdx].radius_fx = 512;
            objectMetadataBuffer->positions[objIdx].yaw_fx = 0;
            objectMetadataBuffer->positions[objIdx].pitch_fx = 0;
            objectMetadataBuffer->positions[objIdx].non_diegetic_flag = 0;
#endif
        }

        /* Wrap azimuth to lie within (-180, 180] range */
#ifdef FIX_2084_FLOATING_POINT_LEFTOVERS
        while ( LT_32( objectMetadataBuffer->positions[objIdx].azimuth_fx, 0 ) )
        {
            objectMetadataBuffer->positions[objIdx].azimuth_fx = L_add( objectMetadataBuffer->positions[objIdx].azimuth_fx, DEG_360_IN_Q22 );
        }
        while ( GE_32( objectMetadataBuffer->positions[objIdx].azimuth_fx, DEG_360_IN_Q22 ) )
        {
            objectMetadataBuffer->positions[objIdx].azimuth_fx = L_sub( objectMetadataBuffer->positions[objIdx].azimuth_fx, DEG_360_IN_Q22 );
        }

        /* Clamp elevation to lie within [-90, 90] range (can't be wrapped easily) */
        objectMetadataBuffer->positions[objIdx].elevation_fx = L_min( L_max( objectMetadataBuffer->positions[objIdx].elevation_fx, -DEG_90_IN_Q22 ), DEG_90_IN_Q22 );

        /* Wrap yaw to lie within (-180, 180] range */
        while ( LT_32( objectMetadataBuffer->positions[objIdx].yaw_fx, 0 ) )
        {
            objectMetadataBuffer->positions[objIdx].yaw_fx = L_add( objectMetadataBuffer->positions[objIdx].yaw_fx, DEG_360_IN_Q22 );
        }
        while ( GE_32( objectMetadataBuffer->positions[objIdx].yaw_fx, DEG_360_IN_Q22 ) )
        {
            objectMetadataBuffer->positions[objIdx].yaw_fx = L_sub( objectMetadataBuffer->positions[objIdx].yaw_fx, DEG_360_IN_Q22 );
        }

        /* Clamp pitch to lie within [-90, 90] range (can't be wrapped easily) */
        objectMetadataBuffer->positions[objIdx].pitch_fx = L_min( L_max( objectMetadataBuffer->positions[objIdx].pitch_fx, -DEG_90_IN_Q22 ), DEG_90_IN_Q22 );
#else
        while ( objectMetadataBuffer->positions[objIdx].azimuth < 0.0f )
        {
            objectMetadataBuffer->positions[objIdx].azimuth += 360.0f;
@@ -3213,6 +3251,7 @@ static void IsmPositionProvider_getNextFrame(
        objectMetadataBuffer->positions[objIdx].pitch = min( max( objectMetadataBuffer->positions[objIdx].pitch, -90 ), 90 );
        objectMetadataBuffer->positions[objIdx].yaw_fx = (Word32) ( ( objectMetadataBuffer->positions[objIdx].yaw ) * ( 1 << Q22 ) );
        objectMetadataBuffer->positions[objIdx].pitch_fx = (Word32) ( ( objectMetadataBuffer->positions[objIdx].pitch ) * ( 1 << Q22 ) );
#endif
    }

    ++positionProvider->frameCounter;
@@ -3517,6 +3556,14 @@ static void parseObjectPosition(
        exit( -1 );
    }

#ifdef FIX_2084_FLOATING_POINT_LEFTOVERS
    position->azimuth_fx = (Word32) ( meta_prm[0] * ( 1 << Q22 ) );   /* Q22 */
    position->elevation_fx = (Word32) ( meta_prm[1] * ( 1 << Q22 ) ); /* Q22 */
    position->radius_fx = (Word16) ( meta_prm[2] * ( 1 << Q9 ) );     /* Q9 */
    position->yaw_fx = (Word32) ( meta_prm[5] * ( 1 << Q22 ) );       /* Q22 */
    position->pitch_fx = (Word32) ( meta_prm[6] * ( 1 << Q22 ) );     /* Q22 */
    position->non_diegetic_flag = (Word16) meta_prm[7];
#else
    position->azimuth = meta_prm[0];
    position->elevation = meta_prm[1];
    position->azimuth_fx = (Word32) ( meta_prm[0] * ( 1 << 22 ) );
@@ -3525,6 +3572,7 @@ static void parseObjectPosition(
    position->yaw = meta_prm[5];
    position->pitch = meta_prm[6];
    position->non_diegetic_flag = (int16_t) meta_prm[7];
#endif

    return;
}
+2 −0
Original line number Diff line number Diff line
@@ -133,6 +133,7 @@ typedef struct _IVAS_ISM_METADATA
    Word32 gainFactor_fx; /* Q29 */
    Word32 yaw_fx;        /* Q22 */
    Word32 pitch_fx;      /* Q22 */
#ifndef FIX_2084_FLOATING_POINT_LEFTOVERS
    float azimuth;
    float elevation;
    float radius;
@@ -140,6 +141,7 @@ typedef struct _IVAS_ISM_METADATA
    float gainFactor;
    float yaw;
    float pitch;
#endif
    Word16 non_diegetic_flag;
    Word32 gain_fx; /* Q29 */

+10 −41
Original line number Diff line number Diff line
@@ -41,14 +41,12 @@
#include <assert.h>
#include "ivas_prot_fx.h"

#ifdef FIX_2089_NONBE_LIMITER_CONSTS
#define RELEASE_CNST_20MS   ( 85899345 )   // Q30
#define RELEASE_CNST_2_20MS ( 21474836 )   // Q30
#define RELEASE_CNST_10MS   ( 42949672 )   // Q30
#define RELEASE_CNST_2_10MS ( 10737418 )   // Q30
#define RELEASE_CNST_5MS    ( 21474836 )   // Q30
#define RELEASE_CNST_2_5MS  ( 5368709 )    // Q30
#endif
#define ATTACK_CNST_48k     ( 2106670080 ) // Q31
#define ATTACK_CNST_32k     ( 2086555136 ) // Q31
#define ATTACK_CNST_16k     ( 2027355264 ) // Q31
@@ -355,7 +353,6 @@ void limiter_process_fx(
     * keep the gain curve smoother if the threshold is exceeded in many frames
     * in a short span of time.
     */
#ifdef FIX_2089_NONBE_LIMITER_CONSTS
    IF( EQ_32( L_mult0( output_frame, 50 ), hLimiter->sampling_rate ) )
    {
        releaseHeuristic_cnst = RELEASE_CNST_20MS;
@@ -379,7 +376,6 @@ void limiter_process_fx(
    }
    ELSE
    {
#ifdef FIX_2089_NONBE_LIMITER_CONSTS_WITH_DIV
        // computing output_frame/hLimiter->sampling_rate in Q30
        i = norm_s( output_frame );
        c = norm_l( hLimiter->sampling_rate );
@@ -394,35 +390,8 @@ void limiter_process_fx(
        i = sub( sub( c, i ), 1 ); // Q30
        releaseHeuristic_cnst_2 = L_shl( scale, i );
        releaseHeuristic_cnst = L_shl( releaseHeuristic_cnst_2, 2 );
#else
        /* or same default values as previous code version */
        releaseHeuristic_cnst = RELEASE_CNST_5MS;
        move32();
        releaseHeuristic_cnst_2 = RELEASE_CNST_2_5MS;
        move32();
#endif
    }

#else
    SWITCH( output_frame )
    {
        case 960:
        case 640:
        case 320:
        case 160:
            releaseHeuristic_cnst = 85899345; /*Q30*/
            move32();
            releaseHeuristic_cnst_2 = 21474836; /*Q30*/
            move32();
            BREAK;
        default:
            releaseHeuristic_cnst = 21474836; /*Q30*/
            move32();
            releaseHeuristic_cnst_2 = 5368709; /*Q30*/
            move32();
            BREAK;
    }
#endif
    releaseHeuristic = hLimiter->release_heuristic_fx; /* Q30 */
    move32();

+2 −8
Original line number Diff line number Diff line
@@ -75,15 +75,9 @@

#define FIX_1990_SANITIZER_IN_REVERB_LOAD                    /* Nokia: Fix issue part of issue 1990 by introducing missing free of structure - keep until #2059 is addressed */
#define FIX_1999_TEMPORARY_DISABLE_DIST_ATT_CHECK            /* Eri: Issue 1999: Range check on float values of distance attenuation, while the float values are not propagated to this function. The test is not correct, but configurable distance attenuation is not used in Characterization.*/
#define OPT_IGF_GET_WHITE_SPEC_DATA                          /* FhG: optimized version of IGF_getWhiteSpectralData_ivas() */
#define FIX_2089_NONBE_LIMITER_CONSTS                        /* Orange : fix issue 2089 : Limiter attack and release constants differ from float version */
#ifdef FIX_2089_NONBE_LIMITER_CONSTS
#define FIX_2089_NONBE_LIMITER_CONSTS_WITH_DIV               /* Orange : compute release const for other output frame generate by jbm */  
#endif
#define FIX_1785_ASSERT_IN_IVAS_JBM_DEC_RENDER_FX            /* Orange: 10ms Rendering: Assert in ivas_jbm_dec_render_fx() -> scale_sig32 */
#define FIX_2081_REVISE_H1_SCALING                           /* VA: accommodate for H1 overshoot that was causing assert in set_impule. Not BE with MASA on LTV with bitrate switching for only 2 instances */
#define TEMP_FIX_2088_MSAN_INIT_ERROR                        /* Eri: Temporary fix for Issue 2088 - MSAN error. Will come with later port of JBM+Split rendering update */

#define FIX_2092_ASSERT_IN_OMASA_RENDER                      /* FhG, Nokia: Fix LTV crash due to overflow in OMASA EXT output */
#define FIX_2084_FLOATING_POINT_LEFTOVERS                    /* FhG: convert floating-point leftovers in IVAS_ENC_FeedObjectMetadata() */
/* ################### End FIXES switches ########################### */

/* #################### Start BASOP porting switches ############################ */
+0 −27
Original line number Diff line number Diff line
@@ -2857,9 +2857,7 @@ static void IGF_getWhiteSpectralData_ivas(
    Word16 tmp_e;
    Word16 out_e_arr[IGF_START_MX + MAX_IGF_SFB_LEN];
    Word16 max_out_e;
#ifdef OPT_IGF_GET_WHITE_SPEC_DATA
    Word64 window_sum;
#endif
    assert( LT_16( stop, IGF_START_MX + MAX_IGF_SFB_LEN ) );

    /* inits */
@@ -2885,30 +2883,18 @@ static void IGF_getWhiteSpectralData_ivas(
    ak_e = add( tmp_e, sub( shl( sub( in_e, s_l ), 1 ), 15 ) ); // tmp_e + 2 * (in_e - s_l) - 15
    ak_e = sub( ak_e, 1 );

#ifdef OPT_IGF_GET_WHITE_SPEC_DATA
    window_sum = 0;
    move64();
    FOR( j = start - level; j < start + level; j++ )
    {
        window_sum = W_mac_32_32( window_sum, in[j], in[j] );
    }
#endif

    FOR( i = start; i < stop - level; i++ )
    {
#ifdef OPT_IGF_GET_WHITE_SPEC_DATA
        window_sum = W_mac_32_32( window_sum, in[i + level], in[i + level] );           /* add the right one */
        ak = Mult_32_16( W_shl_sat_l( window_sum, shift ), quo );                       // add( shl( level, 1 ), 1 ), &tmp_e ) );
        window_sum = W_sub( window_sum, W_mult_32_32( in[i - level], in[i - level] ) ); /* subtract the left one */
#else
        Word64 temp = 0;
        move64();
        FOR( j = i - level; j < i + level + 1; j++ )
        {
            temp = W_mac_32_32( temp, in[j], in[j] );
        }
        ak = Mult_32_16( W_shl_sat_l( temp, shift ), quo ); // add( shl( level, 1 ), 1 ), &tmp_e ) );
#endif

        n = sub( ak_e, norm_l( ak ) );
        n = shr( n, 1 );
@@ -2920,22 +2906,9 @@ static void IGF_getWhiteSpectralData_ivas(

    FOR( ; i < stop; i++ )
    {
#ifdef OPT_IGF_GET_WHITE_SPEC_DATA
        ak = L_deposit_h( BASOP_Util_Divide3216_Scale( W_shl_sat_l( window_sum, shift ), sub( stop, sub( i, level ) ), &tmp_e ) );
        window_sum = W_sub( window_sum, W_mult_32_32( in[i - level], in[i - level] ) ); /* subtract the left one */
        ak_e = add( tmp_e, eff_e );                                                     // tmp_e + 2 * (in_e - s_l) - 15
#else
        Word64 temp = 0;
        move64();

        FOR( j = i - level; j < stop; j++ )
        {
            temp = W_mac_32_32( temp, in[j], in[j] );
        }

        ak = L_deposit_h( BASOP_Util_Divide3216_Scale( W_shl_sat_l( temp, shift ), sub( stop, sub( i, level ) ), &tmp_e ) );
        ak_e = add( tmp_e, eff_e ); // tmp_e + 2 * (in_e - s_l) - 15
#endif

        n = sub( ak_e, add( norm_l( ak ), 1 ) );
        n = shr( n, 1 );
Loading