Commit f6ae1b38 authored by multrus's avatar multrus
Browse files

Merge branch 'basop-2456-harmonize-apply_scale_ind-apply_scale_ivas_fx' into 'main'

Resolve "Harmonize apply_scale_ind(), apply_scale_ivas_fx()"

Closes #2456

See merge request !2846
parents 55434d55 fb0813d1
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -872,7 +872,11 @@ void cng_params_upd_fx(
            Word16 index = 0;
            move32();
            move16();
#ifdef HARM_2456_APPLY_SCALE
            index = apply_scale_ind( &att_fx, bwidth, last_active_brate, scaleTableStereo, SIZE_SCALE_TABLE_STEREO );
#else
            apply_scale_ivas_fx( &att_fx, bwidth, last_active_brate, scaleTableStereo, SIZE_SCALE_TABLE_STEREO, &index );
#endif
            att_fx = pow_10_q23[index]; // Q23
            move32();
            tmp = extract_h( att_fx ); // Q7
+3 −0
Original line number Diff line number Diff line
@@ -1751,9 +1751,11 @@ Word16 apply_scale_ind(
        *scale = L_add( *scale, L_deposit_h( scaleTable[i].scale ) );
        move32();
    }

    return i;
}

#ifndef HARM_2456_APPLY_SCALE
void apply_scale_ivas_fx(
    Word32 *scale,                 /* o  : scalefactor             */
    const Word16 bwmode,           /* i  : audio bandwidth         */
@@ -1780,6 +1782,7 @@ void apply_scale_ivas_fx(
    *index = i;
    move16();
}
#endif
/*-------------------------------------------------------------------
 * bandcombinepow()
 *
+1 −0
Original line number Diff line number Diff line
@@ -101,6 +101,7 @@
#define HARMONIZE_TBE3                                  /* VA: basop issue 2399: Remove duplicated code: TBE, step 3 */
#define FIX_2459_USAN_AMR_SIDSTART                      /* FhG: basop issue 2459: fix msan complaint */
#define FIX_2458_USAN_NULLPTR_WITH_ZERO_OFFSET          /* FhG: basop issue 2458: avoid indexing into null pointer */
#define HARM_2456_APPLY_SCALE                           /* FhG basop issue 2456: Harmonize apply_scale_ind(), apply_scale_ivas_fx() */

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

+2 −0
Original line number Diff line number Diff line
@@ -4884,6 +4884,7 @@ Word16 apply_scale_ind(
    const SCALE_SETUP *scaleTable, /* i  : Scale table             */
    const Word16 scaleTableSize    /* i  : Size of scale table     */
);
#ifndef HARM_2456_APPLY_SCALE
void apply_scale_ivas_fx(
    Word32 *scale,                 /* o  : scalefactor             */
    const Word16 bwmode,           /* i  : audio bandwidth         */
@@ -4891,6 +4892,7 @@ void apply_scale_ivas_fx(
    const SCALE_SETUP *scaleTable, /* i  : Scale table             */
    const Word16 scaleTableSize,   /* i  : Size of scale table     */
    Word16 *index );
#endif
/* Compute the power for each partition */
void bandcombinepow(
+5 −0
Original line number Diff line number Diff line
@@ -1679,9 +1679,14 @@ static Word16 shb_DTX_fx(
    {
        Word32 att_fx32 = 0;
        move32();
#ifdef HARM_2456_APPLY_SCALE

        apply_scale( &att_fx32, st->hFdCngEnc->hFdCngCom->CngBandwidth, st->hFdCngEnc->hFdCngCom->CngBitrate, scaleTableStereo, SIZE_SCALE_TABLE_STEREO ); // Q23;
#else
        Word16 index;

        apply_scale_ivas_fx( &att_fx32, st->hFdCngEnc->hFdCngCom->CngBandwidth, st->hFdCngEnc->hFdCngCom->CngBitrate, scaleTableStereo, SIZE_SCALE_TABLE_STEREO, &index ); // Q23;
#endif

        att_fx = extract_l( L_shr( att_fx32, 15 ) ); // Q8
    }