Commit db38ab8a authored by reutelhuber's avatar reutelhuber
Browse files

replace some decoder files that weren't merged properly

parent d57a0d7e
Loading
Loading
Loading
Loading
Loading
+386 −52
Original line number Diff line number Diff line
@@ -62,18 +62,33 @@ ivas_error ivas_dec(
{
    int16_t n, output_frame, nchan_out;
    Decoder_State *st; /* used for bitstream handling */
#ifdef OSBA_EXT_OUT
    float output[MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS][L_FRAME48k]; /* 'float' buffer for output synthesis, MAX_OUTPUT_CHANNELS channels */
#else
    float output[MAX_OUTPUT_CHANNELS][L_FRAME48k]; /* 'float' buffer for output synthesis, MAX_OUTPUT_CHANNELS channels */
#endif
    int16_t nchan_remapped;
    float output_lfe_ch[L_FRAME48k];
#if defined MASA_AND_OBJECTS || defined OSBA_DISC_OBJ_MCT
    int16_t nb_bits_metadata[MAX_SCE + 1];
#else
    int16_t nb_bits_metadata[MAX_SCE];
#endif
    int32_t output_Fs, ivas_total_brate;
    AUDIO_CONFIG output_config;
    float pan_left, pan_right;
    ivas_error error;
#ifdef OSBA_EXT_OUT
    float *p_output[MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS];
#else
    float *p_output[MAX_OUTPUT_CHANNELS];
#endif
#ifdef VLBR_20MS_MD
    int16_t num_md_sub_frames;
#endif
#ifdef MASA_AND_OBJECTS
    int32_t ism_total_brate;
#endif

    error = IVAS_ERR_OK;

@@ -106,10 +121,24 @@ ivas_error ivas_dec(

    output_frame = (int16_t) ( output_Fs / FRAMES_PER_SEC );

#ifdef OSBA_EXT_OUT
    if ( st_ivas->ivas_format == SBA_ISM_FORMAT && output_config == AUDIO_CONFIG_EXTERNAL )
    {
        for ( n = 0; n < nchan_out; n++ )
        {
            p_output[n] = &output[n][0];
        }
    }
    else
    {
#endif
        for ( n = 0; n < MAX_OUTPUT_CHANNELS; n++ )
        {
            p_output[n] = &output[n][0];
        }
#ifdef OSBA_EXT_OUT
    }
#endif

    /*----------------------------------------------------------------*
     * Combine orientations
@@ -124,10 +153,19 @@ ivas_error ivas_dec(
    if ( ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ||
         ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
    {
#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN
        assert( ( st_ivas->ivas_format != UNDEFINED_FORMAT &&
                  st_ivas->ivas_format != MONO_FORMAT &&
                  st_ivas->ivas_format != STEREO_FORMAT ) &&
                ( output_Fs == 48000 ) && "split binaural mode is currently supported with SBA, MASA, ISM, or MC formats and 48 kHz sampling rate only" );
#else
        assert( ( st_ivas->ivas_format == SBA_FORMAT ||
                  st_ivas->ivas_format == MASA_FORMAT ||
                  st_ivas->ivas_format == ISM_FORMAT ||
                  ( st_ivas->ivas_format == ISM_FORMAT && st_ivas->ism_mode != ISM_MODE_PARAM ) ||
                  ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode != MC_MODE_MCMASA ) ) &&
                ( output_Fs == 48000 ) && "split binaural mode is currently supported with SBA, discrete ISM, or MCT-MC formats and 48 kHz sampling rate only" );
#endif
        ivas_set_split_rend_setup( &st_ivas->splitBinRend, &st_ivas->hRenderConfig->split_rend_config, st_ivas->hCombinedOrientationData, hSplitRendBits );
    }
#endif
@@ -183,14 +221,24 @@ ivas_error ivas_dec(
        }
        else if ( st_ivas->ism_mode == ISM_MODE_PARAM )
        {
            if ( ( error = ivas_ism_metadata_dec( ivas_total_brate, st_ivas->nchan_ism, &( st_ivas->nchan_transport ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, nb_bits_metadata, st_ivas->ism_mode, st_ivas->hISMDTX, st_ivas->hDirAC->hParamIsm, &st_ivas->ism_extmeta_active, &st_ivas->ism_extmeta_cnt ) ) != IVAS_ERR_OK )
            if ( ( error = ivas_ism_metadata_dec( ivas_total_brate, st_ivas->nchan_ism, &( st_ivas->nchan_transport ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, nb_bits_metadata, st_ivas->ism_mode, st_ivas->hISMDTX, st_ivas->hDirAC->hParamIsm, &st_ivas->ism_extmeta_active, &st_ivas->ism_extmeta_cnt
#ifdef OSBA_DISC_OBJ_MCT
                                                  ,
                                                  st_ivas->hSCE[0]->hCoreCoder[0]
#endif
                                                  ) ) != IVAS_ERR_OK )
            {
                return error;
            }
        }
        else /* ISM_MODE_DISC */
        {
            if ( ( error = ivas_ism_metadata_dec( ivas_total_brate, st_ivas->nchan_ism, &( st_ivas->nchan_transport ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, nb_bits_metadata, st_ivas->ism_mode, st_ivas->hISMDTX, NULL, &st_ivas->ism_extmeta_active, &st_ivas->ism_extmeta_cnt ) ) != IVAS_ERR_OK )
            if ( ( error = ivas_ism_metadata_dec( ivas_total_brate, st_ivas->nchan_ism, &( st_ivas->nchan_transport ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, nb_bits_metadata, st_ivas->ism_mode, st_ivas->hISMDTX, NULL, &st_ivas->ism_extmeta_active, &st_ivas->ism_extmeta_cnt
#ifdef OSBA_DISC_OBJ_MCT
                                                  ,
                                                  st_ivas->hSCE[0]->hCoreCoder[0]
#endif
                                                  ) ) != IVAS_ERR_OK )
            {
                return error;
            }
@@ -494,6 +542,301 @@ ivas_error ivas_dec(
            ivas_sba_upmixer_renderer( st_ivas, output, output_frame ); /* Note: ivas_sba_linear_renderer() or ivas_dirac_dec() are called internally */
        }
    }
#ifdef MASA_AND_OBJECTS
    // Todo OMASA JBM: Check here for p_output vs. output and possibly also metadata indices
    else if ( st_ivas->ivas_format == MASA_ISM_FORMAT )
    {
        int16_t nchan_ism, nchan_transport_ism;
        int16_t dirac_bs_md_write_idx;

        st = st_ivas->hCPE[0]->hCoreCoder[0];
        set_s( nb_bits_metadata, 0, MAX_SCE + 1 );

        /* Set the number of objects for the parametric rendering */
        dirac_bs_md_write_idx = 0;
        if ( st_ivas->hDirAC != NULL ) /* TODO: should this check for st_ivas->hSpatParamRendCom != NULL ? */
        {
            st_ivas->hSpatParamRendCom->numIsmDirections = 0;
            if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC && st_ivas->ism_mode != ISM_MASA_MODE_MASA_ONE_OBJ )
            {
                st_ivas->hSpatParamRendCom->numIsmDirections = st_ivas->nchan_ism;
            }

            dirac_bs_md_write_idx = st_ivas->hSpatParamRendCom->dirac_bs_md_write_idx; /* Store the write-index for this frame */
        }

        /* MASA metadata decoding */
        if ( ( error = ivas_masa_decode( st_ivas, st, &nb_bits_metadata[0] ) ) != IVAS_ERR_OK )
        {
            return error;
        }

        /* Configuration of combined-format bit-budget distribution */
        ivas_set_surplus_brate_dec( st_ivas, &ism_total_brate );

        st->bit_stream = &( st_ivas->bit_stream[( ism_total_brate / FRAMES_PER_SEC )] );

        /* set ISM parameters and decode ISM metadata in OMASA format */
        if ( ( error = ivas_omasa_ism_metadata_dec( st_ivas, ism_total_brate, &nchan_ism, &nchan_transport_ism, dirac_bs_md_write_idx, &nb_bits_metadata[1] ) ) != IVAS_ERR_OK )
        {
            return error;
        }

        /* decode ISM channels */
        for ( n = 0; n < nchan_transport_ism; n++ )
        {
            if ( ( error = ivas_sce_dec( st_ivas, n, &output[st_ivas->nchan_transport + n], output_frame, nb_bits_metadata[1] ) ) != IVAS_ERR_OK )
            {
                return error;
            }
        }

        /* decode MASA channels */
        if ( ( error = ivas_cpe_dec( st_ivas, 0, output, output_frame, nb_bits_metadata[0] ) ) != IVAS_ERR_OK )
        {
            return error;
        }

        if ( st_ivas->hCPE[0]->nchan_out == 1 )
        {
            mvr2r( output[0], output[1], output_frame ); /* Copy mono signal to stereo output channels */
        }

        /* HP filtering */
        for ( n = 0; n < getNumChanSynthesis( st_ivas ); n++ )
        {
            hp20( output[n], output_frame, st_ivas->mem_hp20_out[n], output_Fs );
        }

        /* Set edited object positions, if editing enabled */
        ivas_omasa_set_edited_objects( st_ivas );

        /* Rendering */
        if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC )
        {
            if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC && st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC )
            {
                if ( ( error = ivas_omasa_dirac_td_binaural( st_ivas, output, output_frame ) ) != IVAS_ERR_OK )
                {
                    return error;
                }
            }
            else
            {
                ivas_dirac_dec_binaural( st_ivas, st_ivas->hCombinedOrientationData, output, st_ivas->nchan_transport );
            }
        }
        else if ( st_ivas->renderer_type == RENDERER_MONO_DOWNMIX )
        {
            ivas_mono_downmix_render_passive( st_ivas, output, output_frame );
        }
        else if ( st_ivas->renderer_type == RENDERER_DIRAC )
        {
            ivas_omasa_dirac_rend( st_ivas, output, output_frame );
        }

        /* external output */
        if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_EXTERNAL )
        {
            /* sanity check in case of bitrate switching */
            if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC )
            {
                return IVAS_ERROR( IVAS_ERR_INVALID_OUTPUT_FORMAT, "Incorrect output configuration specified for combined MASA and ISM format" );
            }

            /* in case of external rendering, rearrange the channels order */
            mvr2r( output[0], output[MAX_OUTPUT_CHANNELS - 2], output_frame );
            mvr2r( output[1], output[MAX_OUTPUT_CHANNELS - 1], output_frame );

            for ( n = 0; n < nchan_transport_ism; n++ )
            {
                mvr2r( output[st_ivas->nchan_transport + n], output[n], output_frame );
            }
            mvr2r( output[MAX_OUTPUT_CHANNELS - 2], output[n], output_frame );
            mvr2r( output[MAX_OUTPUT_CHANNELS - 1], output[++n], output_frame );
        }
    }
#endif
#ifdef OSBA_DISC_OBJ_MCT
    else if ( st_ivas->ivas_format == SBA_ISM_FORMAT )
    {
        int16_t nchan_ism, nchan_transport_ism;
        int16_t dirac_bs_md_write_idx;

        set_s( nb_bits_metadata, 0, MAX_SCE + 1 );
        nchan_transport_ism = 1;

        dirac_bs_md_write_idx = 0;
        if ( st_ivas->hDirAC != NULL )
        {
            dirac_bs_md_write_idx = st_ivas->hSpatParamRendCom->dirac_bs_md_write_idx; /* Store the write-index for this frame */ /*TODOfto:this seems not to be needed?*/
        }
#ifdef ENABLE_ISM_MD_CODING
        /* set ISM parameters and decode ISM metadata in OSBA format */
        if ( ( error = ivas_osba_ism_metadata_dec( st_ivas, ivas_total_brate, &nchan_ism, &nchan_transport_ism, dirac_bs_md_write_idx, &nb_bits_metadata[1] ) ) != IVAS_ERR_OK )
        {
            return error;
        }
#endif

        /* SBA metadata decoding */
        if ( ( error = ivas_spar_dec( st_ivas, nb_bits_metadata ) ) != IVAS_ERR_OK )
        {
            return error;
        }

        st = st_ivas->hCPE[0]->hCoreCoder[0];

        if ( ( error = ivas_mct_dec( st_ivas, output, output_frame, nb_bits_metadata[0] + nb_bits_metadata[1] ) ) != IVAS_ERR_OK )
        {
            return error;
        }

#ifdef OSBA_MONO_STEREO_OUTPUT
        if ( st_ivas->sba_dirac_stereo_flag )
        {
            ivas_agc_dec_process( st_ivas->hSpar->hAgcDec, &output[st_ivas->nchan_ism], &output[st_ivas->nchan_ism], st_ivas->hSpar->hMdDec->spar_md_cfg.nchan_transport, output_frame );

            if ( st_ivas->hSpar->hPCA != NULL )
            {
                ivas_pca_dec( st_ivas->hSpar->hPCA, output_frame, st_ivas->hSpar->hMdDec->spar_md_cfg.nchan_transport, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->hDecoderConfig->last_ivas_total_brate, st_ivas->bfi, &output[st_ivas->nchan_ism] );
            }

            ivas_spar_dec_gen_umx_mat( st_ivas->hSpar->hMdDec, st_ivas->nchan_transport, IVAS_MAX_NUM_BANDS, st_ivas->bfi,
                                       ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, st_ivas->hDecoderConfig->ivas_total_brate
#ifdef VLBR_20MS_MD
                                       ,
                                       st_ivas->last_active_ivas_total_brate
#endif
                                       ) );

            ivas_sba_dirac_stereo_dec( st_ivas, &output[st_ivas->nchan_ism], output_frame, 0 );
        }
#endif

        /* HP filtering */
        for ( n = 0; n < getNumChanSynthesis( st_ivas ); n++ ) /*TODOfto:check what needs to be filtered here*/
        {
            hp20( output[n], output_frame, st_ivas->mem_hp20_out[n], output_Fs );
        }

        nchan_remapped = ivas_sba_remapTCs( &output[st_ivas->nchan_ism], 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 )
        {
            if ( ( error = ivas_omasa_dirac_td_binaural( st_ivas, output, output_frame ) ) != IVAS_ERR_OK )
            {
                return error;
            }
        }
#ifdef OSBA_MONO_STEREO_OUTPUT
        else if ( st_ivas->ism_mode == ISM_SBA_MODE_DISC && ( st_ivas->renderer_type == RENDERER_OSBA_STEREO || st_ivas->renderer_type == RENDERER_MONO_DOWNMIX ) )
        {
            if ( st_ivas->renderer_type == RENDERER_MONO_DOWNMIX )
            {
                ivas_mono_downmix_render_passive( st_ivas, output, output_frame );
            }
            else /* stereo output */
            {
                /* shift SBA channels to avoid overwrite by ISM upmix in 1 object case */
                if ( nchan_ism == 1 )
                {
                    mvr2r( output[2], output[3], output_frame );
                    mvr2r( output[1], output[2], output_frame );
                }
                ivas_ism_render( st_ivas, p_output, output_frame );
            }

            for ( n = 0; n < nchan_out; n++ )
            {
                v_add( output[n], output[n + max(nchan_out, nchan_ism)], output[n], output_frame );
            }
        }
#endif
#ifdef OSBA_AMBISONICS_OUT
        else if ( st_ivas->renderer_type == RENDERER_OSBA_AMBI )
        {
            float tmp_ism_out[MAX_OUTPUT_CHANNELS][L_FRAME48k];
            float *p_tmp_ism_out[MAX_OUTPUT_CHANNELS];

            for ( n = 0; n < nchan_out; n++ )
            {
                p_tmp_ism_out[n] = &tmp_ism_out[n][0];
            }

            for ( n = 0; n < nchan_ism; n++ )
            {
                mvr2r( output[n], tmp_ism_out[n], output_frame );
                delay_signal( tmp_ism_out[n], output_frame, st_ivas->hMasaIsmData->delayBuffer[n], st_ivas->hMasaIsmData->delayBuffer_size );
            }

            ivas_ism2sba( p_tmp_ism_out, st_ivas->hIsmRendererData, st_ivas->hIsmMetaData, st_ivas->nchan_ism, output_frame, st_ivas->hIntSetup.ambisonics_order );

            ivas_sba_upmixer_renderer( st_ivas, &output[st_ivas->nchan_ism], output_frame );

            for ( n = 0; n < nchan_out; n++ )
            {
                v_add( output[n + nchan_ism], tmp_ism_out[n], output[n], output_frame );
                v_multc( output[n], 0.5f, output[n], output_frame );
            }
        }
#endif
#ifdef OSBA_LS_OUT
        /* todo: almost the same path as for Ambisonics output. Should be merged at some point. */
        else if ( st_ivas->renderer_type == RENDERER_OSBA_LS )
        {
            float tmp_ism_out[MAX_CICP_CHANNELS][L_FRAME48k];
            float *p_tmp_ism_out[MAX_CICP_CHANNELS];

            for ( n = 0; n < nchan_out; n++ )
            {
                p_tmp_ism_out[n] = &tmp_ism_out[n][0];
            }

            for ( n = 0; n < nchan_ism; n++ )
            {
                mvr2r( output[n], tmp_ism_out[n], output_frame );
                delay_signal( tmp_ism_out[n], output_frame, st_ivas->hMasaIsmData->delayBuffer[n], st_ivas->hMasaIsmData->delayBuffer_size );
            }

            ivas_ism_render( st_ivas, p_tmp_ism_out, output_frame );

            ivas_sba_upmixer_renderer( st_ivas, &output[st_ivas->nchan_ism], output_frame );

            for ( n = 0; n < nchan_out; n++ )
            {
                v_add( output[n + nchan_ism], tmp_ism_out[n], output[n], output_frame );
                v_multc( output[n], 0.5f, output[n], output_frame );
            }
        }
#endif
        else /*HOA3 rendering for now*/
        {
#ifdef OSBA_EXT_OUT
            for ( n = 0; n < nchan_ism; n++ )
            {
                delay_signal( output[n], output_frame, st_ivas->hMasaIsmData->delayBuffer[n], st_ivas->hMasaIsmData->delayBuffer_size );
            }

            ivas_sba_upmixer_renderer( st_ivas, &output[st_ivas->nchan_ism], output_frame );
#endif
        }
    }
#endif
    else if ( st_ivas->ivas_format == MC_FORMAT )
    {
        st = ( st_ivas->nSCE > 0 ) ? st_ivas->hSCE[0]->hCoreCoder[0] : st_ivas->hCPE[0]->hCoreCoder[0];
@@ -612,6 +955,10 @@ ivas_error ivas_dec(
            ivas_mc_paramupmix_dec( st_ivas, output );

            /* HP filtering */
#ifdef SPLIT_REND_WITH_HEAD_ROT
            if ( st_ivas->renderer_type != RENDERER_BINAURAL_FASTCONV && st_ivas->renderer_type != RENDERER_BINAURAL_FASTCONV_ROOM )
#endif
            {
                for ( n = 0; n < st_ivas->nchan_transport; n++ )
                {
                    if ( n != LFE_CHANNEL )
@@ -619,6 +966,7 @@ ivas_error ivas_dec(
                        hp20( output[n], output_frame, st_ivas->mem_hp20_out[n], output_Fs );
                    }
                }
            }

            if ( st_ivas->transport_config != st_ivas->intern_config && ( st_ivas->intern_config == AUDIO_CONFIG_FOA || st_ivas->intern_config == AUDIO_CONFIG_HOA2 || st_ivas->intern_config == AUDIO_CONFIG_HOA3 ) )
            {
@@ -629,45 +977,15 @@ ivas_error ivas_dec(
#ifdef JBM_PARAMUPMIX
            if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM )
            {
                ivas_binaural_add_LFE( st_ivas, output_frame, p_output, p_output );
#else
            if ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM )
            {
#ifdef SPLIT_REND_WITH_HEAD_ROT
                if ( ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ||
                     ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
                {
                    ivas_rend_crendProcessSplitBin(
                        st_ivas->hCrendWrapper,
                        st_ivas->intern_config,
                        st_ivas->hOutSetup.output_config,
                        &st_ivas->splitBinRend.splitrend.multiBinPoseData,
                        st_ivas->hDecoderConfig,
                        st_ivas->hCombinedOrientationData,
                        &st_ivas->hIntSetup,
                        st_ivas->hEFAPdata,
                        p_output,
                        output_Fs );
                }
                else
                {
#endif
                    if ( ( error = ivas_rend_crendProcess( st_ivas->hCrendWrapper, st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hDecoderConfig,
                                                           st_ivas->hCombinedOrientationData, &st_ivas->hIntSetup, st_ivas->hEFAPdata, p_output, output_Fs
#ifdef SPLIT_REND_WITH_HEAD_ROT
                                                           ,
                                                           0
                if ( ( st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) &&
                     ( st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
#endif
                                                           ) ) != IVAS_ERR_OK )
                {
                        return error;
                    }
#ifdef SPLIT_REND_WITH_HEAD_ROT
                    ivas_binaural_add_LFE( st_ivas, output_frame, p_output, p_output );
                }
#endif
#endif /* JBM_PARAMUPMIX */
            }
#endif /* JBM_PARAMUPMIX */
            else if ( st_ivas->renderer_type == RENDERER_MC )
            {
                if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_MONO ) || ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_STEREO ) )
@@ -850,11 +1168,16 @@ ivas_error ivas_dec(
        IVAS_DEC_SPLIT_REND_WRAPPER *hSplitBinRend;
        int16_t max_band;
        int16_t pcm_out;
#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN
        int16_t td_input;

        td_input = st_ivas->renderer_type != RENDERER_BINAURAL_FASTCONV && st_ivas->renderer_type != RENDERER_BINAURAL_PARAMETRIC && st_ivas->renderer_type != RENDERER_BINAURAL_PARAMETRIC_ROOM && st_ivas->renderer_type != RENDERER_STEREO_PARAMETRIC;
#endif
        hSplitBinRend = &st_ivas->splitBinRend;
        max_band = (int16_t) ( ( BINAURAL_MAXBANDS * output_Fs ) / 48000 );
        pcm_out = ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0;

        ivas_renderMultiBinToSplitBinaural( &hSplitBinRend->splitrend,
        if ( ( error = ivas_renderMultiBinToSplitBinaural( &hSplitBinRend->splitrend,
                                                           st_ivas->hHeadTrackData->Quaternions,
                                                           st_ivas->hRenderConfig->split_rend_config.splitRendBitRate,
                                                           st_ivas->hRenderConfig->split_rend_config.codec,
@@ -862,8 +1185,15 @@ ivas_error ivas_dec(
                                                           hSplitBinRend->hMultiBinCldfbData->Cldfb_RealBuffer_Binaural,
                                                           hSplitBinRend->hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural,
                                                           max_band, output, 1,
#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN
                                                           td_input,
#else
                                                           st_ivas->renderer_type != RENDERER_BINAURAL_FASTCONV,
                                            pcm_out );
#endif
                                                           pcm_out ) ) != IVAS_ERR_OK )
        {
            return error;
        }

        free( st_ivas->splitBinRend.hMultiBinCldfbData );
    }
@@ -902,6 +1232,10 @@ ivas_error ivas_dec(
        st_ivas->ini_active_frame++;
    }

#ifdef MASA_AND_OBJECTS
    st_ivas->last_ivas_format = st_ivas->ivas_format;
#endif

#ifdef DEBUG_MODE_INFO
    dbgwrite( &st_ivas->bfi, sizeof( int16_t ), 1, output_frame, "res/bfi" );
    dbgwrite( &st_ivas->BER_detect, sizeof( int16_t ), 1, output_frame, "res/BER_detect" );
+735 −93

File changed.

Preview size limit exceeded, changes collapsed.

+165 −18

File changed.

Preview size limit exceeded, changes collapsed.

+20 −0
Original line number Diff line number Diff line
@@ -94,6 +94,26 @@ void ivas_mono_downmix_render_passive(
    MONO_DOWNMIX_RENDERER_HANDLE hDownmix;

    numInputChannels = st_ivas->nSCE;
#ifdef OSBA_MONO_STEREO_OUTPUT
    if ( st_ivas->ivas_format == SBA_ISM_FORMAT )
    {
        numInputChannels = st_ivas->nchan_ism;
    }
#endif
#ifdef MASA_AND_OBJECTS
    if ( st_ivas->ivas_format == MASA_ISM_FORMAT )
    {
        if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ )
        {
            numInputChannels = st_ivas->nchan_transport + 1;
        }
        else
        {
            numInputChannels = st_ivas->nchan_transport + st_ivas->nchan_ism;
        }
    }
#endif

    hDownmix = st_ivas->hMonoDmxRenderer;
    set_zero( proto_signal, output_frame );

+40 −1
Original line number Diff line number Diff line
@@ -53,8 +53,22 @@ ivas_error ivas_td_binaural_open(
    Decoder_Struct *st_ivas /* i/o: IVAS decoder structure  */
)
{
#ifdef MASA_AND_OBJECTS
    int16_t num_src;

    num_src = st_ivas->nchan_transport;
    if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC )
    {
        num_src = st_ivas->nchan_ism;
    }

    return ivas_td_binaural_open_unwrap( &st_ivas->hHrtfTD, st_ivas->hDecoderConfig->output_Fs, num_src, st_ivas->ivas_format,
                                         st_ivas->transport_config, st_ivas->hRenderConfig->directivity, st_ivas->hTransSetup, &st_ivas->hBinRendererTd, &st_ivas->binaural_latency_ns );
#else

    return ivas_td_binaural_open_unwrap( &st_ivas->hHrtfTD, st_ivas->hDecoderConfig->output_Fs, st_ivas->nchan_transport, st_ivas->ivas_format,
                                         st_ivas->transport_config, st_ivas->hRenderConfig->directivity, st_ivas->hTransSetup, &st_ivas->hBinRendererTd, &st_ivas->binaural_latency_ns );
#endif
}


@@ -72,6 +86,17 @@ ivas_error ivas_td_binaural_renderer(
)
{
    int16_t ism_md_subframe_update;
#if defined OSBA_DISC_OBJ_MCT || defined MASA_AND_OBJECTS
    int16_t nchan_transport;
#endif

#if defined OSBA_DISC_OBJ_MCT && defined MASA_AND_OBJECTS
    nchan_transport = ( st_ivas->ism_mode == ISM_SBA_MODE_DISC || st_ivas->ism_mode == ISM_SBA_MODE_DISC ) ? st_ivas->nchan_ism : st_ivas->nchan_transport;
#elif defined MASA_AND_OBJECTS
    nchan_transport = ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) ? st_ivas->nchan_ism : st_ivas->nchan_transport;
#elif defined OSBA_DISC_OBJ_MCT
    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,10 +106,24 @@ ivas_error ivas_td_binaural_renderer(
    {
        ism_md_subframe_update = 2;
    }

#ifdef MASA_AND_OBJECTS
    if ( st_ivas->ivas_format == MASA_ISM_FORMAT )
    {
        ism_md_subframe_update = 0; // ToDo (for Mikko-Ville): verify whether it should not be 2
    }
#endif

    return ivas_td_binaural_renderer_unwrap(
        st_ivas->hReverb,
        st_ivas->transport_config,
        st_ivas->hBinRendererTd, st_ivas->nchan_transport, LFE_CHANNEL, st_ivas->ivas_format,
        st_ivas->hBinRendererTd,
#if defined OSBA_DISC_OBJ_MCT || defined MASA_AND_OBJECTS
        nchan_transport,
#else
        st_ivas->nchan_transport,
#endif
        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,
Loading