Commit 68155186 authored by Archit Tamarapu's avatar Archit Tamarapu
Browse files

[fix] float issue: 1521: SBA loudness for binaural and stereo

parent 71deb78c
Loading
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -148,6 +148,8 @@
#define FIX_BASOP_2517_CLICK_IN_OMASA_LTV               /* FhG: BASOP #2517: preserve precision by removing one-bit headroom from Q_min and allowing saturation during buffer scaling */
#define FIX_BASOP_2559_Q_SYNTH_HISTORY_RESET            /* FhG: BASOP issue 2559: reset hTcxDec->q_synth_history_fx in allocate_CoreCoder_TCX_fx() */
#define FIX_FLOAT_1578_OMASA_REND_SPIKES                /* Nokia: Float issue 1578: Fix spikes and collapsed perception in OMASA/MASA rendering to FOA/HOA */
#define FIX_1521_SBA_LOUDNESS_STEREO                    /* FhG: issue 1521: Fix loudness for SBA to stereo rendering */
#define FIX_1521_SBA_LOUDNESS_BINAURAL                  /* FhG: issue 1521: Fix loudness for SBA to binaural rendering */

/* ##################### End NON-BE switches ########################### */

+13 −0
Original line number Diff line number Diff line
@@ -440,6 +440,19 @@ ivas_error ivas_dec_render_fx(
                return error;
            }
        }
#ifdef FIX_1521_SBA_LOUDNESS_BINAURAL
        test();
        test();
        IF( EQ_32( st_ivas->ivas_format, SBA_FORMAT ) &&
            ( EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) || EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV ) ) )
        {
            /* loudness correction for SBA binaural rendering */
            FOR( n = 0; n < BINAURAL_CHANNELS; n++ )
            {
                v_multc_fx( p_output_fx[n], INV_SQRT2_FX, p_output_fx[n], *nSamplesRendered );
            }
        }
#endif
    }
    ELSE IF( EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) )
    {
+5 −0
Original line number Diff line number Diff line
@@ -1569,8 +1569,13 @@ void ivas_sba_dirac_stereo_dec_fx(
    test();
    IF( !sba_mono_flag && !( EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) && EQ_16( st_ivas->ism_mode, ISM_MODE_NONE ) ) )
    {
#ifdef FIX_1521_SBA_LOUDNESS_STEREO
        v_multc_fx( output[0], INV_SQRT2_FX, output[0], output_frame );
        v_multc_fx( output[1], INV_SQRT2_FX, output[1], output_frame );
#else
        v_shr( output[0], 1, output[0], output_frame ); /*0.5f*/
        v_shr( output[1], 1, output[1], output_frame ); /*0.5f*/
#endif
    }

    /* delay HB synth */
+7 −0
Original line number Diff line number Diff line
@@ -98,10 +98,17 @@ ivas_error ivas_sba_get_hoa_dec_matrix_fx(
    }
    ELSE IF( EQ_32( hOutSetup.output_config, IVAS_AUDIO_CONFIG_STEREO ) )
    {
#ifdef FIX_1521_SBA_LOUDNESS_STEREO
        ( *hoa_dec_mtx )[0] = INV_SQRT2_FX >> 2;
        ( *hoa_dec_mtx )[1] = INV_SQRT2_FX >> 2;
        ( *hoa_dec_mtx )[SBA_NHARM_HOA3] = INV_SQRT2_FX >> 2;
        ( *hoa_dec_mtx )[SBA_NHARM_HOA3 + 1] = -( INV_SQRT2_FX >> 2 );
#else
        ( *hoa_dec_mtx )[0] = ONE_IN_Q28;                   // 0.5f in Q29
        ( *hoa_dec_mtx )[1] = ONE_IN_Q28;                   // 0.5f in Q29
        ( *hoa_dec_mtx )[SBA_NHARM_HOA3] = ONE_IN_Q28;      // 0.5f in Q29
        ( *hoa_dec_mtx )[SBA_NHARM_HOA3 + 1] = -ONE_IN_Q28; // 0.5f in Q29
#endif
        move32();
        move32();
        move32();
+14 −1
Original line number Diff line number Diff line
@@ -2230,7 +2230,20 @@ ivas_error ivas_rend_crendProcessSubframe_fx(
        FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ )
        {
            /* move to output */
#ifdef FIX_1521_SBA_LOUDNESS_BINAURAL
            test();
            IF( EQ_32( inConfigType, IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS ) && NE_32( outConfig, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) )
            {
                /* loudness correction for SBA binaural rendering */
                v_multc_fx( pcm_tmp_fx[ch], INV_SQRT2_FX, p_output_fx[ch], subframe_len );
            }
            ELSE
            {
#endif
                Copy32( pcm_tmp_fx[ch], p_output_fx[ch], subframe_len );
#ifdef FIX_1521_SBA_LOUDNESS_BINAURAL
            }
#endif

            p_output_fx[ch] += subframe_len;
        }