Commit 6d985461 authored by Archit Tamarapu's avatar Archit Tamarapu
Browse files

[fix] gain application for OSBA and lower bitrate SBA BINAURAL_ROOM_REVERB rendering

parent 6381f714
Loading
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -441,13 +441,18 @@ ivas_error ivas_dec_render_fx(
            }
        }
#ifdef FIX_1521_SBA_LOUDNESS_BINAURAL
        test();
        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 ) ) )
            ( EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) ||
              EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) ||
              EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV ) ) )
        {
            /* loudness correction for SBA binaural rendering */
            FOR( n = 0; n < BINAURAL_CHANNELS; n++ )
            nchan_out_syn_output = ( st_ivas->hSplitBinRend != NULL ) ? st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses * BINAURAL_CHANNELS : BINAURAL_CHANNELS;
            move16();
            FOR( n = 0; n < nchan_out_syn_output; n++ )
            {
                v_multc_fx( p_output_fx[n], INV_SQRT2_FX, p_output_fx[n], *nSamplesRendered );
            }
+17 −2
Original line number Diff line number Diff line
@@ -1566,12 +1566,27 @@ void ivas_sba_dirac_stereo_dec_fx(
    synchro_synthesis_fx( st_ivas->hDecoderConfig->ivas_total_brate, hCPE, output, output_frame, 1 /*st_ivas->sba_dirac_stereo_flag*/, q_dft[0] );

    /* output scaling */
#ifdef FIX_1521_SBA_LOUDNESS_STEREO
    IF( !sba_mono_flag )
#else
    test();
    IF( !sba_mono_flag && !( EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) && EQ_16( st_ivas->ism_mode, ISM_MODE_NONE ) ) )
#endif
    {
#ifdef FIX_1521_SBA_LOUDNESS_STEREO
        test();
        IF( EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) && EQ_16( st_ivas->ism_mode, ISM_MODE_NONE ) )
        {
            /* low bitrate OSBA needs a makeup gain of 2.f to compensate for the encoder side
                INV_SQRT2 * 2 = SQRT2  */
            v_multc_fx( output[0], SQRT2_FX, output[0], output_frame );
            v_multc_fx( output[1], SQRT2_FX, output[1], output_frame );
        }
        ELSE
        {
            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*/