Commit 6886e261 authored by Dominik Weckbecker's avatar Dominik Weckbecker 💬
Browse files

add code for ISM_SBA_MODE_DISC n the JBM path

parent 8d46420d
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -5625,6 +5625,16 @@ ivas_error ivas_sba_ism_separate_object_renderer_open(
    Decoder_Struct *st_ivas /* i/o: IVAS decoder structure      */
);

#ifdef JBM_FOR_OSBA
ivas_error ivas_osba_dirac_td_binaural_jbm(
    Decoder_Struct *st_ivas,      /* i/o: IVAS decoder structure          */
    const uint16_t nSamplesAsked, /* i  : number of CLDFB slots requested           */
    uint16_t *nSamplesRendered,   /* o  : number of CLDFB slots rendered            */
    uint16_t *nSamplesAvailable,  /* o  : number of CLDFB slots still to render     */
    float *output_f[]             /* o  : rendered time signal                      */
);
#endif

ivas_error ivas_osba_dirac_td_binaural(
    Decoder_Struct *st_ivas,    /* i/o: IVAS decoder structure          */
    float *output[], /* o  : output synthesis signal         */
+7 −1
Original line number Diff line number Diff line
@@ -1099,7 +1099,13 @@ ivas_error ivas_jbm_dec_render(

		if ( st_ivas->ism_mode == ISM_SBA_MODE_DISC )
        {
			assert( 0 && "This is not supported!" );
            if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV)
            {
                if ( ( error = ivas_osba_dirac_td_binaural_jbm( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, p_output ) ) != IVAS_ERR_OK )
                {
                    return error;
                }
			}
		}
		else if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM )
        {
+70 −3
Original line number Diff line number Diff line
@@ -138,6 +138,73 @@ ivas_error ivas_sba_ism_separate_object_renderer_open(
 * Binaural rendering in OMASA format
 *--------------------------------------------------------------------------*/

#ifdef JBM_FOR_OSBA
ivas_error ivas_osba_dirac_td_binaural_jbm(
    Decoder_Struct *st_ivas,      /* i/o: IVAS decoder structure          */
    const uint16_t nSamplesAsked, /* i  : number of CLDFB slots requested           */
    uint16_t *nSamplesRendered,   /* o  : number of CLDFB slots rendered            */
    uint16_t *nSamplesAvailable,  /* o  : number of CLDFB slots still to render     */
    float *output_f[]             /* o  : rendered time signal                      */
)
{
    int16_t n;
    float data_separated_objects[MAX_NUM_OBJECTS][L_FRAME48k];

    ivas_error error;
    float *p_sepobj[MAX_NUM_OBJECTS];
    int16_t channel_offset;

    for ( n = 0; n < MAX_NUM_OBJECTS; n++ )
    {
        p_sepobj[n] = &data_separated_objects[n][0];
    }

    channel_offset = st_ivas->nchan_ism;

	ivas_sba_dec_render( st_ivas, nSamplesAsked, nSamplesRendered, nSamplesAvailable, output_f );

    for ( n = 0; n < st_ivas->nchan_ism; n++ )
    {
        mvr2r( output_f[n], data_separated_objects[n], nSamplesAsked );
    }

    {
        for ( n = 0; n < st_ivas->nchan_ism; n++ )
        {
            delay_signal( data_separated_objects[n], nSamplesAsked, st_ivas->hMasaIsmData->delayBuffer[n], st_ivas->hMasaIsmData->delayBuffer_size );
        }
    }

    if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV )
    {
        if ( ( error = ivas_sba_upmixer_renderer( st_ivas, &output_f[channel_offset], nSamplesAsked ) ) != IVAS_ERR_OK )
        {
            return error;
        }
    }
    else
    {
        ivas_dirac_dec_binaural( st_ivas, st_ivas->hCombinedOrientationData, &output_f[channel_offset], st_ivas->nchan_transport );
    }

    if ( ( error = ivas_td_binaural_renderer( st_ivas, p_sepobj, nSamplesAsked ) ) != IVAS_ERR_OK )
    {
        return error;
    }

    for ( n = 0; n < BINAURAL_CHANNELS; n++ )
    {
        int16_t i;
        for ( i = 0; i < nSamplesAsked; i++ )
        {
            output_f[n][i] = 0.5f * output_f[channel_offset + n][i] + 0.5f * p_sepobj[n][i];
        }
    }

    return IVAS_ERR_OK;
}
#endif

ivas_error ivas_osba_dirac_td_binaural(
    Decoder_Struct *st_ivas,   /* i/o: IVAS decoder structure          */
    float *output[],           /* o  : output synthesis signal         */
+26 −9
Original line number Diff line number Diff line
@@ -1254,8 +1254,22 @@ void ivas_spar_dec_digest_tc(
        float *pPcm_tmp[MAX_SPAR_INTERNAL_CHANNELS];
        float *p_tc[MAX_SPAR_INTERNAL_CHANNELS];
        int16_t nchan_internal, ch;
#ifdef JBM_FOR_OSBA
        int16_t ch_sba_idx;
#endif
        int16_t nSamplesLeftForTD, default_frame;

#ifdef JBM_FOR_OSBA
        ch_sba_idx = 0;
        if ( st_ivas->ivas_format == SBA_ISM_FORMAT )
        {
            if ( st_ivas->ism_mode == SBA_ISM_FORMAT )
            {
                ch_sba_idx = st_ivas->nchan_ism;
            }
        }
#endif

        /* TD decorrelator */
        default_frame = ( int16_t )( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC );
        nSamplesLeftForTD = nSamplesForRendering;
@@ -1264,7 +1278,11 @@ void ivas_spar_dec_digest_tc(
        for ( ch = 0; ch < nchan_internal; ch++ )
        {
            pPcm_tmp[ch] = Pcm_tmp[ch];
#ifdef JBM_FOR_OSBA
            p_tc[ch] = st_ivas->hTcBuffer->tc[ch + ch_sba_idx];
#else
            p_tc[ch] = st_ivas->hTcBuffer->tc[ch];
#endif
        }

        while ( nSamplesLeftForTD )
@@ -1477,8 +1495,7 @@ void ivas_spar_dec_upmixer_sf(
            for ( i = 0; i < nchan_transport; i++ )
            {
                tmp = roundf( output[i][j] * PCM16_TO_FLT_FAC );
                pcm = ( tmp > MAX16B_FLT ) ? MAX16B : ( tmp < MIN16B_FLT ) ? MIN16B
                                                                           : (short) tmp;
                pcm = ( tmp > MAX16B_FLT ) ? MAX16B : ( tmp < MIN16B_FLT ) ? MIN16B : (short) tmp;
                dbgwrite( &pcm, sizeof( int16_t ), 1, 1, "dmx_dec.raw" );
            }
        }