Commit 45db6408 authored by multrus's avatar multrus
Browse files

[cleanup] accept FIX_2280_REDUCTION_UNNECESSARY_SCALING

parent 6e9e23d1
Loading
Loading
Loading
Loading
+0 −13
Original line number Diff line number Diff line
@@ -1587,12 +1587,7 @@ void ivas_hq_core_dec_fx(
    const Word16 output_frame,                                  /* i  : output frame length                     */
    const Word16 hq_core_type,                                  /* i  : HQ core type                            */
    const Word16 core_switching_flag,                           /* i  : ACELP->HQ switching frame flag          */
#ifdef FIX_2280_REDUCTION_UNNECESSARY_SCALING
    Word32 *output_32_fx                                        /* o  : synthesis @internal_Fs, Q11             */
#else
    Word16 output[],
    Word16 *Q_output 
#endif
);

/* o  : Consumed bits  Q0 */
@@ -1848,11 +1843,7 @@ void stereoFdCngCoherence_fx(
/* o : Q_syn_hb*/
Word16 ivas_wb_bwe_dec_fx(
    Decoder_State *st_fx,                                       /* i/o: decoder state structure                 */
#ifdef FIX_2280_REDUCTION_UNNECESSARY_SCALING
    Word32 output_fx32[],                                       /* o  : synthesis @internal Fs               Q11*/
#else
    const Word16 output[],                                      /* i  : suntehsis @ internal Fs Q_input         */
    #endif
    Word16 *synth_fx,                                           /* i/o: ACELP core synthesis/final synthesis   Q0/Qpost */
    Word16 *hb_synth_fx,                                        /* o  : SHB synthesis/final synthesis          Q_syn_hb */
    const Word16 use_cldfb_for_dft,                             /* i  : flag to use of CLDFB for DFT Stereo     */
@@ -2050,11 +2041,7 @@ void ivas_buffer_deinterleaved_to_interleaved_fx(
void stereo_tcx_core_dec_fx(
    Decoder_State *st,                                          /* i/o: decoder state structure                     */
    const FRAME_MODE frameMode,                                 /* i  : Decoder frame mode                          */
#ifdef FIX_2280_REDUCTION_UNNECESSARY_SCALING
    Word32 *signal_out_32_fx,                                   /* o  : synthesis @internal_Fs, Q11                 */
#else
    Word16 *signal_out,                                         /* o  : synthesis @internal_Fs, Q0                  */
#endif
    Word16 *signal_outFB,                                       /* o  : synthesis @output_Fs, Q0                    */
    Word16 pitch_buf[],                                         /* o  : floating pitch for each subframe, Q6        */
    const Word16 sba_dirac_stereo_flag,                         /* i  : signal stereo output for SBA DirAC          */
+0 −1
Original line number Diff line number Diff line
@@ -83,7 +83,6 @@
#define FIX_1990_SANITIZER_IN_REVERB_LOAD               /* Nokia: Fix issue part of issue 1990 by introducing missing free of structure - keep until #2059 is addressed */
#define TMP_1342_WORKAROUND_DEC_FLUSH_BROKEN_IN_SR      /* FhG: Temporary workaround for incorrect implementation of decoder flush with split rendering */
#define NONBE_1122_KEEP_EVS_MODE_UNCHANGED              /* FhG: Disables fix for issue 1122 in EVS mode to keep BE tests green. This switch should be removed once the 1122 fix is added to EVS via a CR.  */
#define FIX_2280_REDUCTION_UNNECESSARY_SCALING          /* VA: reduction of unnecessary scaling */
#define FIX_2280_REDUCTION_UNNECESSARY_SCALING_NONBE    /* VA: reduction of unnecessary scaling, non-BE part */
#define FIX_2403_COMBINE_PITCH_OL                       /* VA : basop 2403, reusing common code between EVS and IVAS in pitch_ol */
#define FIX_2404_HARM_SIGNAL_CLAS                       /* VA: basop-2404, harmonize signal_clas and signa_ivas_clas */
+0 −13
Original line number Diff line number Diff line
@@ -7343,13 +7343,8 @@ ivas_error core_switching_pre_dec_fx(
ivas_error core_switching_post_dec_fx(
    Decoder_State *st_fx, /* i/o: decoder state structure                                                           */
    Word16 *synth,        /* i/o: output synthesis                                                            Qsynth*/
#ifdef FIX_2280_REDUCTION_UNNECESSARY_SCALING
    Word32 *output_fx,        /* i/o: LB synth/upsampled LB synth                                                    Q11*/
    Word32 output_mem_fx32[], /* i  : OLA memory from last TCX/HQ frame                                               Qx*/
#else
    Word32 *output_fx,      /* i/o: LB synth/upsampled LB synth                                                     Q4*/
    Word16 output_mem_fx[], /* i  : OLA memory from last TCX/HQ frame                                               Qx*/
#endif
    const Word16 use_cldfb_for_dft,     /* i  : flag to use of CLDFB for DFT Stereo                                             Q0*/
    const Word16 output_frame,          /* i  : frame length                                                                    Q0*/
    const Word16 core_switching_flag,   /* i  : ACELP->HQ switching flag                                                        Q0*/
@@ -9899,17 +9894,9 @@ Word16 swb_bwe_dec_fx32(

ivas_error acelp_core_dec_fx(
    Decoder_State *st, /* i/o: decoder state structure                                                 */
#ifdef FIX_2280_REDUCTION_UNNECESSARY_SCALING
    Word32 output_fx32[], /* o  : synthesis @internal Fs                                               Q11*/
#else
    Word16 output_fx[],          /* o  : synthesis @internal Fs                                                  */
#endif
    Word16 synth_fx16[], /* o  : synthesis                                                               */
#ifdef FIX_2280_REDUCTION_UNNECESSARY_SCALING
    Word32 save_hb_synth_fx32[], /* o  : HB synthesis                                                          Q0*/
#else
    Word16 save_hb_synth_fx16[], /* o  : HB synthesis                                                            */
#endif
    Word32 bwe_exc_extended_fx[],        /* i/o: bandwidth extended excitation                                           */
    Word16 *voice_factors_fx,            /* o  : voicing factors                                                         */
    Word16 old_syn_12k8_16k_fx[],        /* o  : intermediate ACELP synthesis at 12.8kHz or 16kHz to be used by SWB BWE  */
+0 −29
Original line number Diff line number Diff line
@@ -53,17 +53,9 @@

ivas_error acelp_core_dec_fx(
    Decoder_State *st, /* i/o: decoder state structure                                                 */
#ifdef FIX_2280_REDUCTION_UNNECESSARY_SCALING
    Word32 output_fx32[], /* o  : synthesis @internal Fs                                                  Q11*/
#else
    Word16 output_fx[],                         /* o  : synthesis @internal Fs                                                  Q_syn*/
#endif
    Word16 synth_fx16[], /* o  : synthesis                                                               Q_syn2*/
#ifdef FIX_2280_REDUCTION_UNNECESSARY_SCALING
    Word32 save_hb_synth_fx32[], /* o  : HB synthesis                                                            Q0*/
#else
    Word16 save_hb_synth_fx16[],                /* o  : HB synthesis                                                            Q0*/
#endif
    Word32 bwe_exc_extended_fx[],        /* i/o: bandwidth extended excitation                                           2*Q_exc*/
    Word16 *voice_factors_fx,            /* o  : voicing factors                                                         Q15*/
    Word16 old_syn_12k8_16k_fx[],        /* o  : intermediate ACELP synthesis at 12.8kHz or 16kHz to be used by SWB BWE  Q_syn2-1*/
@@ -213,11 +205,7 @@ ivas_error acelp_core_dec_fx(
            Copy( lsp_new_fx, st->lsp_old_fx, M ); /*Q15*/
        }

#ifdef FIX_2280_REDUCTION_UNNECESSARY_SCALING
        set32_fx( output_fx32, 0, st->L_frame ); /* output and synth are not used in DFT domain CNG generation and the decoder output is unaffected if they are left uninitalized */
#else
        set16_fx( output_fx, 0, output_frame ); /* output and synth are not used in DFT domain CNG generation and the decoder output is unaffected if they are left uninitalized */
#endif
        set16_fx( synth_fx16, 0, output_frame ); /* They are however read in a few places which causes errors in the valgrind tests. Simplest solution from a code perspective was to set them to zero. */

        /* CN generation done in DFT domain */
@@ -2020,11 +2008,7 @@ ivas_error acelp_core_dec_fx(
                }
            }

#ifdef FIX_2280_REDUCTION_UNNECESSARY_SCALING
            IF( save_hb_synth_fx32 != NULL )
#else
            IF( save_hb_synth_fx16 != NULL )
#endif
            {
                /* save and then zero-out lowband */
                max_real = 0;
@@ -2065,13 +2049,7 @@ ivas_error acelp_core_dec_fx(
                    }
                }

#ifdef FIX_2280_REDUCTION_UNNECESSARY_SCALING
                cldfbSynthesis_ivas_fx( realBuffer_fx, imagBuffer_fx, save_hb_synth_fx32, -1, sub( Q11, Q_real ), -10, st->cldfbSynHB );
#else
                cldfbSynthesis_ivas_fx( realBuffer_fx, imagBuffer_fx, synth_fx /*tmp buffer for save_hb_synth_fx[] */, -1, sub( Q11, Q_real ), -10, st->cldfbSynHB );

                Copy_Scale_sig_32_16( synth_fx, save_hb_synth_fx16, output_frame, 0 ); // Q0
#endif

                /* restore lowband */
                FOR( j = 0; j < CLDFB_NO_CHANNELS_MAX; j++ )
@@ -2214,14 +2192,7 @@ ivas_error acelp_core_dec_fx(

        /* Copy output signal */
        Scale_sig( syn_tmp_fx, add( st->L_frame, L_SUBFR ), negate( st->Q_syn ) ); // Q0
#ifdef FIX_2280_REDUCTION_UNNECESSARY_SCALING
        Copy_Scale_sig_16_32_no_sat( psyn_fx, output_fx32, st->L_frame, sub( Q11, st->Q_syn2 ) ); // Q_syn2->Q11
#else
        IF( st->element_mode > EVS_MONO )
        {
            Copy( psyn_fx, output_fx, st->L_frame ); /*Q_syn*/
        }
#endif

        Copy_Scale_sig_32_16( synth_fx, synth_fx16, output_frame, 0 ); // Q_syn2
        st->Q_syn2 = 0;
+0 −37
Original line number Diff line number Diff line
@@ -215,16 +215,8 @@ void bw_switching_pre_proc_fx(
ivas_error core_switching_post_dec_fx(
    Decoder_State *st_fx, /* i/o: decoder state structure                                                           */
    Word16 *synth,        /* i/o: output synthesis                                                            Qsynth*/
#ifdef FIX_2280_REDUCTION_UNNECESSARY_SCALING
    Word32 *output_fx, /* i/o: LB synth/upsampled LB synth                                                    Q11*/
#else
    Word32 *output_fx,                                                                                      /* i/o: LB synth/upsampled LB synth                                                     Q4*/
#endif
#ifdef FIX_2280_REDUCTION_UNNECESSARY_SCALING
    Word32 output_mem_fx32[], /* i  : OLA memory from last TCX/HQ frame                                               Qx*/
#else
    Word16 output_mem_fx[],                                                                                 /* i  : OLA memory from last TCX/HQ frame                                               Qx*/
#endif
    const Word16 use_cldfb_for_dft,     /* i  : flag to use of CLDFB for DFT Stereo                                             Q0*/
    const Word16 output_frame,          /* i  : frame length                                                                    Q0*/
    const Word16 core_switching_flag,   /* i  : ACELP->HQ switching flag                                                        Q0*/
@@ -446,11 +438,7 @@ ivas_error core_switching_post_dec_fx(
                test();
                IF( ( ( NE_32( st_fx->last_core_brate, SID_2k40 ) && NE_32( st_fx->last_core_brate, FRAME_NO_DATA ) ) || ( NE_16( st_fx->element_mode, IVAS_CPE_DFT ) && NE_16( st_fx->element_mode, IVAS_CPE_TD ) ) || EQ_16( nchan_out, 1 ) ) && !( EQ_16( st_fx->element_mode, IVAS_CPE_MDCT ) && EQ_16( st_fx->idchan, 1 ) && ( EQ_16( nchan_out, 1 ) || EQ_16( last_element_mode, IVAS_CPE_DFT ) ) ) )
                {
#ifdef FIX_2280_REDUCTION_UNNECESSARY_SCALING
                    Scale_sig32( output_fx, L_FRAME48k, Q10 - Q11 ); /* Q10 */
#else
                    Scale_sig32( output_fx, L_FRAME48k, Q10 - Q4 );                                         /* Q10 */
#endif
                    core_switch_lb_upsamp_fx( st_fx, output_fx );
                }

@@ -508,11 +496,7 @@ ivas_error core_switching_post_dec_fx(
                    FOR( i = 0; i < delta; i++ )
                    {
                        st_fx->cldfbAna->cldfb_state_fx[offset - delta + i] =
#ifdef FIX_2280_REDUCTION_UNNECESSARY_SCALING
                            Mpy_32_16_1( L_shl( output_fx[st_fx->L_frame - delta + i], Q10 - Q11 ), alpha ); /* Q10 */
#else
                            Mpy_32_16_1( L_shl( output_fx[st_fx->L_frame - delta + i], Q10 - Q4 ), alpha ); /* Q10 */
#endif
                        move32();
                        IF( LT_16( alpha, sub( 32767, tmp ) ) )
                        {
@@ -561,11 +545,7 @@ ivas_error core_switching_post_dec_fx(
                    FOR( i = 0; i < delta; i++ )
                    {
                        st_fx->cldfbAna->cldfb_state_fx[offset - delta + i] =
#ifdef FIX_2280_REDUCTION_UNNECESSARY_SCALING
                            Mpy_32_16_1( L_shl( output_fx[st_fx->L_frame - delta + i], Q10 - Q11 ), alpha ); /* Q10 */
#else
                            Mpy_32_16_1( L_shl( output_fx[st_fx->L_frame - delta + i], Q10 - Q4 ), alpha ); /* Q10 */
#endif
                        move32();
                        IF( LT_16( alpha, sub( 32767, tmp ) ) )
                        {
@@ -627,18 +607,11 @@ ivas_error core_switching_post_dec_fx(
                    hHQ_core->Q_old_wtda = Qtmp;
                    move16();
                }
#ifdef FIX_2280_REDUCTION_UNNECESSARY_SCALING
                Word16 output_mem_fx[NS2SA( 48000, STEREO_DFT32MS_OVL_NS )];
                IF( output_mem_fx32 != NULL )
                {
                    Copy_Scale_sig_32_16( output_mem_fx32, output_mem_fx, NS2SA_FX2( st_fx->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( Qtmp, Q11 ) ); // Qtmp
                }
#else
                IF( output_mem_fx != NULL )
                {
                    Scale_sig( output_mem_fx, NS2SA_FX2( st_fx->output_Fs, STEREO_DFT32MS_OVL_NS ), Qtmp ); /* Qtmp */
                }
#endif
                *Qsynth = Qtmp;
                move16();

@@ -1073,25 +1046,15 @@ static void core_switch_lb_upsamp_fx(
        no_col = s_min( no_col, temp );
    }

#ifdef FIX_2280_REDUCTION_UNNECESSARY_SCALING
    Scale_sig32( output + imult1616( no_col, st->cldfbSyn->no_channels ), sub( st->hTcxDec->L_frameTCX, imult1616( no_col, st->cldfbSyn->no_channels ) ), Q11 - Q10 ); /* Q11 */
#else
    Scale_sig32( output + imult1616( no_col, st->cldfbSyn->no_channels ), sub( L_FRAME48k, imult1616( no_col, st->cldfbSyn->no_channels ) ), 4 - 10 ); /* Q4 */
#endif

    /* save synthesis - needed in case of core switching */
    IF( st->hTcxDec != NULL )
    {
#ifdef FIX_2280_REDUCTION_UNNECESSARY_SCALING
        Copy_Scale_sig_32_16( output, st->previoussynth_fx, st->hTcxDec->L_frameTCX, -Q4 ); /* Q0 */
#else
        Copy_Scale_sig_32_16( output, st->previoussynth_fx, st->hTcxDec->L_frameTCX, -Q4 ); /* Q0 */
#endif
    }

#ifdef FIX_2280_REDUCTION_UNNECESSARY_SCALING
    Scale_sig32( output, imult1616( no_col, st->cldfbSyn->no_channels ), Q11 - Q4 ); /* Q11 */
#endif

    return;
}
Loading