Commit ef0c516b authored by vaclav's avatar vaclav
Browse files

Merge remote-tracking branch 'remotes/origin/main' into 1961-rom_com-files-duplications

parents 4290523b f735028f
Loading
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -89,6 +89,7 @@


#define FIX_1931_BIN_COHR_CROSS_MIX                    /* FhG: correct binauralCoherenceCrossmixGains_fx calculation */
#define FIX_1939_REVERB_DMX_OUT_Q                       /*Dlb: output correct q factor for the reverb dmx function*/

#define EVS_BE_REUSAGE
#ifdef EVS_BE_REUSAGE
@@ -166,6 +167,7 @@
#define NONBE_FIX_1337_MISSING_DIRECTIVITY_DISTATT_EXTREND /* Eri: issue 1337: Missing directivity setting and distance attenuation in external renderer IVAS_rend */
#define NONBE_1214_PLC_LSF_MEMORY                       /* VA: issue 1224: reset ACELP PLC FEC memory in case of switching from MDCT stereo to TD/DFT stereo */
#define NONBE_1293_SR_HRTF                              /* VA: issue 1293: add support of external HRTFs in split rendering */
#define FIX_1249_REMOVE_OBSOLETE_ALLRAD_MATRIX          /* VA: issue 1249: remove obsolete code around ALLRAD decoder matrix */
#define NONBE_1220_OMASA_JBM_BRATE_SW_FLUSH             /* VA: issue 1220: fix bug in renderer flush in OMASA 1ISM JBM bitrate switching */
#define FIX_1139_REV_COLORATION_SHORT_T60               /* Nokia,FhG: Fix issue 1139, prevent sound coloration artefacts at very low reverberation times */

+40 −10
Original line number Diff line number Diff line
@@ -904,7 +904,16 @@ static ivas_error ivas_binaural_hrtf_open_fx(
 *
 *
 *-------------------------------------------------------------------------*/

#ifdef FIX_1939_REVERB_DMX_OUT_Q
static void ivas_binaural_obtain_DMX_fx(
    const Word16 numTimeSlots,
    BINAURAL_RENDERER_HANDLE hBinRenderer,                                /* i/o: fastconv binaural renderer handle */
    Word32 RealBuffer[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i  : Contains the LS signals         Q_in_out  */
    Word32 ImagBuffer[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i  : Contains the LS signals         Q_in_out  */
    Word32 realDMX[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX],    /*Q_in_out*/
    Word32 imagDMX[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX],    /*Q_in_out*/
    Word16 *Q_in_out )                                                    /*i/o: input and output Q*/
#else
static void ivas_binaural_obtain_DMX_fx(
    const Word16 numTimeSlots,
    BINAURAL_RENDERER_HANDLE hBinRenderer,                                /* i/o: fastconv binaural renderer handle */
@@ -912,6 +921,7 @@ static void ivas_binaural_obtain_DMX_fx(
    Word32 ImagBuffer[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i  : Contains the LS signals         Q_in  */
    Word32 realDMX[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX],    /*Q_in-1*/
    Word32 imagDMX[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX] )   /*Q_in-1*/
#endif
{
    Word16 chIdx, bandIdx, k;

@@ -950,13 +960,13 @@ static void ivas_binaural_obtain_DMX_fx(
                {
                    FOR( k = 0; k < numTimeSlots; k++ )
                    {
                        temp1_fx = Mpy_32_32( RealBuffer[chIdx][k][bandIdx], dmxConst );                  // Q_in
                        temp2_fx = Mpy_32_32( ImagBuffer[chIdx][k][bandIdx], dmxConst );                  // Q_in
                        realDMX[chOutIdx][k][bandIdx] = L_add( realDMX[chOutIdx][k][bandIdx], temp1_fx ); // Q_in
                        temp1_fx = Mpy_32_32( RealBuffer[chIdx][k][bandIdx], dmxConst );                  // Q_in_out
                        temp2_fx = Mpy_32_32( ImagBuffer[chIdx][k][bandIdx], dmxConst );                  // Q_in_out
                        realDMX[chOutIdx][k][bandIdx] = L_add( realDMX[chOutIdx][k][bandIdx], temp1_fx ); // Q_in_out
                        move32();
                        imagDMX[chOutIdx][k][bandIdx] = L_add( imagDMX[chOutIdx][k][bandIdx], temp2_fx ); // Q_in
                        imagDMX[chOutIdx][k][bandIdx] = L_add( imagDMX[chOutIdx][k][bandIdx], temp2_fx ); // Q_in_out
                        move32();
                        P_in_fx[bandIdx] = L_add( P_in_fx[bandIdx], L_add( Mpy_32_32( temp1_fx, temp1_fx ), Mpy_32_32( temp2_fx, temp2_fx ) ) ); // Q31-2*Q_in
                        P_in_fx[bandIdx] = L_add( P_in_fx[bandIdx], L_add( Mpy_32_32( temp1_fx, temp1_fx ), Mpy_32_32( temp2_fx, temp2_fx ) ) ); // Q31-2*Q_in_out
                        move32();
                    }
                }
@@ -972,7 +982,7 @@ static void ivas_binaural_obtain_DMX_fx(
                    move32();
                    temp2_fx = imagDMX[chOutIdx][k][bandIdx];
                    move32();
                    P_out_fx = L_add( P_out_fx, L_add( Mpy_32_32( temp1_fx, temp1_fx ), Mpy_32_32( temp2_fx, temp2_fx ) ) ); // Q31-2*Q_in
                    P_out_fx = L_add( P_out_fx, L_add( Mpy_32_32( temp1_fx, temp1_fx ), Mpy_32_32( temp2_fx, temp2_fx ) ) ); // Q31-2*Q_in_out
                }
                test();
                IF( ( P_in_fx[bandIdx] <= 0 ) || ( P_out_fx <= 0 ) )
@@ -996,13 +1006,16 @@ static void ivas_binaural_obtain_DMX_fx(
                factEQ_fx = L_max( L_min( factEQ_fx, 0x7fffffff ), 0x20000000 ); // Q30 , 0x7fffffff -> (1.0f in Q31)-1, 0x20000000 ->1.0f in Q29
                FOR( k = 0; k < numTimeSlots; k++ )
                {
                    realDMX[chOutIdx][k][bandIdx] = Mpy_32_32( realDMX[chOutIdx][k][bandIdx], factEQ_fx ); // Q_in - 1
                    realDMX[chOutIdx][k][bandIdx] = Mpy_32_32( realDMX[chOutIdx][k][bandIdx], factEQ_fx ); // Q_in_out - 1
                    move32();
                    imagDMX[chOutIdx][k][bandIdx] = Mpy_32_32( imagDMX[chOutIdx][k][bandIdx], factEQ_fx ); // Q_in - 1
                    imagDMX[chOutIdx][k][bandIdx] = Mpy_32_32( imagDMX[chOutIdx][k][bandIdx], factEQ_fx ); // Q_in_out - 1
                    move32();
                }
            }
        }
#ifdef FIX_1939_REVERB_DMX_OUT_Q
        *Q_in_out = sub( *Q_in_out, 1 );
#endif
    }
    ELSE IF( EQ_32( hBinRenderer->ivas_format, SBA_FORMAT ) || EQ_32( hBinRenderer->ivas_format, MASA_FORMAT ) )
    {
@@ -1070,6 +1083,12 @@ static void ivas_binaural_obtain_DMX_fx(
                }
            }
        }
#ifdef FIX_1939_REVERB_DMX_OUT_Q
        IF( NE_16( hBinRenderer->nInChannels, HOA3_CHANNELS ) )
        {
            *Q_in_out = sub( *Q_in_out, 1 );
        }
#endif
    }

    return;
@@ -1852,8 +1871,16 @@ void ivas_binRenderer_fx(
        Word32 inRe_fx[BINAURAL_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX];
        Word32 inIm_fx[BINAURAL_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX];
        Word16 shift_q;
#ifdef FIX_1939_REVERB_DMX_OUT_Q
        Word16 q_in_out;
        q_in_out = *Q_in;
#endif

#ifdef FIX_1939_REVERB_DMX_OUT_Q
        ivas_binaural_obtain_DMX_fx( numTimeSlots, hBinRenderer, RealBuffer_fx, ImagBuffer_fx, inRe_fx, inIm_fx, &q_in_out );
#else
        ivas_binaural_obtain_DMX_fx( numTimeSlots, hBinRenderer, RealBuffer_fx, ImagBuffer_fx, inRe_fx, inIm_fx );
#endif

        FOR( chIdx = 0; chIdx < BINAURAL_CHANNELS; chIdx++ )
        {
@@ -1865,8 +1892,11 @@ void ivas_binRenderer_fx(
        }

        ivas_binaural_reverb_processSubframe_fx( hBinRenderer->hReverb, BINAURAL_CHANNELS, numTimeSlots, inRe_fx, inIm_fx, reverbRe_fx, reverbIm_fx );

#ifdef FIX_1939_REVERB_DMX_OUT_Q
        shift_q = sub( Q6, q_in_out );
#else
        shift_q = sub( Q6, sub( *Q_in, 1 ) );
#endif
        FOR( i = 0; i < BINAURAL_CHANNELS; i++ )
        {
            FOR( j = 0; j < numTimeSlots; j++ )
+6 −2
Original line number Diff line number Diff line
@@ -1943,6 +1943,8 @@ ivas_error ivas_init_decoder_fx(
            return error;
        }
        set16_fx( st_ivas->hSpar->hFbMixer->cldfb_cross_fade_fx, 0, CLDFB_NO_COL_MAX );

#ifndef FIX_1249_REMOVE_OBSOLETE_ALLRAD_MATRIX
        test();
        IF( EQ_32( st_ivas->renderer_type, RENDERER_SBA_LINEAR_DEC ) && st_ivas->hOutSetup.is_loudspeaker_setup )
        {
@@ -1951,7 +1953,7 @@ ivas_error ivas_init_decoder_fx(
                return error;
            }
        }

#endif
        Word16 hodirac_flag = ivas_get_hodirac_flag_fx( ivas_total_brate, st_ivas->sba_analysis_order );
        IF( hodirac_flag )
        {
@@ -2005,6 +2007,7 @@ ivas_error ivas_init_decoder_fx(
        }
        st_ivas->sba_dirac_stereo_flag = ivas_get_sba_dirac_stereo_flag( st_ivas );
        move16();

        FOR( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ )
        {
            Word32 res_dec, res_frac;
@@ -2137,6 +2140,7 @@ ivas_error ivas_init_decoder_fx(
            return error;
        }

#ifndef FIX_1249_REMOVE_OBSOLETE_ALLRAD_MATRIX
        test();
        IF( EQ_32( st_ivas->renderer_type, RENDERER_SBA_LINEAR_DEC ) && st_ivas->hOutSetup.is_loudspeaker_setup )
        {
@@ -2145,7 +2149,7 @@ ivas_error ivas_init_decoder_fx(
                return error;
            }
        }

#endif
        Word16 hodirac_flag = ivas_get_hodirac_flag_fx( ivas_total_brate, st_ivas->sba_analysis_order );
        IF( hodirac_flag )
        {
+12 −0
Original line number Diff line number Diff line
@@ -397,8 +397,10 @@ void ivas_renderer_select(
        test();
        test();
        test();
#ifndef FIX_1249_REMOVE_OBSOLETE_ALLRAD_MATRIX
        test();
        test();
#endif
        IF( EQ_32( ivas_format, SBA_FORMAT ) && ( NE_32( output_config, IVAS_AUDIO_CONFIG_5_1 ) && NE_32( output_config, IVAS_AUDIO_CONFIG_5_1_2 ) && NE_32( output_config, IVAS_AUDIO_CONFIG_5_1_4 ) && NE_32( output_config, IVAS_AUDIO_CONFIG_7_1 ) && NE_32( output_config, IVAS_AUDIO_CONFIG_7_1_4 ) && NE_32( output_config, IVAS_AUDIO_CONFIG_LS_CUSTOM ) && NE_32( output_config, IVAS_AUDIO_CONFIG_MONO ) && NE_32( output_config, IVAS_AUDIO_CONFIG_STEREO ) ) )
        {
            test();
@@ -416,6 +418,13 @@ void ivas_renderer_select(
                *internal_config = output_config;
                move16();
            }
#ifdef FIX_1249_REMOVE_OBSOLETE_ALLRAD_MATRIX
            ELSE
            {
                *internal_config = IVAS_AUDIO_CONFIG_HOA3;
                move16();
            }
#else
            ELSE IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_MONO ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_STEREO ) )
            {
                *internal_config = IVAS_AUDIO_CONFIG_FOA;
@@ -430,6 +439,7 @@ void ivas_renderer_select(
                *internal_config = IVAS_AUDIO_CONFIG_HOA3;
                move16();
            }
#endif
            *renderer_type = RENDERER_SBA_LINEAR_DEC;
            move16();
        }
@@ -454,11 +464,13 @@ void ivas_renderer_select(
            *renderer_type = RENDERER_DISABLE;
            move16();
        }
#ifndef FIX_1249_REMOVE_OBSOLETE_ALLRAD_MATRIX
        ELSE IF( EQ_32( ivas_format, SBA_FORMAT ) && EQ_32( output_config, IVAS_AUDIO_CONFIG_MONO ) )
        {
            *renderer_type = RENDERER_SBA_LINEAR_DEC;
            move16();
        }
#endif
        ELSE IF( EQ_32( ivas_format, SBA_ISM_FORMAT ) && EQ_32( output_config, IVAS_AUDIO_CONFIG_STEREO ) )
        {
            *renderer_type = RENDERER_OSBA_STEREO;