Commit ba0ecb03 authored by vaclav's avatar vaclav
Browse files

HARM_HQ_CORE2

parent 95e95468
Loading
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -4088,6 +4088,7 @@ void pvq_encode_fx(
    const Word16 neg_gain /* i  : Gain use - negative gain in Q15  0 ..1        */
);

#ifndef HARM_HQ_CORE2
void pvq_encode_ivas_fx(
    BSTR_ENC_HANDLE hBstr,
    PVQ_ENC_HANDLE hPVQ,  /* i/o: PVQ encoder handle                            */
@@ -4099,7 +4100,7 @@ void pvq_encode_ivas_fx(
    const Word16 dim,     /* i  : Length of vector                              */
    const Word16 neg_gain /* i  : Gain use - negative gain in  Q15    0 ..1     */
);

#endif
void rc_enc_init_fx(
    PVQ_ENC_HANDLE hPVQ, /* i/o: PVQ encoder handle        */
    Word16 tot_bits      /* i  : Total bit budget        Q0*/
+53 −9
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@
 *--------------------------------------------------------------------*/

static Word16 calc_pvq_splits_fx( BSTR_ENC_HANDLE hBstr, PVQ_ENC_HANDLE hPVQ, const Word16 band_bits, const Word16 sfmsize, const Word16 *y, const Word16 Q_y, Word16 *bits );
#ifndef HARM_HQ_CORE2
static Word16 calc_pvq_splits_ivas_fx(                         /* o  : Number of segments           */
                                       BSTR_ENC_HANDLE hBstr,  /* i/o: Encoder state                */
                                       PVQ_ENC_HANDLE hPVQ,    /* i/o: PVQ encoder handle                 */
@@ -26,10 +27,21 @@ static Word16 calc_pvq_splits_ivas_fx( /* o : Number of
                                       Word16 *bits            /* o  : Consumed bits                */
);
static void densityIndexSymbolEncode_ivas_fx( BSTR_ENC_HANDLE hBstr, PVQ_ENC_HANDLE hPVQ, const Word16 density, const Word16 r_dim, const Word16 l_dim, const Word16 index_phi );
#endif
static void densityIndexSymbolEncode_fx( BSTR_ENC_HANDLE hBstr, PVQ_ENC_HANDLE hPVQ, const Word16 density, const Word16 r_dim, const Word16 l_dim, const Word16 index_phi );
static void encode_energies_fx( BSTR_ENC_HANDLE hBstr, PVQ_ENC_HANDLE hPVQ, const Word16 *coefs, const Word16 Q_coefs, Word16 Np, Word16 *dim_part, Word32 *E_part, Word16 *bits_part, Word16 *g_part, Word16 qband, Word16 *bits_left, Word32 enr, Word16 dim, const Word16 strict_bits );
#ifndef HARM_HQ_CORE2
static void encode_energies_ivas_fx( BSTR_ENC_HANDLE hBstr, PVQ_ENC_HANDLE hPVQ, const Word16 *coefs, const Word16 Q_coefs, Word16 Np, Word16 *dim_part, Word32 *E_part, Word16 *bits_part, Word16 *g_part, Word16 qband, Word16 *bits_left, Word32 enr, Word16 dim, const Word16 strict_bits );
#endif


/*-------------------------------------------------------------------*
 * pvq_encode_band()
 *
 * Encode band with PVQ
 *--------------------------------------------------------------------*/

#ifndef HARM_HQ_CORE2
/* Encode band with PVQ */
static void pvq_encode_band_ivas_fx(
    BSTR_ENC_HANDLE hBstr,    /* i/o: Encoder bitstream handle    */
@@ -58,7 +70,11 @@ static void pvq_encode_band_ivas_fx(
    Word16 tmp;
    Word32 L_coefs_quant_fx[PVQ_MAX_BAND_SIZE];

#ifdef HARM_HQ_CORE2
    Np = calc_pvq_splits_fx( hBstr, hPVQ, band_bits, sfmsize, coefs_norm, Q_coefs, &split_bit );
#else
    Np = calc_pvq_splits_ivas_fx( hBstr, hPVQ, band_bits, sfmsize, coefs_norm, Q_coefs, &split_bit );
#endif
    band_bits_tot = sub( band_bits, split_bit );

    enr = L_deposit_l( 0 );
@@ -90,7 +106,11 @@ static void pvq_encode_band_ivas_fx(
    set16_fx( g_part_neg, -32768, Np ); /* -1.0 in Q15 */
    IF( GT_16( Np, 1 ) )
    {
#ifdef HARM_HQ_CORE2
        encode_energies_fx( hBstr, hPVQ, coefs_norm, Q_coefs, Np, dim_part, E_part, bits_part, g_part_neg, band_bits_tot, bits_left, enr, sfmsize, strict_bits );
#else
        encode_energies_ivas_fx( hBstr, hPVQ, coefs_norm, Q_coefs, Np, dim_part, E_part, bits_part, g_part_neg, band_bits_tot, bits_left, enr, sfmsize, strict_bits );
#endif
    }
    ELSE
    {
@@ -121,8 +141,13 @@ static void pvq_encode_band_ivas_fx(

        IF( K_val > 0 )
        {
#ifdef HARM_HQ_CORE2
            pvq_encode_fx( hBstr, hPVQ, coefs_norm + part_start[js], pulse_vector + part_start[js],
                           coefs_quant + part_start[js], L_coefs_quant_fx, K_val, dim_part[js], g_part_neg[js] );
#else
            pvq_encode_ivas_fx( hBstr, hPVQ, coefs_norm + part_start[js], pulse_vector + part_start[js],
                                coefs_quant + part_start[js], L_coefs_quant_fx, K_val, dim_part[js], g_part_neg[js] );
#endif
        }
        ELSE
        {
@@ -133,6 +158,7 @@ static void pvq_encode_band_ivas_fx(

    return;
}
#endif
static void pvq_encode_band_fx(
    BSTR_ENC_HANDLE hBstr,    /* i/o: Encoder bitstream handle    */
    PVQ_ENC_HANDLE hPVQ,      /* i/o: PVQ encoder handle          */
@@ -147,7 +173,6 @@ static void pvq_encode_band_fx(
    const Word16 strict_bits /* i  : conservative rounding flag  */
)
{

    Word16 K_val;
    Word16 j, Np;
    Word32 enr, E_part[MAX_SPLITS + 1];
@@ -312,8 +337,13 @@ void pvq_encode_frame_ivas_fx(
            bandBitsAdjustment_fx( hPVQ->rc_num_bits, hPVQ->rc_range, bits, bands_to_code, sub( bands_to_code, coded_bands ), sfmsize[is], R[is], bit_pool, /* inputs  */
                                   &band_bits, &bits_left, &bit_pool );

#ifdef HARM_HQ_CORE2
            pvq_encode_band_fx( hBstr, hPVQ, &coefs_norm[sfm_start[is]], Q_coefs, &pulse_vector[sfm_start[is]],
                                &npulses[is], &coefs_quant[sfm_start[is]], sfmsize[is], band_bits, &bits_left, strict_bits );
#else
            pvq_encode_band_ivas_fx( hBstr, hPVQ, &coefs_norm[sfm_start[is]], Q_coefs, &pulse_vector[sfm_start[is]],
                                     &npulses[is], &coefs_quant[sfm_start[is]], sfmsize[is], band_bits, &bits_left, strict_bits );
#endif

            xy_corr = L_deposit_l( 0 );
            yy_corr = L_deposit_l( 1 );
@@ -810,6 +840,8 @@ static void encode_energies_fx(

    return;
}

#ifndef HARM_HQ_CORE2
static void encode_energies_ivas_fx(
    BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle   */
    PVQ_ENC_HANDLE hPVQ,   /* i/o: PVQ encoder handle         */
@@ -952,6 +984,7 @@ static void encode_energies_ivas_fx(

    return;
}

static void densityIndexSymbolEncode_ivas_fx(
    BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle   */
    PVQ_ENC_HANDLE hPVQ,   /* i/o: PVQ encoder handle         */
@@ -1024,6 +1057,7 @@ static void densityIndexSymbolEncode_ivas_fx(

    return;
}
#endif

static void densityIndexSymbolEncode_fx(
    BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle   */
@@ -1098,12 +1132,19 @@ static void densityIndexSymbolEncode_fx(
    return;
}


/*--------------------------------------------------------------------------*
 * calc_pvq_splits()
 *
 * Calculate the number of segments needed
 *--------------------------------------------------------------------------*/

#ifdef HARM_HQ_CORE2
/* o  : Number of segments           */
static Word16 calc_pvq_splits_fx(
#else
static Word16 calc_pvq_splits_ivas_fx( /* o  : Number of segments           */
#endif
    BSTR_ENC_HANDLE hBstr,  /* i/o: Encoder state                */
    PVQ_ENC_HANDLE hPVQ,    /* i/o: PVQ encoder handle                 */
    const Word16 band_bits, /* i  : Band bit rate                */
@@ -1206,6 +1247,8 @@ static Word16 calc_pvq_splits_ivas_fx( /* o : Number of
    Np = s_min( sfmsize, Np ); /* The code line assumes that MIN_BAND_SIZE is 1 */
    return Np;
}
#ifndef HARM_HQ_CORE2

static Word16 calc_pvq_splits_fx(                         /* o  : Number of segments           */
                                  BSTR_ENC_HANDLE hBstr,  /* i/o: Encoder state                */
                                  PVQ_ENC_HANDLE hPVQ,    /* i/o: PVQ encoder handle                 */
@@ -1309,3 +1352,4 @@ static Word16 calc_pvq_splits_fx( /* o : Number of segm
    Np = s_min( sfmsize, Np ); /* The code line assumes that MIN_BAND_SIZE is 1 */
    return Np;
}
#endif
+5 −0
Original line number Diff line number Diff line
@@ -166,10 +166,14 @@ static Word16 one_pulse_search(

    return imax;
}


/*-----------------------------------------------------------------------*
 * Function pvq_encode_fx()                                              *
 *                                                                       *
 *-----------------------------------------------------------------------*/

#ifndef HARM_HQ_CORE2
void pvq_encode_ivas_fx(
    BSTR_ENC_HANDLE hBstr,
    PVQ_ENC_HANDLE hPVQ,  /* i/o: PVQ encoder handle                 */
@@ -374,6 +378,7 @@ void pvq_encode_ivas_fx(

    return;
}
#endif

void pvq_encode_fx(
    BSTR_ENC_HANDLE hBstr,