Commit 90d9274e authored by vaclav's avatar vaclav
Browse files

HARM_CORE_SW, decoder step 8 (core_switching_pre_enc)

parent 0f159366
Loading
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -2963,6 +2963,7 @@ void stereo_icBWE_preproc_fx(
    Word16 shb_speech_nonref[],                                 /* o  : SHB speech non-ref channel              */
    Word16 q_shb_speech_nonref                                  /* i  : Q SHB speech non-ref channel            */
);
#ifndef HARM_CORE_SW

void core_switching_pre_enc_ivas_fx(
    Encoder_State *st_fx,                                       /* i/o: encoder state structure                 */
@@ -2973,7 +2974,7 @@ void core_switching_pre_enc_ivas_fx(
    const Word16 active_cnt,                                    /* i  : active frame counter                    */
    const Word16 last_element_mode                              /* i  : last_element_mode                       */
);

#endif
Word16 ivas_acelp_tcx20_switching_fx(
    Encoder_State *st,                                          /* i/o: encoder state structure                 */
    Word16 *inp_fx,                                             /* i  : new input signal                        */
+39 −2
Original line number Diff line number Diff line
@@ -70,6 +70,7 @@ void core_switching_pre_enc_fx(

            set16_fx( hBWE_FD->old_syn_12k8_16k_fx, 0, NS2SA( 16000, DELAY_FD_BWE_ENC_NS ) );
        }

        test();
        IF( EQ_16( st_fx->last_core, TCX_20_CORE ) || EQ_16( st_fx->last_core, TCX_10_CORE ) )
        {
@@ -206,12 +207,17 @@ void core_switching_pre_enc_fx(
        /* Reset ACELP parameters */
        IF( hLPDmem != NULL )
        {
            move16();
            hLPDmem->syn[M] = 0;
            move16();
            set16_fx( hLPDmem->mem_syn2, 0, M );
            set16_fx( hLPDmem->mem_syn, 0, M );
            set16_fx( hLPDmem->mem_syn1_fx, 0, M );
#ifdef HARM_CORE_SW
            IF( NE_16( st_fx->element_mode, EVS_MONO ) )
            {
                hLPDmem->q_mem_syn = Q15;
            }
#endif
            hLPDmem->mem_w0 = 0;
            move16();
            hLPDmem->tilt_code = 0;
@@ -273,6 +279,7 @@ void core_switching_pre_enc_fx(
            set16_fx( hBWE_FD->old_syn_12k8_16k_fx, 0, NS2SA( 16000, DELAY_FD_BWE_ENC_NS ) );
        }
    }

    test();
    test();
    test();
@@ -438,6 +445,35 @@ void core_switching_pre_enc_fx(
        move16(); /* Set to a High Exponent so it is 1^-30 */
    }

#ifdef HARM_CORE_SW
    /*---------------------------------------------------------------------*
     * band-width switching from WB -> SWB/FB
     *---------------------------------------------------------------------*/

    IF( st_fx->element_mode > EVS_MONO )
    {
        IF( st_fx->bwidth_sw_cnt == 0 )
        {
            test();
            IF( GE_16( st_fx->bwidth, SWB ) && EQ_16( st_fx->last_bwidth, WB ) )
            {
                st_fx->bwidth_sw_cnt = add( st_fx->bwidth_sw_cnt, 1 );
                move16();
            }
        }
        ELSE
        {
            st_fx->bwidth_sw_cnt = add( st_fx->bwidth_sw_cnt, 1 );
            move16();
            IF( EQ_16( st_fx->bwidth_sw_cnt, BWS_TRAN_PERIOD ) )
            {
                st_fx->bwidth_sw_cnt = 0;
                move16();
            }
        }
    }

#endif
    return;
}

@@ -748,6 +784,7 @@ void core_switching_hq_prepare_enc_fx(
    }
    return;
}
#ifndef HARM_CORE_SW

void core_switching_pre_enc_ivas_fx(
    Encoder_State *st_fx,          /* i/o: encoder state structure           */
@@ -1167,7 +1204,7 @@ void core_switching_pre_enc_ivas_fx(

    return;
}
#ifndef HARM_CORE_SW


/*---------------------------------------------------------------------*
 * core_switching_post_enc()
+5 −1
Original line number Diff line number Diff line
@@ -306,7 +306,11 @@ ivas_error ivas_core_enc_fx(
         * Preprocessing (preparing) for ACELP/HQ core switching
         *---------------------------------------------------------------------*/

#ifdef HARM_CORE_SW
        core_switching_pre_enc_fx( st, old_inp_12k8_fx[n], sub( Q_new[n], 1 ), old_inp_16k_fx[n], sub( Q_new[n], 1 ), sts[0]->active_cnt, last_element_mode );
#else
        core_switching_pre_enc_ivas_fx( st, old_inp_12k8_fx[n], sub( Q_new[n], 1 ), old_inp_16k_fx[n], sub( Q_new[n], 1 ), sts[0]->active_cnt, last_element_mode );
#endif

        /*---------------------------------------------------------------------*
         * ACELP core encoding
@@ -637,7 +641,7 @@ ivas_error ivas_core_enc_fx(
        q_inp[0] = st->q_old_inp;
        q_inp[1] = st->q_inp;

        Scale_sig( st->input_fx - input_frame, 2 * input_frame, sub( -1, st->q_inp ) );
        Scale_sig( st->input_fx - input_frame, shl( input_frame, 1 ), sub( -1, st->q_inp ) );
        st->q_inp = -1;
        move16();
        st->q_old_inp = -1;