Commit fdb1a583 authored by Andrea Genovese's avatar Andrea Genovese
Browse files

Merge branch 'qualcomm/contribution-43-early-reflections-draft' into 'main'

[non-BE][ref-using-main] Early reflections generation and rendering for multichannel binaural output

See merge request !883
parents f4f6b60f 811b4fbf
Loading
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -239,6 +239,7 @@
    <ClCompile Include="..\lib_rend\ivas_omasa_ana.c" />
    <ClCompile Include="..\lib_rend\ivas_orient_trk.c" />
    <ClCompile Include="..\lib_rend\ivas_output_init.c" />
	<ClCompile Include="..\lib_rend\ivas_reflections.c" />
    <ClCompile Include="..\lib_rend\ivas_render_config.c" />
    <ClCompile Include="..\lib_rend\ivas_reverb.c" />
    <ClCompile Include="..\lib_rend\ivas_reverb_delay_line.c" />
@@ -251,6 +252,7 @@
    <ClCompile Include="..\lib_rend\ivas_rom_binaural_crend_head.c" />
    <ClCompile Include="..\lib_rend\ivas_rotation.c" />
    <ClCompile Include="..\lib_rend\ivas_rom_rend.c" />
	<ClCompile Include="..\lib_rend\ivas_shoebox.c" />
    <ClCompile Include="..\lib_rend\lib_rend.c" />
  </ItemGroup>
  <ItemGroup>
+10 −0
Original line number Diff line number Diff line
@@ -52,6 +52,9 @@

#define RENDERER_HEAD_POSITIONS_PER_FRAME 4

#ifdef EARLY_REFLECTIONS
#define QC_ABS_COEFF 6
#endif

/*----------------------------------------------------------------------------------*
 * Common API structures
@@ -184,6 +187,13 @@ typedef struct _IVAS_ROOM_ACOUSTICS_CONFIG
    float pAcoustic_dsr[IVAS_CLDFB_NO_CHANNELS_MAX];  /*  - The room's Diffuse to Source Ratio per center frequency */
    float acousticPreDelay;                           /* Time elapsed between input signal and late reverberation start, float, range [0.001..10] */
    float inputPreDelay;                              /* Offset in seconds from where DSR is computed in the RIR (0 = at source), float, range [0.001..10] */
#ifdef EARLY_REFLECTIONS
    int16_t use_er;               /* ER activation flag */
    int32_t lowComplexity;        /* Low complexity ER flag */
    IVAS_VECTOR3 dimensions;      /* Room dimensions [m] */
    float AbsCoeff[QC_ABS_COEFF]; /* Absorption coeffs */
    IVAS_VECTOR3 ListenerOrigin;  /* Listener origin */
#endif
} IVAS_ROOM_ACOUSTICS_CONFIG_DATA;

#ifdef SPLIT_REND_WITH_HEAD_ROT
+30 −0
Original line number Diff line number Diff line
@@ -1891,6 +1891,36 @@ typedef enum
#define IVAS_LIMITER_THRESHOLD                  32729           /* -0.01 dBFS */
#define IVAS_LIMITER_ATTACK_SECONDS             0.005f


#ifdef EARLY_REFLECTIONS
/*----------------------------------------------------------------------------------*
 * Early Reflection constants
 *----------------------------------------------------------------------------------*/
#define ER_ABS_COEFF                            6
#define ER_MAX_SOURCES                          25
#define ER_REF_ORDER                            1
#define ER_NUM_REF                              6

#define ER_AIR_COEFF                            (0.00137f)
#define ER_SOUND_SPEED                          (343.0f)
#define ER_MIN_WALL_DIST                        (0.1f)
#define ER_EUCLIDEAN_SCALE                      (1.29246971E-26f)

#define ER_DEFAULT_ROOM_L                       (3.0f)
#define ER_DEFAULT_ROOM_W                       (4.0f)
#define ER_DEFAULT_ROOM_H                       (5.0f)
#define ER_RADIUS                               (1.0f)
#define ER_LIST_ORIGIN_X                        (0.0f)
#define ER_LIST_ORIGIN_Y                        (0.0f)
#define ER_LIST_HEIGHT                          (1.6f)

#define ER_MIN_ROOM_DIMENSION                   (1.0f)
#define ER_MAX_ROOM_DIMENSION                   (999.0f)
#define ER_MIN_ABS_COEFF                        (0.0f)
#define ER_MAX_ABS_COEFF                        (1.0f)

#endif

/*----------------------------------------------------------------------------------*
 * Stereo downmix EVS constants
 *----------------------------------------------------------------------------------*/
+3 −0
Original line number Diff line number Diff line
@@ -138,6 +138,9 @@ typedef enum
#ifdef CONTROL_METADATA_REVERB
    IVAS_ERR_INVALID_RENDER_CONFIG,
    IVAS_ERR_ACOUSTIC_ENVIRONMENT_MISSING,
#ifdef EARLY_REFLECTIONS
    IVAS_ERR_INVALID_ER_PARAM,
#endif
#ifdef CONTROL_METADATA_DIRECTIVITY
    IVAS_ERR_DIRECTIVITY_PATTERN_ID_MISSING,
#endif
+19 −0
Original line number Diff line number Diff line
@@ -1637,6 +1637,11 @@ ivas_error IVAS_DEC_GetRenderConfig(
    hRCout->split_rend_config.rendererSelection = hRCin->split_rend_config.rendererSelection;
#endif

#ifdef EARLY_REFLECTIONS
    hRCout->room_acoustics.use_er = hRCin->roomAcoustics.use_er;
    hRCout->room_acoustics.lowComplexity = hRCin->roomAcoustics.lowComplexity;
#endif

    return IVAS_ERR_OK;
}

@@ -1678,6 +1683,20 @@ ivas_error IVAS_DEC_FeedRenderConfig(
    hRenderConfig->roomAcoustics.nBands = renderConfig.room_acoustics.nBands;
    hRenderConfig->roomAcoustics.acousticPreDelay = renderConfig.room_acoustics.acousticPreDelay;
    hRenderConfig->roomAcoustics.inputPreDelay = renderConfig.room_acoustics.inputPreDelay;

#ifdef EARLY_REFLECTIONS
    hRenderConfig->roomAcoustics.use_er = 0;
    if ( renderConfig.room_acoustics.use_er == 1 )
    {
        hRenderConfig->roomAcoustics.use_er = renderConfig.room_acoustics.use_er;
        hRenderConfig->roomAcoustics.lowComplexity = renderConfig.room_acoustics.lowComplexity;
        hRenderConfig->roomAcoustics.dimensions = renderConfig.room_acoustics.dimensions;
        hRenderConfig->roomAcoustics.ListenerOrigin = renderConfig.room_acoustics.ListenerOrigin;

        mvr2r( renderConfig.room_acoustics.AbsCoeff, hRenderConfig->roomAcoustics.AbsCoeff, ER_ABS_COEFF );
    }
#endif

    mvr2r( renderConfig.room_acoustics.pFc_input, hRenderConfig->roomAcoustics.pFc_input, CLDFB_NO_CHANNELS_MAX );
    mvr2r( renderConfig.room_acoustics.pAcoustic_rt60, hRenderConfig->roomAcoustics.pAcoustic_rt60, CLDFB_NO_CHANNELS_MAX );
    mvr2r( renderConfig.room_acoustics.pAcoustic_dsr, hRenderConfig->roomAcoustics.pAcoustic_dsr, CLDFB_NO_CHANNELS_MAX );
Loading