Commit 521f8efc authored by Fabian Bauer's avatar Fabian Bauer
Browse files

take all files in libenc and lib dec from main

parent 414954af
Loading
Loading
Loading
Loading
Loading
+4 −30
Original line number Diff line number Diff line
@@ -43,11 +43,9 @@ static void Regression_Anal_fx(
    Word32 L_tmp1, L_tmp2;
    Word16 aindex_fx[MAX_PGF + 1]; // Q0
    Word32 b_p_fx[MAX_PGF + 1];    // Q10
#ifndef ISSUE_1796_replace_shl_o
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
    move32();
#endif
#endif

    /* Initialize */
@@ -80,11 +78,7 @@ static void Regression_Anal_fx(
    {
        b_p_fx[0] = L_add( b_p_fx[0], L_shr( values_fx[i], 2 ) ); /*10 */
        move32();
#ifdef ISSUE_1796_replace_shl_o
        b_p_fx[1] = L_add( b_p_fx[1], Mult_32_16( values_fx[i], shl_sat( sub( num_pgf, i ), 13 ) ) ); /*10 */
#else
        b_p_fx[1] = L_add( b_p_fx[1], Mult_32_16( values_fx[i], shl_o( sub( num_pgf, i ), 13, &Overflow ) ) ); /*10 */
#endif
        move32();
    }

@@ -168,11 +162,9 @@ void HQ_FEC_processing_fx(
    Word16 energy_diff_fx; // Q10
    HQ_NBFEC_HANDLE hHQ_nbfec;
    HQ_DEC_HANDLE hHQ_core;
#ifndef ISSUE_1796_replace_shl_o
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
    move32();
#endif
#endif
    hHQ_nbfec = st_fx->hHQ_nbfec;
    hHQ_core = st_fx->hHQ_core;
@@ -390,11 +382,7 @@ void HQ_FEC_processing_fx(

                FOR( j = 0; j < Num_bands_p[i]; j++ )
                {
#ifdef ISSUE_1796_replace_shl_o
                    hHQ_nbfec->Norm_gain_fx[k] = shl_sat( tmp_fx, 1 );
#else
                    hHQ_nbfec->Norm_gain_fx[k] = shl_o( tmp_fx, 1, &Overflow );
#endif
                    move16();
                    k = add( k, 1 );
                }
@@ -530,11 +518,7 @@ void ivas_HQ_FEC_Mem_update_fx(
                L_tmp = L_add( L_tmp, L_shr( normq_fx[k], 3 ) ); /*11*/
                k = add( k, 1 );
            }
#ifdef ISSUE_1796_replace_shl_o
            tmp_fx = shl_sat( inv_tbl_fx[Num_bands_p[i]], 1 ); /*16*/
#else
            tmp_fx = shl_o( inv_tbl_fx[Num_bands_p[i]], 1, &Overflow ); /*16*/
#endif
            norm_values_fx[0] = Mult_32_16( L_tmp, tmp_fx );            /*11 + 16 - 15*/
            move32();
            tmp_energy_fx = L_add( tmp_energy_fx, L_shr( L_tmp, 3 ) ); /*8*/
@@ -819,11 +803,7 @@ void HQ_FEC_Mem_update_fx(
                L_tmp = L_add( L_tmp, L_shr( normq_fx[k], 3 ) ); /*11*/
                k = add( k, 1 );
            }
#ifdef ISSUE_1796_replace_shl_o
            tmp_fx = shl_sat( inv_tbl_fx[Num_bands_p[i]], 1 ); /*16*/
#else
            tmp_fx = shl_o( inv_tbl_fx[Num_bands_p[i]], 1, &Overflow ); /*16*/
#endif
            norm_values_fx[0] = Mult_32_16( L_tmp, tmp_fx );            /*11 + 16 - 15*/
            move32();
            tmp_energy_fx = L_add( tmp_energy_fx, L_shr( L_tmp, 3 ) ); /*8*/
@@ -1015,11 +995,9 @@ static Word16 find_best_delay_fx(
    Word32 min_sq_cross_fx, min_corr_fx;
    Word32 accA_fx, accB_fx;
    Word32 Rxy_fx[MAXDELAY_FEC], Ryy_fx[MAXDELAY_FEC];
#ifndef ISSUE_1796_replace_shl_o
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
    move32();
#endif
#endif
    move16(); // d1m

@@ -1086,11 +1064,7 @@ static Word16 find_best_delay_fx(
        L_tmp1 = L_shl( min_sq_cross_fx, exp1 );
        L_tmp2 = L_shl( min_corr_fx, exp2 );
        tmp = div_s( extract_h( L_tmp1 ), extract_h( L_tmp2 ) );    /*15 + exp1 - exp2 */
#ifdef ISSUE_1796_replace_shl_o
        tmp = shl_sat( tmp, sub( exp2, add( exp1, 1 ) ) ); /*14 */
#else
        tmp = shl_o( tmp, sub( exp2, add( exp1, 1 ) ), &Overflow ); /*14 */
#endif
    }

    *false_flag = 0;
+2 −12
Original line number Diff line number Diff line
@@ -599,11 +599,7 @@ static void spectrum_mod_dct_fx(

                    Ltmp = L_mult( tmpN, m_binE ); /*2*Qdct+e_binE+9*/
                    e_binE = sub( add( e_tmp, e_binE ), 15 );
#ifdef ISSUE_1799_replace_L_shr_o
                    Ltmp = L_shr_sat( Ltmp, e_binE ); /*2*Qdct+9*/
#else
                    Ltmp = L_shr_o( Ltmp, e_binE, &Overflow );  /*2*Qdct+9*/
#endif
                    Lgain = L_add_o( Ltmp, Lshift, &Overflow ); /*Saturation can occure here result in Q30*/
                }

@@ -905,10 +901,8 @@ static Word16 norm_lfe(
{
    Word32 Ltmp;
    Word16 exp2, tmp16, exp3;
#ifndef ISSUE_1796_replace_shl_o
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
#endif
#endif

    move32();
@@ -929,11 +923,7 @@ static Word16 norm_lfe(
        exp3 = sub( exp2, 12 + 16 - 3 ); /* if exp2 < 31, means that tmp >= 1.0 */
        /* Need to shl by 3 to take into account the 3 multiplications */
    }
#ifdef ISSUE_1796_replace_shl_o
    tmp16 = shl_sat( tmp16, exp3 ); /* Result in Q12 */
#else
    tmp16 = shl_o( tmp16, exp3, &Overflow ); /* Result in Q12 */
#endif

    return tmp16;
}
+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_fx( st_ivas, &numCldfbAnalyses, &numCldfbSyntheses );
    ivas_init_dec_get_num_cldfb_instances_ivas_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 */
+279 −5
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_fx( st_ivas, &numCldfbAnalyses, &numCldfbSyntheses );
    ivas_init_dec_get_num_cldfb_instances_ivas_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_fx( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate );
    st_ivas->p_out_len = ivas_get_nchan_buffers_dec( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate );
    move16();
    FOR( n = 0; n < ivas_get_nchan_buffers_dec_fx( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); n++ )
    FOR( n = 0; n < ivas_get_nchan_buffers_dec( 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_fx(
void ivas_init_dec_get_num_cldfb_instances(
    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,12 +3566,286 @@ void ivas_init_dec_get_num_cldfb_instances_fx(
            *numCldfbSyntheses = st_ivas->hDecoderConfig->nchan_out;
            move16();
            move16();
            BREAK;
            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;
#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_fx( st_ivas, &numCldfbAnalyses_old, &numCldfbSyntheses_old );
    ivas_init_dec_get_num_cldfb_instances_ivas_fx( st_ivas, &numCldfbAnalyses_old, &numCldfbSyntheses_old );
    st_ivas->ism_mode = ism_mode;
    move16();
    nchan_out_buff_old = ivas_get_nchan_buffers_dec_fx( st_ivas, -1, -1 );
    nchan_out_buff_old = ivas_get_nchan_buffers_dec_ivas_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_fx( st_ivas, -1, -1 );
        nchan_out_buff = ivas_get_nchan_buffers_dec( 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 ) )
        {
Loading