Commit 591ca6ed authored by fotopoulou's avatar fotopoulou
Browse files

-fix for binaural output with 2 objects

-fix decoder printout for combined format
-add debugging output
parent 19ceea64
Loading
Loading
Loading
Loading
Loading
+16 −7
Original line number Diff line number Diff line
@@ -2904,6 +2904,15 @@ ivas_error preview_indices(
                st_ivas->nchan_ism = 2 * bit_stream[total_brate / FRAMES_PER_SEC - 1] + bit_stream[total_brate / FRAMES_PER_SEC - 2] + 1;
                st_ivas->ism_mode = ISM_SBA_MODE_DISC;
            }

            /* Read SBA planar flag and SBA order */
            st_ivas->sba_planar = ( bit_stream[IVAS_FORMAT_SIGNALING_NBITS_EXTENDED + IVAS_COMBINED_FORMAT_SIGNALLING_BITS] == 1 );
            st_ivas->sba_order = ( bit_stream[IVAS_FORMAT_SIGNALING_NBITS_EXTENDED + IVAS_COMBINED_FORMAT_SIGNALLING_BITS + 2] == 1 );
            st_ivas->sba_order += 2 * ( bit_stream[IVAS_FORMAT_SIGNALING_NBITS_EXTENDED + IVAS_COMBINED_FORMAT_SIGNALLING_BITS + 1] == 1 );

            st_ivas->sba_analysis_order = ivas_sba_get_analysis_order( total_brate, st_ivas->sba_order );

            ivas_sba_config( total_brate, st_ivas->sba_analysis_order, -1, &( st_ivas->nchan_transport ), st_ivas->sba_planar, &( st_ivas->nSCE ), &( st_ivas->nCPE ), &( st_ivas->element_mode_init ) );
        }
#endif
    }
+1 −0
Original line number Diff line number Diff line
@@ -124,6 +124,7 @@
/*#define DEBUG_AGC*/                           /* debug SPAR AGC in-out */
#endif
/*#define SPAR_HOA_DBG*/                        /* SPAR HOA debug statements */
#define DEBUG_OSBA
/*#define DEBUG_BINAURAL_FILTER_DESIGN*/        /* debugging of Crend binaural filter design */
/*#define DEBUG_AGC_ENCODER_CMD_OPTION*/        /* Ability to force enable or disable AGC behaviour in DIRAC/SPAR via command line option */
#define DEBUG_JBM_CMD_OPTION                    /* ability for telling the decoder the frontend fetch size and to not delay compensate for bad frames at the beginning */
+13 −0
Original line number Diff line number Diff line
@@ -497,6 +497,19 @@ ivas_error ivas_dec(

        nchan_remapped = ivas_sba_remapTCs( output, st_ivas, output_frame );

#ifdef DEBUG_OSBA
        {
            int16_t nchan = st_ivas->nchan_transport + st_ivas->nchan_ism;
            for ( int t = 0; t < output_frame; t++ )
            {
                for ( int c = 0; c < nchan; c++ )
                {
                    int16_t val = (int16_t) ( output[c][t] + 0.5f );
                    dbgwrite( &val, sizeof( int16_t ), 1, 1, "./res/TC_dec_core_out.raw" );
                }
            }
        }
#endif

        if ( st_ivas->ism_mode == ISM_SBA_MODE_DISC && st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV )
        {
+18 −0
Original line number Diff line number Diff line
@@ -72,6 +72,11 @@ ivas_error ivas_td_binaural_renderer(
)
{
    int16_t ism_md_subframe_update;
#ifdef OSBA_DISC_OBJ_MCT
    int16_t nchan_transport;

    nchan_transport = ( st_ivas->ism_mode == ISM_SBA_MODE_DISC ) ? st_ivas->nchan_ism : st_ivas->nchan_transport;
#endif

    if ( st_ivas->hDecoderConfig->Opt_delay_comp )
    {
@@ -81,6 +86,18 @@ ivas_error ivas_td_binaural_renderer(
    {
        ism_md_subframe_update = 2;
    }

#ifdef OSBA_DISC_OBJ_MCT
    return ivas_td_binaural_renderer_unwrap(
        st_ivas->hReverb,
        st_ivas->transport_config,
        st_ivas->hBinRendererTd, nchan_transport, LFE_CHANNEL, st_ivas->ivas_format,
        st_ivas->hIsmMetaData,
        ( st_ivas->hCombinedOrientationData != NULL ) ? st_ivas->hCombinedOrientationData->enableCombinedOrientation : NULL,
        ( st_ivas->hCombinedOrientationData != NULL ) ? st_ivas->hCombinedOrientationData->Quaternions : NULL,
        ( st_ivas->hCombinedOrientationData != NULL ) ? st_ivas->hCombinedOrientationData->listenerPos : NULL,
        ism_md_subframe_update, output, output_frame );
#else
    return ivas_td_binaural_renderer_unwrap(
        st_ivas->hReverb,
        st_ivas->transport_config,
@@ -90,6 +107,7 @@ ivas_error ivas_td_binaural_renderer(
        ( st_ivas->hCombinedOrientationData != NULL ) ? st_ivas->hCombinedOrientationData->Quaternions : NULL,
        ( st_ivas->hCombinedOrientationData != NULL ) ? st_ivas->hCombinedOrientationData->listenerPos : NULL,
        ism_md_subframe_update, output, output_frame );
#endif
}


+31 −5
Original line number Diff line number Diff line
@@ -197,18 +197,20 @@ ivas_error ivas_omasa_dirac_td_binaural(
        p_sepobj[n] = &data_separated_objects[n][0];
    }
#ifdef SBA_AND_OBJECTS
#if 0
    channel_offset = st_ivas->nchan_transport;
    if ( st_ivas->ivas_format == SBA_ISM_FORMAT && st_ivas->nchan_transport == 3 ) /* channels are remapped in ivas_sba_remapTCs() */
    {
        channel_offset = 4;
    }
    channel_offset = 0;
#endif
    channel_offset = st_ivas->nchan_ism;
#endif

    for ( n = 0; n < st_ivas->nchan_ism; n++ )
    {
#ifdef SBA_AND_OBJECTS
        mvr2r( output[channel_offset + n], data_separated_objects[n], output_frame );
        mvr2r( output[n], data_separated_objects[n], output_frame );
#else
        mvr2r( output[2 + n], data_separated_objects[n], output_frame );
#endif
@@ -224,22 +226,46 @@ ivas_error ivas_omasa_dirac_td_binaural(
#ifdef SBA_AND_OBJECTS
    if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV )
    {
        ivas_sba_upmixer_renderer( st_ivas, &output[MAX_NUM_OBJECTS], output_frame );
        ivas_sba_upmixer_renderer( st_ivas, &output[channel_offset], output_frame );
    }
    else
    {
        ivas_dirac_dec_binaural( st_ivas, st_ivas->hCombinedOrientationData, &output[MAX_NUM_OBJECTS], st_ivas->nchan_transport );
        ivas_dirac_dec_binaural( st_ivas, st_ivas->hCombinedOrientationData, &output[channel_offset], st_ivas->nchan_transport );
    }
#else
    ivas_dirac_dec_binaural( st_ivas, st_ivas->hCombinedOrientationData, output, st_ivas->nchan_transport );
#endif

#ifdef DEBUG_OSBA
    {
        for ( int t = 0; t < output_frame; t++ )
        {
            for ( int c = 0; c < BINAURAL_CHANNELS; c++ )
            {
                int16_t val = (int16_t) ( output[channel_offset + c][t] + 0.5f );
                dbgwrite( &val, sizeof( int16_t ), 1, 1, "./res/sba_fast_conv_out.raw" );
            }
        }
    }
#endif

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

#ifdef DEBUG_OSBA
    {
        for ( int t = 0; t < output_frame; t++ )
        {
            for ( int c = 0; c < BINAURAL_CHANNELS; c++ )
            {
                int16_t val = (int16_t) ( p_sepobj[c][t] + 0.5f );
                dbgwrite( &val, sizeof( int16_t ), 1, 1, "./res/ism_td_bin_out.raw" );
            }
        }
    }
#endif
    for ( n = 0; n < BINAURAL_CHANNELS; n++ )
    {
#if 0
@@ -248,7 +274,7 @@ ivas_error ivas_omasa_dirac_td_binaural(
        int16_t i;
        for ( i = 0; i < output_frame; i++ )
        {
            output[n][i] = 0.5f * output[MAX_NUM_OBJECTS + n][i] + 0.5f * p_sepobj[n][i];
            output[n][i] = 0.5f * output[channel_offset + n][i] + 0.5f * p_sepobj[n][i];
        }
#endif
    }
Loading