Commit 6b98c8e2 authored by vaclav's avatar vaclav
Browse files

Merge branch 'apa_exec_scaling_fix' into 'main'

[non-BE] [allow regression] Apa exec scaling fix

See merge request !2452
parents 559d4f54 bca77ac5
Loading
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -79,6 +79,8 @@
#define FIX_2092_ASSERT_IN_OMASA_RENDER                      /* FhG, Nokia: Fix LTV crash due to overflow in OMASA EXT output */
#define FIX_2084_FLOATING_POINT_LEFTOVERS                    /* FhG: convert floating-point leftovers in IVAS_ENC_FeedObjectMetadata() */
#define FIX_2141_ASSERT_IN_OMASA_BITRATE_SWITSCHING          /* FhG: Replace L_shl with L_shl_sat to prevent overflow when calculating scale factors for very small numbers in the logarithmic domain */
#define FIX_APA_EXECS_SCALING                                /* VA: fix scaling of JBM APA buffer */

/* ################### End FIXES switches ########################### */

/* #################### Start BASOP porting switches ############################ */
+16 −0
Original line number Diff line number Diff line
@@ -904,7 +904,11 @@ UWord8 apa_exec_ivas_fx(
    Word16 Q_a_out;
    Word16 Q_a_out_init_old;

#ifdef FIX_APA_EXECS_SCALING
    Q_a_out = add( getScaleFactor32_copy( a_in, l_in ), Q11 - Q16 - Q1 );
#else
    Q_a_out = add( getScaleFactor32_copy( a_in, L_mult0( ps->num_channels, APA_BUF_PER_CHANNEL ) ), Q11 - Q16 - Q1 );
#endif
    Q_a_out_init_old = Q_a_out; /* store the possible scaling of a_in, to be re-used in the next frame */
    move16();
    statsResetThreshold = 1637;
@@ -981,7 +985,11 @@ UWord8 apa_exec_ivas_fx(
        Scale_sig( ps->buf_out_fx, ps->buf_out_capacity, sub( Q_a_out, ps->Q_buf_out ) ); // Q_buf_out -> Q_a_out
        IF( EQ_32( ps->scale, 100 ) )
        {
#ifdef FIX_APA_EXECS_SCALING
            FOR( i = 0; i < ps->l_frm; i++ )
#else
            FOR( i = 0; i < ps->num_channels * APA_BUF_PER_CHANNEL; i++ )
#endif
            {
                a_out[i] = a_in[i]; // Q11
                move32();
@@ -993,7 +1001,11 @@ UWord8 apa_exec_ivas_fx(
        {
            Word16 *frm_in_ptr = &( frm_in[ps->l_frm] );

#ifdef FIX_APA_EXECS_SCALING
            FOR( i = 0; i < ps->l_frm; i++ )
#else
            FOR( i = 0; i < ps->num_channels * APA_BUF_PER_CHANNEL; i++ )
#endif
            {
                a_tmp[i] = extract_h( L_shl( a_in[i], add( Q_a_out, Q5 ) ) ); // Q_a_out
                move16();
@@ -1043,7 +1055,11 @@ UWord8 apa_exec_ivas_fx(
                }
            }

#ifdef FIX_APA_EXECS_SCALING
            FOR( i = 0; i < l_frm_out; i++ )
#else
            FOR( i = 0; i < ps->num_channels * APA_BUF_PER_CHANNEL; i++ )
#endif
            {
                a_out[i] = L_shl( a_tmp[i], sub( Q11, Q_a_out ) ); // Q0 -> Q11
                move32();