Commit 09109881 authored by vaclav's avatar vaclav
Browse files

synchronize with float-main

parent 028d6837
Loading
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -119,6 +119,9 @@
      <Filter>rend_c</Filter>
    </ClCompile>
    <ClCompile Include="..\lib_rend\lib_rend_fx.c" />
    <ClCompile Include="..\lib_rend\ivas_td_ring_buffer_fx.c">
      <Filter>rend_c</Filter>
    </ClCompile>
  </ItemGroup>
  <ItemGroup>
    <ClInclude Include="..\lib_rend\lib_rend.h" />
+3 −3
Original line number Diff line number Diff line
@@ -156,7 +156,6 @@ typedef struct _IVAS_EDITABLE_PARAMETERS

typedef struct
{
    // float w, x, y, z;
    Word32 w_fx, x_fx, y_fx, z_fx;
    Word16 q_fact;

@@ -168,6 +167,7 @@ typedef struct
    float x, y, z;
    Word32 x_fx, y_fx, z_fx;
    Word16 q_fact;

} IVAS_VECTOR3;

typedef enum
@@ -326,8 +326,8 @@ typedef enum
    IVAS_RENDER_TYPE_OVERRIDE_FASTCONV

} IVAS_RENDER_TYPE_OVERRIDE;
#endif

#endif
typedef struct _IVAS_ROOM_ACOUSTICS_CONFIG
{
    Word16 nBands;                                                                                                                       /* Number of frequency bands for which reverb properties are provided, integer, range [2..256]        */
@@ -342,8 +342,8 @@ typedef struct _IVAS_ROOM_ACOUSTICS_CONFIG
    Word32 lowComplexity;                    /* Low complexity ER flag  */
    IVAS_VECTOR3 dimensions;                 /* Room dimensions [m]     */
    float AbsCoeff[IVAS_ROOM_ABS_COEFF];     /* Absorption coeffs       */
    IVAS_VECTOR3 ListenerOrigin;             /* Listener origin         */
    Word32 AbsCoeff_fx[IVAS_ROOM_ABS_COEFF]; /* Absorption coeffs       */
    IVAS_VECTOR3 ListenerOrigin;             /* Listener origin         */

} IVAS_ROOM_ACOUSTICS_CONFIG_DATA;

+4 −2
Original line number Diff line number Diff line
@@ -206,12 +206,14 @@ ivas_error IVAS_DEC_GetCldfbSamples(
    Word16 *nOutSamples                                     /* o  : number of samples per channel written to output buffer                  */
);

Word16 IVAS_DEC_is_split_rendering_enabled(
/*! r: decoder error code */
ivas_error IVAS_DEC_is_split_rendering_enabled(
    IVAS_DEC_HANDLE hIvasDec,                               /* i  : IVAS decoder handle                                                     */
    Word16 *isSplitRend                                     /* o  : flag to indicate if split rendering is enabled                          */
);

Word16 IVAS_DEC_is_split_rendering_coded_out(
/*! r: decoder error code */
ivas_error IVAS_DEC_is_split_rendering_coded_out(
    IVAS_DEC_HANDLE hIvasDec,                               /* i/o: IVAS decoder handle                                                     */
    Word16 *isSplitCoded                                    /* o  : flag to indicate if split rendering is enabled                          */
);
+51 −81
Original line number Diff line number Diff line
@@ -31,9 +31,6 @@
*******************************************************************************************************/

#include "lib_dec.h"
#include <math.h>
#include <assert.h>
#include <string.h>
#include "ivas_cnst.h"
#include "ivas_prot_rend_fx.h"
#include "prot_fx.h"
@@ -122,17 +119,17 @@ static ivas_error ivas_dec_setup_all( IVAS_DEC_HANDLE hIvasDec, UWord8 *nTranspo
static ivas_error ivas_dec_setup_all( IVAS_DEC_HANDLE hIvasDec, UWord8 *nTransportChannels, const Word16 isSplitRend, ISAR_SPLIT_REND_BITS_DATA *splitRendBits );
#endif
static ivas_error apa_setup( IVAS_DEC_HANDLE hIvasDec, const bool isInitialized_voip, const UWord16 nTransportChannels );
static ivas_error isar_set_split_rend_setup( ISAR_DEC_SPLIT_REND_WRAPPER *hSplitBinRend, const ISAR_SPLIT_REND_CONFIG_DATA *hSplitBinConfig, const COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, ISAR_SPLIT_REND_BITS_DATA *splitRendBits );
static ivas_error ivas_dec_reconfig_split_rend( Decoder_Struct *st_ivas );
static ivas_error ivas_dec_init_split_rend( Decoder_Struct *st_ivas );
static ivas_error ivas_create_handle_isar( ISAR_DEC_SPLIT_REND_WRAPPER_HANDLE *hSplitBinRend_out );
static void ivas_destroy_handle_isar( ISAR_DEC_SPLIT_REND_WRAPPER_HANDLE *hSplitBinRend_out );
static Word16 get_render_frame_size_ms( IVAS_RENDER_FRAMESIZE render_framesize );
#ifdef FIX_1119_SPLIT_RENDERING_VOIP
static Word16 get_render_frame_size_samples( const DECODER_CONFIG_HANDLE hDecoderConfig );
static Word16 ivas_dec_split_rend_cldfb_in( const RENDERER_TYPE renderer_type );
#endif
static void update_voip_rendered20ms( IVAS_DEC_HANDLE hIvasDec, const Word16 nSamplesRendered );
static ivas_error isar_set_split_rend_setup( ISAR_DEC_SPLIT_REND_WRAPPER *hSplitBinRend, const ISAR_SPLIT_REND_CONFIG_DATA *hSplitBinConfig, const COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, ISAR_SPLIT_REND_BITS_DATA *splitRendBits );
static ivas_error ivas_dec_reconfig_split_rend( Decoder_Struct *st_ivas );
static ivas_error ivas_dec_init_split_rend( Decoder_Struct *st_ivas );
static ivas_error ivas_create_handle_isar( ISAR_DEC_SPLIT_REND_WRAPPER_HANDLE *hSplitBinRend_out );
static void ivas_destroy_handle_isar( ISAR_DEC_SPLIT_REND_WRAPPER_HANDLE *hSplitBinRend_out );


/*---------------------------------------------------------------------*
@@ -412,11 +409,11 @@ void IVAS_DEC_Close(
        ( *phIvasDec )->hVoIP = NULL;
    }

    IF( ( *phIvasDec )->st_ivas )
    {
        /* destroy Split binaural renderer (ISAR) handle */
        ivas_destroy_handle_isar( &( *phIvasDec )->st_ivas->hSplitBinRend );

    IF( ( *phIvasDec )->st_ivas )
    {
        ivas_destroy_dec_fx( ( *phIvasDec )->st_ivas );
        ( *phIvasDec )->st_ivas = NULL;
    }
@@ -1091,15 +1088,6 @@ ivas_error IVAS_DEC_FeedFrame_Serial(
            {
                return error;
            }
            Word32 ivas_total_brate = hIvasDec->st_ivas->hDecoderConfig->ivas_total_brate;
            move32();
            test();
            IF( ( EQ_16( hIvasDec->st_ivas->ivas_format, MC_FORMAT ) ) && ( EQ_16( hIvasDec->st_ivas->mc_mode, MC_MODE_PARAMMC ) ) )
            {
                MC_LS_SETUP mc_ls_setup;
                mc_ls_setup = ivas_mc_map_output_config_to_mc_ls_setup_fx( hIvasDec->st_ivas->transport_config );
                hIvasDec->st_ivas->nchan_transport = ivas_param_mc_getNumTransportChannels_fx( ivas_total_brate, mc_ls_setup );
            }

            test();
            IF( hIvasDec->hVoIP != NULL && hIvasDec->hVoIP->hCurrentDataUnit != NULL )
@@ -1119,6 +1107,7 @@ ivas_error IVAS_DEC_FeedFrame_Serial(
                move32();
            }
#endif

            hIvasDec->isInitialized = true;
            move16();
        }
@@ -1130,33 +1119,6 @@ ivas_error IVAS_DEC_FeedFrame_Serial(
        move16();
    }

    /* Update redundant frame information in EVS (pre- read indices) */
    test();
    test();
    IF( EQ_16( (Word16) hIvasDec->mode, IVAS_DEC_MODE_EVS ) && hIvasDec->hVoIP != NULL && hIvasDec->hVoIP->hCurrentDataUnit != NULL )
    {
        DEC_CORE_HANDLE st = hIvasDec->st_ivas->hSCE[0]->hCoreCoder[0];
        st->bit_stream = serial;

        test();
        IF( hIvasDec->hVoIP->hCurrentDataUnit->partial_frame || st->prev_use_partial_copy )
        {
            st->next_coder_type = hIvasDec->hVoIP->hCurrentDataUnit->nextCoderType;
        }
        ELSE
        {
            st->next_coder_type = INACTIVE;
        }
        move16();

        test();
        if ( EQ_16( (Word16) hIvasDec->hVoIP->hCurrentDataUnit->partial_frame, 1 ) && NE_16( bfi, 1 ) )
        {
            bfi = 2;
            move16();
        }
    }

    IF( NE_32( ( error = read_indices_fx( hIvasDec->st_ivas, serial, num_bits, &hIvasDec->prev_ft_speech, &hIvasDec->CNG, bfi ) ), IVAS_ERR_OK ) )
    {
        return error;
@@ -1188,6 +1150,7 @@ ivas_error IVAS_DEC_FeedFrame_Serial(
    return IVAS_ERR_OK;
}


#ifdef FIX_1119_SPLIT_RENDERING_VOIP
/*---------------------------------------------------------------------*
 * isar_get_frame_size( )
@@ -2161,7 +2124,7 @@ static Word16 getOutputBufferSize(

    IF( EQ_16( (Word16) st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) )
    {
        return extract_l( Mult_32_16( imult3216( st_ivas->hDecoderConfig->output_Fs, ( RENDERER_MAX_OUTPUT_CHANNELS + IVAS_MAX_NUM_OBJECTS ) ), INV_FRAME_PER_SEC_Q15 ) );
        return extract_l( Mult_32_16( imult3216( st_ivas->hDecoderConfig->output_Fs, ( MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS ) ), INV_FRAME_PER_SEC_Q15 ) );
    }
    ELSE IF( EQ_16( (Word16) st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_LS_CUSTOM ) )
    {
@@ -2685,7 +2648,7 @@ ivas_error IVAS_DEC_FeedCustomLsData(
/*---------------------------------------------------------------------*
 * IVAS_DEC_GetHrtfTDrendHandle( )
 *
 *
 * Get TD binaural renderer handle
 *---------------------------------------------------------------------*/

ivas_error IVAS_DEC_GetHrtfTDrendHandle(
@@ -2709,7 +2672,7 @@ ivas_error IVAS_DEC_GetHrtfTDrendHandle(
/*---------------------------------------------------------------------*
 * IVAS_DEC_GetHrtfCRendHandle( )
 *
 *
 * Get Crend binaural renderer handle
 *---------------------------------------------------------------------*/

ivas_error IVAS_DEC_GetHrtfCRendHandle(
@@ -2733,7 +2696,7 @@ ivas_error IVAS_DEC_GetHrtfCRendHandle(
/*---------------------------------------------------------------------*
 * IVAS_DEC_GetHrtfFastConvHandle( )
 *
 *
 * Get FastConv binaural renderer handle
 *---------------------------------------------------------------------*/

ivas_error IVAS_DEC_GetHrtfFastConvHandle(
@@ -2757,7 +2720,7 @@ ivas_error IVAS_DEC_GetHrtfFastConvHandle(
/*---------------------------------------------------------------------*
 * IVAS_DEC_GetHrtfParamBinHandle( )
 *
 *
 * Get Parametric binaural renderer handle
 *---------------------------------------------------------------------*/

ivas_error IVAS_DEC_GetHrtfParamBinHandle(
@@ -2781,7 +2744,7 @@ ivas_error IVAS_DEC_GetHrtfParamBinHandle(
/*---------------------------------------------------------------------*
 * IVAS_DEC_GetHrtfStatisticsHandle( )
 *
 *
 * Get HRTF statistics (room effect) binaural renderer handle
 *---------------------------------------------------------------------*/

ivas_error IVAS_DEC_GetHrtfStatisticsHandle(
@@ -3106,7 +3069,7 @@ ivas_error IVAS_DEC_FeedRenderConfig(
        }
    }

    /* FB reverberator */
    /* Parametric renderer reverberator */
    test();
    IF( st_ivas->hDiracDecBin[0] != NULL && st_ivas->hDiracDecBin[0]->hReverb != NULL )
    {
@@ -3118,8 +3081,8 @@ ivas_error IVAS_DEC_FeedRenderConfig(
        }
    }

    /* FastConv renderer reverberator */
    test();
    /* Fastconv CLDFB reverberator */
    IF( st_ivas->hBinRenderer != NULL && st_ivas->hBinRenderer->hReverb != NULL )
    {
        ivas_binaural_reverb_close_fx( &( st_ivas->hBinRenderer->hReverb ) );
@@ -3139,6 +3102,7 @@ ivas_error IVAS_DEC_FeedRenderConfig(
    IF( hRenderConfig->split_rend_config.dof == 0 )
    {
        hRenderConfig->split_rend_config.poseCorrectionMode = ISAR_SPLIT_REND_POSE_CORRECTION_MODE_NONE;
        move16();
    }

    IF( is_split_rendering_enabled( st_ivas->hDecoderConfig, hRenderConfig ) )
@@ -3156,7 +3120,7 @@ ivas_error IVAS_DEC_FeedRenderConfig(
/*---------------------------------------------------------------------*
 * IVAS_DEC_GetDelay( )
 *
 *
 * Return IVAS decoder delay in nanoseconds
 *---------------------------------------------------------------------*/

ivas_error IVAS_DEC_GetDelay(
@@ -3454,7 +3418,7 @@ ivas_error IVAS_DEC_VoIP_SetScale(
        return IVAS_ERR_UNEXPECTED_NULL_POINTER;
    }

    IF( !hIvasDec->st_ivas->hDecoderConfig->Opt_tsm )
    IF( hIvasDec->st_ivas->hDecoderConfig->Opt_tsm == 0 )
    {
        return IVAS_ERR_TSM_NOT_ENABLED;
    }
@@ -3829,10 +3793,11 @@ static ivas_error apa_exec_evs_wrapper(
}
#endif


/*---------------------------------------------------------------------*
 * IVAS_DEC_GetSamplesDecoder( )
 *
 * Main function to decode transport channels, do TSM and feed to renderer.
 * Main function to run setup, decode transport channels, do TSM and feed to renderer.
 *---------------------------------------------------------------------*/

ivas_error IVAS_DEC_GetSamplesDecoder(
@@ -4093,12 +4058,13 @@ ivas_error IVAS_DEC_GetSamplesDecoder(
/*---------------------------------------------------------------------*
 * IVAS_DEC_GetEditableParameters( )
 *
 *
 * Get editable metadata parameters
 *---------------------------------------------------------------------*/

ivas_error IVAS_DEC_GetEditableParameters(
    IVAS_DEC_HANDLE hIvasDec,
    IVAS_EDITABLE_PARAMETERS *hIvasEditableParameters )
    IVAS_DEC_HANDLE hIvasDec,                         /* i/o: IVAS decoder handle              */
    IVAS_EDITABLE_PARAMETERS *hIvasEditableParameters /* o  : object editing parameters handle */
)
{
    Word16 obj, dirac_read_idx;
    Decoder_Struct *st_ivas;
@@ -4284,12 +4250,13 @@ ivas_error IVAS_DEC_GetEditableParameters(
/*---------------------------------------------------------------------*
 * IVAS_DEC_SetEditableParameters( )
 *
 * Main function to decode to PCM data
 * Set editable metadata parameters
 *---------------------------------------------------------------------*/

ivas_error IVAS_DEC_SetEditableParameters(
    IVAS_DEC_HANDLE hIvasDec,
    IVAS_EDITABLE_PARAMETERS hIvasEditableParameters )
    IVAS_DEC_HANDLE hIvasDec,                        /* i/o: IVAS decoder handle              */
    IVAS_EDITABLE_PARAMETERS hIvasEditableParameters /* i  : object editing parameters handle */
)
{
    Word16 dirac_read_idx, obj;
    Decoder_Struct *st_ivas;
@@ -4830,7 +4797,7 @@ ivas_error IVAS_DEC_VoIP_GetSamples
            dbgwrite( &scale, sizeof( uint32_t ), 1, 1, "./res/JBM_scale.dat" );
            dbgwrite( &maxScaling, sizeof( uint32_t ), 1, 1, "./res/JBM_maxScale.dat" );
#endif
            /* avoid time scaling multiple times in one sound card slot */
            /* avoid time scaling multiple times within one 20ms frame*/
            IF( NE_64( scale, 100U ) )
            {
                IF( hIvasDec->timeScalingDone )
@@ -5190,7 +5157,6 @@ ivas_error IVAS_DEC_Flush(
    ivas_error error;
    UWord16 nSamplesToRender;
    UWord16 nSamplesFlushedLocal;
    nSamplesFlushedLocal = 0; // temp. hack

    test();
    IF( hIvasDec == NULL || hIvasDec->st_ivas == NULL )
@@ -5223,12 +5189,12 @@ ivas_error IVAS_DEC_Flush(
        *nSamplesFlushed = 0;
        move16();
    }

#ifdef TMP_1342_WORKAROUND_DEC_FLUSH_BROKEN_IN_SR
    hIvasDec->st_ivas->flushing = 0;
    move16();
#endif


    return error;
}

@@ -5241,7 +5207,8 @@ ivas_error IVAS_DEC_Flush(

bool IVAS_DEC_VoIP_IsEmpty(
    IVAS_DEC_HANDLE hIvasDec,  /* i/o: IVAS decoder handle              */
    const Word16 nSamplesAsked )
    const Word16 nSamplesAsked /* i  : number of output samples asked   */
)
{
    test();
    IF( hIvasDec == NULL || hIvasDec->hVoIP == NULL )
@@ -5962,7 +5929,8 @@ ivas_error IVAS_DEC_GetSplitRendBitstreamHeader(
    ISAR_SPLIT_REND_POSE_CORRECTION_MODE *poseCorrection, /* o  : pointer to pose correction mode       */
    Word16 *pIsar_frame_size_ms,                          /* o  : pointer to ISAR frame size setting    */
    Word16 *pCodec_frame_size_ms,                         /* o  : pointer to codec frame size setting   */
    Word16 *pLc3plusHighRes )
    Word16 *pLc3plusHighRes                               /* o  : pointer to LC3plus High-Res setting   */
)
{
    test();
    IF( hIvasDec == NULL || hIvasDec->st_ivas == NULL )
@@ -6137,7 +6105,8 @@ static void ivas_destroy_handle_isar(
 *
 *---------------------------------------------------------------------*/

Word16 IVAS_DEC_is_split_rendering_enabled(
/*! r: decoder error code */
ivas_error IVAS_DEC_is_split_rendering_enabled(
    IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle                               */
    Word16 *isSplitRend       /* o  : flag to indicate if split rendering is enabled    */
)
@@ -6447,7 +6416,8 @@ static ivas_error ivas_dec_init_split_rend(
 * Return flag to indicate if split rendering is enabled
 *---------------------------------------------------------------------*/

Word16 IVAS_DEC_is_split_rendering_coded_out(
/*! r: decoder error code */
ivas_error IVAS_DEC_is_split_rendering_coded_out(
    IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle                               */
    Word16 *isSplitCoded      /* o  : flag to indicate if split rendering is enabled    */
)