Commit d3c538ef authored by vaclav's avatar vaclav
Browse files

Merge remote-tracking branch 'remotes/origin/main' into 1855-basop-PortFlpMr1611

parents 0cd4a784 a1dfaa7a
Loading
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -3904,6 +3904,17 @@ ivas_error ivas_osba_render_sf_fx(
    Word32 *p_output[]              /* o  : rendered time signal                      */
);

#ifdef NONBE_1894_OSBA_SCALING
void ivas_osba_stereo_add_channels_fx(
    Word32 *tc_fx[],                    /* i  : transport channels                */
    Word32 *output_fx[],                /* i/o: output channels                   */
    const Word16 gain,                  /* i  : gain bed value       Q11          */
    const Word16 nchan_out,             /* i  : number of output channels         */
    const Word16 nchan_ism,             /* i  : number of ISM channels            */
    const UWord16 n_samples_to_render   /* i  : output frame length per channel   */
);
#endif

void ivas_osba_data_close_fx(
    SBA_ISM_DATA_HANDLE *hSbaIsmData /* i/o: OSBA rendering handle                   */
);
+2 −0
Original line number Diff line number Diff line
@@ -132,6 +132,8 @@
#define NONBE_FIX_1052_SBA_EXT_FIX                      /* VA: SBA external output support fix - do not overwrite "output_config" parameter */
#define NONBE_FIX_1110_STEREO_DTX_BRATE_SWITCHING       /* VA: issue 1110: fix encoder crash in the stereo DTX bitrate switching condition */

#define NONBE_1894_OSBA_SCALING                          /* FhG: do not scale OSBA inputs by 0.5 any more */

/* #################### End BASOP porting switches ############################ */

#define FIX_1766_TCX2ACELP_BWE_ISSUE    /* VA : Fix rare BWE issue when switching from TCX to ACELP */
+16 −0
Original line number Diff line number Diff line
@@ -2230,10 +2230,14 @@ ivas_error ivas_jbm_dec_render_fx(
                ivas_ism_render_sf_fx( st_ivas, st_ivas->renderer_type, p_output_fx, *nSamplesRendered );

                /* add already rendered SBA part */
#ifdef NONBE_1894_OSBA_SCALING
                ivas_osba_stereo_add_channels_fx( p_tc_fx, p_output_fx, ONE_IN_Q11, nchan_out, st_ivas->nchan_ism, *nSamplesRendered );
#else
                FOR( n = 0; n < nchan_out; n++ )
                {
                    v_add_fixed_no_hdrm( p_output_fx[n], p_tc_fx[n + st_ivas->nchan_ism], p_output_fx[n], *nSamplesRendered );
                }
#endif
            }
            ELSE IF( EQ_32( st_ivas->renderer_type, RENDERER_OSBA_AMBI ) || EQ_32( st_ivas->renderer_type, RENDERER_OSBA_LS ) || EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV_ROOM ) )
            {
@@ -2265,6 +2269,12 @@ ivas_error ivas_jbm_dec_render_fx(
        ELSE IF( EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) || EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) )
        {
            ivas_dirac_dec_binaural_render_fx( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, nchan_remapped, p_output_fx );
#ifdef NONBE_1894_OSBA_SCALING
            FOR( n = 0; n < st_ivas->hDecoderConfig->nchan_out; n++ )
            {
                scale_sig32( p_output_fx[n], *nSamplesRendered, 1 );
            }
#endif
        }
        ELSE
        {
@@ -2284,6 +2294,12 @@ ivas_error ivas_jbm_dec_render_fx(
                    set32_fx( p_output_fx[n], 0, *nSamplesRendered );
                }
            }
#ifdef NONBE_1894_OSBA_SCALING
            FOR( n = 0; n < st_ivas->hDecoderConfig->nchan_out; n++ )
            {
                scale_sig32( p_output_fx[n], *nSamplesRendered, 1 );
            }
#endif
        }
    }
    ELSE IF( EQ_32( st_ivas->ivas_format, MC_FORMAT ) )
+67 −0
Original line number Diff line number Diff line
@@ -203,13 +203,21 @@ ivas_error ivas_osba_dirac_td_binaural_jbm_fx(
                FOR( b = 0; b < num_cldfb_bands; b++ )
                {
                    st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_RealBuffer_Binaural_fx[n][slot_idx_start + slot_idx][b] =
#ifdef NONBE_1894_OSBA_SCALING
                        L_add( st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_RealBuffer_Binaural_fx[n][add( slot_idx_start, slot_idx )][b], Cldfb_RealBuffer[b] );
#else
                        L_add( L_shr( st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_RealBuffer_Binaural_fx[n][add( slot_idx_start, slot_idx )][b], 1 ),
                               L_shr( Cldfb_RealBuffer[b], 1 ) );
#endif
                    move32();

                    st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural_fx[n][slot_idx_start + slot_idx][b] =
#ifdef NONBE_1894_OSBA_SCALING
                        L_add( st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural_fx[n][add( slot_idx_start, slot_idx )][b], Cldfb_ImagBuffer[b] );
#else
                        L_add( L_shr( st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural_fx[n][add( slot_idx_start, slot_idx )][b], 1 ),
                               L_shr( Cldfb_ImagBuffer[b], 1 ) );
#endif
                    move32();
                }
            }
@@ -227,7 +235,11 @@ ivas_error ivas_osba_dirac_td_binaural_jbm_fx(
            Word16 i;
            FOR( i = 0; i < nSamplesAsked; i++ )
            {
#ifdef NONBE_1894_OSBA_SCALING
                output_fx[n][i] = L_add( output_fx[channel_offset + n][i], p_sepobj_fx[n][i] );
#else
                output_fx[n][i] = L_add( L_shr( output_fx[channel_offset + n][i], 1 ), L_shr( p_sepobj_fx[n][i], 1 ) );
#endif
                move32();
            }
        }
@@ -318,13 +330,68 @@ ivas_error ivas_osba_render_sf_fx(
    {
        IF( NE_32( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV_ROOM ) )
        {
#ifndef NONBE_1894_OSBA_SCALING
            v_add_fixed( p_output[n], p_output_ism[n], p_output[n], *nSamplesRendered, 1 ); // takes care of downscaling by 0.5f
#else
            v_add_fixed_no_hdrm( p_output[n], p_output_ism[n], p_output[n], *nSamplesRendered );
#endif
        }
#ifndef NONBE_1894_OSBA_SCALING
        ELSE
        {
            scale_sig32( p_output[n], *nSamplesRendered, -1 );
        }
#endif
    }

    return IVAS_ERR_OK;
}


#ifdef NONBE_1894_OSBA_SCALING
/*-------------------------------------------------------------------------*
 * ivas_osba_stereo_add_channels()
 *
 *
 *-------------------------------------------------------------------------*/

void ivas_osba_stereo_add_channels_fx(
    Word32 *tc_fx[],                  /* i  : transport channels                */
    Word32 *output_fx[],              /* i/o: output channels                   */
    const Word16 gain,                /* i  : gain bed value        Q11         */
    const Word16 nchan_out,           /* i  : number of output channels         */
    const Word16 nchan_ism,           /* i  : number of ISM channels            */
    const UWord16 n_samples_to_render /* i  : output frame length per channel   */
)
{
    Word16 n;

#if 0
    IF ( ism_mode == ISM_SBA_MODE_DISC )
    {
#endif
    IF( NE_16( gain, ONE_IN_Q11 ) )
    {
        assert( 0 && "Object editing is not implemented in the BASOP code!" );
    }
    ELSE
    {
        FOR( n = 0; n < nchan_out; n++ )
        {
            v_add_fixed_no_hdrm( output_fx[n], tc_fx[n + nchan_ism], output_fx[n], n_samples_to_render );
        }
    }
#if 0
    }
    ELSE
    {
        FOR( n = 0; n < nchan_out; n++ )
        {
            v_add_fixed_no_hdrm( output_fx[n], tc_fx[n + nchan_ism], output_fx[n], n_samples_to_render );
        }
    }
#endif

    return;
}
#endif