Commit ed62ce7c authored by vaclav's avatar vaclav
Browse files

review of core decoder handles

parent 6b7b8ea6
Loading
Loading
Loading
Loading
Loading
+0 −652
Original line number Diff line number Diff line
@@ -1548,516 +1548,6 @@ Word32 BIT_ALLOC_IDX_16KHZ_fx( Word32 brate, Word16 ctype, Word16 sfrm, Word16 t
    return L_temp;
}

/*-------------------------------------------------------------------*
 * read_indices_mime_handle_dtx()
 *
 * Handle DTX for MIME and RTP_DUMP decoding.
 * Returns the actual total_brate.
 *-------------------------------------------------------------------*/

static Word32 read_indices_mime_handle_dtx(
    Decoder_State *st,
    Word16 isAMRWB_IOmode,
    Word16 core_mode,
    Word32 total_brate,
    Word16 sti,
    Word16 speech_lost,
    Word16 no_data )
{
    Word16 curr_ft_good_sp = 0;
    Word16 speech_bad = 0;
    Word16 sid_upd_bad = 0, sid_update = 0;
    Word16 amrwb_sid_first = 0; /* derived from sti  SID_FIRST indicator in AMRWB payload */
    move16();
    move16();
    move16();
    move16();
    move16();

    /* keep st->CNG , st_bfi and total_brate  updated  for proper synthesis in DTX and FER  */
    IF( GT_32( total_brate, SID_2k40 ) )
    {
        if ( NE_16( st->bfi, 1 ) ) /* so  far derived from q bit in AMRWB/AMRWBIO cases   */
        {
            curr_ft_good_sp = 1;
            move16();
        }
    }

    /* handle q_bit and  lost_sp  clash ,  assume worst case  */
    IF( speech_lost != 0 ) /*  overrides  a good q_bit */
    {
        curr_ft_good_sp = 0;
        move16();
        st->bfi = 1; /* override  qbit */
        move16();
    }

    /* now_bfi_fx has been set based on q_bit and ToC fields */


    /* SID_UPDATE check */
    test();
    IF( EQ_32( total_brate, SID_1k75 ) || EQ_32( total_brate, SID_2k40 ) )
    {
        IF( st->bfi == 0 )
        {
            /* typically from q bit  */
            sid_update = 1;
            move16();
        }
        ELSE
        {
            sid_upd_bad = 1; /* may happen in saving from e.g. a CS-connection */
            move16();
        }
    }

    test();
    test();
    IF( isAMRWB_IOmode && total_brate == 0 && sti == 0 )
    {
        IF( st->bfi )
        {
            sid_upd_bad = 1; /*  corrupt sid_first, signaled as bad sid  */
            move16();
        }
        ELSE
        {
            amrwb_sid_first = 1; /* 1-sti  */
            move16();
        }
    }

    test();
    test();
    test();
    test();
    IF( sid_upd_bad != 0 && ( ( isAMRWB_IOmode != 0 && st->Opt_AMR_WB == 0 ) ||            /* switch to    AMRWBIO */
                              ( NE_16( isAMRWB_IOmode, 1 ) && EQ_16( st->Opt_AMR_WB, 1 ) ) /* switch from  AMRWBIO */
                              ) )
    {
        /* do not allow a normal start of  CNG synthesis if this SID(with BER or FER) is a switch to/from AMRWBIO  */
        sid_upd_bad = 0; /* revert this detection due to AMRWBIO/EVS mode switch */
        move16();
        total_brate = 0;
        move32();
        no_data = 1;
        move16();
        assert( st->bfi == 1 ); /* bfi stays 1 */
    }

    test();
    if ( GT_32( total_brate, SID_2k40 ) && EQ_16( st->bfi, 1 ) ) /* typically from q bit  */
    {
        speech_bad = 1; /* initial assumption,   CNG synt state decides what to actually do */
        move16();
    }
    /* all frame types decoded */

    /*    update CNG synthesis state */
    /*    Decoder can only  enter CNG-synthesis  for  CNG frame types (sid_upd,  sid_bad, sid_first) */
    IF( st->CNG_fx != 0 )
    {
        /* We were in CNG synthesis  */
        if ( curr_ft_good_sp != 0 )
        {
            /* only a good speech frame makes decoder leave CNG synthesis */
            st->CNG_fx = 0;
            move16();
        }
    }
    ELSE
    {
        /*   We were in SPEECH synthesis  */
        /*   only a received SID frame can make the decoder enter into CNG synthesis  */
        test();
        test();
        if ( amrwb_sid_first || sid_update || sid_upd_bad )
        {
            st->CNG_fx = 1;
            move16();
        }
    }

    /* Now modify bfi flag for the  decoder's  SPEECH/CNG synthesis logic  */
    /*   in SPEECH synthesis, make sure to activate speech plc for a received no_data frame,
             no_data frames may be injected by the network or by the dejitter buffer   */
    /*   modify bfi_flag to stay/move into the correct decoder PLC section  */
    test();
    if ( ( st->CNG_fx == 0 ) && ( no_data != 0 ) )
    {
        /*  treat no_data received in speech synthesis as  SP_LOST frames, SPEECH PLC code will now become active */
        st->bfi = 1;
        move16();
        /* total_brate= 0;    always zero for no_data */
    }

    /* in CNG  */
    /* handle bad speech frame(and bad sid frame) in the decoders CNG synthesis settings pair (total_brate, bfi)  */
    test();
    test();
    test();
    test();
    IF( ( st->CNG_fx != 0 && ( speech_bad || speech_lost || no_data ) ) || /* SP_BAD or SPEECH_LOST)   --> stay in CNG */
        sid_upd_bad )                                                      /* SID_UPD_BAD               --> start/stay  CNG   */
    {
        st->bfi = 0; /* mark as good to not start speech PLC */
        move16();
        total_brate = 0; /* this zeroing needed  for  speech_bad, sid_bad frames */
        move32();
    }


    /*  now  bfi, total_brate are set by RX-DTX handler::
    bfi==0, total_brate!=0    cng or speech pending  bitrate
    bfi==0, total_brate==0    cng will continue or start(sid_first, sid_bad)
    bfi==1, total_brate!=0    speech plc
    bfi==1, total_brate==0 ,  speech plc
    */


    /*  handle available AMRWB/AMRWBIO MIME header ToC rate-info at startup   */
    test();
    test();
    test();
    test();
    IF( ( EQ_16( st->bfi, 1 ) && st->ini_frame == 0 ) &&
        ( ( st->amrwb_rfc4867_flag != 0 ) || ( st->amrwb_rfc4867_flag == 0 && isAMRWB_IOmode != 0 ) ) ) /*AMRWB ToC */
    {
        Word32 init_rate;

        init_rate = total_brate; /* default , may have been modified from original ToC value */
        move32();

        test();
        IF( speech_lost != 0 || no_data != 0 )
        {
            init_rate = ACELP_12k65; /* make sure the decoder starts up in a selected AMRWB mode */
            move32();
        }
        ELSE IF( speech_bad != 0 )
        {
            init_rate = AMRWB_IOmode2rate[core_mode]; /* read from from ToC */
            move32();
        }
        st->total_brate = init_rate; /* not updated on bfi as  decoderSelectCodec is not called below */
        move32();
        st->core_brate = init_rate;
        move32();
    }

    return total_brate;
}


/*-------------------------------------------------------------------*
 * read_indices_mime_handle_sti_and_all_zero_bits()
 *
 * Handle STI and frames with all zero bits for MIME and RTP_DUMP decoding.
 *-------------------------------------------------------------------*/

static void read_indices_mime_handle_sti_and_all_zero_bits(
    Decoder_State *st,
    Word32 *total_brate,
    Word16 sti )
{
    Word16 k;

    IF( sti == 0 )
    {
        *total_brate = 0; /* signal received SID_FIRST as a good frame with no bits */
        move32();
        FOR( k = 0; k < 35; k++ )
        {
            st->bfi = s_or( st->bfi, st->bit_stream[k] ); /* partity check of 35 zeroes,  any single 1 gives BFI */
            move16();
        }
    }
    /* all zero bit SID_update results in a valid LP filter with extremely high LP-filter-gain  */
    /* all zero bits signal may be a result of CS bit errors  or erronesouly injected by gateways or bad dejitter handlers */
    IF( EQ_16( sti, 1 ) )
    { /*sid_update received */
        Word16 sum = 0;
        move16();
        FOR( k = 0; k < 35; k++ )
        {
            sum = add( sum, st->bit_stream[k] ); /* check of 35 zeroes */
        }

        if ( sum == 0 )
        {
            st->bfi = 1; /* eventually becomes SID_UPD_BAD */
            move16();
        }
    }
}


/*------------------------------------------------------------------------------------------*
 * read_indices_mime()
 *
 * Read indices from MIME formatted bitstream to the buffer
 *   The magic word and number of channnels should be consumed before calling this function
 *-------------------------------------------------------------------------------------------*/

Word16 read_indices_mime(                    /* o  : 1 = reading OK, 0 = problem            */
                          Decoder_State *st, /* i/o: decoder state structure                */
                          FILE *file,        /* i  : bitstream file                         */
                          Word16 rew_flag    /* i  : rewind flag (rewind file after reading) */
)
{
    Word16 k, isAMRWB_IOmode, cmi, core_mode = -1, qbit, sti;
    UWord8 header;
    UWord8 pFrame[( MAX_BITS_PER_FRAME + 7 ) >> 3];
    UWord8 mask = 0x80, *pt_pFrame = pFrame;
    UWord16 *bit_stream_ptr;
    Word16 num_bits;
    Word32 total_brate;
    UWord16 utmp;
    Word32 L_tmp;
    Word16 speech_lost = 0, no_data = 0;
    Word16 num_bytes_read;

    move16();
    move16();
    move16();
    move16();

    st->BER_detect = 0;
    move16();
    st->bfi = 0;
    move16();
    st->mdct_sw_enable = 0;
    move16();
    st->mdct_sw = 0;
    move16();
    reset_indices_dec_fx( st );

    /* read the FT Header field from the bitstream */
    IF( NE_32( fread( &header, sizeof( UWord8 ), 1, file ), 1 ) )
    {
        IF( ferror( file ) )
        {
            /* error during reading */
            fprintf( stderr, "\nError reading the bitstream !" );
            exit( -1 );
        }
        ELSE
        {
            /* end of file reached */
            return 0;
        }
    }

    /* init local RXDTX flags */
    sti = -1;
    move16();

    IF( st->amrwb_rfc4867_flag != 0 )
    {
        /*   RFC 4867
        5.3 ....
        Each stored speech frame starts with a one-octet frame header with
        the following format:
        0 1 2 3 4 5 6 7
        +-+-+-+-+-+-+-+-+
        |P| FT    |Q|P|P|
        +-+-+-+-+-+-+-+-+
        The FT field and the Q bit are defined in the same way as in
        Section 4.3.2. The P bits are padding and MUST be set to 0, and MUST be ignored. */

        isAMRWB_IOmode = 1;
        move16();
        qbit = s_and( shr( header, 2 ), 0x01 ); /* b2 bit       (b7 is the F bit ) */
        st->bfi = !qbit;
        move16();
        core_mode = s_and( shr( header, 3 ), 0x0F ); /*  b6..b3      */
        total_brate = AMRWB_IOmode2rate[core_mode];  /* get the frame length from the header */
        move32();
    }
    ELSE
    {
        /*0 1 2 3 4 5 6 7   MS-bit ---> LS-bit
         +-+-+-+-+-+-+-+-+
         |H|F|E|x| brate |
         +-+-+-+-+-+-+-+-+
          where :
                "E|x|  brate "  is the 6 bit "FT" -field
                 x is unused    if E=0, (should be 0 )
                 x is the q-bit if E=1, q==1(good), Q==0(bad, maybe bit errors in payload )
                 H,F  always   0 in RTP format.
        */
        isAMRWB_IOmode = extract_l( GT_16( s_and( header, 0x20 ), 0 ) ); /* get EVS mode-from header */ /*    b2   */
        core_mode = s_and( header, 0x0F );                                                              /* b4,b5,b6,b7 */

        IF( isAMRWB_IOmode )
        {
            qbit = extract_l( GT_16( s_and( header, 0x10 ), 0 ) ); /* get Q bit,    valid for IO rates */ /* b3 */
            total_brate = AMRWB_IOmode2rate[core_mode];
            move32();
        }
        ELSE
        {
            qbit = 1; /* assume good q_bit for the unused EVS-mode bit,    complete ToC validity checked later */
            move16();
            total_brate = PRIMARYmode2rate[core_mode];
            move32();
        }
        st->bfi = !qbit;
        move16();
    }


    /* set up RX-DTX-handler input */
    if ( EQ_16( core_mode, 14 ) )
    {
        /* SP_LOST */
        speech_lost = 1;
        move16();
    }
    if ( EQ_16( core_mode, 15 ) )
    {
        /*  NO_DATA unsent CNG frame OR  any frame marked or injected  as no_data  by e.g a signaling layer or dejitter buffer */
        no_data = 1;
        move16();
    }

    Mpy_32_16_ss( total_brate, 5243, &L_tmp, &utmp ); /* 5243 is 1/50 in Q18. (0+18-15=3) */
    num_bits = extract_l( L_shr( L_tmp, 3 ) );        /* Q0 */
    st->total_num_bits = num_bits;
    move16();

    IF( total_brate < 0 )
    {
        /* validate that total_brate (derived from RTP packet or a file header) is one of the defined bit rates  */
        fprintf( stderr, "\n  Error.  Illegal total bit rate (= %d) in MIME ToC header \n", total_brate );
        /* num_bits = -1;   not needed as BASOP multiplication preserves sign */
    }

    /* Check correctness of ToC headers  */
    IF( st->amrwb_rfc4867_flag == 0 )
    {
        /* EVS ToC header (FT field(b2-b7), H bit (b0),    F bit (b1)  ,  (EVS-modebit(b2)=0  unused(Qbit)(b3)==0)   */
        test();
        test();
        test();
        test();
        test();
        test();
        test();
        IF( ( isAMRWB_IOmode == 0 ) && ( ( num_bits < 0 ) || ( s_and( header, 0x80 ) > 0 ) || ( s_and( header, 0x40 ) > 0 ) || s_and( header, 0x30 ) != 0x00 ) )
        {
            /* incorrect FT header */
            fprintf( stderr, "\nError in EVS  FT ToC header(%02x) ! ", header );
            exit( -1 );
        }
        ELSE IF( ( isAMRWB_IOmode != 0 ) && ( ( num_bits < 0 ) || ( s_and( header, 0x80 ) > 0 ) || ( s_and( header, 0x40 ) > 0 ) ) ) /* AMRWBIO */
        {
            /* incorrect IO FT header */
            fprintf( stderr, "\nError in EVS(AMRWBIO)  FT ToC header(%02x) ! ", header );
            exit( -1 );
        }
    }
    ELSE
    {
        /* legacy AMRWB ToC,   is only using  Padding bits which MUST be ignored */
        IF( num_bits < 0 )
        {
            /* incorrect FT header */
            fprintf( stderr, "\nError in AMRWB RFC4867  Toc(FT)  header(%02x) !", header );
            exit( -1 );
        }
    }

    /* read serial stream of indices from file to the local buffer */
    num_bytes_read = extract_l( fread( pFrame, sizeof( UWord8 ), shr( add( num_bits, 7 ), 3 ), file ) );
    IF( NE_16( num_bytes_read, shr( add( num_bits, 7 ), 3 ) ) )
    {
        fprintf( stderr, "\nError, invalid number of bytes read ! Exiting ! \n" );
        exit( -1 );
    }

    /* in case rew_flag is set, rewind the file and return */
    /* (used in io_dec() to attempt print out info about technologies and to initialize the codec ) */
    IF( rew_flag )
    {
        st->total_brate = total_brate; /* used for the codec banner output */
        move32();
        test();
        test();
        IF( st->bfi == 0 && speech_lost == 0 && no_data == 0 )
        {
            decoder_selectCodec( st, total_brate, unpack_bit( &pt_pFrame, &mask ) ? G192_BIN1 : G192_BIN0 );
        }
        return 1;
    }


    /* unpack speech data */
    bit_stream_ptr = st->bit_stream;
    FOR( k = 0; k < num_bits; k++ )
    {
        IF( isAMRWB_IOmode )
        {
            st->bit_stream[sort_ptr[core_mode][k]] = unpack_bit( &pt_pFrame, &mask );
            move16();
            bit_stream_ptr++;
        }
        ELSE
        {
            *bit_stream_ptr++ = unpack_bit( &pt_pFrame, &mask );
            move16();
        }
    }

    /* unpack auxiliary bits */
    /* Note: the cmi bits are unpacked for  demo  purposes;  */
    test();
    IF( isAMRWB_IOmode && EQ_32( total_brate, SID_1k75 ) )
    {
        sti = unpack_bit( &pt_pFrame, &mask );
        cmi = shl( unpack_bit( &pt_pFrame, &mask ), 3 );
        cmi = s_or( cmi, shl( unpack_bit( &pt_pFrame, &mask ), 2 ) );
        cmi = s_or( cmi, shl( unpack_bit( &pt_pFrame, &mask ), 1 ) );
        cmi = s_or( cmi, unpack_bit( &pt_pFrame, &mask ) );

        read_indices_mime_handle_sti_and_all_zero_bits( st, &total_brate, sti );
    }

    /*add two zero bytes for arithmetic coder flush*/
    FOR( k = 0; k < 2 * 8; ++k )
    {
        *bit_stream_ptr++ = 0;
        move16();
    }

    /* MIME RX_DTX handler */
    IF( !rew_flag )
    {
        total_brate = read_indices_mime_handle_dtx( st, isAMRWB_IOmode, core_mode, total_brate, sti, speech_lost, no_data );
    }

    IF( st->bfi == 0 )
    {
        /* select MODE1 or MODE2 in  MIME */
        IF( *st->bit_stream )
        {
            decoder_selectCodec( st, total_brate, G192_BIN1 );
        }
        ELSE
        {
            decoder_selectCodec( st, total_brate, G192_BIN0 );
        }
        /* a change of the total bitrate should not be known to the decoder, if the received frame was truly lost */
        st->total_brate = total_brate;
        move32();
        mdct_switching_dec( st );
    }
    /* else{ bfi stay in past synthesis mode(SP,CNG) } */

    return 1;
}

/*-------------------------------------------------------------------*
 * berCheck()
@@ -2418,148 +1908,6 @@ void get_NextCoderType_fx(
    move16();
}

/*-------------------------------------------------------------------*
 * read_indices_from_djb_fx()
 *
 * Read indices from the de-jitter buffer payload (works also for AMR-WB IO mode)
 *-------------------------------------------------------------------*/

void read_indices_from_djb_fx(
    Decoder_State *st, /* i/o: decoder state structure       */
    UWord8 *pt_stream, /* i  : bitstream file                */
    Word16 num_bits,   /* i  : input frame length in bits    */
    Word16 isAMRWB_IOmode,
    Word16 core_mode,
    Word16 qbit,
    Word16 partialframe,   /* i  : partial frame information     */
    Word16 next_coder_type /* i  : next coder type information   */
)
{
    Word16 k;
    UWord8 mask = 0x80;
    Word16 no_data = 0;
    Word16 sti = -1;
    UWord16 *bit_stream_ptr;
    Word32 total_brate;
    Word16 speech_lost = 0;

    move16();
    move16();
    move16();
    move16();

    st->bfi = 0;
    move16();
    st->BER_detect = 0;
    move16();
    st->mdct_sw_enable = 0;
    move16();
    st->mdct_sw = 0;
    move16();
    reset_indices_dec_fx( st );

    st->bfi = !qbit;
    move16();
    total_brate = L_mult0( num_bits, 50 );
    st->total_num_bits = num_bits;
    move16();

    IF( num_bits == 0 ) /* guess type of missing frame for SP_LOST and NO_DATA */
    {
        speech_lost = st->CNG_fx == 0;
        move16();
        move16();
        no_data = st->CNG_fx != 0;
        move16();
    }

    test();
    IF( partialframe || st->prev_use_partial_copy )
    {
        st->next_coder_type = next_coder_type;
        move16();
    }
    ELSE
    {
        st->next_coder_type = INACTIVE;
        move16();
    }

    if ( EQ_16( partialframe, 1 ) )
    {
        st->bfi = 2;
        move16();
    }

    /* unpack speech data */
    bit_stream_ptr = st->bit_stream;
    /* convert bitstream from compact bytes to short values and store it in decoder state */
    FOR( k = 0; k < num_bits; k++ )
    {
        test();
        IF( EQ_16( st->bitstreamformat, VOIP_RTPDUMP ) && isAMRWB_IOmode )
        {
            st->bit_stream[sort_ptr[core_mode][k]] = unpack_bit( &pt_stream, &mask );
            move16();
            bit_stream_ptr++;
        }
        ELSE
        {
            *bit_stream_ptr++ = unpack_bit( &pt_stream, &mask );
            move16();
        }
    }

    /* unpack auxiliary bits */
    test();
    IF( isAMRWB_IOmode && EQ_32( total_brate, SID_1k75 ) )
    {
        IF( EQ_16( st->bitstreamformat, VOIP_RTPDUMP ) )
        {
            /* A.2.2.1.3: AMR-WB SID_1k75 frame is followed by STI bit and CMI bits */
            sti = unpack_bit( &pt_stream, &mask );
        }
        ELSE
        {
            /* VOIP_G192_RTP does not contain STI and CMI */
            sti = 1;
            move16();
        }
        read_indices_mime_handle_sti_and_all_zero_bits( st, &total_brate, sti );
    }

    /* add two zero bytes for arithmetic coder flush */
    FOR( k = 0; k < 8 * 2; ++k )
    {
        *bit_stream_ptr++ = 0;
        move16();
    }

    total_brate = read_indices_mime_handle_dtx( st, isAMRWB_IOmode, core_mode, total_brate, sti, speech_lost, no_data );
    /* st->CNG_fx set inside */

    IF( NE_16( st->bfi, 1 ) )
    {
        /* select Mode 1 or Mode 2 */
        IF( *st->bit_stream )
        {
            decoder_selectCodec( st, total_brate, G192_BIN1 );
        }
        ELSE
        {
            decoder_selectCodec( st, total_brate, G192_BIN0 );
        }


        /* a change of the total bitrate should not be known to the decoder, if the received frame was truly lost */
        st->total_brate = total_brate;
        move32();

        mdct_switching_dec( st );
    }
}


/*-------------------------------------------------------------------*
 * get_indice_preview()
 *
+0 −19
Original line number Diff line number Diff line
@@ -1368,12 +1368,6 @@ Word16 BRATE2IDX16k_fx( Word32 brate );
Word32 BIT_ALLOC_IDX_fx( Word32 brate, Word16 ctype, Word16 sfrm, Word16 tc );
Word32 BIT_ALLOC_IDX_16KHZ_fx( Word32 brate, Word16 ctype, Word16 sfrm, Word16 tc );
Word16 read_indices_mime(                    /* o  : 1 = reading OK, 0 = problem            */
                          Decoder_State *st, /* i/o: decoder state structure                */
                          FILE *file,        /* i  : bitstream file                         */
                          Word16 rew_flag    /* i  : rewind flag (rewind file after reading)*/
);
void getPartialCopyInfo(
    Decoder_State *st, /* i  : decoder state structure       */
    Word16 *coder_type,
@@ -1405,19 +1399,6 @@ void get_NextCoderType_fx(
    Word16 *next_coder_type /* o : next coder type   */
);
void read_indices_from_djb_fx(
    Decoder_State *st, /* i/o: decoder state structure */
    UWord8 *pt_stream, /* i  : bitstream file                         */
    Word16 nbits       /* i  : number of bits                         */
    ,
    Word16 isAMRWB_IOmode,
    Word16 core_mode,
    Word16 qbit,
    Word16 partialframe /* i  : partial frame information     */
    ,
    Word16 next_coder_type /* i  : next coder type information     */
);
void evs_dec_previewFrame(
    UWord8 *bitstream,            /* i  : bitstream pointer */
    Word16 bitstreamSize,         /* i  : bitstream size    */
+1 −1
Original line number Diff line number Diff line
@@ -554,7 +554,7 @@ ivas_error acelp_core_dec_fx(
            IF( st_fx->cng_type == LP_CNG )
            {

                CNG_dec_fx( st_fx, st_fx->last_element_mode, Aq_fx, lsp_new_fx, lsf_new_fx, &allow_cn_step_fx, sid_bw, q_env );
                CNG_dec_fx( st_fx, EVS_MONO, Aq_fx, lsp_new_fx, lsf_new_fx, &allow_cn_step_fx, sid_bw, q_env );

                /* comfort noise generation */
                CNG_exc_fx( st_fx->core_brate, st_fx->L_frame, &st_fx->hTdCngDec->Enew_fx, &st_fx->hTdCngDec->cng_seed, exc_fx, exc2_fx, &st_fx->lp_ener_fx, st_fx->last_core_brate,
+2 −1
Original line number Diff line number Diff line
@@ -350,10 +350,11 @@ ivas_error evs_dec_fx(
         * Postprocessing for ACELP/HQ core switching
         *---------------------------------------------------------------------*/

        if ( ( error = core_switching_post_dec_fx( st_fx, synth_fx, output_frame, core_switching_flag, st_fx->last_element_mode, &Qpostd ) ) != IVAS_ERR_OK )
        if ( ( error = core_switching_post_dec_fx( st_fx, synth_fx, output_frame, core_switching_flag, EVS_MONO, &Qpostd ) ) != IVAS_ERR_OK )
        {
            return error;
        }

        /*---------------------------------------------------------------------*
         * Pre-processing for bandwidth switching
         *---------------------------------------------------------------------*/
+0 −6
Original line number Diff line number Diff line
@@ -358,10 +358,6 @@ ivas_error init_decoder_fx(
    }
    st_fx->cng_type = -1;
    move16();
    st_fx->CNG_fx = 0;
    move16(); /* RTXDTX handler CNG=1  nonCNG= 0,*/
    st_fx->prev_ft_speech_fx = 1;
    move16(); /* RXDTX handeler  previous frametype flag for  G.192 format AMRWB  SID_FIRST  detection  */
    st_fx->first_CNG = 0;
    move16();
    Copy( st_fx->lsp_old_fx, st_fx->lspCNG_fx, M ); // Q15
@@ -843,8 +839,6 @@ ivas_error init_decoder_fx(
    move16();
    st_fx->element_mode = EVS_MONO; /* element mode */
    move16();
    st_fx->last_element_mode = st_fx->element_mode; /* element mode */
    move16();
    st_fx->element_brate = -1; /* element bitrate */
    move16();
    st_fx->low_rate_mode = 0; /* low-rate mode flag */
Loading