Commit d7c931c5 authored by PLAINSI's avatar PLAINSI
Browse files

Rendering Fix

parent 5a8a5c70
Loading
Loading
Loading
Loading
Loading
+14 −1
Original line number Diff line number Diff line
@@ -4825,16 +4825,29 @@ void ivas_ls_setup_conversion_close(
    LSSETUP_CONVERSION_HANDLE *hLsSetUpConversion               /* i/o: LS converter handle                             */
);

#ifdef MC_PARAMUPMIX_MODE
void ivas_ls_setup_conversion(
    Decoder_Struct *st_ivas,                                    /* i  : IVAS decoder structure                          */
    const int16_t input_chans,                                  /* i  : number of input channels to the renderer        */
    const int16_t output_frame,                                 /* i  : frame length                                    */
    float output[][L_FRAME48k]                                  /* i/o: LS input/output synthesis signal                */
);

void ivas_ls_setup_conversion_process_mdct(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder structure                          */
    const int16_t input_chans,                                  /* i  : number of input channels to the renderer        */
    float output[][L_FRAME48k]                                  /* i/o: output synthesis signal                         */
);
#else
void ivas_ls_setup_conversion(
    Decoder_Struct *st_ivas,                                    /* i  : IVAS decoder structure                          */
    const int16_t output_frame,                                 /* i  : frame length                                    */
    float output[][L_FRAME48k]                                  /* i/o: LS input/output synthesis signal                */
);
void ivas_ls_setup_conversion_process_mdct(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder structure                          */
    float output[][L_FRAME48k]                                  /* i/o: output synthesis signal                         */
);
#endif

void ivas_ls_setup_conversion_process_mdct_param_mc(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder structure                          */
+15 −2
Original line number Diff line number Diff line
@@ -134,7 +134,11 @@ ivas_error ivas_dec(
        /* Rendering */
        if ( st_ivas->renderer_type == RENDERER_MC )
        {
#ifdef MC_PARAMUPMIX_MODE
            ivas_ls_setup_conversion( st_ivas, st_ivas->nchan_transport, output_frame, output );
#else
            ivas_ls_setup_conversion( st_ivas, output_frame, output );
#endif
        }
    }
    else if ( st_ivas->ivas_format == ISM_FORMAT )
@@ -487,7 +491,11 @@ ivas_error ivas_dec(
            }
            else if ( st_ivas->renderer_type == RENDERER_MC )
            {
#ifdef MC_PARAMUPMIX_MODE
                ivas_ls_setup_conversion( st_ivas, st_ivas->nchan_transport, output_frame, output );
#else
                ivas_ls_setup_conversion( st_ivas, output_frame, output );
#endif
            }
            else if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC )
            {
@@ -548,9 +556,9 @@ ivas_error ivas_dec(

                ivas_binaural_add_LFE( st_ivas, output_frame, output );
            }
            else if ( st_ivas->renderer_type == RENDERER_MC )
            else if ( st_ivas->renderer_type == RENDERER_MC || st_ivas->renderer_type == RENDERER_MC_PARAMUPMIX )
            {
                ivas_ls_setup_conversion( st_ivas, output_frame, output );
                ivas_ls_setup_conversion( st_ivas, MC_PARAMUPMIX_MAX_INPUT_CHANS, output_frame, output );
            }
            else if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC )
            {
@@ -565,6 +573,7 @@ ivas_error ivas_dec(

                ivas_binaural_add_LFE( st_ivas, output_frame, output );
            }

        }
#endif
        else if ( st_ivas->mc_mode == MC_MODE_PARAMMC )
@@ -596,7 +605,11 @@ ivas_error ivas_dec(
            /* Rendering */
            if ( output_config == AUDIO_CONFIG_MONO || output_config == AUDIO_CONFIG_STEREO )
            {
#ifdef MC_PARAMUPMIX_MODE
                ivas_ls_setup_conversion( st_ivas, st_ivas->nchan_transport, output_frame, output );
#else
                ivas_ls_setup_conversion( st_ivas, output_frame, output );
#endif
            }
            else
            {
+14 −20
Original line number Diff line number Diff line
@@ -1366,7 +1366,11 @@ ivas_error ivas_init_decoder(
            }
        }
    }
#ifdef MC_PARAMUPMIX_MODE
    else if ( st_ivas->renderer_type == RENDERER_MC || st_ivas->renderer_type == RENDERER_MC_PARAMUPMIX )
#else
    else if ( st_ivas->renderer_type == RENDERER_MC )
#endif
    {
        if ( ( error = ivas_ls_setup_conversion_open( st_ivas ) ) != IVAS_ERR_OK )
        {
@@ -1997,12 +2001,6 @@ void ivas_init_dec_get_num_cldfb_instances(
                }
            }
            break;
#ifdef MC_PARAMUPMIX_MODE
        case RENDERER_MC_PARAMUPMIX:
            *numCldfbAnalyses = MC_PARAMUPMIX_MIN_CLDFB;
            *numCldfbSyntheses = MC_PARAMUPMIX_MIN_CLDFB;
            break;
#endif
        case RENDERER_MC_PARAMMC:
            if ( st_ivas->hDecoderConfig->nchan_out <= 2 )
            {
@@ -2032,6 +2030,9 @@ void ivas_init_dec_get_num_cldfb_instances(
        case RENDERER_BINAURAL_MIXER_CONV_ROOM:
        case RENDERER_BINAURAL_FASTCONV:
        case RENDERER_BINAURAL_FASTCONV_ROOM:
#ifdef MC_PARAMUPMIX_MODE
        case RENDERER_MC_PARAMUPMIX:
#endif
            if ( st_ivas->sba_mode == SBA_MODE_SPAR )
            {
                if ( st_ivas->sba_dirac_stereo_flag )
@@ -2057,13 +2058,6 @@ void ivas_init_dec_get_num_cldfb_instances(
                    }
                }
            }
#ifdef MC_PARAMUPMIX_MODE
            else if ( st_ivas->mc_mode == MC_MODE_PARAMUPMIX )
            {
                *numCldfbAnalyses = MC_PARAMUPMIX_MIN_CLDFB;
                *numCldfbSyntheses = MC_PARAMUPMIX_MIN_CLDFB;
            }
#endif
            else if ( st_ivas->mc_mode == MC_MODE_PARAMMC )
            {
                /* do nothing for ParamMC */
@@ -2080,13 +2074,6 @@ void ivas_init_dec_get_num_cldfb_instances(
            {
                *numCldfbSyntheses = param_mc_get_num_cldfb_syntheses( st_ivas );
            }
#ifdef MC_PARAMUPMIX_MODE
            else if ( st_ivas->mc_mode == MC_MODE_PARAMUPMIX )
            {
                *numCldfbAnalyses = MC_PARAMUPMIX_MIN_CLDFB;
                *numCldfbSyntheses = MC_PARAMUPMIX_MIN_CLDFB;
            }
#endif
            else if ( st_ivas->ism_mode == ISM_MODE_PARAM )
            {
                *numCldfbSyntheses = st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe;
@@ -2106,6 +2093,13 @@ void ivas_init_dec_get_num_cldfb_instances(
        default:
            assert( 0 && "Renderer not handled for CLDFB reservation." );
    }
#ifdef MC_PARAMUPMIX_MODE
    if ( st_ivas->mc_mode == MC_MODE_PARAMUPMIX )
    {
        *numCldfbAnalyses = max( MC_PARAMUPMIX_MIN_CLDFB, *numCldfbAnalyses );
        *numCldfbSyntheses = max( MC_PARAMUPMIX_MIN_CLDFB, *numCldfbSyntheses );
    }
#endif

    return;
}
+14 −1
Original line number Diff line number Diff line
@@ -190,11 +190,24 @@ ivas_error ivas_mct_dec(
        ivas_mdct_core_tns_ns( hCPE, hMCT->LFE_off, fUseTns[cpe_id], tnsData[cpe_id], x, Aq[cpe_id], 1 );
    }

#ifdef MC_PARAMUPMIX_MODE
    if ( st_ivas->renderer_type == RENDERER_MC)
    {
        /* Equalization in MDCT Domain */
        ivas_ls_setup_conversion_process_mdct( st_ivas, st_ivas->nchan_transport, output );
    }
    else if ( st_ivas->renderer_type == RENDERER_MC_PARAMUPMIX )
    {
        /* Equalization in MDCT Domain */
        ivas_ls_setup_conversion_process_mdct( st_ivas, MC_PARAMUPMIX_MAX_INPUT_CHANS, output );
    }
#else
    if ( st_ivas->renderer_type == RENDERER_MC )
    {
        /* Equalization in MDCT Domain */
        ivas_ls_setup_conversion_process_mdct( st_ivas, output );
    }
#endif
    else if ( st_ivas->renderer_type == RENDERER_MC_PARAMMC && ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_MONO || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_STEREO ) )
    {
        float *x_all[MAX_CICP_CHANNELS][NB_DIV];
@@ -788,7 +801,7 @@ static ivas_error ivas_mc_dec_reconfig(
            ivas_qmetadata_close( &st_ivas->hQMetaData );

            /* init LS conversion if the renderer type asks for it */
            if ( st_ivas->renderer_type == RENDERER_MC && st_ivas->hLsSetUpConversion == NULL )
            if ( (st_ivas->renderer_type == RENDERER_MC || st_ivas->renderer_type == RENDERER_MC_PARAMUPMIX) && st_ivas->hLsSetUpConversion == NULL )
            {
                if ( ( error = ivas_ls_setup_conversion_open( st_ivas ) ) != IVAS_ERR_OK )
                {
+26 −4
Original line number Diff line number Diff line
@@ -326,11 +326,7 @@ ivas_error ivas_ls_setup_conversion_open(
    assert( nchan_out <= MAX_OUTPUT_CHANNELS );

    outChannels = nchan_out;
#ifdef MC_PARAMUPMIX_MODE
    if ( st_ivas->renderer_type == RENDERER_MC_PARAMMC || st_ivas->renderer_type == RENDERER_MC_PARAMUPMIX )
#else
    if ( st_ivas->renderer_type == RENDERER_MC_PARAMMC )
#endif
    {
        inChannels = st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe;
        hLsSetUpConversion->sfbCnt = (int16_t) ( output_Fs * INV_CLDFB_BANDWIDTH + 0.5f );
@@ -355,7 +351,19 @@ ivas_error ivas_ls_setup_conversion_open(
    }
    else
    {
#ifdef MC_PARAMUPMIX_MODE
        if (st_ivas->renderer_type == RENDERER_MC_PARAMUPMIX)
        {
            inChannels = st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe;
        }
        else
        {
            inChannels = st_ivas->nchan_transport;
        }
#else
        inChannels = st_ivas->nchan_transport;
#endif
        
        /*Initialization of MDCT bands with TCX20 resolution */
        ivas_lssetupconversion_mdct_init_bands( output_frame, TCX_20_CORE, &hLsSetUpConversion->sfbOffset[0], &hLsSetUpConversion->sfbCnt );
        if ( ( hLsSetUpConversion->targetEnergyPrev[0] = (float *) malloc( ( MAX_SFB + 2 ) * sizeof( float ) ) ) == NULL )
@@ -469,6 +477,9 @@ void ivas_ls_setup_conversion_close(

void ivas_ls_setup_conversion(
    Decoder_Struct *st_ivas,    /* i  : IVAS decoder structure           */
#ifdef MC_PARAMUPMIX_MODE
    const int16_t input_chans, /* i  : number of input channels to the renderer        */
#endif
    const int16_t output_frame, /* i  : frame length                     */
    float output[][L_FRAME48k]  /* i/o: LS input/output synthesis signal */
)
@@ -485,7 +496,11 @@ void ivas_ls_setup_conversion(
    for ( chOutIdx = 0; chOutIdx < st_ivas->hDecoderConfig->nchan_out; chOutIdx++ )
    {
        set_zero( output_tmp[chOutIdx], output_frame );
#ifdef MC_PARAMUPMIX_MODE
        for ( chInIdx = 0; chInIdx < input_chans; chInIdx++ )
#else
        for ( chInIdx = 0; chInIdx < st_ivas->nchan_transport; chInIdx++ )
#endif
        {
            dmxCoeff = hLsSetUpConversion->dmxMtx[chInIdx][chOutIdx];

@@ -531,6 +546,9 @@ void ivas_ls_setup_conversion(

void ivas_ls_setup_conversion_process_mdct(
    Decoder_Struct *st_ivas,   /* i/o: IVAS decoder structure          */
#ifdef MC_PARAMUPMIX_MODE
    const int16_t input_chans, /* i  : number of input channels to the renderer        */
#endif
    float output[][L_FRAME48k] /* i/o: output synthesis signal         */
)
{
@@ -556,7 +574,11 @@ void ivas_ls_setup_conversion_process_mdct(
    push_wmops( "LS_Renderer_MDCT" );

    /* Assign all the declared variables */
#ifdef MC_PARAMUPMIX_MODE
    inChannels = input_chans;
#else
    inChannels = st_ivas->nchan_transport;
#endif
    outChannels = st_ivas->hDecoderConfig->nchan_out;
    num_CPE = st_ivas->nCPE;

Loading