Commit 1175563c authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Fix for 3GPP issue 1749: Use of divide1616 and idivide1616 with constant denominator

Link #1749
parent 806b4a24
Loading
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -226,6 +226,7 @@ enum{
#define ONE_BY_L_FRAME32k_Q31           3355443
#define ONE_BY_L_FRAME25_6k_Q31         4194304
#define ONE_BY_L_FRAME16k_Q31           6710886
#define ONE_BY_L_FRAME16k_Q15           102
#define ONE_BY_L_FRAME_Q31              8388608
#define ONE_BY_240_Q31                  8947849
#define ONE_BY_L_FRAME8k_Q31            13421772
@@ -680,6 +681,7 @@ enum
#define NUM_DCT_LENGTH                      24

#define NB_DIV                              2                                   /* number of division (subframes) per 20ms frame  */
#define NB_DIV_LOG2                         1                                   /* To be used for shift operation instead of division */
#define L_MDCT_HALF_OVLP_MAX                L_MDCT_OVLP_MAX - 48000 / 200       /* Size of HALF overlap window slope @ 48 kHz */
#define L_MDCT_MIN_OVLP_MAX                 60                                  /* Size of the MDCT minimal overlap @ 48 kHz - 1.25ms */
#define L_MDCT_TRANS_OVLP_MAX               NS2SA( 48000, ACELP_TCX_TRANS_NS )  /* Size of the ACELP->MDCT transition overlap - 1.25ms */
@@ -708,6 +710,7 @@ enum
#define L_FRAME                             256                                                                                                              /* frame size at 12.8kHz                      */
#define NB_SUBFR                            4                                                                                                                /* number of subframes per frame              */
#define L_SUBFR                             ( L_FRAME / NB_SUBFR )                                                                                           /* subframe size                              */
#define L_SUBFR_LOG2                        6                                                                                                                /* To be used for shift operation instead of division */
#define L_SUBFR_Q6                            ((L_FRAME/NB_SUBFR)*64)       /* subframe size                              */
#define L_SUBFR_Q16                           ((L_FRAME/NB_SUBFR)*65536)    /* subframe size                              */

@@ -788,6 +791,7 @@ enum
#endif
#define CLDFB_NO_CHANNELS_MAX_FX            30720                  /*Q9*/ 
#define CLDFB_NO_COL_MAX                    16                     /* CLDFB resampling - max number of CLDFB col., == IVAS_CLDFB_NO_COL_MAX */
#define CLDFB_NO_COL_MAX_LOG2               4                      /* To be used for shift operation instead of division */
#define CLDFB_NO_COL_MAX_SWITCH             6                      /* CLDFB resampling - max number of CLDFB col. for switching */
#define CLDFB_NO_COL_MAX_SWITCH_BFI         10                     /* CLDFB resampling - max number of CLDFB col. for switching, BFI */
#define CLDFB_OVRLP_MIN_SLOTS               3                      /* CLDFB resampling - minimize processing to minimum required for transition frame ACELP->TCX/HQ */
@@ -1533,6 +1537,7 @@ enum
#define INTERP_3_2_MEM_LEN                  15
#define L_SHB_LAHEAD                        20                      /* Size of lookahead for SHB */
#define NUM_SHB_SUBFR                       16
#define NUM_SHB_SUBFR_LOG2                  4                       /* To be used for shift operation instead of division */
#define LPC_SHB_ORDER                       10
#define LPC_WHTN_ORDER                      4                       /* Order of whitening filter for SHB excitation */
#define SHB_OVERLAP_LEN                     ( L_FRAME16k - L_SHB_LAHEAD ) / ( NUM_SHB_SUBFR - 1 )
@@ -3093,6 +3098,7 @@ extern const Word16 Idx2Freq_Tbl[];
#define FS_16K_IN_NS_Q31 34360

#define ONE_BY_THREE_Q15 10923    /* 1/3.f in Q15  */
#define ONE_BY_TEN_Q15   3277     /* 1/10.f in Q15 */
#define THREE_Q21        6291456
#define SIX_Q21          12582912

+7 −0
Original line number Diff line number Diff line
@@ -166,6 +166,7 @@ typedef enum

#define BINAURAL_CHANNELS                       2                           /* number of channels for binaural output configuration */
#define CPE_CHANNELS                            2                           /* number of CPE (stereo) channels */
#define CPE_CHANNELS_LOG2                       1                           /* To be used for the shift operation instead of division */
#define FOA_CHANNELS                            4                           /* number of FOA channels */
#define HOA2_CHANNELS                           9
#define HOA3_CHANNELS                           16
@@ -198,6 +199,7 @@ typedef enum
#define MAX_JBM_SUBFRAMES_5MS                   8
#define DEFAULT_JBM_SUBFRAMES_5MS               4
#define JBM_CLDFB_SLOTS_IN_SUBFRAME             4
#define JBM_CLDFB_SLOTS_IN_SUBFRAME_LOG2        2                           /* To be used for shift operation instead of division */
#define MAX_JBM_CLDFB_TIMESLOTS                 32
#define DEFAULT_JBM_CLDFB_TIMESLOTS             16
#define MAX_JBM_L_FRAME48k                      1920
@@ -934,12 +936,14 @@ typedef enum {
#define MDFT_FB_BANDS_240                       240
#define CLDFB_TO_MDFT_FAC                       4
#define MDFT_NO_COL_MAX                         4
#define MDFT_NO_COL_MAX_LOG2                    2 /* To be used for shift operation instead of division */

/*----------------------------------------------------------------------------------*
 * General Parametric Coding Constants
 *----------------------------------------------------------------------------------*/

#define MAX_PARAM_SPATIAL_SUBFRAMES             4                           /* Maximum number of subframes for parameteric spatial coding */
#define MAX_PARAM_SPATIAL_SUBFRAMES_LOG2        2                           /* To be used for shift operation instead of division */
#define L_SPATIAL_SUBFR_48k                     (L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES)
#define CLDFB_SLOTS_PER_SUBFRAME                ( CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES ) /* Number of CLDFB slots per subframe */

@@ -970,6 +974,7 @@ typedef enum {
#define DIRAC_MAX_NBANDS                        12                          /* Maximum number of frequency bands for the DirAC Side Parameter decoding */
#define DIRAC_LOW_BANDRES_STEP                  2                           /* always combine two bands for low band resolution in the DirAC parameter coding */
#define DIRAC_NO_COL_AVG_DIFF                   32                          /* Number of slots for averaging intensity vector for diffuseness computation */
#define DIRAC_NO_COL_AVG_DIFF_LOG2              5                           /* To be used for shift operation instead of division */
#define DIRAC_DIFFUSE_LEVELS                    8                           /* Size of the diffuseness alphabet (constant value) */
#define INV_DIRAC_DIFFUSE_LEVELS_Q13            1170                        /* 1/(DIRAC_DIFFUSE_LEVELS - 1) in Q13 */
#define DIRAC_DITH_SEED                         29680
@@ -1687,6 +1692,7 @@ typedef enum
#define DEG_180_IN_Q22                          ( 180 << Q22 )  // Q22
#define DEG_90_IN_Q22                           ( 90 << Q22 )   // Q22
#define ONE_BY_360_Q31                          ( 5965232 )     // Q31
#define ONE_BY_360_Q15                          ( 91 )          // Q15
#define ONE_BY_180_Q31                          ( 11930465 )    // Q31

/* ----- Enums - TD Renderer ----- */
@@ -1860,6 +1866,7 @@ typedef enum
#define SPAR_DIRAC_SPLIT_START_BAND             8 
#define DIRAC_TO_SPAR_HBR_PRED_CHS                     (FOA_CHANNELS - 1)
#define SPAR_DTX_BANDS                          2
#define SPAR_DTX_BANDS_LOG2                     1 /* To be used for shift operation instead of division */
#define DIRAC_DTX_BANDS                         2
#define SPAR_DIRAC_DTX_BANDS                    ( SPAR_DTX_BANDS + DIRAC_DTX_BANDS )
#define CLDFB_PAR_WEIGHT_START_BAND             7
+4 −2
Original line number Diff line number Diff line
@@ -292,7 +292,7 @@ void ivas_transient_det_process_fx(
)
{
    Word32 in_duck_gain[L_FRAME48k];
    Word16 num_sf, sf, sf_samp, idx;
    Word16 num_sf, sf, sf_samp, idx, num_sf_log2;
    Word32 mem = hTranDet->in_duck_gain; /*Q30*/
    move32();

@@ -309,7 +309,9 @@ void ivas_transient_det_process_fx(

    num_sf = 16; /*Q0*/
    move16();
    sf_samp = idiv1616( frame_len, num_sf ); /*Q0*/
    num_sf_log2 = 4;                         /* To be used for shift operation instead of division */
    move16();
    sf_samp = shr( frame_len, num_sf_log2 ); /*Q0*/
    FOR( sf = 1; sf <= num_sf; sf++ )
    {
        idx = sub( imult1616( sf_samp, sf ), 1 );
+1 −1
Original line number Diff line number Diff line
@@ -3102,7 +3102,7 @@ void ivas_dirac_dec_render_sf_fx(
            }
            ELSE
            {
                hDirACRend->index_buffer_intensity = add( sub( hDirACRend->index_buffer_intensity, i_mult( idiv1616( hDirACRend->index_buffer_intensity, DIRAC_NO_COL_AVG_DIFF ), DIRAC_NO_COL_AVG_DIFF ) ), 1 ); /* averaging_length = 32 */
                hDirACRend->index_buffer_intensity = add( sub( hDirACRend->index_buffer_intensity, i_mult( shr( hDirACRend->index_buffer_intensity, DIRAC_NO_COL_AVG_DIFF_LOG2 ), DIRAC_NO_COL_AVG_DIFF ) ), 1 ); /* averaging_length = 32 */
                move16();
            }

+1 −1
Original line number Diff line number Diff line
@@ -2042,7 +2042,7 @@ void ivas_spar_param_to_masa_param_mapping_fx(
        }
        ELSE
        {
            sf = idiv1616( hSpar->render_to_md_map[slot_idx + slot_idx_start], JBM_CLDFB_SLOTS_IN_SUBFRAME );
            sf = shr( hSpar->render_to_md_map[slot_idx + slot_idx_start], JBM_CLDFB_SLOTS_IN_SUBFRAME_LOG2 );
        }

        IF( LT_16( sf, SPAR_META_DELAY_SUBFRAMES ) )
Loading