Commit bff20dfb authored by Stephane Ragot's avatar Stephane Ragot
Browse files

reduction of ROM by VBR coding

parent d366fb34
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -1063,10 +1063,15 @@ enum
#define IVAS_PCA_NB_SUBR                        20 /* 80 -> 0.25 ms, 40 -> 0.5 ms... */
#define IVAS_PCA_COV_THRES                      3e-5f
#define IVAS_PCA_QUAT_EPS                       1e-7f
#define IVAS_PCA_QBITS                          19
#define IVAS_PCA_N1                             91
#define IVAS_PCA_N1_EQ                          ( (IVAS_PCA_N1-1)/2 )
#ifndef IVAS_PCA_VBR
#define IVAS_PCA_QBITS                          19
#define IVAS_PCA_BIT_LEN                        ( 1 + ( IVAS_PCA_QBITS - 1 + IVAS_PCA_QBITS ) )
#else
#define IVAS_PCA_BIT_LEN_MAX 50 // 1 + 8+8+9 + 7+8+9
#define IVAS_PCA_N1_BITS 8
#endif
#define IVAS_PCA_INTERP                         4   /* 4D (Quaternion) dimension */
#define IVAS_PCA_N_SLOTS                        40 //20
#define IVAS_PCA_LEN_INTERP_Q                   ( IVAS_PCA_INTERP * IVAS_PCA_N_SLOTS )
+71 −8
Original line number Diff line number Diff line
@@ -44,6 +44,15 @@
#include "prot.h"


#ifdef IVAS_PCA_VBR
int16_t nval2nbits( int16_t nval )
{
    int16_t nbits;
    nbits = (int16_t) ceilf( logf( nval ) / logf( 2.f ) );
    return nbits;
}
#endif

/*---------------------------------------------------------------------*
 * eye_matrix()
 *
@@ -732,8 +741,13 @@ static void sp2cart(
    return;
}

#ifdef IVAS_PCA_VBR 
int16_t calc_n2(
    const float ph1 )
#else
static int16_t calc_n2(
    const float ph1 )
#endif
{
    int16_t n2;

@@ -747,10 +761,15 @@ static int16_t calc_n2(
    return n2;
}


#ifdef IVAS_PCA_VBR
int16_t calc_n3(
    const float ph1,
    const float ph2 )
#else
static int16_t calc_n3(
    const float ph1,
    const float ph2 )
#endif
{
    int16_t n3;

@@ -909,7 +928,7 @@ static int16_t sel_q(
    return i_min;
}


#ifndef IVAS_PCA_VBR
static int16_t get_pca_offset_n2(
    const int16_t index1 )
{
@@ -926,7 +945,7 @@ static int16_t get_pca_offset_n2(

    return index2;
}

#endif

/*---------------------------------------------------------------------*
 * pca_enc_s3()
@@ -934,9 +953,15 @@ static int16_t get_pca_offset_n2(
 *
 *---------------------------------------------------------------------*/

#ifdef IVAS_PCA_VBR
void pca_enc_s3(float* q,
	            uint16_t* index,
	            int16_t* nbits_q)
#else
void pca_enc_s3(
    float *q,
    int32_t *index )
#endif
{
    float ph1, ph2, ph3, r, v;
    float ph1_q[2], ph2_q[4], ph3_q[4];
@@ -962,8 +987,16 @@ void pca_enc_s3(

        sp2cart( *ph1_q, 0.f, 0.f, q );

#ifdef IVAS_PCA_VBR
		index[0] = index1;             
		index[1] = 0;                  
		index[2] = 0;                  
		nbits_q[0] = IVAS_PCA_N1_BITS; 
		nbits_q[1] = 0;                
		nbits_q[2] = 0;                
#else
        *index = ivas_pca_offset_index1[index1];

#endif
        return;
    }

@@ -999,9 +1032,19 @@ void pca_enc_s3(
        index1 = ind1[j];
        index2 = ind2[j];

#ifdef IVAS_PCA_VBR
		index[0] = index1;             
		index[1] = index2;             
		index[2] = 0;                  
		nbits_q[0] = IVAS_PCA_N1_BITS; 
		nbits_q[1] = nval2nbits(n2[j]); 
		nbits_q[2] = 0;                 
		assert(index2 < n2[j]);
#else
		index2 += get_pca_offset_n2(index1);

        *index = ivas_pca_offset_index1[index1] + ivas_pca_offset_index2[index2];
#endif

        return;
    }
@@ -1034,9 +1077,20 @@ void pca_enc_s3(
    index1 = ind1[j >> 1];
    index2 = ind2[j];
    index3 = ind3[j];
#ifdef IVAS_PCA_VBR
	index[0] = index1;                   
	index[1] = index2;                   
	index[2] = index3;                   
	nbits_q[0] = IVAS_PCA_N1_BITS;       
	nbits_q[1] = nval2nbits(n2[j >> 1]); 
	nbits_q[2] = nval2nbits(n3[j]);      
	assert(index2 < n2[j >> 1]);
	assert(index3 < n3[j]);
#else
	index2 += get_pca_offset_n2(index1); 

    *index = ivas_pca_offset_index1[index1] + ivas_pca_offset_index2[index2] + index3;
#endif

    return;
}
@@ -1046,18 +1100,27 @@ void pca_enc_s3(
 *
 *
 *---------------------------------------------------------------------*/

#ifdef IVAS_PCA_VBR
void pca_dec_s3( float *ph_q, 
	        float* q)
#else
void pca_dec_s3(
    const int32_t index,
    float *q )
#endif
{
#ifndef IVAS_PCA_VBR
    float ph1_q, ph2_q, ph3_q;
    int32_t j;
    int16_t i;
    int16_t n1, n2, n3;
    int16_t index1, index2, index3;
    float d;
#endif

#ifdef IVAS_PCA_VBR
	sp2cart(ph_q[0], ph_q[1], ph_q[2], q); FUNC(4); INDIRECT(4); ADD(2);
#else
    j = index;
    index1 = -1;
    for ( i = 0; i < IVAS_PCA_N1; i++ )
@@ -1116,6 +1179,6 @@ void pca_dec_s3(
        ph3_q = d * index3;
    }
    sp2cart( ph1_q, ph2_q, ph3_q, q );

#endif
    return;
}
+18 −0
Original line number Diff line number Diff line
@@ -4447,15 +4447,33 @@ void pca_interp_preproc(
    float *qr_interp 
);

#ifdef IVAS_PCA_VBR
int16_t nval2nbits( int16_t nval );
int16_t calc_n2(
    const float ph1 );
int16_t calc_n3(
    const float ph1,
    const float ph2 );

void pca_enc_s3(float* q,
	            uint16_t* index,
	            int16_t* nbits_q);
#else
void pca_enc_s3( 
    float *q, 
    int32_t *index 
);
#endif

#ifdef IVAS_PCA_VBR
void pca_dec_s3( float *ph_q, 
	        float* q);
#else
void pca_dec_s3( 
    const int32_t index, 
    float *q 
);
#endif

int16_t ivas_get_bits_to_encode( 
    int32_t val 
+2 −2
Original line number Diff line number Diff line
@@ -1495,7 +1495,7 @@ const int16_t remix_order_set[1][IVAS_SPAR_MAX_CH] = { /* WYZX --> WYXZ... */
const int16_t keep_planar[IVAS_SPAR_MAX_CH - IVAS_SPAR_MAX_DMX_CHS] = { 1, 1, 1, 1 };
const int16_t HOA_keep_ind[IVAS_SPAR_MAX_CH] = {0, 1, 2, 3, 4, 8, 9, 15};
#ifdef IVAS_PCA_VBR
/*----------------------------------------------------------------------*
* PCA ROM tables
*-----------------------------------------------------------------------*/
@@ -1800,7 +1800,7 @@ const int16_t ivas_pca_offset_n2[IVAS_PCA_N1] =
 4744, 4798, 4850, 4900, 4946, 4990, 5030, 5068, 5104, 5136, 5166, 5192,
 5216, 5236, 5254, 5268, 5278, 5286, 5290
};
#endif
/*----------------------------------------------------------------------------------*
 * Parametric MC ROM tables
+2 −2
Original line number Diff line number Diff line
@@ -186,7 +186,7 @@ extern const int16_t dtx_pr_real_q_levels[3][3];
extern const int16_t pr_pr_idx_pairs[3][3][2];
extern const int16_t pr_pd_idx_pairs[3][3][2];


#ifndef IVAS_PCA_VBR
/*----------------------------------------------------------------------*
 * PCA ROM tables
 *-----------------------------------------------------------------------*/
@@ -194,7 +194,7 @@ extern const int16_t pr_pd_idx_pairs[3][3][2];
extern const int32_t ivas_pca_offset_index1[IVAS_PCA_N1 + 1];
extern const int16_t ivas_pca_offset_index2[2692];
extern const int16_t ivas_pca_offset_n2[IVAS_PCA_N1];

#endif

/*----------------------------------------------------------------------------------*
 * Parametric MC ROM tables
Loading