Commit 69ab1d3f authored by TYAGIRIS's avatar TYAGIRIS
Browse files

decoder bitrate switching and split rendering changes

parent e81dcba4
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -227,6 +227,7 @@
#define OSBA_AMBISONICS_OUT
#define OSBA_LS_OUT
#define OSBA_BR_SWITCHING
#define OSBA_SPLIT_RENDERING
#endif

/* ################## End BE DEVELOPMENT switches ######################### */
+3 −0
Original line number Diff line number Diff line
@@ -386,6 +386,9 @@ ivas_error ivas_dec(
    }
    else if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == MASA_FORMAT )
    {
#ifdef OSBA_BR_SWITCHING
        st_ivas->ism_mode = ISM_MODE_NONE;
#endif
        set_s( nb_bits_metadata, 0, MAX_SCE );

        /* read parameters from the bitstream */
+64 −2
Original line number Diff line number Diff line
@@ -70,7 +70,9 @@ static ivas_error ivas_dec_reconfig_split_rend(
    ivas_error error;
    int16_t cldfb_in, num_ch, ch, isCldfbNeeded, i, pcm_out;
    SPLIT_REND_WRAPPER *hSplitRendWrapper;
#ifndef OSBA_SPLIT_RENDERING
    CLDFB_TYPE cldfbMode;
#endif

    hSplitRendWrapper = &st_ivas->splitBinRend.splitrend;
    pcm_out = ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0;
@@ -88,23 +90,36 @@ static ivas_error ivas_dec_reconfig_split_rend(
        st_ivas->hHeadTrackData->sr_pose_pred_axis );

    isCldfbNeeded = 0;
#ifndef OSBA_SPLIT_RENDERING
    cldfbMode = CLDFB_ANALYSIS;
#else
    if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV && st_ivas->ivas_format == SBA_ISM_FORMAT )
    {
        cldfb_in = 0;
    }
#endif
    if ( st_ivas->renderer_type != RENDERER_DISABLE )
    {
        if ( cldfb_in == 0 )
        {
            isCldfbNeeded = 1;
#ifndef OSBA_SPLIT_RENDERING
            cldfbMode = CLDFB_ANALYSIS;
#endif
        }
        else if ( st_ivas->hRenderConfig->split_rend_config.codec == IVAS_SPLIT_REND_CODEC_LC3PLUS && cldfb_in )
        {
            isCldfbNeeded = 1;
#ifndef OSBA_SPLIT_RENDERING
            cldfbMode = CLDFB_SYNTHESIS;
#endif
        }
        else if ( pcm_out && cldfb_in )
        {
            isCldfbNeeded = 1;
#ifndef OSBA_SPLIT_RENDERING
            cldfbMode = CLDFB_SYNTHESIS;
#endif
        }
    }

@@ -126,12 +141,28 @@ static ivas_error ivas_dec_reconfig_split_rend(
        for ( ch = 0; ch < num_ch; ch++ )
        {
            if ( ( error = openCldfb( &( hSplitRendWrapper->hCldfbHandles->cldfbAna[ch] ),
#ifndef OSBA_SPLIT_RENDERING
                                      cldfbMode,
#else
                                      CLDFB_ANALYSIS,
#endif
                                      st_ivas->hDecoderConfig->output_Fs, CLDFB_PROTOTYPE_5_00MS ) ) != IVAS_ERR_OK )
            {
                return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not open CLDFB handles\n" ) );
            }
        }

#ifdef OSBA_SPLIT_RENDERING
        for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ )
        {
            if ( ( error = openCldfb( &( hSplitRendWrapper->hCldfbHandles->cldfbSyn[ch] ),
                                      CLDFB_SYNTHESIS,
                                      st_ivas->hDecoderConfig->output_Fs, CLDFB_PROTOTYPE_5_00MS ) ) != IVAS_ERR_OK )
            {
                return error;
            }
        }
#endif
    }
    else if ( isCldfbNeeded == 0 && hSplitRendWrapper->hCldfbHandles != NULL )
    {
@@ -144,11 +175,26 @@ static ivas_error ivas_dec_reconfig_split_rend(
                hSplitRendWrapper->hCldfbHandles->cldfbAna[ch] = NULL;
            }
        }
#ifdef OSBA_SPLIT_RENDERING
        for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ )
        {
            if ( hSplitRendWrapper->hCldfbHandles->cldfbSyn[ch] != NULL )
            {
                deleteCldfb( &hSplitRendWrapper->hCldfbHandles->cldfbSyn[ch] );
                hSplitRendWrapper->hCldfbHandles->cldfbSyn[ch] = NULL;
            }
        }
#endif
        free( hSplitRendWrapper->hCldfbHandles );
        hSplitRendWrapper->hCldfbHandles = NULL;
    }

#ifdef OSBA_SPLIT_RENDERING
    if ( ( st_ivas->renderer_type != RENDERER_BINAURAL_OBJECTS_TD ) &&
         ( st_ivas->renderer_type != RENDERER_BINAURAL_FASTCONV || st_ivas->ivas_format != SBA_ISM_FORMAT ) )
#else
    if ( st_ivas->renderer_type != RENDERER_BINAURAL_OBJECTS_TD )
#endif
    {
        for ( i = 0; i < MAX_HEAD_ROT_POSES - 1; ++i )
        {
@@ -197,7 +243,12 @@ ivas_error ivas_dec_init_split_rend(
    }

    ivas_split_rend_choose_default_codec( &st_ivas->hRenderConfig->split_rend_config.codec, ( cldfb_in == 0 ), pcm_out );

#ifdef OSBA_SPLIT_RENDERING
    if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV && st_ivas->ivas_format == SBA_ISM_FORMAT )
    {
        cldfb_in = 0;
    }
#endif
    error = ivas_split_renderer_open( &st_ivas->splitBinRend.splitrend,
                                      &st_ivas->hRenderConfig->split_rend_config,
                                      st_ivas->hDecoderConfig->output_Fs,
@@ -394,13 +445,21 @@ ivas_error ivas_dec_setup(
            else
            {
                ivas_sba_config( ivas_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 );
#ifdef OSBA_BR_SWITCHING
                /*correct number of CPEs for discrete ISM coding*/
                if ( st_ivas->ini_frame > 0 && st_ivas->ism_mode == ISM_SBA_MODE_DISC )
                {
                    st_ivas->nCPE += ( st_ivas->nchan_ism + 1 ) >> 1;
                }

#endif
            }
#ifndef OSBA_BR_SWITCHING
            /*correct number of CPEs for discrete ISM coding*/
            if ( st_ivas->ini_frame > 0 && st_ivas->ism_mode == ISM_SBA_MODE_DISC )
            {
                st_ivas->nCPE += ( st_ivas->nchan_ism + 1 ) >> 1;
            }
#endif

            st_ivas->ism_mode = ISM_SBA_MODE_DISC;
        }
@@ -1429,6 +1488,9 @@ ivas_error ivas_init_decoder(
            }
        }

#ifdef OSBA_BR_SWITCHING
        st_ivas->nchan_transport += st_ivas->nchan_ism;
#endif
        if ( ( error = create_mct_dec( st_ivas ) ) != IVAS_ERR_OK )
        {
            return error;
+7 −1
Original line number Diff line number Diff line
@@ -353,11 +353,13 @@ ivas_error create_mct_dec(
    )
    {
        hMCT->nchan_out_woLFE = st_ivas->nchan_transport;
#ifndef OSBA_BR_SWITCHING
#ifdef OSBA_DISC_OBJ_MCT
        if ( st_ivas->ivas_format == SBA_ISM_FORMAT && st_ivas->ism_mode == ISM_SBA_MODE_DISC )
        {
            hMCT->nchan_out_woLFE += st_ivas->nchan_ism;
        }
#endif
#endif
    }
    else if ( st_ivas->mc_mode == MC_MODE_MCT )
@@ -466,7 +468,11 @@ ivas_error mct_dec_reconfigure(
    if ( b_nchan_change )
    {
        /* Determine active channels */
        if ( ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_PARAMMC ) || st_ivas->ivas_format == SBA_FORMAT )
        if ( ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_PARAMMC ) || st_ivas->ivas_format == SBA_FORMAT
#ifdef OSBA_BR_SWITCHING
             || st_ivas->ivas_format == SBA_ISM_FORMAT
#endif
        )
        {
            hMCT->nchan_out_woLFE = st_ivas->nchan_transport;
        }
+60 −16
Original line number Diff line number Diff line
@@ -164,10 +164,16 @@ ivas_error ivas_osba_dirac_td_binaural(
        mvr2r( output[n], data_separated_objects[n], output_frame );
    }

#ifdef OSBA_SPLIT_RENDERING
    if ( st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_BINAURAL_SPLIT_CODED &&
         st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
#endif
    {
        for ( n = 0; n < st_ivas->nchan_ism; n++ )
        {
            delay_signal( data_separated_objects[n], output_frame, st_ivas->hMasaIsmData->delayBuffer[n], st_ivas->hMasaIsmData->delayBuffer_size );
        }
    }

    if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV )
    {
@@ -190,7 +196,42 @@ ivas_error ivas_osba_dirac_td_binaural(
        }
    }
#endif

#ifdef OSBA_SPLIT_RENDERING
    if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ||
         ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
    {
        int16_t slot_idx, num_cldfb_bands, b, nchan_transport_orig;
        float Cldfb_RealBuffer[CLDFB_NO_CHANNELS_MAX];
        float Cldfb_ImagBuffer[CLDFB_NO_CHANNELS_MAX];
        num_cldfb_bands = st_ivas->splitBinRend.splitrend.hCldfbHandles->cldfbAna[0]->no_channels;
        nchan_transport_orig = st_ivas->nchan_transport;
        st_ivas->nchan_transport = st_ivas->nchan_ism;
        ObjRenderIvasFrame_splitBinaural( st_ivas, output, output_frame );
        st_ivas->nchan_transport = nchan_transport_orig;
        for ( n = 0; n < st_ivas->splitBinRend.splitrend.multiBinPoseData.num_poses * BINAURAL_CHANNELS; ++n )
        {
            for ( slot_idx = 0; slot_idx < CLDFB_NO_COL_MAX; slot_idx++ )
            {
                cldfbAnalysis_ts( &( output[n][num_cldfb_bands * slot_idx] ),
                                  Cldfb_RealBuffer,
                                  Cldfb_ImagBuffer,
                                  num_cldfb_bands,
                                  st_ivas->splitBinRend.splitrend.hCldfbHandles->cldfbAna[n] );
                for ( b = 0; b < num_cldfb_bands; b++ )
                {
                    st_ivas->splitBinRend.hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[n][slot_idx][b] =
                        ( 0.5f * st_ivas->splitBinRend.hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[n][slot_idx][b] ) +
                        ( 0.5f * Cldfb_RealBuffer[b] );
                    st_ivas->splitBinRend.hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[n][slot_idx][b] =
                        ( 0.5f * st_ivas->splitBinRend.hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[n][slot_idx][b] ) +
                        ( 0.5f * Cldfb_ImagBuffer[b] );
                }
            }
        }
    }
    else
    {
#endif
        if ( ( error = ivas_td_binaural_renderer( st_ivas, p_sepobj, output_frame ) ) != IVAS_ERR_OK )
        {
            return error;
@@ -216,6 +257,9 @@ ivas_error ivas_osba_dirac_td_binaural(
                output[n][i] = 0.5f * output[channel_offset + n][i] + 0.5f * p_sepobj[n][i];
            }
        }
#ifdef OSBA_SPLIT_RENDERING
    }
#endif

    return IVAS_ERR_OK;
}
Loading