Commit dc8a3c11 authored by Marek Szczerba's avatar Marek Szczerba
Browse files

Updated Q-format fixed-point representation for RT60 reverberation times (Q27 -> Q26)

parent 1fadc683
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -122,7 +122,7 @@
/* #define NONBE_FIX_991_PARAMBIN_BINARY_HRTF   */           /* Nokia: issue #991: fix using of binary file HRTF in ParamBin (to activate when USE_NEW_HRTF_BINARY_FILE_FORMAT and FIX_777_COMBI_RENDER_CONFIG_FILE are on ) */

#define FIX_1024_REMOVE_PARAMMC_MIXING_MAT              /* VA: issue 1024: remove unused function ivas_param_mc_get_mono_stereo_mixing_matrices() */
#define FIX_1741_REVERB_TIMES_Q_FORMAT                  /* Philips: reverberation times in Q27 format instead of Q31 */
#define FIX_1741_REVERB_TIMES_Q_FORMAT                  /* Philips: reverberation times in Q26 format instead of Q31 */

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

+1 −1
Original line number Diff line number Diff line
@@ -504,7 +504,7 @@ ivas_error ivas_dirac_dec_binaural_copy_hrtfs_fx(
            }
        }
#ifdef FIX_1741_REVERB_TIMES_Q_FORMAT
        Copy32( parametricReverberationTimes_fx, hrtfParambin->parametricReverberationTimes_fx, CLDFB_NO_CHANNELS_MAX ); /*Q27*/
        Copy32( parametricReverberationTimes_fx, hrtfParambin->parametricReverberationTimes_fx, CLDFB_NO_CHANNELS_MAX ); /*Q26*/
#else
        Copy32( parametricReverberationTimes_fx, hrtfParambin->parametricReverberationTimes_fx, CLDFB_NO_CHANNELS_MAX ); /*Q31*/
#endif
+10 −10
Original line number Diff line number Diff line
@@ -220,7 +220,7 @@ static void ivas_binaural_reverb_setReverbTimes_fx(
    REVERB_STRUCT_HANDLE hReverb, /* i/o: binaural reverb handle                                  */
    const Word32 output_Fs,       /* i  : sampling_rate                                           */
#ifdef FIX_1741_REVERB_TIMES_Q_FORMAT
    const Word32 *revTimes_fx, /*Q27 i  : reverberation times T60 for each CLDFB bin in seconds   */
    const Word32 *revTimes_fx, /*Q26 i  : reverberation times T60 for each CLDFB bin in seconds   */
#else
    const Word32 *revTimes_fx, /*Q31 i  : reverberation times T60 for each CLDFB bin in seconds   */
#endif
@@ -329,7 +329,7 @@ static void ivas_binaural_reverb_setReverbTimes_fx(
        L_tmp = Mpy_32_32( 1677721600, revTimes_fx[bin] ); // e10 --> 800 * 2^21, + e0
        tmp = BASOP_Util_Divide3232_Scale( 1073741824, L_tmp, &scale );
#ifdef FIX_1741_REVERB_TIMES_Q_FORMAT
        scale = add( scale, sub( 1, 14 ) ); // revTimes_fx in Q27
        scale = add( scale, sub( 1, 15 ) ); // revTimes_fx in Q26
#else
        scale = add( scale, sub( 1, 10 ) );
#endif
@@ -2395,7 +2395,7 @@ static ivas_error ivas_binaural_reverb_open_fx(
    const Word16 numCldfbSlotsPerFrame, /* i  : Q0 number of CLDFB slots per frame                         */
    const Word32 sampling_rate,         /* i  : Q0 sampling rate                                           */
#ifdef FIX_1741_REVERB_TIMES_Q_FORMAT
    const Word32 *revTimes_fx, /* i  : Q27 reverberation times T60 for each CLDFB bin in seconds   */
    const Word32 *revTimes_fx, /* i  : Q26 reverberation times T60 for each CLDFB bin in seconds   */
#else
    const Word32 *revTimes_fx, /* i  : Q31 reverberation times T60 for each CLDFB bin in seconds   */
#endif
@@ -2459,9 +2459,9 @@ static ivas_error ivas_binaural_reverb_open_fx(
        /* Note: the resulted length is very sensitive to the precision of the constants below (e.g. 1.45 vs. 1.45f) */
        // hReverb->loopBufLength[bin] = (int16_t) ( 1.45 * (int16_t) ( revTimes[bin] * 150.0 ) + 1 );
#ifdef FIX_1741_REVERB_TIMES_Q_FORMAT
        Word32 L_tmp_BufLength = L_shl( L_shr( Mpy_32_32( revTimes_fx[bin], 1258291200 /*150.0 in Q23*/ ), 19 ), 19 );
        L_tmp_BufLength = L_add( Mpy_32_32( 1556925645 /*1.45 in Q30*/, L_tmp_BufLength ), ONE_IN_Q18 );
        hReverb->loopBufLength[bin] = (Word16) L_shr( L_tmp_BufLength, 18 ); /*Q0*/
        Word32 L_tmp_BufLength = L_shl( L_shr( Mpy_32_32( revTimes_fx[bin], 1258291200 /*150.0 in Q23*/ ), 18 ), 18 );
        L_tmp_BufLength = L_add( Mpy_32_32( 1556925645 /*1.45 in Q30*/, L_tmp_BufLength ), ONE_IN_Q17 );
        hReverb->loopBufLength[bin] = (Word16) L_shr( L_tmp_BufLength, 17 ); /*Q0*/
#else
        Word32 L_tmp_BufLength = L_shl( L_shr( Mpy_32_32( revTimes_fx[bin], 1258291200 /*150.0 in Q23*/ ), 23 ), 23 );
        L_tmp_BufLength = L_add( Mpy_32_32( 1556925645 /*1.45 in Q30*/, L_tmp_BufLength ), ONE_IN_Q22 );
@@ -2560,7 +2560,7 @@ ivas_error ivas_binaural_reverb_init(

        preDelay = (int16_t) roundf( 48000.0f * roomAcoustics->acousticPreDelay / CLDFB_NO_CHANNELS_MAX );
#ifdef FIX_1741_REVERB_TIMES_Q_FORMAT
        floatToFixed_arrL( t60_temp, t60, Q27, CLDFB_NO_CHANNELS_MAX );
        floatToFixed_arrL( t60_temp, t60, Q26, CLDFB_NO_CHANNELS_MAX );
#else
        floatToFixed_arrL( t60_temp, t60, Q31, CLDFB_NO_CHANNELS_MAX );
#endif
@@ -2624,7 +2624,7 @@ ivas_error ivas_binaural_reverb_open_fastconv_fx(
    ELSE
    {
#ifdef FIX_1741_REVERB_TIMES_Q_FORMAT
        revTimes = hHrtfFastConv->fastconvReverberationTimes_fx;        /*Q27*/
        revTimes = hHrtfFastConv->fastconvReverberationTimes_fx; /*Q26*/
#else
        revTimes = hHrtfFastConv->fastconvReverberationTimes_fx; /*Q31*/
#endif
@@ -2673,7 +2673,7 @@ ivas_error ivas_binaural_reverb_open_parambin(
    ELSE
    {
#ifdef FIX_1741_REVERB_TIMES_Q_FORMAT
        revTimes = hHrtfParambin->parametricReverberationTimes_fx;        /*Q27*/
        revTimes = hHrtfParambin->parametricReverberationTimes_fx; /*Q26*/
#else
        revTimes = hHrtfParambin->parametricReverberationTimes_fx; /*Q31*/
#endif
+3 −3
Original line number Diff line number Diff line
@@ -73,7 +73,7 @@ extern Word32 rightBRIRImag_fx[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NT

/* Reverberation parameters based on BRIRs for fastconv */
#ifdef FIX_1741_REVERB_TIMES_Q_FORMAT
extern Word32 fastconvReverberationTimes_fx[CLDFB_NO_CHANNELS_MAX]; /* Q27 */
extern Word32 fastconvReverberationTimes_fx[CLDFB_NO_CHANNELS_MAX]; /* Q26 */
#else
extern Word32 fastconvReverberationTimes_fx[CLDFB_NO_CHANNELS_MAX]; /* Q31 */
#endif
@@ -83,7 +83,7 @@ extern Word32 fastconvReverberationEneCorrections_fx[CLDFB_NO_CHANNELS_MAX]; /*
 * with the above binaural rendering data set based on HRIRs for parametric
 * renderer */
#ifdef FIX_1741_REVERB_TIMES_Q_FORMAT
extern const Word32 parametricReverberationTimes_fx[CLDFB_NO_CHANNELS_MAX]; /* Q27 */
extern const Word32 parametricReverberationTimes_fx[CLDFB_NO_CHANNELS_MAX]; /* Q26 */
#else
extern const Word32 parametricReverberationTimes_fx[CLDFB_NO_CHANNELS_MAX]; /* Q31 */
#endif
+17 −18
Original line number Diff line number Diff line
@@ -47157,16 +47157,15 @@ const Word32 rightBRIRImag_fx[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTA
#ifdef FIX_1741_REVERB_TIMES_Q_FORMAT
const Word32 fastconvReverberationTimes_fx[CLDFB_NO_CHANNELS_MAX] /* Q27 */ =
{
    57606384, 27529398, 27157346, 27968692, 28945932, 31748532, 30950340, 30655330,
    30530104, 29387776, 30344346, 29622122, 29729360, 29993770, 30025176, 30475880,
    30588086, 29940082, 29527900, 29337714, 29583868, 29293020, 28621930, 28230418,
    27839038, 26675774, 26340230, 26161316, 25546062, 24763170, 24203886, 23644734,
    23689428, 23834786, 24640094, 26295534, 27279754, 27973256, 28812118, 29527900,
    29919414, 30926046, 31397284, 31359570, 31720078, 31867046, 32430896, 32362310,
    32057502, 32532230, 33056752, 33010582, 33030982, 32936494, 32742548, 32765634,
    32114276, 32410092, 31517544, 33962452
const Word32 fastconvReverberationTimes_fx[CLDFB_NO_CHANNELS_MAX] /* Q26 */ =
{
    28803192, 13764699, 13578673, 13984346, 14472966, 15874266, 15475170, 15327665,
    15265052, 14693888, 15172173, 14811061, 14864680, 14996885, 15012588, 15237940,
    15294043, 14970041, 14763950, 14668857, 14791934, 14646510, 14310965, 14115209,
    13919519, 13337887, 13170115, 13080658, 12773031, 12381585, 12101943, 11822367,
    11844714, 11917393, 12320047, 13147767, 13639877, 13986628, 14406059, 14763950,
    14959707, 15463023, 15698642, 15679785, 15860039, 15933523, 16215448, 16181155,
    16028751, 16266115, 16528376, 16505291, 16515491, 16468247, 16371274, 16382817
};
#else
const Word32 fastconvReverberationTimes_fx[CLDFB_NO_CHANNELS_MAX]  /* Q31 */=
@@ -47183,16 +47182,16 @@ const Word32 fastconvReverberationEneCorrections_fx[CLDFB_NO_CHANNELS_MAX] /* Q
#ifdef FIX_1741_REVERB_TIMES_Q_FORMAT
const Word32 parametricReverberationTimes_fx[CLDFB_NO_CHANNELS_MAX] /* Q27 */ =
{
    46371420, 42876392, 44689268, 48442264, 50237560, 49764848, 48133832, 46721592,
    46051312, 44473180, 42480180, 40933052, 39574768, 38594172, 37570228, 36275964,
    35439116, 34413964, 33540876, 32486058, 31551098, 30822698, 30028532, 29366168,
    28534554, 27875546, 27122986, 26587726, 26025756, 24952150, 24518492, 24422258,
    24130736, 24035844, 23695066, 23129472, 22965056, 22542002, 22545088, 22710848,
    22459994, 22270210, 21953322, 21683948, 21260760, 21025342, 20850858, 20613158,
    20344186, 20127694, 19891604, 19655650, 19419694, 19183740, 18947786, 18711830,
    18475742, 18239786, 18003832, 17767878
const Word32 parametricReverberationTimes_fx[CLDFB_NO_CHANNELS_MAX] /* Q26 */ =
{
    23185710, 21438196, 22344634, 24221132, 25118780, 24882424, 24066916, 23360796,
    23025656, 22236590, 21240090, 20466526, 19787384, 19297086, 18785114, 18137982,
    17719558, 17206982, 16770438, 16243029, 15775549, 15411349, 15014266, 14683084,
    14267277, 13937773, 13561493, 13293863, 13012878, 12476075, 12259246, 12211129,
    12065368, 12017922, 11847533, 11564736, 11482528, 11271001, 11272544, 11355424,
    11229997, 11135105, 10976661, 10841974, 10630380, 10512671, 10425429, 10306579,
    10172093, 10063847,  9945802,  9827825,  9709847,  9591870,  9473893,  9355915,
     9237871,  9119893,  9001916,  8883939
};
#else
const Word32 parametricReverberationTimes_fx[CLDFB_NO_CHANNELS_MAX] /* Q31 */=
Loading