Commit e50f8a5c authored by norvell's avatar norvell
Browse files

Change scaling of distance attenuation

parent 2eb0fcc7
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -342,7 +342,11 @@ typedef struct _IVAS_RENDER_CONFIG
    float directivity[IVAS_MAX_NUM_OBJECTS * 3];
    Word16 directivity_fx[IVAS_MAX_NUM_OBJECTS * 3]; // has the following q-factor pattern: {6, 6, 15, 6, 6, 15, 6, 6, 15, 6, 6, 15}
    float distAtt[3];
#ifdef FIX_1999
    Word32 distAtt_fx[3]; /* {Q27, Q30, Q27} */
#else
    Word32 distAtt_fx[3]; /* {Q27, Q30, Q30} */
#endif

} IVAS_RENDER_CONFIG_DATA, *IVAS_RENDER_CONFIG_HANDLE;

+3 −2
Original line number Diff line number Diff line
@@ -41,10 +41,10 @@

/* ################### Start DEBUGGING switches ######################## */

/*#define DEBUGGING*/                             /* Allows debugging message to be printed out during runtime */
#define DEBUGGING                             /* Allows debugging message to be printed out during runtime */
#ifdef DEBUGGING
/*#define DBG_BITSTREAM_ANALYSIS*/            /* Write bitstream with annotations to a text file */
#define DEBUG_MODE_INFO                       /* Define to output most important parameters to the subdirectory "res/" */
/*#define DEBUG_MODE_INFO*/                       /* Define to output most important parameters to the subdirectory "res/" */
#define DEBUG_MODE_INFO_TWEAK                 /* Enable command line switch to specify subdirectory for debug info output inside "./res/" */
#define DEBUG_FORCE_MDCT_STEREO_MODE          /* Force stereo mode decision for MDCT stereo: -stereo 3 1 forces L/R coding and -stereo 3 2 forces full M/S coding */
/*#define DEBUG_FORCE_DIR*/                       /* Force modes/parameters by reading from external binary files */
@@ -107,6 +107,7 @@
#define NONBE_FIX_1143_MASA_BRSW                        /* Nok: Fix for issue 1143: MSAN use of uninitialized value in masa decoding to binaural with dtx bitrate switching and 5 % FER */
#define NONBE_FIX_1220_OMASA_JBM_EXT_USAN               /* Nokia: fix issue 1220 OMASA EXT JBM USAN, also fix similar cases of free to avoid future problems */
#define NONBE_FIX_1376_MDCT_CONCEALMENT                 /* FhG: fix concealment artifact in MDCT Stereo with DTX, in case transition frame gets lost */
#define FIX_1999

/* #################### End BASOP porting switches ############################ */

+8 −0
Original line number Diff line number Diff line
@@ -210,7 +210,11 @@ ivas_error ivas_td_binaural_open_unwrap_fx(
            move32();
            DistAtten.RefDist_fx = ONE_IN_Q30; // Q30
            move32();
#ifdef FIX_1999
            DistAtten.RollOffFactor_fx = ONE_IN_Q27; // Q27
#else
            DistAtten.RollOffFactor_fx = ONE_IN_Q30; // Q30
#endif
            move32();

            // TDREND_SRC_SPATIAL_t *SrcSpatial_p = pBinRendTd->Sources[nS]->SrcSpatial_p;
@@ -268,7 +272,11 @@ ivas_error ivas_td_binaural_open_unwrap_fx(
                move32();
                DistAtten.RefDist_fx = ONE_IN_Q30; // Q30
                move32();
#ifdef FIX_1999
                DistAtten.RollOffFactor_fx = ONE_IN_Q27; // Q27
#else
                DistAtten.RollOffFactor_fx = ONE_IN_Q30; // Q30
#endif
                move32();
            }
            else
+11 −0
Original line number Diff line number Diff line
@@ -393,6 +393,7 @@ void TDREND_SRC_REND_UpdateFiltersFromSpatialParams_fx(
            move32();
        }

        dbgwrite( SrcRend_p->DistGain_p_fx, sizeof( Word16 ), 1, 1, "DistGain_fx.short" );

        /* Update total gains */
        *Gain = L_shl( Mpy_32_32( L_shl( L_mult( *SrcRend_p->SrcGain_p_fx, *SrcRend_p->DirGain_p_fx ), 1 ), L_shl( L_mult( *SrcRend_p->DistGain_p_fx, hBinRendererTd->Gain_fx ), 1 ) ), 1 ); // Q30
@@ -800,8 +801,13 @@ static Word16 TDREND_SRC_SPATIAL_GetDistGain_fx(
            /* DistGain = powf( DistAtten_p->RefDist / Dist2, DistAtten_p->RollOffFactor ); */
            tmp16 = BASOP_Util_Divide3232_Scale( DistAtten_p->RefDist_fx, Dist2_fx, &Dist_s ); /* tmp16 is Q(15 - Dist_s + Dist2_e - 1) */
            tmp32 = L_deposit_h( tmp16 );                                                      /* tmp32 is Q(31 - Dist_s + Dist2_e - 1) */
#ifdef FIX_1999
            /* tmp32 exponent: 31 - (31 - Dist_s + Dist2_e - 1) = Dist_s - Dist2_e + 1, RollOffFactor_fx exponent: 31 - 27 = 4 */
            tmp32 = BASOP_Util_fPow( tmp32, add( sub( Dist_s, Dist2_e ), 1 ), DistAtten_p->RollOffFactor_fx, 4, &tmp_e ); /* Q(31 - tmp_e) */
#else
            /* tmp32 exponent: 31 - (31 - Dist_s + Dist2_e - 1) = Dist_s - Dist2_e + 1, RollOffFactor_fx exponent: 31 - 30 = 1 */
            tmp32 = BASOP_Util_fPow( tmp32, add( sub( Dist_s, Dist2_e ), 1 ), DistAtten_p->RollOffFactor_fx, 1, &tmp_e ); /* Q(31 - tmp_e) */
#endif
            BREAK;

        case TDREND_DIST_ATTEN_MODEL_INV_DIST_CLAMPED:
@@ -824,8 +830,13 @@ static Word16 TDREND_SRC_SPATIAL_GetDistGain_fx(
            /* DistGain = powf( DistAtten_p->RefDist / Dist2, DistAtten_p->RollOffFactor ); */
            tmp16 = BASOP_Util_Divide3232_Scale( DistAtten_p->RefDist_fx, Dist2_fx, &Dist_s ); /* tmp16 is Q(15 - Dist_s + Dist2_e - 1) */
            tmp32 = L_deposit_h( tmp16 );                                                      /* tmp32 is Q(31 - Dist_s + Dist2_e - 1) */
#ifdef FIX_1999
            /* tmp32 exponent: 31 - (31 - Dist_s + Dist2_e - 1) = Dist_s - Dist2_e + 1, RollOffFactor_fx exponent: 31 - 27 = 4 */
            tmp32 = BASOP_Util_fPow( tmp32, add( sub( Dist_s, Dist2_e ), 1 ), DistAtten_p->RollOffFactor_fx, 4, &tmp_e ); /* Q(31 - tmp_e) */
#else
            /* tmp32 exponent: 31 - (31 - Dist_s + Dist2_e - 1) = Dist_s - Dist2_e + 1, RollOffFactor_fx exponent: 31 - 30 = 1 */
            tmp32 = BASOP_Util_fPow( tmp32, add( sub( Dist_s, Dist2_e ), 1 ), DistAtten_p->RollOffFactor_fx, 1, &tmp_e ); /* Q(31 - tmp_e) */
#endif

            BREAK;
    }
+4 −0
Original line number Diff line number Diff line
@@ -148,7 +148,11 @@ ivas_error ivas_render_config_init_from_rom_fx(
    move32();
    ( *hRenderConfig )->distAtt_fx[1] = ONE_IN_Q30; // Q30   /* Default ref dist */
    move32();
#ifdef FIX_1999
    ( *hRenderConfig )->distAtt_fx[2] = ONE_IN_Q27; // Q27   /* Default rolloff factor */
#else
    ( *hRenderConfig )->distAtt_fx[2] = ONE_IN_Q30; // Q30   /* Default rolloff factor */
#endif
    move32();
    ( *hRenderConfig )->split_rend_config.splitRendBitRate = ISAR_MAX_SPLIT_REND_BITRATE;
    move32();
Loading