Commit 39a9215d authored by multrus's avatar multrus
Browse files

Merge branch 'basop-2362-ivas_cpe_enc_fx-wrong-calculation-of-total_brate' into 'main'

Resolve "ivas_cpe_enc_fx(): Wrong calculation of total_brate"

Closes #2362

See merge request !2740
parents 5354f2cb f7d7b9fa
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -103,6 +103,7 @@
#define HARM_COREDECODER_FUNCTIONS                      /* VA: basop issue 2347: Remove various duplicated code in core-decoder  */
#define FIX_BASOP_2351_EXTREND_SCALE                    /* FhG: basop issue 2351: Only scale initialized samples in renderer, related to 2326 */
#define FIX_2331_CLANG18_MSAN_UNINIT_VARIABLE           /* FhG: Fix issue 2331: Uninitialized variable */
#define FIX_2362_TOTAL_BRATE_CALCULATION                /* FhG: basop issue 2362: fix calculation of st->total_brate in ivas_cpe_enc_fx() */

/* #################### End BE switches ################################## */

+11 −1
Original line number Diff line number Diff line
@@ -630,7 +630,17 @@ ivas_error ivas_cpe_enc_fx(
            {
                sts[n]->bits_frame_nominal = extract_l( Mpy_32_32_r( hCPE->element_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) );                             /* Q0 */
                sts[n]->bits_frame_channel = idiv1616( extract_l( Mpy_32_32_r( hCPE->element_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) ), n_CoreChannels ); /* Q0 */
#ifdef FIX_2362_TOTAL_BRATE_CALCULATION
                /* sts[n]->total_brate = hCPE->element_brate / n_CoreChannels; */
                assert( n_CoreChannels == 1 || n_CoreChannels == 2 );
                sts[n]->total_brate = hCPE->element_brate;
                if ( n_CoreChannels == 2 )
                {
                    sts[n]->total_brate = L_shr( hCPE->element_brate, 1 );
                }
#else
                sts[n]->total_brate = L_shl( div_l( hCPE->element_brate, n_CoreChannels ), 1 );                                                                                       /* Q0 */
#endif
                move32();
                move16();
                move16();