Commit 09676b20 authored by vaillancour's avatar vaillancour
Browse files

Fix inov to be used in IVAS

parent 94de4a0c
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -120,8 +120,7 @@
    #define REUSE_EVS_ACELP_SHIFT    // Add shift parameter as expected by EVS acelp subfunctions
    #define REUSE_EVS_ACELP_HL_AVQ   // Replace ACELP high layers by EVS
    #define REUSE_EVS_ACELP_TC       // Replace TC by EVS TC
    #define REUSE_EVS_ACELP_TC_tmp_inov  // Temporary until inov_encode_ivas_fx is replaced
    //#define REUSE_EVS_ACELP_TC_BE
    #define REUSE_EVS_ACELP_INOV
#endif


+3 −3
Original line number Diff line number Diff line
@@ -145,7 +145,7 @@ Word16 encod_tran_fx(
    move16();
    set16_fx( code_preQ, 0, L_SUBFR );
    shift_wsp = add( Q_new, shift );
#if defined REUSE_EVS_ACELP_TC && !defined REUSE_EVS_ACELP_TC_tmp_inov
#if defined REUSE_EVS_ACELP_TC && !defined REUSE_EVS_ACELP_INOV
    test();
    if ( st_fx->element_mode > EVS_MONO && LT_32( st_fx->core_brate, MIN_BRATE_AVQ_EXC ) )
    {
@@ -196,7 +196,7 @@ Word16 encod_tran_fx(
        /*-----------------------------------------------------------------*
         * ACELP codebook search + pitch sharpening
         *-----------------------------------------------------------------*/
#ifdef REUSE_EVS_ACELP_TC_tmp_inov
#ifndef REUSE_EVS_ACELP_INOV
        if ( st_fx->element_mode > EVS_MONO )
        {
            inov_encode_ivas _fx( st_fx, st_fx->core_brate, 0, L_frame_fx, st_fx->last_L_frame, st_fx->coder_type, st_fx->bwidth, st_fx->sharpFlag,
+100 −0
Original line number Diff line number Diff line
@@ -89,7 +89,12 @@ Word16 inov_encode_fx(
    Word16 Rw[L_SUBFR];
    Word16 acelpautoc;
    BSTR_ENC_HANDLE hBstr = st_fx->hBstr;
#ifdef REUSE_EVS_ACELP_INOV
    Word16 i, k, Qdn = 8; 
    move16();
#else
    (void) last_L_frame;
#endif
    stack_pulses = 0;
    move16();

@@ -276,6 +281,101 @@ Word16 inov_encode_fx(
    {
        IF( st_fx->acelp_cfg.fcb_mode )
        {
#ifdef REUSE_EVS_ACELP_INOV
            Word16 idx = 0, idx2 = 0;
            move16();
            move16();

            IF( i_subfr != 0 )
            {
                idx = idiv1616( i_subfr, L_subfr );
                idx2 = idiv1616( i_subfr, L_SUBFR );
            }

            IF( LT_16( st_fx->acelp_cfg.fixed_cdk_index[idx], ACELP_FIXED_CDK_NB ) )
            {
                Word16 wordcnt, bitcnt;
                Word16 prm[8];

                IF( st_fx->acelp_cfg.fixed_cdk_index[idx] >= 0 )
                {
                    test();
                    test();
                    test();
                    IF( EQ_16( L_subfr, 2 * L_SUBFR ) )
                    {
                        nBits = st_fx->acelp_cfg.fixed_cdk_index[idx];
                        move16();

                        IF( EQ_16( nBits, 8 ) )
                        {
                            acelp_1t64_fx( hBstr, dn, h2, code, y2, L_subfr );
                        }
                        ELSE
                        {
                            acelp_fast_fx( hBstr, nBits, dn, Qdn, cn, Qdn, h2, code, y2, L_subfr );
                        }
                    }
                    ELSE IF( ( EQ_16( st_fx->idchan, 1 ) && LE_16( st_fx->acelp_cfg.fixed_cdk_index[idx2], 7 ) ) || ( st_fx->idchan == 0 && LE_16( st_fx->acelp_cfg.fixed_cdk_index[idx2], 3 ) ) )
                    {
                        IF( st_fx->acelp_cfg.fixed_cdk_index[i_subfr / L_SUBFR] == 0 )
                        {
                            acelp_1t64_fx( hBstr, dn, h2, code, y2, L_subfr );
                        }
                        ELSE
                        {
                            acelp_fast_fx( hBstr, st_fx->acelp_cfg.fixed_cdk_index[idx2], dn, Qdn, cn, Qdn, h2, code, y2, L_SUBFR );
                        }
                    }
                    ELSE
                    {
#ifndef REUSE_EVS_BE_ACELP_4T64
                        E_ACELP_4t_fx( dn, cn, h2, Rw, (Word8) acelpautoc, code, st_fx->acelp_cfg.fixed_cdk_index[idx2], prm, L_frame, last_L_frame, st_fx->total_brate, i_subfr, cmpl_flag );
#else
                        E_ACELP_4t_fx( dn, cn, h2, Rw, (Word8) acelpautoc, code, st_fx->acelp_cfg.fixed_cdk_index[idx2], prm, L_frame, last_L_frame, st_fx->total_brate, i_subfr, cmpl_flag, st_fx->element_mode );
#endif
                        wordcnt = shr( ACELP_FIXED_CDK_BITS( st_fx->acelp_cfg.fixed_cdk_index[idx2] ), 4 );
                        bitcnt = s_and( ACELP_FIXED_CDK_BITS( st_fx->acelp_cfg.fixed_cdk_index[idx2] ), 15 );

                        FOR( i = 0; i < wordcnt; i++ )
                        {
                            push_indice( hBstr, IND_ALG_CDBK_4T64, prm[i], 16 );
                        }
                        IF( bitcnt )
                        {
                            push_indice( hBstr, IND_ALG_CDBK_4T64, prm[i], bitcnt );
                        }

                        /* Generate weighted code */
                        set16_fx( y2, 0, L_SUBFR );
                        Word16 sh = add( norm_s( h2[0] ), 1 );
                        FOR( i = 0; i < L_SUBFR; i++ )
                        {
                            /* Code is sparse, so check which samples are non-zero */
                            IF( code[i] != 0 )
                            {
                                FOR( k = 0; k < L_SUBFR - i; k++ )
                                {
                                    y2[i + k] = add_sat( y2[i + k], round_fx( L_shl( L_mult( code[i], h2[k] ), sh ) ) ); // Q9 Added saturation: needs to be rechecked
                                    move16();
                                }
                            }
                        }
                    }
                }
                ELSE
                {
                    set16_fx( code, 0, L_SUBFR );
                    set16_fx( y2, 0, L_SUBFR );
                }
            }
#ifdef DEBUGGING
            else
            {
                IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "invalid mode for acelp frame!\n" );
            }
#endif
#endif
        }
        ELSE
        {
+10 −61
Original line number Diff line number Diff line
@@ -407,17 +407,7 @@ void transition_enc_fx(
                push_indice( hBstr, IND_PITCH, index, nBits );

                /* Find the adaptive codebook vector - ACELP long-term prediction */
#ifdef REUSE_EVS_ACELP_TC_BE
                IF( st_fx->element_mode > EVS_MONO )
                {
                    pred_lt4_ivas_fx( &exc_fx[i_subfr], &exc_fx[i_subfr], *T0, *T0_frac, L_SUBFR + 1, pitch_inter4_2, L_INTERPOL2, PIT_UP_SAMP );
                }
                ELSE
#endif
                {
                pred_lt4( &exc_fx[i_subfr], &exc_fx[i_subfr], *T0, *T0_frac, L_SUBFR + 1, pitch_inter4_2, L_INTERPOL2, PIT_UP_SAMP );
                }


                offset = tbe_celp_exc_offset( *T0, *T0_frac, st_fx->L_frame );

@@ -470,16 +460,8 @@ void transition_enc_fx(
                push_indice( hBstr, IND_PITCH, index, nBits );

                /* Find the adaptive codebook vector - ACELP long-term prediction */
#ifdef REUSE_EVS_ACELP_TC_BE
                IF( st_fx->element_mode > EVS_MONO )
                {
                    pred_lt4_ivas_fx( &exc_fx[i_subfr], &exc_fx[i_subfr], *T0, *T0_frac, L_SUBFR + 1, pitch_inter4_2, L_INTERPOL2, PIT_UP_SAMP );
                }
                ELSE
#endif
                {
                pred_lt4( &exc_fx[i_subfr], &exc_fx[i_subfr], *T0, *T0_frac, L_SUBFR + 1, pitch_inter4_2, L_INTERPOL2, PIT_UP_SAMP );
                }

                offset = tbe_celp_exc_offset( *T0, *T0_frac, st_fx->L_frame );


@@ -547,16 +529,8 @@ void transition_enc_fx(
                push_indice( hBstr, IND_PITCH, index, nBits );

                /* Find the adaptive codebook vector - ACELP long-term prediction */
#ifdef REUSE_EVS_ACELP_TC_BE
                IF( st_fx->element_mode > EVS_MONO )
                {
                    pred_lt4_ivas_fx( &exc_fx[i_subfr], &exc_fx[i_subfr], *T0, *T0_frac, L_SUBFR + 1, pitch_inter4_2, L_INTERPOL2, PIT_UP_SAMP );
                }
                ELSE
#endif
                {
                pred_lt4( &exc_fx[i_subfr], &exc_fx[i_subfr], *T0, *T0_frac, L_SUBFR + 1, pitch_inter4_2, L_INTERPOL2, PIT_UP_SAMP );
                }
                
                offset = tbe_celp_exc_offset( *T0, *T0_frac, st_fx->L_frame );

                FOR( i = 0; i < L_SUBFR * HIBND_ACB_L_FAC; i++ )
@@ -584,16 +558,8 @@ void transition_enc_fx(
                push_indice( hBstr, IND_PITCH, index, nBits );

                /* Find the adaptive codebook vector - ACELP long-term prediction */
#ifdef REUSE_EVS_ACELP_TC_BE
                IF( st_fx->element_mode > EVS_MONO )
                {
                    pred_lt4_ivas_fx( &exc_fx[i_subfr], &exc_fx[i_subfr], *T0, *T0_frac, L_SUBFR + 1, pitch_inter4_2, L_INTERPOL2, PIT_UP_SAMP );
                }
                ELSE
#endif
                {
                pred_lt4( &exc_fx[i_subfr], &exc_fx[i_subfr], *T0, *T0_frac, L_SUBFR + 1, pitch_inter4_2, L_INTERPOL2, PIT_UP_SAMP );
                }

                offset = tbe_celp_exc_offset( *T0, *T0_frac, st_fx->L_frame );


@@ -639,16 +605,7 @@ void transition_enc_fx(
                pit_Q_enc_fx( hBstr, 0, nBits, 8, pit_flag, limit_flag, *T0, *T0_frac, T0_min, T0_max );

                /* Find the adaptive codebook vector - ACELP long-term prediction */
#ifdef REUSE_EVS_ACELP_TC_BE
                IF( st_fx->element_mode > EVS_MONO )
                {
                    pred_lt4_ivas_fx( &exc_fx[i_subfr], &exc_fx[i_subfr], *T0, *T0_frac, L_SUBFR + 1, pitch_inter4_2, L_INTERPOL2, PIT_UP_SAMP );
                }
                ELSE
#endif
                {
                pred_lt4( &exc_fx[i_subfr], &exc_fx[i_subfr], *T0, *T0_frac, L_SUBFR + 1, pitch_inter4_2, L_INTERPOL2, PIT_UP_SAMP );
                }

                offset = tbe_celp_exc_offset( *T0, *T0_frac, st_fx->L_frame );

@@ -910,16 +867,8 @@ void transition_enc_fx(
            ELSE
            {
                /* Find the adaptive codebook vector - ACELP long-term prediction */
#ifdef REUSE_EVS_ACELP_TC_BE
                IF( st_fx->element_mode > EVS_MONO )
                {
                    pred_lt4_ivas_fx( &exc_fx[i_subfr], &exc_fx[i_subfr], *T0, *T0_frac, L_SUBFR + 1, pitch_inter4_2, L_INTERPOL2, PIT_UP_SAMP );
                }
                ELSE
#endif
                {
                pred_lt4( &exc_fx[i_subfr], &exc_fx[i_subfr], *T0, *T0_frac, L_SUBFR + 1, pitch_inter4_2, L_INTERPOL2, PIT_UP_SAMP );
                }

                offset = L_deposit_l( 0 );

                tmp = extract_l( L_mult( *T0_frac, 32 ) ); /*Q8, 0.25 in Q7*/