Commit 618eaa20 authored by Vladimir Malenovsky's avatar Vladimir Malenovsky
Browse files

Merge branch 'main' into 1224-float-split-rendering-command-line-issues

parents b0db2d05 b79aeaee
Loading
Loading
Loading
Loading
Loading
+14 −2
Original line number Diff line number Diff line
@@ -5856,7 +5856,11 @@ ivas_error ivas_mct_enc_fx(
    const Word16 nb_bits_metadata                               /* i  : number of metadata bits                 */
);

#ifdef FIX_2344_ALIGN_PREPROC
void ivas_compute_core_buffers_fx(
#else
ivas_error ivas_compute_core_buffers_fx(
#endif
    Encoder_State *st,                                          /* i/o: encoder state structure                  */
    Word16 **inp16k_out_fx,                                     /* o  : ptr. to inp. signal in the current frame */
    Word16 *old_inp_16k_fx,                                     /* i/o: buffer of old input signal @ 16kHz       */
@@ -5870,7 +5874,7 @@ ivas_error ivas_compute_core_buffers_fx(
    Word32 epsP[M + 1],                                         /* i/o: LP prediction errors                     */
    Word16 lsp_new_fx[M],                                       /* i/o: LSPs at the end of the frame             */
    Word16 lsp_mid_fx[M],                                       /* i/o: LSPs in the middle of the frame          */
    Word16 Q_old_inp_16k,
    const Word16 Q_old_inp_16k,
    Word16 Q_r[2],
    Word16 *Q_new 
);
@@ -5961,7 +5965,11 @@ void ivas_mct_enc_close_fx(
    MCT_ENC_HANDLE *hMCT                                        /* i/o: MCT encoder structure                   */
);

#ifdef FIX_2344_ALIGN_PREPROC
void pre_proc_front_ivas_fx(
#else
ivas_error pre_proc_front_ivas_fx(
#endif
    SCE_ENC_HANDLE hSCE,                                           /* i/o: SCE encoder structure                                    */
    CPE_ENC_HANDLE hCPE,                                           /* i/o: CPE encoder structure                                    */
    const Word32 element_brate,                                    /* i  : SCE/CPE element bitrate                                  Q0*/
@@ -6017,7 +6025,11 @@ ivas_error pre_proc_front_ivas_fx(
    Word16 *Q_new                                                  /* i/o : Q factor of speech buffers                              */
);

#ifdef FIX_2344_ALIGN_PREPROC
void pre_proc_ivas_fx(
#else
ivas_error pre_proc_ivas_fx(
#endif
    Encoder_State *st,                                          /* i/o: encoder state structure                                */
    const Word16 last_element_mode,                             /* i  : last element mode                                    Q0*/
    const Word32 element_brate,                                 /* i  : element bitrate                                      Q0*/
+2 −0
Original line number Diff line number Diff line
@@ -103,6 +103,7 @@
#define HARM_CORE_SW                                    /* VA: basop issue 2314: Remove duplicated code in the core switching */
#define HARM_PREPROC                                    /* VA: basop issue 2339: Remove duplicated code in the core-coder DTX  */
#define HARM_NON_LINEARITY                              /* VA: basop issue 2345: Remove duplicated code in core-coder: non_linearity_fx() and LP CNG */
#define FIX_2344_ALIGN_PREPROC                          /* VA: basop issue 2344: Align pre_proc_ivas() between FLP and BASOP */

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

@@ -119,6 +120,7 @@
#define OPT_NBE_2311_HARM_GSC_GAIN                      /* VA: issue 2311: non-BE part of the GSC gain harmonization */
#define FIX_2261_REMOVE_LP_RESCALING                    /* VA: Remove of unnecessary lpc coefficient rescaling */
#define FIX_2320_OOB_SCE_SWITCHING                      /* VA: basop issue 2320: Correct the length of the buffer to be scaled in SCE/CPE switching */
#define FIX_2302_LSF_CDBK_THRESHOLD                     /* VA: basop issue 2302: fix threshold for LSF Q codebook-type decision  */

/* ##################### End NON-BE switches ########################### */

+31 −9
Original line number Diff line number Diff line
@@ -230,6 +230,20 @@ ivas_error ivas_core_enc_fx(
#endif
            Scale_sig( &Aw_fx[n][i * ( M + 1 )], M + 1, sub( norm_s( Aw_fx[n][i * ( M + 1 )] ), 2 ) ); // scaling to Q12
        }

#ifdef FIX_2344_ALIGN_PREPROC
        Word32 last_element_brate_tmp = element_brate;
        move32();
        IF( EQ_32( ivas_format, SBA_FORMAT ) )
        {
            last_element_brate_tmp = last_element_brate;
            move32();
        }

        pre_proc_ivas_fx( st, last_element_mode, element_brate, last_element_brate_tmp, input_frame, old_inp_12k8_fx[n] /* i: -1, o: Q_new - 1 */, old_inp_16k_fx[n] /* i: -1, o: Q_new - 1 */,
                          &inp_fx[n], &ener_fx[n], A_fx[n], Aw_fx[n], epsP_fx[n], &epsP_fx_q[n], lsp_new_fx[n], lsp_mid_fx[n], new_inp_resamp16k_fx[n], &Voicing_flag[n], old_wsp_fx[n], e_old_wsp[n], loc_harm[n],
                          vad_flag_dtx[n], MCT_flag, vad_hover_flag[n], flag_16k_smc, enerBuffer_fx[n], enerBuffer_fx_exp[n], fft_buff_fx[n], cor_map_sum_fx[n], &Q_new[n] );
#else
        IF( EQ_32( ivas_format, SBA_FORMAT ) )
        {
            IF( NE_32( ( error = pre_proc_ivas_fx( st, last_element_mode, element_brate, last_element_brate, input_frame, old_inp_12k8_fx[n] /* i: -1, o: Q_new - 1 */, old_inp_16k_fx[n] /* i: -1, o: Q_new - 1 */,
@@ -250,6 +264,8 @@ ivas_error ivas_core_enc_fx(
                return error;
            }
        }
#endif

        test();
        IF( EQ_16( st->element_mode, IVAS_CPE_MDCT ) || EQ_16( st->element_mode, IVAS_SCE ) )
        {
@@ -744,6 +760,11 @@ ivas_error ivas_core_enc_fx(

        Word16 Q_shb_spch_16 = Q_shb_spch;
        move16();
#ifdef FIX_2344_ALIGN_PREPROC
        IF( st->tcxonly == 0 || hStereoICBWE != NULL || st->core == ACELP_CORE ) // temp. fix to keep BE until #1504 (FLP) is solved, then it will become:
                                                                                 // IF( st->tcxonly == 0 )
#endif
        {
            shift = add( getScaleFactor16( shb_speech_fx, L_FRAME16k ), Q16 );
            Copy_Scale_sig_16_32_no_sat( shb_speech_fx, shb_speech_fx32, L_FRAME16k, shift ); // Q_shb_spch
            Q_shb_spch = add( Q_shb_spch, shift );
@@ -755,6 +776,7 @@ ivas_error ivas_core_enc_fx(
                move16();
                Scale_sig( st->hBWE_FD->L_old_wtda_swb_fx, L_FRAME48k, shift ); // st->Q_old_wtda
            }
        }

        /* SWB TBE encoder */
        test();
+33 −5
Original line number Diff line number Diff line
@@ -76,7 +76,11 @@ static Word16 get_zero_flag( const Word32 arr[], const Word16 len )
 * (resampling, spectral analysis, LP analysis, VAD, OL pitch calculation, classification)
 *--------------------------------------------------------------------*/

#ifdef FIX_2344_ALIGN_PREPROC
void pre_proc_front_ivas_fx(
#else
ivas_error pre_proc_front_ivas_fx(
#endif
    SCE_ENC_HANDLE hSCE,                                           /* i/o: SCE encoder structure                                    */
    CPE_ENC_HANDLE hCPE,                                           /* i/o: CPE encoder structure                                    */
    const Word32 element_brate,                                    /* i  : SCE/CPE element bitrate                                  Q0*/
@@ -157,7 +161,9 @@ ivas_error pre_proc_front_ivas_fx(
    STEREO_CLASSIF_HANDLE hStereoClassif;
    Word16 old_pitch1; /* previous frame OL pitch[1] @12.8 kHz */
    Word16 LR_localVAD;
#ifndef FIX_2344_ALIGN_PREPROC
    ivas_error error;
#endif
    Word16 *signal_in_fx;
    Word32 *signal32_in_fx;
    Word16 *inp_12k8_fx, *new_inp_12k8_fx; /* pointers to current frame and new data       */
@@ -225,21 +231,30 @@ ivas_error pre_proc_front_ivas_fx(
    Word16 sf_energySum[CLDFB_NO_CHANNELS_MAX];
    Word16 Q_inp_const = -1;
    move16();
#ifdef FIX_2344_ALIGN_PREPROC
    Word16 headroom, preemp_len, inp_max;
#else
    Word16 headroom = 0, preemp_len = 0, inp_max = 0;
    move16();
    move16();
    move16();
#endif
    Word16 *preemp_start_idx = NULL;
#ifdef FIX_2344_ALIGN_PREPROC
    Word32 sig_out[STEREO_DFT_OVL_16k + L_FRAME16k /* = max( L_FRAME16k + STEREO_DFT_OVL_16k, L_FRAME16k + L_FILT16k + lMemRecalc_16k ) */], max_32;
#else
    Word32 sig_out[960], max_32;
#endif

    push_wmops( "pre_proc_front" );
    /*------------------------------------------------------------------*
     * Initialization
     *------------------------------------------------------------------*/

#ifndef FIX_2344_ALIGN_PREPROC
    error = IVAS_ERR_OK;
    move32();

#endif
    cldfbScale.lb_scale = Q31;
    cldfbScale.hb_scale = Q31;
    move16();
@@ -544,12 +559,17 @@ ivas_error pre_proc_front_ivas_fx(
     * Perform fixed preemphasis (12.8 kHz signal) through 1 - g*z^-1
     *-----------------------------------------------------------------*/

#ifndef FIX_2344_ALIGN_PREPROC
    *Q_new = 0;
    move16();
    set32_fx( sig_out, 0, 960 );

#endif
    headroom = 2;
    move16();
#ifdef FIX_2344_ALIGN_PREPROC
    preemp_len = 0;
    move16();
#endif

    st->mem_preemph_fx_q_inp = shl_sat( st->mem_preemph_fx_q_inp, sub( st->q_inp, st->mem_preemph_q ) ); /*st->q_inp*/
    move16();
@@ -636,6 +656,7 @@ ivas_error pre_proc_front_ivas_fx(
        preemp_len = L_FRAME + L_FILT;
        move16();
    }

    st->mem_preemph_fx = shl_sat( st->mem_preemph_fx_q_inp, sub( -1, st->q_inp ) ); /*Q(-1) saturation added as float value goes above 65536 for +10 dB test (ltv48_MC512.wav and ltv48_MC51.wav) */
    move16();
    st->mem_preemph_DFT_fx = shl_sat( st->mem_preemph_DFT_fx_q_inp, sub( -1, st->q_inp ) ); /*Q(-1)*/
@@ -1329,12 +1350,11 @@ ivas_error pre_proc_front_ivas_fx(
     * 1st stage speech/music classification (GMM model)
     *----------------------------------------------------------------*/

    SP_MUS_CLAS_HANDLE hSpMusClas = st->hSpMusClas;
    shift = getScaleFactor32( PS_fx, 128 );
    scale_sig32( PS_fx, 128, shift );
    Qfact_PS = add( Qfact_PS, shift );

    smc_dec = ivas_smc_gmm_fx( st, hStereoClassif, localVAD_HE_SAD, extract_h( Etot_fx ), lsp_new_fx, *cor_map_sum_fx /*Q8*/, epsP_fx, PS_fx, non_staX_fx, *relE_fx, &high_lpn_flag, flag_spitch, Qfact_PS, *epsP_fx_q, hSpMusClas->past_PS_Q ); /* Q0 */
    smc_dec = ivas_smc_gmm_fx( st, hStereoClassif, localVAD_HE_SAD, extract_h( Etot_fx ), lsp_new_fx, *cor_map_sum_fx /*Q8*/, epsP_fx, PS_fx, non_staX_fx, *relE_fx, &high_lpn_flag, flag_spitch, Qfact_PS, *epsP_fx_q, st->hSpMusClas->past_PS_Q ); /* Q0 */

#ifdef DEBUGGING
    if ( st->idchan == 0 )
@@ -1476,11 +1496,15 @@ ivas_error pre_proc_front_ivas_fx(
                move16();

                /* Compute core-coder buffers at internal sampling rate */
#ifdef FIX_2344_ALIGN_PREPROC
                ivas_compute_core_buffers_fx( st, NULL, old_inp_16k_fx, NULL, input_frame, IVAS_SCE /*last_element_mode*/, INT_FS_16k /*sr_core_tmp*/, ener_fx, A_fx, Aw_fx, epsP_fx, lsp_new_fx, lsp_mid_fx, Q_old_inp_16k, Q_r, Q_new );
#else
                error = ivas_compute_core_buffers_fx( st, NULL, old_inp_16k_fx, NULL, input_frame, IVAS_SCE /*last_element_mode*/, INT_FS_16k /*sr_core_tmp*/, ener_fx, A_fx, Aw_fx, epsP_fx, lsp_new_fx, lsp_mid_fx, Q_old_inp_16k, Q_r, Q_new );
                IF( NE_32( error, IVAS_ERR_OK ) )
                {
                    return error;
                }
#endif

                *epsP_fx_q = add( Q_r[0], 1 );
                move16();
@@ -1571,7 +1595,11 @@ ivas_error pre_proc_front_ivas_fx(
    free( temp1F_icatdmResampBuf_fx );
#endif
    pop_wmops();
#ifdef FIX_2344_ALIGN_PREPROC
    return;
#else
    return error;
#endif
}


+142 −17

File changed.

Preview size limit exceeded, changes collapsed.

Loading