Commit 30733d95 authored by bayers's avatar bayers
Browse files

fix OSBA JBM ambi and LS output, add OSBA JBM EXT output, temporary fix for...

fix OSBA JBM ambi and LS output, add OSBA JBM EXT output, temporary fix for wrong allocation of float buffers for some OSBA cases
parent d31aaf10
Loading
Loading
Loading
Loading
+14 −17
Original line number Diff line number Diff line
@@ -2067,6 +2067,9 @@ static ivas_error decodeG192(
    uint16_t nOutSamples = 0;
#else
    int16_t nOutSamples = 0;
#endif
#ifdef API_5MS
    int16_t num_subframes;
#endif
    int32_t delayTimeScale = 0;
    ivas_error error = IVAS_ERR_UNKNOWN;
@@ -2116,7 +2119,7 @@ static ivas_error decodeG192(
        }
        else
        {
            IVAS_DEC_VoIP_SetScale( hIvasDec, arg.tsmScale, arg.tsmScale );
            IVAS_DEC_VoIP_SetScale( hIvasDec, INT16_MAX, arg.tsmScale );
        }
    }
#endif
@@ -2211,7 +2214,7 @@ static ivas_error decodeG192(
                goto cleanup;
            }
        }
#ifdef API_5MS
#ifdef API_5MS_NO
        int16_t enable5ms, num_subframes;
        IVAS_DEC_Get5msFlag( hIvasDec, &enable5ms );
        arg.enable5ms = enable5ms;
@@ -2336,7 +2339,7 @@ static ivas_error decodeG192(
                        fprintf( stderr, "\nError: input bitstream file couldn't be read: %s \n\n", arg.inputBitstreamFilename );
                        goto cleanup;
                    }
                    IVAS_DEC_VoIP_SetScale( hIvasDec, scale, scale );
                    IVAS_DEC_VoIP_SetScale( hIvasDec, INT16_MAX, scale );
                }
#endif
#endif
@@ -2566,10 +2569,6 @@ static ivas_error decodeG192(
            }
        }
        vec_pos_update = ( vec_pos_update + 1 ) % vec_pos_len;
#ifdef API_5MS
        if ( needNewFrame )
        {
#endif
        frame++;
        if ( !arg.quietModeEnabled )
        {
@@ -2581,9 +2580,7 @@ static ivas_error decodeG192(
            }
#endif
        }
#ifdef API_5MS
        }
#endif

#ifdef WMOPS
        if ( vec_pos_update == 0 )
        {
+1 −1
Original line number Diff line number Diff line
@@ -184,7 +184,7 @@
#define CR_FIX_586_BPF_DFT_MEM                          /* FhG: issue 586: set input memory of DFT analysis of BPF signal to zero for HQ core to fix issue with PLC and bitrate switching */
#define CR_FIX_ISM_DTX_INFINITE_CNG_ON_TRAILING_SILENCE /* FhG: fix for cng in ISM DTX on sudden silence periods */
#define CR_FIX_698_SBA_MSAN                             /* Dlb: issue 698: Uninitialized memory read in SBA init */

#define CR_FIX_OSBA_FLOAT_BUFFER_INIT
/* ##################### End NON-BE CR switches ########################### */

/* ################## End DEVELOPMENT switches ######################### */
+8 −0
Original line number Diff line number Diff line
@@ -801,7 +801,11 @@ ivas_error ivas_dec(
            }
            else
            {
#ifdef JBM_FOR_OSBA
                ivas_sba_upmixer_renderer( st_ivas, output, output_frame );
#else
                ivas_sba_upmixer_renderer( st_ivas, &output[sba_ch_idx], output_frame );
#endif
            }
        }
        else if ( st_ivas->ism_mode == ISM_SBA_MODE_DISC && ( st_ivas->renderer_type == RENDERER_OSBA_STEREO || st_ivas->renderer_type == RENDERER_MONO_DOWNMIX ) )
@@ -850,7 +854,11 @@ ivas_error ivas_dec(
                }
            }

#ifdef JBM_FOR_OSBA
            if ( ( error = ivas_sba_upmixer_renderer( st_ivas, output, output_frame ) ) != IVAS_ERR_OK )
#else
            if ( ( error = ivas_sba_upmixer_renderer( st_ivas, &output[sba_ch_idx], output_frame ) ) != IVAS_ERR_OK )
#endif
            {
                return error;
            }
+46 −17
Original line number Diff line number Diff line
@@ -879,6 +879,15 @@ ivas_error ivas_jbm_dec_feed_tc_to_renderer(
        {
            ivas_ism_dec_digest_tc( st_ivas );

            /* delay the objects here for all renderers where it is needed */
            if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_OSBA_AMBI || st_ivas->renderer_type == RENDERER_OSBA_LS || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_EXTERNAL )
            {
                for ( n = 0; n < st_ivas->nchan_ism; n++ )
                {
                    delay_signal( st_ivas->hTcBuffer->tc[n], st_ivas->hTcBuffer->n_samples_available, st_ivas->hMasaIsmData->delayBuffer[n], st_ivas->hMasaIsmData->delayBuffer_size );
                }
            }

            if ( !st_ivas->sba_dirac_stereo_flag )
            {
                if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV )
@@ -966,7 +975,11 @@ ivas_error ivas_jbm_dec_render(
    float pan_left, pan_right;
    int16_t nSamplesAskedLocal;
    ivas_error error;
    float *p_output[MAX_OUTPUT_CHANNELS];
    float *p_output[MAX_OUTPUT_CHANNELS
#ifdef JBM_FOR_OSBA
                    + MAX_NUM_OBJECTS
#endif
    ];
    float *p_tc[MAX_TRANSPORT_CHANNELS];
    SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom;

@@ -986,7 +999,12 @@ ivas_error ivas_jbm_dec_render(
    nSamplesAskedLocal = nSamplesAsked + st_ivas->hTcBuffer->n_samples_discard;


    for ( n = 0; n < MAX_OUTPUT_CHANNELS; n++ )
    for ( n = 0; n < MAX_OUTPUT_CHANNELS
#ifdef JBM_FOR_OSBA
                         + MAX_NUM_OBJECTS
#endif
          ;
          n++ )
    {
        p_output[n] = &output[n][0];
    }
@@ -1204,24 +1222,21 @@ ivas_error ivas_jbm_dec_render(
                    p_output_ism[n] = &output_ism[n][0];
                }

                if ( st_ivas->hSpatParamRendCom->slots_rendered == 0 )
                {
                    int16_t tcBufferSize;

                    tcBufferSize = st_ivas->hSpatParamRendCom->num_slots * st_ivas->hSpatParamRendCom->slot_size;

                    for ( n = 0; n < st_ivas->nchan_ism; n++ )
                ivas_sba_dec_render( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, p_output );
                ivas_ism_render_sf( st_ivas, p_output_ism, *nSamplesRendered );
                for ( n = 0; n < nchan_out; n++ )
                {
                        float *tc_local_n = st_ivas->hTcBuffer->tc[n];
                        delay_signal( tc_local_n, tcBufferSize, st_ivas->hMasaIsmData->delayBuffer[n], st_ivas->hMasaIsmData->delayBuffer_size );
                    v_add( p_output[n], p_output_ism[n], p_output[n], *nSamplesRendered );
                    v_multc( p_output[n], 0.5f, p_output[n], *nSamplesRendered );
                }
            }
            else if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_EXTERNAL ) /*EXT output = individual objects + HOA3*/
            {

                ivas_ism_render_sf( st_ivas, p_output_ism, nSamplesAsked );
                ivas_sba_dec_render( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, p_output );
                for ( n = 0; n < nchan_out; n++ )
                ivas_sba_dec_render( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, &p_output[st_ivas->nchan_ism] );
                for ( n = 0; n < st_ivas->nchan_ism; n++ )
                {
                    v_add( p_output[n],output_ism[n], p_output[n], nSamplesAsked );
                    mvr2r( st_ivas->hTcBuffer->tc[n] + st_ivas->hTcBuffer->n_samples_rendered, p_output[n], *nSamplesRendered );
                }
            }
            else
@@ -1237,6 +1252,20 @@ ivas_error ivas_jbm_dec_render(
        else /* SBA_MODE_SPAR */
        {
            ivas_sba_dec_render( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, p_output );
            if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_EXTERNAL )
            {
#ifdef DEBUGGING
                assert( st_ivas->ism_mode == ISM_MODE_NONE );
#endif
                for ( n = st_ivas->hIntSetup.nchan_out_woLFE - 1; n >= 0; n-- )
                {
                    mvr2r( output[n], output[n + st_ivas->nchan_ism], *nSamplesRendered );
                }
                for ( n = 0; n < st_ivas->nchan_ism; n++ )
                {
                    set_zero( output[n], *nSamplesRendered );
                }
            }
        }
    }
#endif
+4 −15
Original line number Diff line number Diff line
@@ -150,23 +150,8 @@ ivas_error ivas_osba_dirac_td_binaural_jbm(
    int16_t n;
    ivas_error error;

    /* Delay the object signals to match the CLDFB delay on the first ts, taken from OMASA path */
    if ( st_ivas->hSpatParamRendCom->slots_rendered == 0 )
    {
        int16_t tcBufferSize;

        tcBufferSize = st_ivas->hSpatParamRendCom->num_slots * st_ivas->hSpatParamRendCom->slot_size;

        for ( n = 0; n < st_ivas->nchan_ism; n++ )
        {
            float *tc_local_n = st_ivas->hTcBuffer->tc[n];
            delay_signal( tc_local_n, tcBufferSize, st_ivas->hMasaIsmData->delayBuffer[n], st_ivas->hMasaIsmData->delayBuffer_size );
        }
    }

    ivas_sba_dec_render( st_ivas, nSamplesAsked, nSamplesRendered, nSamplesAvailable, &output_f[2] );


    if ( ( error = ivas_td_binaural_renderer_sf( st_ivas, output_f, *nSamplesRendered ) ) != IVAS_ERR_OK )
    {
        return error;
@@ -393,7 +378,11 @@ ivas_error ivas_osba_render(
        }
    }

#ifdef JBM_FOR_OSBA
    if ( ( error = ivas_sba_upmixer_renderer( st_ivas, output_f, output_frame ) ) != IVAS_ERR_OK )
#else
    if ( ( error = ivas_sba_upmixer_renderer( st_ivas, &output_f[sba_ch_idx], output_frame ) ) != IVAS_ERR_OK )
#endif
    {
        return error;
    }
Loading