From 09109881bd36dd04438dc2a41e04be1437161401 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 10 Nov 2025 12:53:42 +0100 Subject: [PATCH 1/4] synchronize with float-main --- Workspace_msvc/lib_rend.vcxproj.filters | 3 + lib_com/common_api_types.h | 6 +- lib_dec/lib_dec.h | 6 +- lib_dec/lib_dec_fx.c | 132 +++++++++--------------- 4 files changed, 61 insertions(+), 86 deletions(-) diff --git a/Workspace_msvc/lib_rend.vcxproj.filters b/Workspace_msvc/lib_rend.vcxproj.filters index 0892a4dcb..dfa1253eb 100644 --- a/Workspace_msvc/lib_rend.vcxproj.filters +++ b/Workspace_msvc/lib_rend.vcxproj.filters @@ -119,6 +119,9 @@ rend_c + + rend_c + diff --git a/lib_com/common_api_types.h b/lib_com/common_api_types.h index 6259b5f8d..4f144044b 100644 --- a/lib_com/common_api_types.h +++ b/lib_com/common_api_types.h @@ -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; diff --git a/lib_dec/lib_dec.h b/lib_dec/lib_dec.h index e911a5fca..f58d8a819 100644 --- a/lib_dec/lib_dec.h +++ b/lib_dec/lib_dec.h @@ -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 */ ); diff --git a/lib_dec/lib_dec_fx.c b/lib_dec/lib_dec_fx.c index 382d72dd2..b65fda0da 100644 --- a/lib_dec/lib_dec_fx.c +++ b/lib_dec/lib_dec_fx.c @@ -31,9 +31,6 @@ *******************************************************************************************************/ #include "lib_dec.h" -#include -#include -#include #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; } - /* destroy Split binaural renderer (ISAR) handle */ - ivas_destroy_handle_isar( &( *phIvasDec )->st_ivas->hSplitBinRend ); - IF( ( *phIvasDec )->st_ivas ) { + /* destroy Split binaural renderer (ISAR) handle */ + ivas_destroy_handle_isar( &( *phIvasDec )->st_ivas->hSplitBinRend ); + 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( ) @@ -1613,11 +1576,11 @@ ivas_error IVAS_DEC_GetSamplesRenderer( *---------------------------------------------------------------------*/ ivas_error IVAS_DEC_GetSplitBinauralBitstream( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - Word16 *pcmBuf_out, /* o : output synthesis signal for BINAURAL_SPLIT_PCM */ - ISAR_SPLIT_REND_BITS_DATA *splitRendBits, /* o : output split rendering bits */ - Word16 *nOutSamples, /* o : number of samples per channel written to output buffer */ - bool *needNewFrame /* o : indication that the decoder needs a new frame */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + Word16 *pcmBuf_out, /* o : output synthesis signal for BINAURAL_SPLIT_PCM */ + ISAR_SPLIT_REND_BITS_DATA *splitRendBits, /* o : output split rendering bits */ + Word16 *nOutSamples, /* o : number of samples per channel written to output buffer */ + bool *needNewFrame /* o : indication that the decoder needs a new frame */ ) { #ifdef FIX_1119_SPLIT_RENDERING_VOIP @@ -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 ) ) { @@ -2249,10 +2212,10 @@ ivas_error IVAS_DEC_GetNumOutputChannels( *---------------------------------------------------------------------*/ ivas_error IVAS_DEC_GetObjectMetadata( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - IVAS_ISM_METADATA *metadata, /* o : struct where metadata decoded in most recently decoded frame will be written */ - const UWord16 zero_flag, /* i : if this flag is enabled, this function outputs a zero-initialized metadata struct */ - const UWord16 objectIdx /* i : index of the queried object */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + IVAS_ISM_METADATA *metadata, /* o : struct where metadata decoded in most recently decoded frame will be written */ + const UWord16 zero_flag, /* i : if this flag is enabled, this function outputs a zero-initialized metadata struct */ + const UWord16 objectIdx /* i : index of the queried object */ ) { Decoder_Struct *st_ivas; @@ -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; } @@ -5240,8 +5206,9 @@ ivas_error IVAS_DEC_Flush( *---------------------------------------------------------------------*/ bool IVAS_DEC_VoIP_IsEmpty( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - const Word16 nSamplesAsked ) + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + 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 */ ) -- GitLab From 3912e62593dd39e63854ee82cdbc75b87dd79e19 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 10 Nov 2025 13:45:11 +0100 Subject: [PATCH 2/4] fix --- lib_dec/lib_dec_fx.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/lib_dec/lib_dec_fx.c b/lib_dec/lib_dec_fx.c index b65fda0da..249f59f66 100644 --- a/lib_dec/lib_dec_fx.c +++ b/lib_dec/lib_dec_fx.c @@ -1119,6 +1119,33 @@ 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; -- GitLab From f85ff450705480f2aefe4ee2b896ded7399d54ac Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 10 Nov 2025 14:34:44 +0100 Subject: [PATCH 3/4] fix --- lib_dec/lib_dec_fx.c | 115 ++++++++++++++++++++++++++++--------------- 1 file changed, 76 insertions(+), 39 deletions(-) diff --git a/lib_dec/lib_dec_fx.c b/lib_dec/lib_dec_fx.c index 249f59f66..513fd8cd7 100644 --- a/lib_dec/lib_dec_fx.c +++ b/lib_dec/lib_dec_fx.c @@ -294,12 +294,14 @@ ivas_error IVAS_DEC_Open( move16(); move16(); move16(); + return IVAS_ERR_OK; } return IVAS_ERR_WRONG_PARAMS; } + /*-------------------------------------------------------------------------* * isar_set_split_rend_setup() * @@ -321,6 +323,14 @@ static ivas_error isar_set_split_rend_setup( splitRendBits->codec_frame_size_ms = 0; splitRendBits->isar_frame_size_ms = 0; splitRendBits->lc3plus_highres = 0; + move16(); + move16(); + move16(); + move16(); + move16(); + move16(); + move16(); + move16(); #ifndef TMP_FIX_SPLIT_REND IF( ( hSplitBinRend->hMultiBinCldfbData = (ISAR_DEC_SPLIT_REND_MULTI_BIN_CLDFB_DATA_HANDLE) malloc( sizeof( ISAR_DEC_SPLIT_REND_MULTI_BIN_CLDFB_DATA ) ) ) == NULL ) @@ -339,6 +349,7 @@ static ivas_error isar_set_split_rend_setup( return IVAS_ERR_OK; } + /*---------------------------------------------------------------------* * init_decoder_config() * @@ -747,18 +758,21 @@ ivas_error IVAS_DEC_SetRenderFramesize( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } + hIvasDec->st_ivas->hDecoderConfig->render_framesize = render_framesize; + move16(); + IF( hIvasDec->st_ivas->hExtOrientationData != NULL ) { hIvasDec->st_ivas->hExtOrientationData->num_subframes = (Word16) render_framesize; + move16(); } + IF( hIvasDec->st_ivas->hCombinedOrientationData != NULL ) { hIvasDec->st_ivas->hCombinedOrientationData->num_subframes = (Word16) render_framesize; + move16(); } - hIvasDec->st_ivas->hDecoderConfig->render_framesize = render_framesize; - move16(); - return IVAS_ERR_OK; } @@ -818,10 +832,12 @@ static Word16 get_render_frame_size_samples( { tmp = 0; } + return tmp; } #endif + /*---------------------------------------------------------------------* * IVAS_DEC_GetGetRenderFramesizeSamples( ) * @@ -871,6 +887,7 @@ ivas_error IVAS_DEC_GetRenderFramesizeSamples( return IVAS_ERR_OK; } + /*---------------------------------------------------------------------* * IVAS_DEC_GetGetRenderFramesizeMs( ) * @@ -895,6 +912,7 @@ ivas_error IVAS_DEC_GetRenderFramesizeMs( return IVAS_ERR_OK; } + /*---------------------------------------------------------------------* * IVAS_DEC_GetGetReferencesUpdateFrequency( ) * @@ -1119,7 +1137,7 @@ ivas_error IVAS_DEC_FeedFrame_Serial( move16(); } - /* Update redundant frame information in EVS (pre- read indices) */ + /* 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 ) @@ -1320,15 +1338,15 @@ static ivas_error isar_generate_metadata_and_bitstream( move16(); } - n_samples_in_cldfb_slot = NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ); - assert( nSamples % n_samples_in_cldfb_slot == 0 ); - num_cldfb_slots = int_div_s_x( nSamples, n_samples_in_cldfb_slot ); - - num_poses = hSplitBinRend->splitrend.multiBinPoseData.num_poses; - move16(); - IF( cldfb_in_flag ) { + n_samples_in_cldfb_slot = NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ); + assert( nSamples % n_samples_in_cldfb_slot == 0 ); + num_cldfb_slots = int_div_s_x( nSamples, n_samples_in_cldfb_slot ); + + num_poses = hSplitBinRend->splitrend.multiBinPoseData.num_poses; + move16(); + FOR( i = 0; i < imult1616( BINAURAL_CHANNELS, num_poses ); ++i ) { FOR( j = 0; j < num_cldfb_slots; ++j ) @@ -1348,8 +1366,12 @@ static ivas_error isar_generate_metadata_and_bitstream( ELSE { ivas_TD_RINGBUF_PopChannels( st_ivas->hSplitBinRend->hMultiBinTdData, p_head_pose_buf, nSamples ); - } + num_cldfb_slots = 0; // just to avoid compilation warning + num_poses = 0; // just to avoid compilation warning + move16(); + move16(); + } IF( st_ivas->hBinRendererTd != NULL ) { @@ -1470,7 +1492,7 @@ ivas_error IVAS_DEC_GetSamplesRenderer( { ivas_error error; UWord16 nSamplesRendered, nSamplesRendered_loop; - UWord16 nOutChannels; + UWord8 nOutChannels; Decoder_Struct *st_ivas; nSamplesRendered = 0; @@ -1531,11 +1553,12 @@ ivas_error IVAS_DEC_GetSamplesRenderer( move16(); move16(); move16(); + return IVAS_ERR_OK; } - test(); /* check if we are still at the beginning with bad frames, put out zeroes, keep track of subframes */ + test(); IF( !hIvasDec->isInitialized && st_ivas->bfi ) { hIvasDec->hasBeenFedFrame = false; @@ -1681,7 +1704,7 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream( ivas_limiter_dec_fx( st_ivas->hLimiter, p_head_pose_buf, st_ivas->hDecoderConfig->nchan_out, numSamplesPerChannelToOutput, st_ivas->BER_detect, Q11 ); } - ivas_syn_output_fx( p_head_pose_buf, Q11, numSamplesPerChannelToOutput, st_ivas->hDecoderConfig->nchan_out, (int16_t *) pcmBuf_out ); + ivas_syn_output_fx( p_head_pose_buf, Q11, numSamplesPerChannelToOutput, st_ivas->hDecoderConfig->nchan_out, pcmBuf_out ); } #else Decoder_Struct *st_ivas; @@ -4387,6 +4410,7 @@ ivas_error IVAS_DEC_SetEditableParameters( move32(); st_ivas->hParamIsmDec->edited_elevation_values_fx[obj] = hIvasEditableParameters.ism_metadata[obj].elevation_fx; move32(); + IF( st_ivas->hMasaIsmData != NULL ) { #ifdef FIX_GAIN_EDIT_LIMITS @@ -4786,7 +4810,6 @@ ivas_error IVAS_DEC_VoIP_GetSamples IF( hIvasDec->hasBeenFedFirstGoodFrame ) { /* check if the TC buffer already exists, otherweise nothing is buffered anyway */ - IF( st_ivas->hTcBuffer != NULL ) { nSamplesBuffered = sub( st_ivas->hTcBuffer->n_samples_buffered, st_ivas->hTcBuffer->n_samples_rendered ); @@ -4956,6 +4979,7 @@ ivas_error IVAS_DEC_VoIP_GetSamples move16(); *parametersAvailableForEditing = true; move16(); + return IVAS_ERR_OK; } } @@ -5028,7 +5052,7 @@ ivas_error IVAS_DEC_VoIP_GetSamples ivas_limiter_dec_fx( st_ivas->hLimiter, p_head_pose_buf, st_ivas->hDecoderConfig->nchan_out, *nSamplesRendered, st_ivas->BER_detect, Q11 ); } - ivas_syn_output_fx( p_head_pose_buf, Q11, *nSamplesRendered, st_ivas->hDecoderConfig->nchan_out, (int16_t *) pcmBuf ); + ivas_syn_output_fx( p_head_pose_buf, Q11, *nSamplesRendered, st_ivas->hDecoderConfig->nchan_out, pcmBuf ); } } #endif @@ -5104,6 +5128,7 @@ ivas_error IVAS_DEC_VoIP_GetSplitBinauralBitstream( Word32 *pp_head_pose_buf[BINAURAL_CHANNELS * MAX_HEAD_ROT_POSES]; ivas_error error = IVAS_ERR_UNKNOWN; Word16 nSamplesPerChannel = 0; + move16(); IF( NE_32( ( error = IVAS_DEC_GetRenderFramesizeSamples( hIvasDec, &nSamplesPerChannel ) ), IVAS_ERR_OK ) ) { @@ -5300,8 +5325,8 @@ static void ivas_destroy_handle_VoIP_fx( return; } - #ifdef SUPPORT_JBM_TRACEFILE + /*---------------------------------------------------------------------* * store_JbmData() * @@ -5378,7 +5403,6 @@ ivas_error IVAS_DEC_GetJbmData( #endif - /*---------------------------------------------------------------------* * IVAS_DEC_GetErrorMessage( ) * @@ -5756,23 +5780,8 @@ static ivas_error evs_dec_main_fx( IF( st_ivas->hDecoderConfig->Opt_tsm ) #endif { - /* BE workaround: in order to keep EVS bit-exact wrt. TS 26.443, convert 'float' output data to 'short' before the TSM */ // TODO: verify if it is still needed and if it works well for EVS stereo panning output -#ifdef JBM_MEMORY_OPT - Word32 pcm_buf_local[CPE_CHANNELS * L_FRAME48k]; -#else - Word32 pcm_buf_local[L_FRAME48k]; -#endif - - FOR( ch = 0; ch < st_ivas->hDecoderConfig->nchan_out; ch++ ) - { -#ifdef JBM_MEMORY_OPT - ivas_buffer_deinterleaved_to_interleaved_fx( &p_output_fx[ch], st_ivas->hDecoderConfig->nchan_out, nOutSamples, pcm_buf_local ); -#else - ivas_syn_output_f_fx( &p_output_fx[ch], nOutSamples, 1, pcm_buf_local ); -#endif - - Copy32( pcm_buf_local, p_output_fx[ch], nOutSamples ); - } + /* BE workaround: in order to keep EVS bit-exact wrt. TS 26.443, convert 'float' output data to 'short' before the TSM */ + /* not applicable in BASOP */ } return IVAS_ERR_OK; @@ -5824,6 +5833,7 @@ static ivas_error input_format_API_to_internal( move16(); move16(); + return IVAS_ERR_OK; } @@ -5890,6 +5900,7 @@ static ivas_error apa_setup( move16(); move16(); + test(); test(); test(); @@ -6068,6 +6079,7 @@ static ivas_error ivas_create_handle_isar( #endif hSplitBinRend->hCldfbDataOut = NULL; hSplitBinRend->numTdSamplesPerChannelCached = 0; + move16(); *hSplitBinRend_out = hSplitBinRend; @@ -6096,6 +6108,7 @@ static void ivas_destroy_handle_isar( { ivas_TD_RINGBUF_Close( &( *hSplitBinRend )->hMultiBinTdData ); } + FOR( i = 0; i < MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS; ++i ) { IF( ( *hSplitBinRend )->hMultiBinCldfbData[i] != NULL ) @@ -6175,6 +6188,9 @@ static ivas_error ivas_dec_reconfig_split_rend( cldfb_in_flag = 0; move16(); + test(); + test(); + test(); IF( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV ) || EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV_ROOM ) || EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) || @@ -6189,6 +6205,10 @@ static ivas_error ivas_dec_reconfig_split_rend( isCldfbNeeded = 0; move16(); + test(); + test(); + test(); + test(); IF( ( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV ) && EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) || ( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) && EQ_16( st_ivas->ivas_format, MASA_ISM_FORMAT ) && EQ_16( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) ) ) { @@ -6220,6 +6240,7 @@ static ivas_error ivas_dec_reconfig_split_rend( move16(); } + test(); test(); IF( EQ_16( isCldfbNeeded, 1 ) && hSplitRendWrapper->hCldfbHandles == NULL ) { @@ -6228,7 +6249,7 @@ static ivas_error ivas_dec_reconfig_split_rend( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for CLDFB handles\n" ) ); } - num_ch = i_mult( MAX_HEAD_ROT_POSES, BINAURAL_CHANNELS ); + num_ch = MAX_HEAD_ROT_POSES, BINAURAL_CHANNELS; move16(); FOR( ch = 0; ch < num_ch; ch++ ) { @@ -6257,7 +6278,7 @@ static ivas_error ivas_dec_reconfig_split_rend( } ELSE IF( EQ_16( isCldfbNeeded, 0 ) && hSplitRendWrapper->hCldfbHandles != NULL ) { - num_ch = i_mult( MAX_HEAD_ROT_POSES, BINAURAL_CHANNELS ); + num_ch = MAX_HEAD_ROT_POSES, BINAURAL_CHANNELS; move16(); FOR( ch = 0; ch < num_ch; ch++ ) { @@ -6284,6 +6305,11 @@ static ivas_error ivas_dec_reconfig_split_rend( move32(); } + test(); + test(); + test(); + test(); + test(); IF( ( NE_16( st_ivas->renderer_type, RENDERER_BINAURAL_OBJECTS_TD ) ) && ( NE_16( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV ) || NE_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) && !( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) && EQ_16( st_ivas->ivas_format, MASA_ISM_FORMAT ) && EQ_16( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) ) ) /* td-rend not needed? */ @@ -6350,7 +6376,13 @@ static ivas_error ivas_dec_init_split_rend( ISAR_SPLIT_REND_ROT_AXIS head_rot_axis; #endif - pcm_out_flag = ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0; + pcm_out_flag = 0; + move16(); + if ( EQ_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) + { + pcm_out_flag = 1; + move16(); + } cldfb_in_flag = 0; move16(); @@ -6384,6 +6416,7 @@ static ivas_error ivas_dec_init_split_rend( head_rot_axis = st_ivas->hHeadTrackData->sr_pose_pred_axis; move32(); } + ISAR_PRE_REND_GetMultiBinPoseData( &st_ivas->hRenderConfig->split_rend_config, &st_ivas->hSplitBinRend->splitrend.multiBinPoseData, head_rot_axis ); num_poses = st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses; @@ -6423,6 +6456,10 @@ static ivas_error ivas_dec_init_split_rend( mixed_td_cldfb_flag = 0; move16(); + test(); + test(); + test(); + test(); IF( ( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV ) && EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) || ( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) && EQ_16( st_ivas->ivas_format, MASA_ISM_FORMAT ) && EQ_16( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) ) ) { -- GitLab From ea1129e20153ed9b1ae41df831fb34533ee45b0e Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 10 Nov 2025 15:39:57 +0100 Subject: [PATCH 4/4] fix --- lib_dec/lib_dec_fx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_dec/lib_dec_fx.c b/lib_dec/lib_dec_fx.c index 513fd8cd7..38c9c2fd1 100644 --- a/lib_dec/lib_dec_fx.c +++ b/lib_dec/lib_dec_fx.c @@ -6249,7 +6249,7 @@ static ivas_error ivas_dec_reconfig_split_rend( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for CLDFB handles\n" ) ); } - num_ch = MAX_HEAD_ROT_POSES, BINAURAL_CHANNELS; + num_ch = MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS; move16(); FOR( ch = 0; ch < num_ch; ch++ ) { @@ -6278,7 +6278,7 @@ static ivas_error ivas_dec_reconfig_split_rend( } ELSE IF( EQ_16( isCldfbNeeded, 0 ) && hSplitRendWrapper->hCldfbHandles != NULL ) { - num_ch = MAX_HEAD_ROT_POSES, BINAURAL_CHANNELS; + num_ch = MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS; move16(); FOR( ch = 0; ch < num_ch; ch++ ) { -- GitLab