Commit 3eace83d authored by vaclav's avatar vaclav
Browse files

HARM_COREDECODER_FUNCTIONS

parent 2529d7d4
Loading
Loading
Loading
Loading
Loading
+19 −4
Original line number Diff line number Diff line
@@ -1152,7 +1152,11 @@ void writeLPCparam_fx(
    IF( st->enableTcxLpc && st->core != ACELP_CORE )
    {
        /* Encode the indices */
#ifdef HARM_COREDECODER_FUNCTIONS
        *nbits_lpc = enc_lsf_tcxlpc_fx( &param_lpc, hBstr ); /* Q0 */
#else
        *nbits_lpc = enc_lsf_tcxlpc_ivas_fx( &param_lpc, hBstr );                                                                                          /* Q0 */
#endif
        move16();
    }
    ELSE
@@ -1171,7 +1175,11 @@ void writeLPCparam_fx(
                move16();
            }

#ifdef HARM_COREDECODER_FUNCTIONS
            *nbits_lpc = encode_lpc_avq_fx( hBstr, numlpc, param_lpc, st->core, st->element_mode ); /* Q0 */
#else
            *nbits_lpc = encode_lpc_avq_ivas_fx( hBstr, numlpc, param_lpc, st->core, st->element_mode );                                                   /* Q0 */
#endif
            move16();
        }
        ELSE IF( EQ_16( st->lpcQuantization, 1 ) )
@@ -1181,13 +1189,20 @@ void writeLPCparam_fx(
            IF( EQ_32( st->sr_core, INT_FS_16k ) && EQ_16( st->coder_type, VOICED ) && EQ_16( st->core, ACELP_CORE ) )
            {
                assert( st->element_mode == EVS_MONO );

#ifdef HARM_COREDECODER_FUNCTIONS
                *nbits_lpc = lsf_bctcvq_encprm_fx( hBstr, param_lpc, bits_param_lpc, no_param_lpc ); /* Q0 */
#else
                *nbits_lpc = lsf_bctcvq_encprm_ivas_fx( hBstr, param_lpc, bits_param_lpc, no_param_lpc );                                                  /* Q0 */
#endif
                move16();
            }
            ELSE
            {
#ifdef HARM_COREDECODER_FUNCTIONS
                *nbits_lpc = lsf_msvq_ma_encprm_fx( hBstr, param_lpc, st->core, st->coder_type, st->acelp_cfg.midLpc, bits_param_lpc, no_param_lpc ); /* Q0 */
#else
                *nbits_lpc = lsf_msvq_ma_encprm_ivas_fx( hBstr, param_lpc, st->core, st->coder_type, st->acelp_cfg.midLpc, bits_param_lpc, no_param_lpc ); /* Q0 */
#endif
                move16();
            }
        }
+6 −1
Original line number Diff line number Diff line
@@ -2445,14 +2445,17 @@ void ivas_mdct_core_whitening_enc_fx(
                }
            }

#ifdef HARM_COREDECODER_FUNCTIONS
            encode_lpc_avq_fx( hBstr, num_sns, param_lpc[ch], st->core, st->element_mode );
#else
            encode_lpc_avq_ivas_fx( hBstr, num_sns, param_lpc[ch], st->core, st->element_mode );
#endif

            st->side_bits_frame_channel = add( st->side_bits_frame_channel, sub( hBstr->nb_bits_tot, nbits_start_sns ) );
            move16();
        }
    }


    /*update pitch buffer*/
    FOR( ch = 0; ch < CPE_CHANNELS; ch++ )
    {
@@ -2474,6 +2477,8 @@ void ivas_mdct_core_whitening_enc_fx(
    pop_wmops();
    return;
}


void ivas_mdct_quant_coder_fx(
    CPE_ENC_HANDLE hCPE,                  /* i/o: Encoder CPE handle                   */
    Word16 tnsBits[CPE_CHANNELS][NB_DIV], /* i  : bits needed for TNS parameters       */
+6 −8
Original line number Diff line number Diff line
@@ -1466,7 +1466,6 @@ excludes the waveform contributions at pos 21,22,23 to the MSE, important to kee
    /*mvi2i (indices[1]+c2*stages, Idx, stages);*/
    Copy( indices[1] + c2 * stages, Idx, stages );


    return;
}

@@ -1496,7 +1495,6 @@ Word16 lsf_msvq_ma_encprm_fx(

    FOR( i = 0; i < no_indices; i++ )
    {

        push_next_indice( hBstr, *param_lpc, bits_param_lpc[i] );
        param_lpc++;
        nbits_lpc = add( nbits_lpc, bits_param_lpc[i] );
@@ -1506,7 +1504,6 @@ Word16 lsf_msvq_ma_encprm_fx(
        test();
        IF( ( core == ACELP_CORE ) && acelp_midLpc )
        {

            push_next_indice( hBstr, *param_lpc, bits_midlpc );
            nbits_lpc = add( nbits_lpc, bits_midlpc );
        }
@@ -1515,7 +1512,7 @@ Word16 lsf_msvq_ma_encprm_fx(
    return nbits_lpc;
}


#ifndef HARM_COREDECODER_FUNCTIONS
Word16 lsf_msvq_ma_encprm_ivas_fx(
    BSTR_ENC_HANDLE hBstr,
    const Word16 *param_lpc, // Q0
@@ -1553,7 +1550,7 @@ Word16 lsf_msvq_ma_encprm_ivas_fx(

    return nbits_lpc;
}

#endif

/*--------------------------------------------------------------------------*
 * midlsf_enc_fx()
@@ -1995,7 +1992,7 @@ Word16 enc_lsf_tcxlpc_fx(
    return NumBits;
}


#ifndef HARM_COREDECODER_FUNCTIONS
Word16 enc_lsf_tcxlpc_ivas_fx(
    const Word16 **indices, /* i  : Ptr to VQ indices  */
    BSTR_ENC_HANDLE hBstr   /* i/o: encoder bitstream handle    */
@@ -2029,7 +2026,7 @@ Word16 enc_lsf_tcxlpc_ivas_fx(
    }
    return NumBits;
}

#endif

/*--------------------------------------------------------------------------*
 * lsf_bctcvq_encprm_fx()
@@ -2056,7 +2053,7 @@ Word16 lsf_bctcvq_encprm_fx(

    return nbits_lpc;
}

#ifndef HARM_COREDECODER_FUNCTIONS

Word16 lsf_bctcvq_encprm_ivas_fx(
    BSTR_ENC_HANDLE hBstr,
@@ -2078,3 +2075,4 @@ Word16 lsf_bctcvq_encprm_ivas_fx(

    return nbits_lpc;
}
#endif
+8 −4
Original line number Diff line number Diff line
@@ -2808,12 +2808,13 @@ Word16 enc_lsf_tcxlpc_fx(
    BSTR_ENC_HANDLE hBstr /* i/o: encoder bitstream handle      */
);

#ifndef HARM_COREDECODER_FUNCTIONS
/* Returns: number of bits written */
Word16 enc_lsf_tcxlpc_ivas_fx(
    const Word16 **indices, /* i  : Ptr to VQ indices           */
    BSTR_ENC_HANDLE hBstr   /* i/o: encoder bitstream handle    */
);

#endif
Word16 encode_lpc_avq_fx(
    BSTR_ENC_HANDLE hBstr,    /* i/o: bitstream handle                                    */
    const Word16 numlpc,      /* i  : Number of sets of lpc                             Q0*/
@@ -2822,6 +2823,7 @@ Word16 encode_lpc_avq_fx(
    const Word16 element_mode /* i  : element mode - decides between SNS and LPC coding Q0*/
);

#ifndef HARM_COREDECODER_FUNCTIONS
Word16 encode_lpc_avq_ivas_fx(
    BSTR_ENC_HANDLE hBstr,    /* i/o: bitstream handle                                  */
    const Word16 numlpc,      /* i  : Number of sets of lpc                             Q0*/
@@ -2829,19 +2831,20 @@ Word16 encode_lpc_avq_ivas_fx(
    const Word16 core,        /* i  : core                                              Q0*/
    const Word16 element_mode /* i  : element mode - decides between SNS and LPC coding Q0*/
);

#endif
Word16 lsf_bctcvq_encprm_fx(
    BSTR_ENC_HANDLE hBstr,
    Word16 *param_lpc,
    Word16 *bits_param_lpc,
    Word16 no_indices );

#ifndef HARM_COREDECODER_FUNCTIONS
Word16 lsf_bctcvq_encprm_ivas_fx(
    BSTR_ENC_HANDLE hBstr,
    const Word16 *param_lpc,
    const Word16 *bits_param_lpc,
    const Word16 no_indices );

#endif
Word16 lsf_msvq_ma_encprm_fx(
    BSTR_ENC_HANDLE hBstr,
    Word16 *param_lpc,
@@ -2851,6 +2854,7 @@ Word16 lsf_msvq_ma_encprm_fx(
    Word16 *bits_param_lpc,
    Word16 no_indices );

#ifndef HARM_COREDECODER_FUNCTIONS
Word16 lsf_msvq_ma_encprm_ivas_fx(
    BSTR_ENC_HANDLE hBstr,
    const Word16 *param_lpc,
@@ -2859,7 +2863,7 @@ Word16 lsf_msvq_ma_encprm_ivas_fx(
    const Word16 acelp_midLpc,
    const Word16 *bits_param_lpc,
    const Word16 no_indices );

#endif
/* o: number of bits written per frame */
Word16 IGFEncWriteBitstream_fx(
    const IGF_ENC_INSTANCE_HANDLE hInstance, /**< in:     | instance handle of IGF Encoder                                               */
+35 −3
Original line number Diff line number Diff line
@@ -123,15 +123,21 @@ void qlpc_avq_fx(

    return;
}

/*-------------------------------------------------------------------*
 * unary_code()
 *
 *
 *--------------------------------------------------------------------*/

#ifdef HARM_COREDECODER_FUNCTIONS
static Word16 unary_code_fx(
#else
static Word16 unary_code(
#endif
    Word16 ind, /* Q0 */
    BSTR_ENC_HANDLE hBstr )
#ifndef HARM_COREDECODER_FUNCTIONS
{
    Word16 nb_bits;

@@ -155,6 +161,7 @@ static Word16 unary_code(
static Word16 unary_code_ivas_fx(
    Word16 ind, /* Q0 */
    BSTR_ENC_HANDLE hBstr )
#endif
{
    Word16 nb_bits;

@@ -181,12 +188,18 @@ static Word16 unary_code_ivas_fx(

    return ( nb_bits );
}

/*-------------------------------------------------------------------*
 * unpack4bits()
 *
 *
 *--------------------------------------------------------------------*/

#ifdef HARM_COREDECODER_FUNCTIONS
static Word16 unpack4bits_fx(
#else
static Word16 unpack4bits(
#endif
    Word16 nbits,      /* Q0 */
    const Word16 *prm, /* Q0 */
    BSTR_ENC_HANDLE hBstr )
@@ -215,6 +228,7 @@ static Word16 unpack4bits(

    return ( i );
}
#ifndef HARM_COREDECODER_FUNCTIONS
static Word16 unpack4bits_ivas_fx(
    Word16 nbits,      /* Q0 */
    const Word16 *prm, /* Q0 */
@@ -244,6 +258,7 @@ static Word16 unpack4bits_ivas_fx(

    return ( i );
}
#endif
/*-------------------------------------------------------------------*
 * encode_lpc_avq_fx()
 *
@@ -251,6 +266,7 @@ static Word16 unpack4bits_ivas_fx(
 *--------------------------------------------------------------------*/

Word16 encode_lpc_avq_fx(
#ifndef HARM_COREDECODER_FUNCTIONS
    BSTR_ENC_HANDLE hBstr,    /* i/o: bitstream handle                                  */
    const Word16 numlpc,      /* i  : Number of sets of lpc                             Q0*/
    const Word16 *param_lpc,  /* i  : lpc parameters                                    Q0*/
@@ -458,6 +474,7 @@ Word16 encode_lpc_avq_fx(
}

Word16 encode_lpc_avq_ivas_fx(
#endif
    BSTR_ENC_HANDLE hBstr,    /* i/o: bitstream handle                                    */
    const Word16 numlpc,      /* i  : Number of sets of lpc                             Q0*/
    const Word16 *param_lpc,  /* i  : lpc parameters                                    Q0*/
@@ -491,8 +508,6 @@ Word16 encode_lpc_avq_ivas_fx(
    FOR( k = 0; k < numlpc; k++ )
    {
        /* Retrieve quantizer type */


        move16();
        q_type = 0;
        IF( k != 0 )
@@ -508,6 +523,7 @@ Word16 encode_lpc_avq_ivas_fx(
            move16();
            j = add( j, 1 );
        }

        /* Determine number of AVQ indices */
        move16();
        nb_ind = 0;
@@ -615,7 +631,11 @@ Word16 encode_lpc_avq_ivas_fx(

                IF( nb > 0 )
                {
#ifdef HARM_COREDECODER_FUNCTIONS
                    unary_code_fx( nb, hBstr );
#else
                    unary_code_ivas_fx( nb, hBstr );
#endif
                }
                nb_bits = add( nb_bits, nb );

@@ -643,17 +663,29 @@ Word16 encode_lpc_avq_ivas_fx(

                IF( nb > 0 )
                {
#ifdef HARM_COREDECODER_FUNCTIONS
                    unary_code_fx( nb, hBstr );
#else
                    unary_code_ivas_fx( nb, hBstr );
#endif
                }
                nb_bits = add( nb_bits, nb );

                avqBits = shl( qn1, 2 );
#ifdef HARM_COREDECODER_FUNCTIONS
                unpack4bits_fx( avqBits, &param_lpc[j], hBstr );
#else
                unpack4bits_ivas_fx( avqBits, &param_lpc[j], hBstr );
#endif
                j = add( j, qn1 );
                nb_bits = add( nb_bits, avqBits ); // Q0

                avqBits = shl( qn2, 2 );
#ifdef HARM_COREDECODER_FUNCTIONS
                unpack4bits_fx( avqBits, &param_lpc[j], hBstr );
#else
                unpack4bits_ivas_fx( avqBits, &param_lpc[j], hBstr );
#endif
                j = add( j, qn2 );
                nb_bits = add( nb_bits, avqBits ); // Q0
            }