Commit f4c65a71 authored by multrus's avatar multrus
Browse files

merge from main

parents 25aff9c9 4c369fc1
Loading
Loading
Loading
Loading
Loading
+32 −0
Original line number Diff line number Diff line
@@ -507,6 +507,14 @@ int main(
            goto cleanup;
        }

#ifdef FIX_2500_RENDCONF_REFACTOR
        if ( RenderConfigReader_checkValues( renderConfigReader ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "Invalid renderer configuration parameters\n\n" );
            goto cleanup;
        }
#endif

        aeCount = RenderConfigReader_getAcousticEnvironmentCount( renderConfigReader );
        if ( aeCount > 0 )
        {
@@ -585,6 +593,13 @@ int main(

        if ( arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB )
        {
#ifdef FIX_2500_RENDCONF_REFACTOR
            if ( ( error = IVAS_DEC_GetAcousticEnvironment( hIvasDec, aeID, &renderConfig.roomAcoustics ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "Failed to get acoustic environment with ID: %d\n\n", aeID );
                goto cleanup;
            }
#else
            if ( ( error = IVAS_DEC_GetAcousticEnvironment( hIvasDec, aeID, &renderConfig.roomAcoustics ) ) == IVAS_ERR_OK )
            {
                if ( RenderConfigReader_checkValues( &renderConfig ) != IVAS_ERR_OK )
@@ -598,6 +613,7 @@ int main(
                fprintf( stderr, "Failed to get acoustic environment with ID: %d\n\n", aeID );
                goto cleanup;
            }
#endif
        }

        /* ISAR frame size is set from command line, not renderer config file.
@@ -2114,6 +2130,14 @@ static ivas_error decodeG192(
            fprintf( stderr, "Failed to read renderer configuration from file %s\n\n", arg.renderConfigFilename );
            goto cleanup;
        }

#ifdef FIX_2500_RENDCONF_REFACTOR
        if ( RenderConfigReader_checkValues( renderConfigReader ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "Invalid renderer configuration parameters\n\n" );
            goto cleanup;
        }
#endif
    }

    for ( i = 0; i < IVAS_MAX_NUM_OBJECTS; ++i )
@@ -2276,6 +2300,13 @@ static ivas_error decodeG192(
                            arg.aeSequence.selected = 0;
                        }
                        arg.aeSequence.frameCounter = 0;
#ifdef FIX_2500_RENDCONF_REFACTOR
                        if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, arg.aeSequence.pID[arg.aeSequence.selected], &renderConfig.roomAcoustics ) ) != IVAS_ERR_OK )
                        {
                            fprintf( stderr, "Failed to get acoustic environment with ID %d\n\n", arg.aeSequence.pID[arg.aeSequence.selected] );
                            goto cleanup;
                        }
#else
                        if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, arg.aeSequence.pID[arg.aeSequence.selected], &renderConfig.roomAcoustics ) ) == IVAS_ERR_OK )
                        {
                            if ( RenderConfigReader_checkValues( &renderConfig ) != IVAS_ERR_OK )
@@ -2289,6 +2320,7 @@ static ivas_error decodeG192(
                            fprintf( stderr, "Failed to get acoustic environment with ID %d\n\n", arg.aeSequence.pID[arg.aeSequence.selected] );
                            goto cleanup;
                        }
#endif
                        if ( ( error = IVAS_DEC_FeedRenderConfig( hIvasDec, renderConfig ) ) != IVAS_ERR_OK )
                        {
                            fprintf( stderr, "\nIVAS_DEC_FeedRenderConfig failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
+37 −0
Original line number Diff line number Diff line
@@ -1246,6 +1246,13 @@ int main(
            fprintf( stderr, "\nFailed to read renderer configuration from file %s\n", args.renderConfigFilePath );
            goto cleanup;
        }
#ifdef FIX_2500_RENDCONF_REFACTOR
        if ( RenderConfigReader_checkValues( renderConfigReader ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "Invalid renderer configuration parameters\n\n" );
            goto cleanup;
        }
#endif
        if ( ( error = RenderConfigReader_getDirectivity( renderConfigReader, args.directivityPatternId, renderConfig.directivity_fx ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "Failed to get directivity patterns for one or more of IDs: %d %d %d %d\n\n", args.directivityPatternId[0], args.directivityPatternId[1], args.directivityPatternId[2], args.directivityPatternId[3] );
@@ -1259,6 +1266,13 @@ int main(
        if ( args.outConfig.audioConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB )
        {
            aeID = args.aeSequence.count > 0 ? args.aeSequence.pID[0] : IVAS_DEFAULT_AEID;
#ifdef FIX_2500_RENDCONF_REFACTOR
            if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, aeID, &renderConfig.roomAcoustics ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "\nFailed to get acoustic environment with ID: %d\n\n", aeID );
                goto cleanup;
            }
#else
            if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, aeID, &renderConfig.roomAcoustics ) ) == IVAS_ERR_OK )
            {
                if ( RenderConfigReader_checkValues( &renderConfig ) != IVAS_ERR_OK )
@@ -1272,6 +1286,7 @@ int main(
                fprintf( stderr, "Failed to get acoustic environment with ID: %d\n\n", aeID );
                goto cleanup;
            }
#endif
        }

        /* ISAR frame size is set from command line, not renderer config file.
@@ -1716,6 +1731,13 @@ int main(
                    args.aeSequence.selected = 0;
                }
                args.aeSequence.frameCounter = 0;
#ifdef FIX_2500_RENDCONF_REFACTOR
                if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, args.aeSequence.pID[args.aeSequence.selected], &renderConfig.roomAcoustics ) ) != IVAS_ERR_OK )
                {
                    fprintf( stderr, "\nFailed to get acoustic environment with ID %d\n\n", args.aeSequence.pID[args.aeSequence.selected] );
                    goto cleanup;
                }
#else
                if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, args.aeSequence.pID[args.aeSequence.selected], &renderConfig.roomAcoustics ) ) == IVAS_ERR_OK )
                {
                    if ( RenderConfigReader_checkValues( &renderConfig ) != IVAS_ERR_OK )
@@ -1729,6 +1751,7 @@ int main(
                    fprintf( stderr, "Failed to get acoustic environment with ID %d\n\n", args.aeSequence.pID[args.aeSequence.selected] );
                    goto cleanup;
                }
#endif
                if ( ( error = IVAS_REND_FeedRenderConfig( hIvasRend, renderConfig ) ) != IVAS_ERR_OK )
                {
                    fprintf( stderr, "\nIVAS_REND_FeedRenderConfig failed: %s\n\n", ivas_error_to_string( error ) );
@@ -3179,7 +3202,13 @@ static void IsmPositionProvider_getNextFrame(
            objectMetadataBuffer->positions[objIdx].non_diegetic_flag = 0;
        }


#ifdef FIX_1548_HARMONIZE_NON_DIEGETIC_PANNING_LAW
        /* Wrap azimuth to lie within (0, 360] range */
#else
        /* Wrap azimuth to lie within (-180, 180] range */
#endif

        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 );
@@ -3189,6 +3218,14 @@ static void IsmPositionProvider_getNextFrame(
            objectMetadataBuffer->positions[objIdx].azimuth_fx = L_sub( objectMetadataBuffer->positions[objIdx].azimuth_fx, DEG_360_IN_Q22 );
        }

#ifdef FIX_1548_HARMONIZE_NON_DIEGETIC_PANNING_LAW
        IF( objectMetadataBuffer->positions[objIdx].non_diegetic_flag && objectMetadataBuffer->positions[objIdx].azimuth_fx >= DEG_180_IN_Q22 )
        {
            /* Wrap azimuth to lie within [-180, 180) range for non-diegetic panning */
            objectMetadataBuffer->positions[objIdx].azimuth_fx = L_sub( objectMetadataBuffer->positions[objIdx].azimuth_fx, DEG_360_IN_Q22 );
        }
#endif

        /* 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 );

+14 −0
Original line number Diff line number Diff line
@@ -896,7 +896,21 @@ Word16 shr_o( Word16 var1, Word16 var2, Flag *Overflow )

Word16 shr( Word16 var1, Word16 var2 )
{
#ifdef FIX_BASOP_2563_CRASH_HQ_GENERIC_DEC
    Flag Overflow;
    Word16 result;

    Overflow = 0;

    result = shr_o( var1, var2, &Overflow );
    if ( Overflow )
    {
        assert( 0 );
    }
    return result;
#else
    return shr_o( var1, var2, NULL );
#endif
}
Word16 shr_sat( Word16 var1, Word16 var2 )
{
+8 −0
Original line number Diff line number Diff line
@@ -1588,6 +1588,11 @@ typedef enum
#define RESAMPLE_FACTOR_16_48_FX                ( 5461 )  // Q14
#define RESAMPLE_FACTOR_32_48_FX                ( 10922 ) // Q14

#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION
#define DIST_ATT_DEFAULT_MAXDIST_Q25 528482304 /* Q25 */                      /* Default maxDist based on maximum radius in encoded metadata (2^ISM_RADIUS_NBITS-1)*0.25 */ 
#define DIST_ATT_DEFAULT_REFDIST_Q28 ONE_IN_Q28 /* Q28 */                     /* Default refDist 1.0 in Q28 */                                      
#define DIST_ATT_DEFAULT_ROLLOFF_Q28 ONE_IN_Q28 /* Q28 */                     /* Default rolloffFactor 1.0 in Q28 */                                      
#endif

/* ----- Enums - TD Renderer ----- */

@@ -1948,6 +1953,9 @@ typedef enum
#define ONE_IN_Q31                              0x7fffffff
#define ONE_IN_Q45                              (Word64)0x200000000000
#define ONE_IN_Q62                              (Word64)0x4000000000000000
#ifdef FIX_1548_HARMONIZE_NON_DIEGETIC_PANNING_LAW
#define MINUS_ONE_IN_Q31                        ( -2147483647 - 1 ) /* same as (Word32)0x80000000 */
#endif

#define MAX_WORD16                              32767

+24 −3
Original line number Diff line number Diff line
@@ -2800,17 +2800,34 @@ void InternalTCXDecoder_fx(

void stereo_tcx_core_enc(
    Encoder_State *st,                                          /* i/o: encoder state structure                 */
#ifdef SIMPLIFY_CORE_ENC
    Word16 new_samples_12k8[],                                  /* i  : buffer of input signal @12.8 kHz        */
    Word16 new_samples_16k[],                                   /* i  : buffer of input signal @16 kHz          */
#else
    const Word16 new_samples_12k8[],                            /* i  : buffer of input signal @12.8 kHz        */
    const Word16 new_samples_16k[],                             /* i  : buffer of input signal @16 kHz          */
#endif
    const Word16 Aw_fx[],                                       /* i  : weighted A(z) unquant. for subframes,Q12*/
    Word16 lsp_new_fx[],                                        /* i  : LSPs at the end of the frame,    Q15    */
    Word16 lsp_mid_fx[],                                        /* i  : LSPs in the middle of the frame, Q15    */
    Word16 pitch_buf_fx[NB_SUBFR16k],                           /* o  : pitch for each subframe, Q6             */
    const Word16 last_element_mode,                             /* i  : last element mode, Q0                   */
    const Word16 vad_hover_flag,                                /* i  : VAD hangover flag, Q0                   */
#ifdef SIMPLIFY_CORE_ENC
    const Word16 Q_new_orig                                     /* i  : Scaling factor of new_samples_xx[]     */
#else
    Word16 Q_new
#endif
);

#ifdef SIMPLIFY_CORE_ENC
void stereo_tcx_enc_scale_buffers( 
    Encoder_State *st,                                          /* i/o: encoder state structure                 */
    const Word16 n_channels,                                    /* i  : number of core channels                 */
    const Word16 Q_spec_old                                     /* i  : Q of old spectrum                       */
);

#endif
Word16 transient_analysis_ivas_fx(
    TRAN_DET_HANDLE hTranDet,                                   /* i  : handle transient detection              */
    const Word16 cor_map_LT[],                                  /* i  : LT correlation map  Q_cor_map = Qx      */
@@ -5747,7 +5764,11 @@ void pre_proc_ivas_fx(
    const Word16 vad_hover_flag,                                /* i  : VAD hangover flag                                    Q0*/
    const Word16 flag_16k_smc,                                  /* i  : flag to indicate if the OL SMC is run at 16 kHz      Q0*/
    Word32 enerBuffer_fx[CLDFB_NO_CHANNELS_MAX],                /* i  : energy buffer                             e_enerBuffer */
#ifdef SIMPLIFY_CORE_ENC
    Word16 e_enerBuffer,                                        /* i  : Q value of energy buffer                               */
#else
    const Word16 e_enerBuffer,                                  /* i  : Q value of energy buffer                               */
#endif
    Word16 fft_buff_fx[2 * L_FFT],                              /* i  : FFT buffer                                           Qx*/
    const Word16 cor_map_sum_fx,                                /* i  : speech/music clasif. parameter                       Q8*/
    Word16 *Q_new                                               /* i/o: Q factor of speech buffers                             */
@@ -5816,8 +5837,8 @@ ivas_error ivas_core_enc_fx(
    const Word16 loc_harm[],                                    /* i  : harmonicity flag                              Q0*/
    const Word16 cor_map_sum_fx[],                              /* i  : speech/music clasif. parameter                Q8*/
    const Word16 vad_flag_dtx[],                                /* i  : HE-SAD flag with additional DTX HO            Q0*/
    Word32 enerBuffer_fx[][CLDFB_NO_CHANNELS_MAX],              /* o  : energy buffer                  enerBuffer_fx_exp*/
    Word16 enerBuffer_fx_exp[],                                 /* o  : energy buffer                                   */
    Word32 enerBuffer_fx[][CLDFB_NO_CHANNELS_MAX],              /* i  : energy buffer                  enerBuffer_fx_exp*/
    Word16 enerBuffer_fx_exp[],                                 /* i  : energy buffer                                   */
    Word16 fft_buff_fx[][2 * L_FFT],                            /* i  : FFT buffer                                    Qx*/
    const Word16 tdm_SM_or_LRTD_Pri,                            /* i  : channel combination scheme flag               Q0*/
    const Word16 ivas_format,                                   /* i  : IVAS format                                   Q0*/
Loading