Commit 60200d5c authored by multrus's avatar multrus
Browse files

Merge branch '1366-improve-wmops-of-sns_1st_cod_fx' of...

Merge branch '1366-improve-wmops-of-sns_1st_cod_fx' of ssh://forge.3gpp.org:29419/sa4/audio/ivas-basop into 1366-improve-wmops-of-sns_1st_cod_fx
parents 241044c5 2fcbd3b3
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -172,4 +172,5 @@
#define DOT_PROD_CHOLESKY_64BIT                 /* FhG: Issue 1323, optimized 64 bit implementation of dot_product_cholesky() */
#define OPT_BASOP_ADD_v1                        /* optimizations to avoid usage of BASOP_Util_Add_MantExp */
#define FIX_ISSUE_1327                          /* Ittiam: Fix for issue 1327: Glitch when stereo is switching from TD to FD*/
#define FIX_ISSUE_1376                          /* VA: Fix for issue 1376 (issue with GSC excitation) */
#endif
+7 −1
Original line number Diff line number Diff line
@@ -578,7 +578,9 @@ void enc_pit_exc_ivas_fx(
    Word16 use_fcb;
    Word32 gc_mem[NB_SUBFR - 1]; /* gain_code from previous subframes */
    Word16 gp_mem[NB_SUBFR - 1]; /* gain_pitch from previous subframes*/
#ifndef FIX_ISSUE_1376
    Word16 h1_q15[PIT_EXC_L_SUBFR + ( M + 1 )];
#endif
    Word16 q_h1;
    BSTR_ENC_HANDLE hBstr = st_fx->hBstr;
    GSC_ENC_HANDLE hGSCEnc = st_fx->hGSCEnc;
@@ -771,11 +773,15 @@ void enc_pit_exc_ivas_fx(
         * Codebook target computation
         * (No LP filtering of the adaptive excitation)
         *-----------------------------------------------------------------*/
#ifndef FIX_ISSUE_1376
        Copy_Scale_sig( h1, h1_q15, L_subfr, 1 ); // Q14 -> Q15

        lp_select = lp_filt_exc_enc_ivas_fx( MODE1, AUDIO, i_subfr, exc, h1_q15,
                                             xn, y1, xn2, L_subfr, st_fx->L_frame, g_corr, clip_gain, &gain_pit, &lp_flag ); /* Q0 */

#else
        lp_select = lp_filt_exc_enc_ivas_fx( MODE1, AUDIO, i_subfr, exc, h1,
                                             xn, y1, xn2, L_subfr, st_fx->L_frame, g_corr, clip_gain, &gain_pit, &lp_flag ); /* Q0 */
#endif
        IF( EQ_16( lp_flag, NORMAL_OPERATION ) )
        {
            push_indice( hBstr, IND_LP_FILT_SELECT, lp_select, 1 );
+12 −15
Original line number Diff line number Diff line
@@ -72,20 +72,20 @@ static Word16 sns_1st_cod_fx(
        SWITCH( L_frame )
        {
            case L_FRAME16k:
                means = &sns_1st_means_16k[core - 1][0];
                means = &sns_1st_means_16k[core - 1][0]; // Q14
                break;
            case L_FRAME25_6k:
                means = &sns_1st_means_25k6[core - 1][0];
                means = &sns_1st_means_25k6[core - 1][0]; // Q14
                break;
            case L_FRAME32k:
                means = &sns_1st_means_32k[core - 1][0];
                means = &sns_1st_means_32k[core - 1][0]; // Q14
                break;
            default:
                assert( !"illegal frame length in sns_1st_cod" );
        }
        FOR( Word16 i = 0; i < M; ++i )
        {
            Word32 tmp = L_mult( means[i], means_fix ); // Q16
            Word32 tmp = L_mult( means[i], means_fix ); // Q14->Q16
            snsq_fx[i] = L_sub( sns_fx[i], tmp );       // Q16
            move32();
        }
@@ -100,7 +100,7 @@ static Word16 sns_1st_cod_fx(
            Word32 dist_min_fx;
            const Word16 cdbk_fix = 8; // 1.f / powf( 2, SNS_CDBKS_BITS_4_FRAC ) in Q15
            move16();
            const Word16 *const cdbk = &sns_1st_cdbk[split][core - 1][0];
            const Word16 *const cdbk = &sns_1st_cdbk[split][core - 1][0]; // Q12

            j0 = imult1616( split, split_len );
            j1 = add( j0, split_len );
@@ -114,19 +114,16 @@ static Word16 sns_1st_cod_fx(
            {
                Word32 dist_fx = 0;
                move32();
                FOR( Word16 j = j0; j < j1; ++j )
                FOR( Word16 j = j0; j < j1; ++j ) // j1-j0=split_len. split_len=M/2. M=16
                {
                    Word32 tmp;
                    Word32 dist;
                    Word16 tmp2;

                    tmp = L_mult( *cdbk_ptr++, cdbk_fix ); // Q16
                    dist = L_sub( snsq_fx[j], tmp );
                    dist = L_shr( dist, 4 ); // make sure that the next multiplication does not overflow

                    tmp2 = extract_l( dist );
                    dist = L_mult( tmp2, tmp2 );
                    dist = L_shr( dist, 4 ); // make sure that the sum does not overflow
                    tmp = L_mult( *cdbk_ptr++, cdbk_fix ); // Q12->Q16
                    dist = L_sub( snsq_fx[j], tmp );       // Q16
                    dist = L_shl( dist, 11 );              // cdbk_ptr is a 16 bit LUT with 3.12 values, used as 3.16. assumption: snsq_fx has the same representation. thus, the subtraction results are in 4.16, which leaves 11 bit headroom.
                    dist = Mpy_32_32( dist, dist );
                    dist = L_shr( dist, 3 ); // make sure that the sum of 8 values does not overflow
                    dist_fx = L_add( dist_fx, dist );
                }

@@ -783,7 +780,7 @@ Word16 quantize_sns_fx(
                IF( zero_side_flag[k] )
                {
                    set32_fx( snsQ_fx, 0, M );
                    CONTINUE;
                    continue;
                }

                nStages = SNS_MSVQ_NSTAGES_SIDE;