Commit f8bf262f authored by vaclav's avatar vaclav
Browse files

Merge remote-tracking branch 'remotes/origin/main' into 1870-basop-PortFlpMr1860

parents ed10ba41 97a22a9d
Loading
Loading
Loading
Loading
Loading
+1 −7
Original line number Diff line number Diff line
@@ -698,17 +698,11 @@ Word16 read_flag_EC_DFT(
    Word16 *flag               /* o  : flag value           */
);

void ivas_init_dec_get_num_cldfb_instances(
void ivas_init_dec_get_num_cldfb_instances_fx(
    Decoder_Struct *st_ivas,  /* i  : IVAS decoder structure                  */
    Word16 *numCldfbAnalyses, /* o  : number of CLDFB analysis instances      */
    Word16 *numCldfbSyntheses /* o  : number of CLDFB synthesis instances     */
);
/*file:ivas_init_dec_fx.c*/
void ivas_init_dec_get_num_cldfb_instances_ivas_fx(
    Decoder_Struct *st_ivas,  /* i  : IVAS decoder structure                     */
    Word16 *numCldfbAnalyses, /* o  : number of needed CLDFB analysis instances  */
    Word16 *numCldfbSyntheses /* o  : number of needed CLDFB synthesis instances */
);

Word16 masa_sq_fx(
    const Word32 in,         /* i  : input value                             */
+1 −1
Original line number Diff line number Diff line
@@ -577,7 +577,7 @@ ivas_error ivas_cldfb_dec_reconfig_fx(

    hDecoderConfig = st_ivas->hDecoderConfig;

    ivas_init_dec_get_num_cldfb_instances_ivas_fx( st_ivas, &numCldfbAnalyses, &numCldfbSyntheses );
    ivas_init_dec_get_num_cldfb_instances_fx( st_ivas, &numCldfbAnalyses, &numCldfbSyntheses );

    /* special case, if there was one transport channel in the previous frame and more than one in the current frame,
       remove the second CLDFB here, it was for CNA/CNG */
+5 −279
Original line number Diff line number Diff line
@@ -2666,7 +2666,7 @@ ivas_error ivas_init_decoder_fx(
     * CLDFB handles for rendering
     *-----------------------------------------------------------------*/

    ivas_init_dec_get_num_cldfb_instances_ivas_fx( st_ivas, &numCldfbAnalyses, &numCldfbSyntheses );
    ivas_init_dec_get_num_cldfb_instances_fx( st_ivas, &numCldfbAnalyses, &numCldfbSyntheses );

    FOR( i = 0; i < numCldfbAnalyses; i++ )
    {
@@ -2809,9 +2809,9 @@ ivas_error ivas_init_decoder_fx(
    /*-----------------------------------------------------------------*
     * Allocate floating-point output audio buffers
     *-----------------------------------------------------------------*/
    st_ivas->p_out_len = ivas_get_nchan_buffers_dec( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate );
    st_ivas->p_out_len = ivas_get_nchan_buffers_dec_fx( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate );
    move16();
    FOR( n = 0; n < ivas_get_nchan_buffers_dec( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); n++ )
    FOR( n = 0; n < ivas_get_nchan_buffers_dec_fx( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); n++ )
    {
        /* note: these are intra-frame heap memories */
        IF( ( st_ivas->p_output_fx[n] = (Word32 *) malloc( ( 48000 / FRAMES_PER_SEC ) * sizeof( Word32 ) ) ) == NULL )
@@ -3321,7 +3321,7 @@ void ivas_destroy_dec_fx(
 *-------------------------------------------------------------------*/

/*! r: number of cldfb instances */
void ivas_init_dec_get_num_cldfb_instances(
void ivas_init_dec_get_num_cldfb_instances_fx(
    Decoder_Struct *st_ivas,  /* i  : IVAS decoder structure                     */
    Word16 *numCldfbAnalyses, /* o  : number of needed CLDFB analysis instances  */
    Word16 *numCldfbSyntheses /* o  : number of needed CLDFB synthesis instances */
@@ -3566,286 +3566,12 @@ void ivas_init_dec_get_num_cldfb_instances(
            *numCldfbSyntheses = st_ivas->hDecoderConfig->nchan_out;
            move16();
            move16();
            break;
        case RENDERER_OMASA_MIX_EXT:
            *numCldfbAnalyses = add( st_ivas->nchan_transport, 1 );
            *numCldfbSyntheses = 0;
            move16();
            break;
#endif
        default:
            assert( 0 && "Renderer not handled for CLDFB reservation." );
    }
    test();
    test();
    IF( EQ_32( st_ivas->mc_mode, MC_MODE_PARAMUPMIX ) && NE_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_MONO ) && NE_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_STEREO ) )
    {
        test();
        test();
        IF( EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV ) || EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV_ROOM ) || EQ_32( st_ivas->renderer_type, RENDERER_STEREO_PARAMETRIC ) )
        {
            *numCldfbAnalyses = s_max( MC_PARAMUPMIX_MAX_INPUT_CHANS, *numCldfbAnalyses );
            move16();
        }
        ELSE
        {
            *numCldfbAnalyses = s_max( MC_PARAMUPMIX_MIN_CLDFB, *numCldfbAnalyses );
            move16();
        }
        *numCldfbSyntheses = s_max( MC_PARAMUPMIX_MIN_CLDFB, *numCldfbSyntheses );
        move16();
    }

    return;
}

void ivas_init_dec_get_num_cldfb_instances_ivas_fx(
    Decoder_Struct *st_ivas,  /* i  : IVAS decoder structure                     */
    Word16 *numCldfbAnalyses, /* o  : number of needed CLDFB analysis instances  */
    Word16 *numCldfbSyntheses /* o  : number of needed CLDFB synthesis instances */
)
{
    IVAS_FORMAT ivas_format;
    *numCldfbAnalyses = st_ivas->nchan_transport;
    move16();
    *numCldfbSyntheses = st_ivas->hDecoderConfig->nchan_out;
    move16();
    ivas_format = st_ivas->ivas_format;
    move32();

    test();
    IF( EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) && EQ_16( st_ivas->ism_mode, ISM_MODE_NONE ) )
    {
        ivas_format = SBA_FORMAT; /* treat ISM_SBA_MODE_NONE just like SBA_FORMAT */
        move32();
    }

    SWITCH( st_ivas->renderer_type )
    {
        case RENDERER_BINAURAL_PARAMETRIC:
        case RENDERER_BINAURAL_PARAMETRIC_ROOM:
        case RENDERER_STEREO_PARAMETRIC:
            IF( EQ_16( st_ivas->nchan_transport, 1 ) )
            {
                *numCldfbAnalyses = add( st_ivas->nchan_transport, 1 );
                move16();
            }
            test();
            IF( EQ_16( st_ivas->mc_mode, MC_MODE_MCMASA ) && st_ivas->hOutSetup.separateChannelEnabled )
            {
                *numCldfbAnalyses = add( st_ivas->nchan_transport, 1 );
                move16();
            }

            IF( EQ_32( ivas_format, SBA_ISM_FORMAT ) )
            {
                IF( EQ_32( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) )
                {
                    *numCldfbAnalyses = add( *numCldfbAnalyses, st_ivas->nchan_ism );
                    move16();
                }
            }

            IF( EQ_32( ivas_format, MASA_ISM_FORMAT ) )
            {
                test();
                IF( EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) )
                {
                    *numCldfbAnalyses = add( *numCldfbAnalyses, st_ivas->nchan_ism );
                    move16();
                }
                ELSE IF( EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_MASA_ONE_OBJ ) || EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_PARAM_ONE_OBJ ) )
                {
                    *numCldfbAnalyses = add( st_ivas->nchan_transport, 1 );
                    move16();
                }
            }
            IF( st_ivas->hDiracDecBin[0]->useTdDecorr )
            {
                *numCldfbAnalyses = add( *numCldfbAnalyses, 2 );
                move16();
            }
            BREAK;
        case RENDERER_NON_DIEGETIC_DOWNMIX:
        case RENDERER_MONO_DOWNMIX:
            test();
            test();
            IF( EQ_32( ivas_format, ISM_FORMAT ) || EQ_32( ivas_format, MASA_ISM_FORMAT ) || EQ_32( ivas_format, SBA_ISM_FORMAT ) )
            {
                /* CLDFB not used in rendering */
                *numCldfbAnalyses = 0;
                move16();
                *numCldfbSyntheses = 0;
                move16();
            }
            BREAK;
        case RENDERER_DIRAC:
            IF( EQ_32( ivas_format, SBA_FORMAT ) )
            {
                *numCldfbAnalyses = st_ivas->hSpar->hFbMixer->fb_cfg->num_in_chans;
                move16();
                test();
                IF( st_ivas->hOutSetup.is_loudspeaker_setup && EQ_32( st_ivas->renderer_type, RENDERER_DIRAC ) )
                {
                    *numCldfbSyntheses = st_ivas->hOutSetup.nchan_out_woLFE;
                    move16();
                }
                ELSE IF( EQ_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_FOA ) )
                {
                    *numCldfbSyntheses = st_ivas->hSpar->hFbMixer->fb_cfg->num_out_chans;
                    move16();
                }
                ELSE
                {
                    *numCldfbSyntheses = MAX_OUTPUT_CHANNELS;
                    move16();
                }
            }
            IF( NE_32( ivas_format, SBA_FORMAT ) )
            {
                test();
                test();
                IF( GT_16( st_ivas->nchan_transport, 2 ) && ( st_ivas->sba_planar != 0 ) )
                {
                    *numCldfbAnalyses = add( st_ivas->nchan_transport, 1 );
                    move16();
                }
                ELSE IF( EQ_16( st_ivas->nchan_transport, 1 ) && EQ_32( st_ivas->hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) )
                {
                    *numCldfbAnalyses = add( st_ivas->nchan_transport, 1 );
                    move16();
                }
            }
            BREAK;
        case RENDERER_MC_PARAMMC:
            IF( LE_16( st_ivas->hDecoderConfig->nchan_out, 2 ) )
            {
                /* CLDFB not used in rendering */
                *numCldfbAnalyses = 0;
                move16();
                *numCldfbSyntheses = 0;
                move16();
            }
            ELSE
            {
                *numCldfbSyntheses = param_mc_get_num_cldfb_syntheses_fx( st_ivas );
                move16();
            }
            BREAK;
        case RENDERER_PARAM_ISM:
            /* Already correct with no exception */
            BREAK;
        case RENDERER_DISABLE:
            /* CLDFB not used */
            *numCldfbAnalyses = 0;
            move16();
            *numCldfbSyntheses = 0;
            move16();
            BREAK;
        case RENDERER_MC:
        case RENDERER_SBA_LINEAR_DEC:
        case RENDERER_TD_PANNING:
        case RENDERER_BINAURAL_OBJECTS_TD:
        case RENDERER_MCMASA_MONO_STEREO:
        case RENDERER_BINAURAL_MIXER_CONV:
        case RENDERER_BINAURAL_MIXER_CONV_ROOM:
        case RENDERER_BINAURAL_FASTCONV:
        case RENDERER_BINAURAL_FASTCONV_ROOM:
        case RENDERER_OSBA_STEREO:
        case RENDERER_OSBA_AMBI:
        case RENDERER_OSBA_LS:
            test();
            IF( EQ_32( ivas_format, SBA_FORMAT ) || EQ_32( ivas_format, SBA_ISM_FORMAT ) )
            {
                IF( st_ivas->sba_dirac_stereo_flag != 0 )
                {
                    *numCldfbAnalyses = 0;
                    move16();
                    *numCldfbSyntheses = 0;
                    move16();
                }
                ELSE
                {
                    *numCldfbAnalyses = st_ivas->hSpar->hFbMixer->fb_cfg->num_in_chans;
                    move16();

                    test();
                    IF( st_ivas->hOutSetup.is_loudspeaker_setup && EQ_32( st_ivas->renderer_type, RENDERER_DIRAC ) )
                    {
                        *numCldfbSyntheses = st_ivas->hOutSetup.nchan_out_woLFE;
                        move16();
                    }
                    ELSE IF( EQ_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_FOA ) )
                    {
                        *numCldfbSyntheses = st_ivas->hSpar->hFbMixer->fb_cfg->num_out_chans;
                        move16();
                    }
                    ELSE
                    {
                        *numCldfbSyntheses = MAX_OUTPUT_CHANNELS;
                        move16();
                    }

                    test();
                    IF( EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) && EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV_ROOM ) )
                    {
                        *numCldfbAnalyses = add( st_ivas->nchan_ism, st_ivas->hSpar->hFbMixer->fb_cfg->num_in_chans );
                        move16();
                    }
                }
            }
            ELSE IF( EQ_32( st_ivas->mc_mode, MC_MODE_PARAMMC ) )
            {
                /* do nothing for ParamMC */
            }
            ELSE
            {
                /* CLDFB not used in rendering */
                *numCldfbAnalyses = 0;
                move16();
                *numCldfbSyntheses = 0;
                move16();
            }
            BREAK;
        case RENDERER_SBA_LINEAR_ENC:
            IF( EQ_32( st_ivas->mc_mode, MC_MODE_PARAMMC ) )
            {
                *numCldfbSyntheses = param_mc_get_num_cldfb_syntheses_fx( st_ivas );
                move16();
            }
            ELSE IF( EQ_32( st_ivas->ism_mode, ISM_MODE_PARAM ) )
            {
                *numCldfbSyntheses = add( st_ivas->hIntSetup.nchan_out_woLFE, st_ivas->hIntSetup.num_lfe );
                move16();
            }
            ELSE IF( EQ_32( st_ivas->mc_mode, MC_MODE_MCMASA ) )
            {
                *numCldfbAnalyses = st_ivas->nchan_transport;
                move16();
                *numCldfbSyntheses = add( st_ivas->hIntSetup.nchan_out_woLFE, st_ivas->hIntSetup.num_lfe );
                move16();
            }
            ELSE
            {
                /* CLDFB not used in rendering */
                *numCldfbAnalyses = 0;
                move16();
                *numCldfbSyntheses = 0;
                move16();
            }
            BREAK;
#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT
        case RENDERER_OMASA_OBJECT_EXT:
            *numCldfbAnalyses = st_ivas->nchan_transport;
            *numCldfbSyntheses = st_ivas->hDecoderConfig->nchan_out;
            move16();
            move16();
            break;
        case RENDERER_OMASA_MIX_EXT:
            *numCldfbAnalyses = add( st_ivas->nchan_transport, 1 );
            *numCldfbSyntheses = 0;
            move16();
            break;
            BREAK;
#endif
        default:
            assert( 0 && "Renderer not handled for CLDFB reservation." );
+3 −3
Original line number Diff line number Diff line
@@ -78,10 +78,10 @@ static ivas_error ivas_ism_bitrate_switching_dec_fx(
    move16();
    st_ivas->ism_mode = last_ism_mode;
    move16();
    ivas_init_dec_get_num_cldfb_instances_ivas_fx( st_ivas, &numCldfbAnalyses_old, &numCldfbSyntheses_old );
    ivas_init_dec_get_num_cldfb_instances_fx( st_ivas, &numCldfbAnalyses_old, &numCldfbSyntheses_old );
    st_ivas->ism_mode = ism_mode;
    move16();
    nchan_out_buff_old = ivas_get_nchan_buffers_dec_ivas_fx( st_ivas, -1, -1 );
    nchan_out_buff_old = ivas_get_nchan_buffers_dec_fx( st_ivas, -1, -1 );

    IF( NE_32( ( error = ivas_ism_config_fx( st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->nchan_ism, NULL, 0, NULL, NULL, element_brate_tmp, NULL, NULL, 0 ) ), IVAS_ERR_OK ) )
    {
@@ -320,7 +320,7 @@ static ivas_error ivas_ism_bitrate_switching_dec_fx(
     *-----------------------------------------------------------------*/

    {
        nchan_out_buff = ivas_get_nchan_buffers_dec( st_ivas, -1, -1 );
        nchan_out_buff = ivas_get_nchan_buffers_dec_fx( st_ivas, -1, -1 );

        IF( NE_32( ( error = ivas_output_buff_dec_fx( st_ivas->p_output_fx, nchan_out_buff_old, nchan_out_buff ) ), IVAS_ERR_OK ) )
        {
+3 −3
Original line number Diff line number Diff line
@@ -124,12 +124,12 @@ ivas_error ivas_jbm_dec_tc_fx(

    IF( st_ivas->hDecoderConfig->Opt_tsm == 0 )
    {
        FOR( n = 0; n < ivas_get_nchan_buffers_dec( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); n++ )
        FOR( n = 0; n < ivas_get_nchan_buffers_dec_fx( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); n++ )
        {
            set_zero_fx( st_ivas->p_output_fx[n], L_FRAME48k );
            st_ivas->hTcBuffer->tc_fx[n] = st_ivas->p_output_fx[n];
        }
        st_ivas->hTcBuffer->no_channels = ivas_get_nchan_buffers_dec( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate );
        st_ivas->hTcBuffer->no_channels = ivas_get_nchan_buffers_dec_fx( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate );
        move16();
    }

@@ -2627,7 +2627,7 @@ ivas_error ivas_jbm_dec_render_fx(

    IF( st_ivas->hTcBuffer->n_samples_discard > 0 )
    {
        FOR( n = 0; n < s_min( MAX_OUTPUT_CHANNELS, ivas_get_nchan_buffers_dec( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ) ); n++ )
        FOR( n = 0; n < s_min( MAX_OUTPUT_CHANNELS, ivas_get_nchan_buffers_dec_fx( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ) ); n++ )
        {
            p_output_fx[n] += st_ivas->hTcBuffer->n_samples_discard;
        }
Loading