Commit d2bf3142 authored by vaclav's avatar vaclav
Browse files

LSF_LVQ_RESTRUCTURE

parent c88b5452
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -88,6 +88,7 @@
#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_BASOP_2620_ICBWE_GSMAPPING_DEAD_CLAMP       /* FhG: remove dead (always-overwritten) gsMapping clamp in ic_bwe_enc_gsMapping_fx; float ref has no clamp */
#define FIX_BASOP_2626_RC_UNI_DEC_READ_BITS_HANG        /* FhG: BASOP #2626: rc_uni_dec_read_bits: replace loop counter tmp with UWord64; with UWord32 the division-substitute loop (tmp <= low) never terminates after the bit-error sentinel sets rc_low=0xFFFFFFFF -> decoder hang on corrupted bitstreams */
#define LSF_LVQ_RESTRUCTURE                             /* VA: restructure LSF LVQ to save memory */

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

+13 −0
Original line number Diff line number Diff line
@@ -110,6 +110,19 @@ struct dispMem_fx
    Word16 prev_gain_pit[6]; /*Q14 */
};

#ifdef LSF_LVQ_RESTRUCTURE
/* LSF LVQ handle - used only in EVS */
typedef struct
{
    Word32 offset_scale1_fx[MAX_NO_MODES + 1][MAX_NO_SCALES + 1];     /* offsets for LSF LVQ structure 1st 8-dim subvector*/
    Word32 offset_scale2_fx[MAX_NO_MODES + 1][MAX_NO_SCALES + 1];     /* offsets for LSF LVQ structure 2nd 8-dim subvector*/
    Word32 offset_scale1_p_fx[MAX_NO_MODES_p + 1][MAX_NO_SCALES + 1]; /* offsets for LSF LVQ structure, pred. case, 1st 8-dim subvector*/
    Word32 offset_scale2_p_fx[MAX_NO_MODES_p + 1][MAX_NO_SCALES + 1]; /* offsets for LSF LVQ structure, pred. case, 2nd 8-dim subvector*/
    Word16 no_scales_fx[MAX_NO_MODES][2];                             /* LSF LVQ structure Q0*/
    Word16 no_scales_p_fx[MAX_NO_MODES_p][2];                         /* LSF LVQ structure Q0*/
} LSF_LVQ_DATA, *LSF_LVQ_HANDLE;
#endif

/*---------------------------------------------------------------*
 * ACELP Encoder/Decoder Static RAM                              *
 *---------------------------------------------------------------*/
+13 −1
Original line number Diff line number Diff line
@@ -39,7 +39,6 @@
#include "cnst.h"    /* Common constants                       */
#include "rom_com.h" /* Static table prototypes                */
#include "stl.h"     /* required for wmc_tool */
#include "basop_util.h"
#include "ivas_prot_fx.h"


@@ -133,7 +132,20 @@ ivas_error init_decoder_fx(
    /* LSF initilaizations */
    Copy( GEWB_Ave_fx, st_fx->mem_AR_fx, M );

#ifdef LSF_LVQ_RESTRUCTURE
    /* LSF LVQ handle */
    st_fx->hLsfLvq = NULL;
    IF( st_fx->element_mode == EVS_MONO )
    {
        IF( ( st_fx->hLsfLvq = (LSF_LVQ_HANDLE) malloc( sizeof( LSF_LVQ_DATA ) ) ) == NULL )
        {
            return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LSF LVQ\n" );
        }
        init_lvq_fx( st_fx->hLsfLvq->offset_scale1_fx, st_fx->hLsfLvq->offset_scale2_fx, st_fx->hLsfLvq->offset_scale1_p_fx, st_fx->hLsfLvq->offset_scale2_p_fx, st_fx->hLsfLvq->no_scales_fx, st_fx->hLsfLvq->no_scales_p_fx );
    }
#else
    init_lvq_fx( st_fx->offset_scale1_fx, st_fx->offset_scale2_fx, st_fx->offset_scale1_p_fx, st_fx->offset_scale2_p_fx, st_fx->no_scales_fx, st_fx->no_scales_p_fx );
#endif

    set16_fx( st_fx->mem_MA_fx, 0, M );

+8 −0
Original line number Diff line number Diff line
@@ -3022,6 +3022,14 @@ void destroy_core_dec_fx(
{
    destroy_cldfb_decoder_fx( hCoreCoder );

#ifdef LSF_LVQ_RESTRUCTURE
    IF( hCoreCoder->hLsfLvq != NULL )
    {
        free( hCoreCoder->hLsfLvq );
        hCoreCoder->hLsfLvq = NULL;
    }

#endif
    IF( hCoreCoder->hGSCDec != NULL )
    {
        free( hCoreCoder->hGSCDec );
+17 −0
Original line number Diff line number Diff line
@@ -45,8 +45,13 @@ static void dqlsf_CNG_fx(
    /* deindex_lvq_cng decoder does not need to know the sampling rate, the sampling rate data is embedded inside the LSF coefficients */
    IF( st_fx->element_mode == EVS_MONO )
    {
#ifdef LSF_LVQ_RESTRUCTURE
        ber_flag =
            deindex_lvq_cng_fx( &indice[1], lsf_q, indice[0], LSF_BITS_CNG - 4, &st_fx->hLsfLvq->offset_scale1_fx[0][0], &st_fx->hLsfLvq->offset_scale2_fx[0][0], &st_fx->hLsfLvq->no_scales_fx[0][0] ); /* Q0 */
#else
        ber_flag =
            deindex_lvq_cng_fx( &indice[1], lsf_q, indice[0], LSF_BITS_CNG - 4, &st_fx->offset_scale1_fx[0][0], &st_fx->offset_scale2_fx[0][0], &st_fx->no_scales_fx[0][0] ); /* Q0 */
#endif
    }
    ELSE
    {
@@ -712,9 +717,15 @@ void lsf_end_dec_fx(
                }
                ELSE
                {
#ifdef LSF_LVQ_RESTRUCTURE
                    ber_flag = vq_dec_lvq_fx( 1, qlsf, &lindice[1], stages0, M, mode_lvq, levels0[stages0 - 1],
                                              &st->hLsfLvq->offset_scale1_fx[0][0], &st->hLsfLvq->offset_scale2_fx[0][0], &st->hLsfLvq->offset_scale1_p_fx[0][0], &st->hLsfLvq->offset_scale2_p_fx[0][0],
                                              &st->hLsfLvq->no_scales_fx[0][0], &st->hLsfLvq->no_scales_p_fx[0][0] ); /* Q0 */
#else
                    ber_flag = vq_dec_lvq_fx( 1, qlsf, &lindice[1], stages0, M, mode_lvq, levels0[stages0 - 1],
                                              &st->offset_scale1_fx[0][0], &st->offset_scale2_fx[0][0], &st->offset_scale1_p_fx[0][0], &st->offset_scale2_p_fx[0][0],
                                              &st->no_scales_fx[0][0], &st->no_scales_p_fx[0][0] ); /* Q0 */
#endif
                }
                st->BER_detect = s_or( st->BER_detect, ber_flag ); /* Q0 */
                move16();
@@ -737,9 +748,15 @@ void lsf_end_dec_fx(
            }
            ELSE
            {
#ifdef LSF_LVQ_RESTRUCTURE
                ber_flag = vq_dec_lvq_fx( 0, qlsf, &lindice[1], stages1, M, mode_lvq_p, levels1[stages1 - 1],
                                          &st->hLsfLvq->offset_scale1_fx[0][0], &st->hLsfLvq->offset_scale2_fx[0][0], &st->hLsfLvq->offset_scale1_p_fx[0][0], &st->hLsfLvq->offset_scale2_p_fx[0][0],
                                          &st->hLsfLvq->no_scales_fx[0][0], &st->hLsfLvq->no_scales_p_fx[0][0] ); /* Q0 */
#else
                ber_flag = vq_dec_lvq_fx( 0, qlsf, &lindice[1], stages1, M, mode_lvq_p, levels1[stages1 - 1],
                                          &st->offset_scale1_fx[0][0], &st->offset_scale2_fx[0][0], &st->offset_scale1_p_fx[0][0], &st->offset_scale2_p_fx[0][0],
                                          &st->no_scales_fx[0][0], &st->no_scales_p_fx[0][0] ); /* Q0 */
#endif
            }
            st->BER_detect = s_or( st->BER_detect, ber_flag ); /* Q0 */
            move16();
Loading