From e143622ad839d86410b862dce465bfb49b092eef Mon Sep 17 00:00:00 2001 From: vaclav Date: Thu, 20 Jun 2024 10:49:37 +0200 Subject: [PATCH 1/6] fix use of "renderFramesize" vs. "render_num_subframes" --- apps/decoder.c | 37 +++++++++--------- apps/isar_post_rend.c | 24 ++++++------ apps/renderer.c | 27 ++++++------- lib_com/common_api_types.h | 10 ++--- lib_dec/ivas_init_dec.c | 4 +- lib_dec/ivas_stat_dec.h | 6 +-- lib_dec/lib_dec.c | 60 +++++++++++++++-------------- lib_dec/lib_dec.h | 12 +++--- lib_isar/isar_prot.h | 4 +- lib_isar/isar_splitRendererPre.c | 4 +- lib_isar/isar_splitRenderer_utils.c | 12 +++--- lib_isar/lib_isar_pre_rend.c | 18 ++++----- lib_isar/lib_isar_pre_rend.h | 2 +- 13 files changed, 113 insertions(+), 107 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index 354d611a95..f2268c2eeb 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -135,7 +135,7 @@ typedef struct char *outputMdFilename; IVAS_DEC_COMPLEXITY_LEVEL complexityLevel; bool tsmEnabled; - IVAS_RENDER_FRAMESIZE renderFramesize; + IVAS_RENDER_NUM_SUBFR render_num_subframes; #ifdef DEBUGGING IVAS_DEC_FORCED_REND_MODE forcedRendMode; #ifdef DEBUG_FOA_AGC @@ -196,7 +196,7 @@ int main( Vector3PairFileReader *referenceVectorReader = NULL; RenderConfigReader *renderConfigReader = NULL; int16_t *pcmBuf = NULL; - IVAS_RENDER_FRAMESIZE asked_frame_size; + IVAS_RENDER_NUM_SUBFR asked_num_subframes; IVAS_DEC_HRTF_HANDLE *hHrtfTD = NULL; IVAS_DEC_HRTF_CREND_HANDLE *hSetOfHRTF = NULL; IVAS_DEC_HRTF_STATISTICS_HANDLE *hHrtfStatistics = NULL; @@ -425,21 +425,23 @@ int main( * Configure the decoder *------------------------------------------------------------------------------------------*/ - asked_frame_size = arg.renderFramesize; + asked_num_subframes = arg.render_num_subframes; uint16_t aeID = arg.aeSequence.count > 0 ? arg.aeSequence.pID[0] : 65535; - if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputConfig, arg.tsmEnabled, arg.renderFramesize, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled, arg.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain, + + if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputConfig, arg.tsmEnabled, arg.render_num_subframes, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled, arg.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain, arg.Opt_dpid_on, aeID, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nConfigure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } - if ( ( error = IVAS_DEC_GetRenderFramesize( hIvasDec, &arg.renderFramesize ) ) != IVAS_ERR_OK ) + + if ( ( error = IVAS_DEC_GetRenderNumSubfr( hIvasDec, &arg.render_num_subframes ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nConfigure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } - if ( arg.renderFramesize != asked_frame_size ) + if ( arg.render_num_subframes != asked_num_subframes ) { fprintf( stderr, "\nChanged render framesize, only 20ms are allowed for decoding to EXT!\n" ); } @@ -448,7 +450,6 @@ int main( * Configure Split rendering *------------------------------------------------------------------------------------------*/ - asked_frame_size = arg.renderFramesize; if ( arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { if ( ( error = IVAS_DEC_EnableSplitRendering( hIvasDec ) ) != IVAS_ERR_OK ) @@ -457,7 +458,7 @@ int main( goto cleanup; } - if ( ( error = IVAS_DEC_GetRenderFramesize( hIvasDec, &arg.renderFramesize ) ) != IVAS_ERR_OK ) + if ( ( error = IVAS_DEC_GetRenderNumSubfr( hIvasDec, &arg.render_num_subframes ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nConfigure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; @@ -625,23 +626,23 @@ int main( } if ( arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { - if ( asked_frame_size != IVAS_RENDER_FRAMESIZE_20MS && + if ( asked_num_subframes != IVAS_RENDER_NUM_SUBFR_20MS && ( renderConfig.split_rend_config.poseCorrectionMode == ISAR_SPLIT_REND_POSE_CORRECTION_MODE_NONE || renderConfig.split_rend_config.dof == 0 ) ) { - arg.renderFramesize = asked_frame_size; + arg.render_num_subframes = asked_num_subframes; } else { - arg.renderFramesize = IVAS_RENDER_FRAMESIZE_20MS; + arg.render_num_subframes = IVAS_RENDER_NUM_SUBFR_20MS; } - if ( ( error = IVAS_DEC_SetRenderFramesize( hIvasDec, arg.renderFramesize ) ) != IVAS_ERR_OK ) + if ( ( error = IVAS_DEC_SetRenderFramesize( hIvasDec, arg.render_num_subframes ) ) != IVAS_ERR_OK ) { return error; } - if ( arg.renderFramesize != asked_frame_size ) + if ( arg.render_num_subframes != asked_num_subframes ) { fprintf( stderr, "\nChanged render framesize, only 20ms are allowed for non-0dof split rendering!\n" ); } @@ -667,7 +668,7 @@ int main( /* ISAR frame size is set from command line, not renderer config file. * This will be ignored if output format is not split rendering. */ - renderConfig.split_rend_config.isar_frame_size_ms = (int16_t) arg.renderFramesize /* given in number of 5ms subframes */ * 5; + renderConfig.split_rend_config.isar_frame_size_ms = (int16_t) arg.render_num_subframes * 5; if ( ( error = IVAS_DEC_FeedRenderConfig( hIvasDec, renderConfig ) ) != IVAS_ERR_OK ) { @@ -1074,7 +1075,7 @@ static bool parseCmdlIVAS_dec( arg->Opt_non_diegetic_pan = 0; arg->non_diegetic_pan_gain = 0.f; arg->tsmEnabled = false; - arg->renderFramesize = IVAS_RENDER_FRAMESIZE_20MS; + arg->render_num_subframes = IVAS_RENDER_NUM_SUBFR_20MS; #ifdef DEBUGGING #ifdef VARIABLE_SPEED_DECODING arg->tsmScale = 100; @@ -1288,13 +1289,13 @@ static bool parseCmdlIVAS_dec( switch ( (int16_t) tmp ) { case 5: - arg->renderFramesize = IVAS_RENDER_FRAMESIZE_5MS; + arg->render_num_subframes = IVAS_RENDER_NUM_SUBFR_5MS; break; case 10: - arg->renderFramesize = IVAS_RENDER_FRAMESIZE_10MS; + arg->render_num_subframes = IVAS_RENDER_NUM_SUBFR_10MS; break; case 20: - arg->renderFramesize = IVAS_RENDER_FRAMESIZE_20MS; + arg->render_num_subframes = IVAS_RENDER_NUM_SUBFR_20MS; break; default: fprintf( stderr, "Error: Invalid render frame size %d \n\n", tmp ); diff --git a/apps/isar_post_rend.c b/apps/isar_post_rend.c index 752618406c..70c4b1eabc 100644 --- a/apps/isar_post_rend.c +++ b/apps/isar_post_rend.c @@ -110,7 +110,7 @@ typedef struct bool delayCompensationEnabled; bool quietModeEnabled; bool sceneDescriptionInput; - IVAS_RENDER_FRAMESIZE render_framesize; + IVAS_RENDER_NUM_SUBFR render_num_subframes; } CmdlnArgs; typedef enum @@ -328,26 +328,28 @@ static bool parseInConfig( static bool parseRenderFramesize( char *value, - IVAS_RENDER_FRAMESIZE *render_framesize ) + IVAS_RENDER_NUM_SUBFR *render_num_subframes ) { int32_t tmp; - *render_framesize = IVAS_RENDER_FRAMESIZE_UNKNOWN; + *render_num_subframes = IVAS_RENDER_NUM_SUBFR_UNKNOWN; + if ( !is_digits_only( value ) ) { return false; } + tmp = (int32_t) strtol( value, NULL, 0 ); switch ( (int16_t) tmp ) { case 5: - *render_framesize = IVAS_RENDER_FRAMESIZE_5MS; + *render_num_subframes = IVAS_RENDER_NUM_SUBFR_5MS; break; case 10: - *render_framesize = IVAS_RENDER_FRAMESIZE_10MS; + *render_num_subframes = IVAS_RENDER_NUM_SUBFR_10MS; break; case 20: - *render_framesize = IVAS_RENDER_FRAMESIZE_20MS; + *render_num_subframes = IVAS_RENDER_NUM_SUBFR_20MS; break; default: return false; @@ -452,7 +454,7 @@ static CmdlnArgs defaultArgs( args.quietModeEnabled = false; args.sceneDescriptionInput = false; - args.render_framesize = IVAS_RENDER_FRAMESIZE_20MS; + args.render_num_subframes = IVAS_RENDER_NUM_SUBFR_20MS; return args; } @@ -535,7 +537,7 @@ static void parseOption( break; case CmdLnOptionId_framing: assert( numOptionValues == 1 ); - if ( !parseRenderFramesize( optionValues[0], &args->render_framesize ) ) + if ( !parseRenderFramesize( optionValues[0], &args->render_num_subframes ) ) { fprintf( stderr, "Unknown or invalid option for frame size: %s\n", optionValues[0] ); exit( -1 ); @@ -859,9 +861,9 @@ int main( * Open ISAR handle *------------------------------------------------------------------------------------------*/ - const int16_t frameSize_smpls = (int16_t) ( ( args.render_framesize ) * args.sampleRate * 5 / ( 1000 ) ); + const int16_t frameSize_smpls = (int16_t) ( ( args.render_num_subframes ) * args.sampleRate * 5 / ( 1000 ) ); args.outConfig.audioConfig = IVAS_AUDIO_CONFIG_BINAURAL; - if ( ( error = ISAR_POST_REND_open( &hIsarPostRend, args.sampleRate, args.outConfig.audioConfig, true, 0, 0.0, (int16_t) args.render_framesize ) ) != IVAS_ERR_OK ) + if ( ( error = ISAR_POST_REND_open( &hIsarPostRend, args.sampleRate, args.outConfig.audioConfig, true, 0, 0.0, (int16_t) args.render_num_subframes ) ) != IVAS_ERR_OK ) { fprintf( stderr, "Error opening renderer handle: %s\n", ivas_error_to_string( error ) ); exit( -1 ); @@ -1028,7 +1030,7 @@ int main( convertInputBuffer( inpInt16Buffer, numSamplesRead, inBuffer.config.numSamplesPerChannel, num_in_channels, inFloatBuffer ); int16_t num_subframes, sf_idx; - num_subframes = (int16_t) args.render_framesize; + num_subframes = (int16_t) args.render_num_subframes; /* Read from head rotation trajectory file if specified */ if ( headRotReader != NULL ) diff --git a/apps/renderer.c b/apps/renderer.c index cf97acf947..2f302723e3 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -183,7 +183,7 @@ typedef struct bool lfeCustomRoutingEnabled; char inLfePanningMatrixFile[RENDERER_MAX_CLI_ARG_LENGTH]; float syncMdDelay; - IVAS_RENDER_FRAMESIZE render_framesize; + IVAS_RENDER_NUM_SUBFR render_num_subframes; uint16_t directivityPatternId[RENDERER_MAX_ISM_INPUTS]; AcousticEnvironmentSequence aeSequence; } CmdlnArgs; @@ -880,9 +880,9 @@ int main( exit( -1 ); } - const int16_t frameSize_smpls = (int16_t) ( ( args.render_framesize ) * args.sampleRate * 5 / ( 1000 ) ); + const int16_t frameSize_smpls = (int16_t) ( ( args.render_num_subframes ) * args.sampleRate * 5 / ( 1000 ) ); - if ( ( error = IVAS_REND_Open( &hIvasRend, args.sampleRate, args.outConfig.audioConfig, !isEmptyString( args.customHrtfFilePath ), args.nonDiegeticPan, args.nonDiegeticPanGain, (int16_t) args.render_framesize ) ) != IVAS_ERR_OK ) + if ( ( error = IVAS_REND_Open( &hIvasRend, args.sampleRate, args.outConfig.audioConfig, !isEmptyString( args.customHrtfFilePath ), args.nonDiegeticPan, args.nonDiegeticPanGain, (int16_t) args.render_num_subframes ) ) != IVAS_ERR_OK ) { fprintf( stderr, "Error opening renderer handle: %s\n", ivas_error_to_string( error ) ); exit( -1 ); @@ -1047,7 +1047,7 @@ int main( /* ISAR frame size is set from command line, not renderer config file. * This will be ignored if output format is not split rendering. */ - renderConfig.split_rend_config.isar_frame_size_ms = (int16_t) args.render_framesize /* given in number of 5ms subframes */ * 5; + renderConfig.split_rend_config.isar_frame_size_ms = (int16_t) args.render_num_subframes * 5; if ( ( error = IVAS_REND_FeedRenderConfig( hIvasRend, renderConfig ) ) != IVAS_ERR_OK ) { @@ -1424,7 +1424,7 @@ int main( { int16_t num_in_channels; num_in_channels = inBuffer.config.numChannels; - const bool isCurrentFrameMultipleOf20ms = frame % ( 4 / args.render_framesize ) == 0; + const bool isCurrentFrameMultipleOf20ms = frame % ( 4 / args.render_num_subframes ) == 0; if ( args.outConfig.audioConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB && renderConfigReader != NULL && args.aeSequence.count > 0 && args.aeSequence.pValidity[args.aeSequence.selected] != 0 ) @@ -1475,7 +1475,7 @@ int main( convertInputBuffer( inpInt16Buffer, numSamplesRead, inBuffer.config.numSamplesPerChannel, num_in_channels, inFloatBuffer, inBuffer.config.is_cldfb, cldfbAna ); int16_t num_subframes, sf_idx; - num_subframes = (int16_t) args.render_framesize; + num_subframes = (int16_t) args.render_num_subframes; if ( isCurrentFrameMultipleOf20ms ) { @@ -2176,26 +2176,27 @@ static bool parseDiegeticPan( static bool parseRenderFramesize( char *value, - IVAS_RENDER_FRAMESIZE *render_framesize ) + IVAS_RENDER_NUM_SUBFR *render_num_subframes ) { int32_t tmp; - *render_framesize = IVAS_RENDER_FRAMESIZE_UNKNOWN; + *render_num_subframes = IVAS_RENDER_NUM_SUBFR_UNKNOWN; if ( !is_digits_only( value ) ) { return false; } + tmp = (int32_t) strtol( value, NULL, 0 ); switch ( (int16_t) tmp ) { case 5: - *render_framesize = IVAS_RENDER_FRAMESIZE_5MS; + *render_num_subframes = IVAS_RENDER_NUM_SUBFR_5MS; break; case 10: - *render_framesize = IVAS_RENDER_FRAMESIZE_10MS; + *render_num_subframes = IVAS_RENDER_NUM_SUBFR_10MS; break; case 20: - *render_framesize = IVAS_RENDER_FRAMESIZE_20MS; + *render_num_subframes = IVAS_RENDER_NUM_SUBFR_20MS; break; default: return false; @@ -2526,7 +2527,7 @@ static CmdlnArgs defaultArgs( args.lfeCustomRoutingEnabled = false; clearString( args.inLfePanningMatrixFile ); - args.render_framesize = IVAS_RENDER_FRAMESIZE_20MS; + args.render_num_subframes = IVAS_RENDER_NUM_SUBFR_20MS; args.syncMdDelay = 0; for ( int32_t i = 0; i < RENDERER_MAX_ISM_INPUTS; ++i ) @@ -2692,7 +2693,7 @@ static void parseOption( break; case CmdLnOptionId_framing: assert( numOptionValues == 1 ); - if ( !parseRenderFramesize( optionValues[0], &args->render_framesize ) ) + if ( !parseRenderFramesize( optionValues[0], &args->render_num_subframes ) ) { fprintf( stderr, "Unknown or invalid option for frame size: %s\n", optionValues[0] ); exit( -1 ); diff --git a/lib_com/common_api_types.h b/lib_com/common_api_types.h index 279e00b986..e95b4039d1 100644 --- a/lib_com/common_api_types.h +++ b/lib_com/common_api_types.h @@ -155,12 +155,12 @@ typedef enum typedef enum { - IVAS_RENDER_FRAMESIZE_UNKNOWN = 0, - IVAS_RENDER_FRAMESIZE_5MS = 1, - IVAS_RENDER_FRAMESIZE_10MS = 2, - IVAS_RENDER_FRAMESIZE_20MS = 4 + IVAS_RENDER_NUM_SUBFR_UNKNOWN = 0, + IVAS_RENDER_NUM_SUBFR_5MS = 1, + IVAS_RENDER_NUM_SUBFR_10MS = 2, + IVAS_RENDER_NUM_SUBFR_20MS = 4 -} IVAS_RENDER_FRAMESIZE; +} IVAS_RENDER_NUM_SUBFR; typedef struct ivas_masa_metadata_frame_struct *IVAS_MASA_METADATA_HANDLE; typedef struct ivas_masa_decoder_ext_out_meta_struct *IVAS_MASA_DECODER_EXT_OUT_META_HANDLE; diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 92859dc966..3cb802695d 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -822,7 +822,7 @@ ivas_error ivas_init_decoder_front( if ( st_ivas->hDecoderConfig->Opt_ExternalOrientation ) { - if ( ( error = ivas_external_orientation_open( &( st_ivas->hExtOrientationData ), st_ivas->hDecoderConfig->render_framesize ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_external_orientation_open( &( st_ivas->hExtOrientationData ), st_ivas->hDecoderConfig->render_num_subframes ) ) != IVAS_ERR_OK ) { return error; } @@ -834,7 +834,7 @@ ivas_error ivas_init_decoder_front( if ( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation ) { - if ( ( error = ivas_combined_orientation_open( &( st_ivas->hCombinedOrientationData ), st_ivas->hDecoderConfig->output_Fs, st_ivas->hDecoderConfig->render_framesize ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_combined_orientation_open( &( st_ivas->hCombinedOrientationData ), st_ivas->hDecoderConfig->output_Fs, st_ivas->hDecoderConfig->render_num_subframes ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index 8f096dd705..856941ebc8 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -997,9 +997,9 @@ typedef struct decoder_config_structure /* temp. development parameters */ int16_t force_rend; /* forced TD/CLDFB binaural renderer (for ISM and MC) */ #endif - int16_t Opt_tsm; /* indicates whether time scaling modification is activated */ - IVAS_RENDER_FRAMESIZE render_framesize; - int16_t Opt_delay_comp; /* flag indicating delay compensation active */ + int16_t Opt_tsm; /* indicates whether time scaling modification is activated */ + IVAS_RENDER_NUM_SUBFR render_num_subframes; /* renderer number of subframes */ + int16_t Opt_delay_comp; /* flag indicating delay compensation active */ } DECODER_CONFIG, *DECODER_CONFIG_HANDLE; diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 66032833c1..17f5a3e9b6 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -123,7 +123,7 @@ 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 int16_t get_render_frame_size_ms( IVAS_RENDER_FRAMESIZE render_framesize ); +static int16_t get_render_frame_size_ms( IVAS_RENDER_NUM_SUBFR render_num_subfr ); static void update_voip_rendered20ms( IVAS_DEC_HANDLE hIvasDec, const int16_t nSamplesRendered ); /*---------------------------------------------------------------------* @@ -405,7 +405,7 @@ ivas_error IVAS_DEC_Configure( const uint32_t sampleRate, /* i : output sampling frequency */ const AUDIO_CONFIG outputConfig, /* i : output configuration */ const int16_t tsmEnabled, /* i : enable time scale modification */ - const IVAS_RENDER_FRAMESIZE renderFramesize, /* i : rendering frame size */ + const IVAS_RENDER_NUM_SUBFR render_num_subframes, /* i : rendering number of subframes */ const int16_t customLsOutputEnabled, /* i : enable custom loudspeaker setup handle */ const int16_t hrtfReaderEnabled, /* i : enable HRTF binary file input */ const int16_t enableHeadRotation, /* i : enable head rotation for binaural output */ @@ -476,17 +476,18 @@ ivas_error IVAS_DEC_Configure( hDecoderConfig->Opt_dpid_on = Opt_dpid_on; hDecoderConfig->Opt_aeid_on = acousticEnvironmentId != 65535 ? TRUE : FALSE; - if ( renderFramesize == IVAS_RENDER_FRAMESIZE_UNKNOWN ) + if ( render_num_subframes == IVAS_RENDER_NUM_SUBFR_UNKNOWN ) { return IVAS_ERR_WRONG_PARAMS; } + if ( outputConfig == IVAS_AUDIO_CONFIG_EXTERNAL ) { - hDecoderConfig->render_framesize = IVAS_RENDER_FRAMESIZE_20MS; + hDecoderConfig->render_num_subframes = IVAS_RENDER_NUM_SUBFR_20MS; } else { - hDecoderConfig->render_framesize = renderFramesize; + hDecoderConfig->render_num_subframes = render_num_subframes; } if ( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) @@ -545,7 +546,7 @@ ivas_error IVAS_DEC_EnableSplitRendering( hDecoderConfig = hIvasDec->st_ivas->hDecoderConfig; hDecoderConfig->Opt_Headrotation = 1; - hDecoderConfig->render_framesize = IVAS_RENDER_FRAMESIZE_20MS; + hDecoderConfig->render_num_subframes = IVAS_RENDER_NUM_SUBFR_20MS; return IVAS_ERR_OK; } @@ -557,9 +558,9 @@ ivas_error IVAS_DEC_EnableSplitRendering( *---------------------------------------------------------------------*/ int16_t get_render_frame_size_ms( - const IVAS_RENDER_FRAMESIZE render_framesize ) + const IVAS_RENDER_NUM_SUBFR render_num_subframes ) { - return (int16_t) ( render_framesize * ( 1000 / ( FRAMES_PER_SEC * IVAS_MAX_PARAM_SPATIAL_SUBFRAMES ) ) ); + return (int16_t) ( render_num_subframes * ( 1000 / ( FRAMES_PER_SEC * IVAS_MAX_PARAM_SPATIAL_SUBFRAMES ) ) ); } @@ -570,8 +571,8 @@ int16_t get_render_frame_size_ms( *---------------------------------------------------------------------*/ ivas_error IVAS_DEC_SetRenderFramesize( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - const IVAS_RENDER_FRAMESIZE render_framesize /* i : render framesize */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + const IVAS_RENDER_NUM_SUBFR render_num_subframes /* i : renderer number of subframes */ ) { if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL || hIvasDec->st_ivas->hDecoderConfig == NULL ) @@ -579,37 +580,38 @@ ivas_error IVAS_DEC_SetRenderFramesize( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } - hIvasDec->st_ivas->hDecoderConfig->render_framesize = render_framesize; + hIvasDec->st_ivas->hDecoderConfig->render_num_subframes = render_num_subframes; if ( hIvasDec->st_ivas->hExtOrientationData != NULL ) { - hIvasDec->st_ivas->hExtOrientationData->num_subframes = (int16_t) render_framesize; + hIvasDec->st_ivas->hExtOrientationData->num_subframes = (int16_t) render_num_subframes; } + if ( hIvasDec->st_ivas->hCombinedOrientationData != NULL ) { - hIvasDec->st_ivas->hCombinedOrientationData->num_subframes = (int16_t) render_framesize; + hIvasDec->st_ivas->hCombinedOrientationData->num_subframes = (int16_t) render_num_subframes; } return IVAS_ERR_OK; } /*---------------------------------------------------------------------* - * IVAS_DEC_GetGetRenderFramesize( ) + * IVAS_DEC_GetRenderNumSubfr( ) * - * Get the 5ms flag + * Get number of rendering subframes *---------------------------------------------------------------------*/ -ivas_error IVAS_DEC_GetRenderFramesize( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - IVAS_RENDER_FRAMESIZE *render_framesize /* o : render framesize */ +ivas_error IVAS_DEC_GetRenderNumSubfr( + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + IVAS_RENDER_NUM_SUBFR *render_num_subframes /* o : rendering number of subframes */ ) { - if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL || render_framesize == NULL ) + if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL || render_num_subframes == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } - *render_framesize = hIvasDec->st_ivas->hDecoderConfig->render_framesize; + *render_num_subframes = hIvasDec->st_ivas->hDecoderConfig->render_num_subframes; return IVAS_ERR_OK; } @@ -630,7 +632,7 @@ ivas_error IVAS_DEC_GetRenderFramesizeSamples( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } - *render_framesize = (int16_t) ( hIvasDec->st_ivas->hDecoderConfig->output_Fs * hIvasDec->st_ivas->hDecoderConfig->render_framesize / ( FRAMES_PER_SEC * IVAS_MAX_PARAM_SPATIAL_SUBFRAMES ) ); + *render_framesize = (int16_t) ( hIvasDec->st_ivas->hDecoderConfig->output_Fs * hIvasDec->st_ivas->hDecoderConfig->render_num_subframes / ( FRAMES_PER_SEC * IVAS_MAX_PARAM_SPATIAL_SUBFRAMES ) ); return IVAS_ERR_OK; } @@ -651,7 +653,7 @@ ivas_error IVAS_DEC_GetRenderFramesizeMs( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } - *render_framesize = get_render_frame_size_ms( hIvasDec->st_ivas->hDecoderConfig->render_framesize ); + *render_framesize = get_render_frame_size_ms( hIvasDec->st_ivas->hDecoderConfig->render_num_subframes ); return IVAS_ERR_OK; } @@ -672,7 +674,7 @@ ivas_error IVAS_DEC_GetReferencesUpdateFrequency( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } - *update_frequency = (int16_t) ( IVAS_MAX_PARAM_SPATIAL_SUBFRAMES / hIvasDec->st_ivas->hDecoderConfig->render_framesize ); + *update_frequency = (int16_t) ( IVAS_MAX_PARAM_SPATIAL_SUBFRAMES / hIvasDec->st_ivas->hDecoderConfig->render_num_subframes ); return IVAS_ERR_OK; } @@ -693,7 +695,7 @@ ivas_error IVAS_DEC_GetNumOrientationSubframes( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } - *num_subframes = (int16_t) hIvasDec->st_ivas->hDecoderConfig->render_framesize; + *num_subframes = (int16_t) hIvasDec->st_ivas->hDecoderConfig->render_num_subframes; return IVAS_ERR_OK; } @@ -1102,12 +1104,12 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream( numPoses = hSplitBinRend->splitrend.multiBinPoseData.num_poses; - if ( st_ivas->hDecoderConfig->render_framesize != IVAS_RENDER_FRAMESIZE_20MS && + if ( st_ivas->hDecoderConfig->render_num_subframes != IVAS_RENDER_NUM_SUBFR_20MS && ( hIvasDec->st_ivas->hRenderConfig->split_rend_config.poseCorrectionMode == ISAR_SPLIT_REND_POSE_CORRECTION_MODE_NONE || hIvasDec->st_ivas->hRenderConfig->split_rend_config.dof == 0 ) ) { numSamplesPerChannelToDecode = (int16_t) ( output_Fs / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES ); - numSamplesPerChannelToDecode *= (int16_t) st_ivas->hDecoderConfig->render_framesize; + numSamplesPerChannelToDecode *= (int16_t) st_ivas->hDecoderConfig->render_num_subframes; } if ( is_split_rendering_enabled( st_ivas->hDecoderConfig, st_ivas->hRenderConfig ) == 0 ) @@ -1219,7 +1221,7 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream( /* convert to int16 with limiting for BINAURAL_SPLIT_PCM */ if ( pcm_out_flag ) { - if ( st_ivas->hDecoderConfig->render_framesize == IVAS_RENDER_FRAMESIZE_5MS ) + if ( st_ivas->hDecoderConfig->render_num_subframes == IVAS_RENDER_NUM_SUBFR_5MS ) { #ifndef DISABLE_LIMITER ivas_limiter_dec( st_ivas->hLimiter, pOutput, st_ivas->hDecoderConfig->nchan_out, numSamplesPerChannelToDecode, st_ivas->BER_detect ); @@ -3131,7 +3133,7 @@ static ivas_error printConfigInfo_dec( if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { - fprintf( stdout, "Render framesize: %dms\n", get_render_frame_size_ms( st_ivas->hDecoderConfig->render_framesize ) ); + fprintf( stdout, "Render number of subframes: %dms\n", get_render_frame_size_ms( st_ivas->hDecoderConfig->render_num_subframes ) ); } if ( st_ivas->hDecoderConfig->Opt_HRTF_binary ) { @@ -4130,7 +4132,7 @@ static ivas_error ivas_dec_init_split_rend( mixed_td_cldfb_flag = 1; } - error = ISAR_PRE_REND_open( &st_ivas->hSplitBinRend->splitrend, &st_ivas->hRenderConfig->split_rend_config, st_ivas->hDecoderConfig->output_Fs, cldfb_in_flag, pcm_out_flag, (int16_t) st_ivas->hDecoderConfig->render_framesize, mixed_td_cldfb_flag ); + error = ISAR_PRE_REND_open( &st_ivas->hSplitBinRend->splitrend, &st_ivas->hRenderConfig->split_rend_config, st_ivas->hDecoderConfig->output_Fs, cldfb_in_flag, pcm_out_flag, (int16_t) st_ivas->hDecoderConfig->render_num_subframes, mixed_td_cldfb_flag ); return error; } diff --git a/lib_dec/lib_dec.h b/lib_dec/lib_dec.h index 0be389a61d..c78cf837bf 100644 --- a/lib_dec/lib_dec.h +++ b/lib_dec/lib_dec.h @@ -123,7 +123,7 @@ ivas_error IVAS_DEC_Configure( const uint32_t sampleRate, /* i : output sampling frequency */ const IVAS_AUDIO_CONFIG outputConfig, /* i : audio configuration */ const int16_t tsmEnabled, /* i : enable TSM */ - const IVAS_RENDER_FRAMESIZE renderFramesize, /* i : rendering frame size */ + const IVAS_RENDER_NUM_SUBFR render_num_subframes, /* i : rendering number of subrames */ const int16_t customLsOutputEnabled, /* i : enable custom loudspeaker setup handle */ const int16_t hrtfReaderEnabled, /* i : enable HRTF binary file input */ const int16_t enableHeadRotation, /* i : enable head rotation for binaural output */ @@ -307,13 +307,13 @@ ivas_error IVAS_DEC_EnableSplitRendering( ); ivas_error IVAS_DEC_SetRenderFramesize( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - const IVAS_RENDER_FRAMESIZE render_framesize /* i : render framesize */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + const IVAS_RENDER_NUM_SUBFR render_num_subframes /* i : rendering number of subframes */ ); -ivas_error IVAS_DEC_GetRenderFramesize( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - IVAS_RENDER_FRAMESIZE *render_framesize /* o : render framesize */ +ivas_error IVAS_DEC_GetRenderNumSubfr( + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + IVAS_RENDER_NUM_SUBFR *render_num_subframes /* o : rendering number of subframes */ ); ivas_error IVAS_DEC_GetRenderFramesizeSamples( diff --git a/lib_isar/isar_prot.h b/lib_isar/isar_prot.h index d9a37dc136..5188176493 100644 --- a/lib_isar/isar_prot.h +++ b/lib_isar/isar_prot.h @@ -58,7 +58,7 @@ ivas_error split_renderer_open_lc3plus( SPLIT_REND_WRAPPER *hSplitRendWrapper, /* i/o: Split renderer pre-renderer handle */ const ISAR_SPLIT_REND_CONFIG_DATA *pSplitRendConfig, /* i : Split renderer pre-renderer config */ const int32_t output_Fs, /* i : output sampling rate */ - const IVAS_RENDER_FRAMESIZE ivas_frame_size /* i : IVAS frame size */ + const IVAS_RENDER_NUM_SUBFR render_num_subframes /* i : rendering number of subframes */ ); void isar_splitBinPreRendClose( @@ -353,7 +353,7 @@ int32_t isar_get_split_rend_md_target_brate( ); ivas_error isar_framesize_to_ms( - const IVAS_RENDER_FRAMESIZE frame_size, /* i : frame size enum */ + const IVAS_RENDER_NUM_SUBFR render_num_subframes, /* i : rendering number of subframes */ int16_t *ms /* o : frame size in ms */ ); diff --git a/lib_isar/isar_splitRendererPre.c b/lib_isar/isar_splitRendererPre.c index 4cd4855ecc..284f9b3ac3 100644 --- a/lib_isar/isar_splitRendererPre.c +++ b/lib_isar/isar_splitRendererPre.c @@ -1735,7 +1735,7 @@ ivas_error split_renderer_open_lc3plus( SPLIT_REND_WRAPPER *hSplitRendWrapper, /* i/o: Split renderer pre-renderer handle */ const ISAR_SPLIT_REND_CONFIG_DATA *pSplitRendConfig, /* i : Split renderer pre-renderer config */ const int32_t output_Fs, /* i : output sampling rate */ - const IVAS_RENDER_FRAMESIZE isar_frame_size /* i : IVAS frame size */ + const IVAS_RENDER_NUM_SUBFR render_num_subframes /* i : rendering number of subframes */ ) { ivas_error error; @@ -1743,7 +1743,7 @@ ivas_error split_renderer_open_lc3plus( LC3PLUS_CONFIG config; int16_t isar_frame_size_ms; - if ( ( error = isar_framesize_to_ms( isar_frame_size, &isar_frame_size_ms ) ) != IVAS_ERR_OK ) + if ( ( error = isar_framesize_to_ms( render_num_subframes, &isar_frame_size_ms ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_isar/isar_splitRenderer_utils.c b/lib_isar/isar_splitRenderer_utils.c index 40c2f73951..a8d2f67b72 100644 --- a/lib_isar/isar_splitRenderer_utils.c +++ b/lib_isar/isar_splitRenderer_utils.c @@ -1039,19 +1039,19 @@ void isar_init_multi_bin_pose_data( *------------------------------------------------------------------------*/ ivas_error isar_framesize_to_ms( - const IVAS_RENDER_FRAMESIZE frame_size, /* i : frame size enum */ - int16_t *ms /* o : frame size in ms */ + const IVAS_RENDER_NUM_SUBFR render_num_subframes, /* i : rendering number of subframes */ + int16_t *ms /* o : frame size in ms */ ) { - switch ( frame_size ) + switch ( render_num_subframes ) { - case IVAS_RENDER_FRAMESIZE_5MS: + case IVAS_RENDER_NUM_SUBFR_5MS: *ms = 5; break; - case IVAS_RENDER_FRAMESIZE_10MS: + case IVAS_RENDER_NUM_SUBFR_10MS: *ms = 10; break; - case IVAS_RENDER_FRAMESIZE_20MS: + case IVAS_RENDER_NUM_SUBFR_20MS: *ms = 20; break; default: diff --git a/lib_isar/lib_isar_pre_rend.c b/lib_isar/lib_isar_pre_rend.c index b5090b38c1..106a45570d 100644 --- a/lib_isar/lib_isar_pre_rend.c +++ b/lib_isar/lib_isar_pre_rend.c @@ -53,20 +53,20 @@ *------------------------------------------------------------------------*/ ivas_error ISAR_PRE_REND_open( - SPLIT_REND_WRAPPER *hSplitBinRend, /* i/o: Split renderer pre-renerer handle */ - ISAR_SPLIT_REND_CONFIG_DATA *pSplitRendConfig, /* i/o: Split renderer pre-renerer config */ - const int32_t output_Fs, /* i : output sampling rate */ - const int16_t cldfb_in_flag, /* i : Flag to indicate CLDFB or time doamin input */ - const int16_t pcm_out_flag, /* i : Flag to indicate PCM output */ - const IVAS_RENDER_FRAMESIZE ivas_frame_size, /* i : IVAS frame size */ - const int16_t mixed_td_cldfb_flag /* i : Flag to indicate combined TD and CLDFB input */ + SPLIT_REND_WRAPPER *hSplitBinRend, /* i/o: Split renderer pre-renerer handle */ + ISAR_SPLIT_REND_CONFIG_DATA *pSplitRendConfig, /* i/o: Split renderer pre-renerer config */ + const int32_t output_Fs, /* i : output sampling rate */ + const int16_t cldfb_in_flag, /* i : Flag to indicate CLDFB or time doamin input */ + const int16_t pcm_out_flag, /* i : Flag to indicate PCM output */ + const IVAS_RENDER_NUM_SUBFR render_num_subframes, /* i : rendering number of subframes */ + const int16_t mixed_td_cldfb_flag /* i : Flag to indicate combined TD and CLDFB input */ ) { ivas_error error, ch, num_ch; uint8_t isCldfbNeeded = 0; int16_t cldfb_in_flag_local = cldfb_in_flag; - if ( ( error = isar_split_rend_choose_default_codec( &( pSplitRendConfig->codec ), &pSplitRendConfig->isar_frame_size_ms, &pSplitRendConfig->codec_frame_size_ms, cldfb_in_flag_local, pcm_out_flag, (int16_t) ivas_frame_size ) ) != IVAS_ERR_OK ) + if ( ( error = isar_split_rend_choose_default_codec( &( pSplitRendConfig->codec ), &pSplitRendConfig->isar_frame_size_ms, &pSplitRendConfig->codec_frame_size_ms, cldfb_in_flag_local, pcm_out_flag, (int16_t) render_num_subframes ) ) != IVAS_ERR_OK ) { return error; } @@ -148,7 +148,7 @@ ivas_error ISAR_PRE_REND_open( { if ( pSplitRendConfig->codec == ISAR_SPLIT_REND_CODEC_LC3PLUS ) { - if ( ( error = split_renderer_open_lc3plus( hSplitBinRend, pSplitRendConfig, output_Fs, ivas_frame_size ) ) != IVAS_ERR_OK ) + if ( ( error = split_renderer_open_lc3plus( hSplitBinRend, pSplitRendConfig, output_Fs, render_num_subframes ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_isar/lib_isar_pre_rend.h b/lib_isar/lib_isar_pre_rend.h index 02e37dfa48..412329c453 100644 --- a/lib_isar/lib_isar_pre_rend.h +++ b/lib_isar/lib_isar_pre_rend.h @@ -48,7 +48,7 @@ ivas_error ISAR_PRE_REND_open( const int32_t output_Fs, /* i : output sampling rate */ const int16_t cldfb_in_flag, /* i : Flag to indicate CLDFB or time doamin input */ const int16_t pcm_out_flag, /* i : Flag to indicate PCM output */ - const IVAS_RENDER_FRAMESIZE ivas_frame_size, /* i : IVAS frame size */ + const IVAS_RENDER_NUM_SUBFR render_num_subframes, /* i : rendering number of subframes */ const int16_t mixed_td_cldfb_flag /* i : Flag to indicate combined TD and CLDFB input */ ); -- GitLab From 31142848da643634d4ddbbef8c93f3a8f97dd3d3 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 25 Jun 2024 08:48:16 +0200 Subject: [PATCH 2/6] replace hard-coded number by a define const --- apps/isar_post_rend.c | 2 +- apps/renderer.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/isar_post_rend.c b/apps/isar_post_rend.c index 70c4b1eabc..78f0a904c4 100644 --- a/apps/isar_post_rend.c +++ b/apps/isar_post_rend.c @@ -861,7 +861,7 @@ int main( * Open ISAR handle *------------------------------------------------------------------------------------------*/ - const int16_t frameSize_smpls = (int16_t) ( ( args.render_num_subframes ) * args.sampleRate * 5 / ( 1000 ) ); + const int16_t frameSize_smpls = (int16_t) ( ( args.render_num_subframes ) * args.sampleRate * BINAURAL_RENDERING_FRAME_SIZE_MS / ( 1000 ) ); args.outConfig.audioConfig = IVAS_AUDIO_CONFIG_BINAURAL; if ( ( error = ISAR_POST_REND_open( &hIsarPostRend, args.sampleRate, args.outConfig.audioConfig, true, 0, 0.0, (int16_t) args.render_num_subframes ) ) != IVAS_ERR_OK ) { diff --git a/apps/renderer.c b/apps/renderer.c index 2f302723e3..2ed4fee1f9 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -880,7 +880,7 @@ int main( exit( -1 ); } - const int16_t frameSize_smpls = (int16_t) ( ( args.render_num_subframes ) * args.sampleRate * 5 / ( 1000 ) ); + const int16_t frameSize_smpls = (int16_t) ( ( args.render_num_subframes ) * args.sampleRate * BINAURAL_RENDERING_FRAME_SIZE_MS / ( 1000 ) ); if ( ( error = IVAS_REND_Open( &hIvasRend, args.sampleRate, args.outConfig.audioConfig, !isEmptyString( args.customHrtfFilePath ), args.nonDiegeticPan, args.nonDiegeticPanGain, (int16_t) args.render_num_subframes ) ) != IVAS_ERR_OK ) { -- GitLab From d1e5fd1cc8061cc883cf3726ff02cae6c19e2c61 Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 20 Nov 2024 12:32:44 +0100 Subject: [PATCH 3/6] remove duplicated API function for getting number of rendering subframes; under FIX_945_REMOVE_DUPLICATED_API_FUNC; improve formal aspects --- apps/decoder.c | 25 ++++++++++++++++++++++++- lib_com/options.h | 2 +- lib_dec/lib_dec.c | 29 +++++++++++++++++------------ lib_dec/lib_dec.h | 24 +++++++++++++----------- 4 files changed, 55 insertions(+), 25 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index be666995f0..2c323f3550 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -639,11 +639,13 @@ int main( fprintf( stderr, "Failed to get directivity patterns for one or more of IDs: %d %d %d %d\n\n", arg.directivityPatternId[0], arg.directivityPatternId[1], arg.directivityPatternId[2], arg.directivityPatternId[3] ); goto cleanup; } + if ( ( error = RenderConfigReader_getDistanceAttenuation( renderConfigReader, renderConfig.distAtt ) ) != IVAS_ERR_OK ) { fprintf( stderr, "Failed to get Distance Attenuation \n\n" ); goto cleanup; } + if ( arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { if ( asked_num_subframes != IVAS_RENDER_NUM_SUBFR_20MS && @@ -657,7 +659,7 @@ int main( arg.render_num_subframes = IVAS_RENDER_NUM_SUBFR_20MS; } - if ( ( error = IVAS_DEC_SetRenderFramesize( hIvasDec, arg.render_num_subframes ) ) != IVAS_ERR_OK ) + if ( ( error = IVAS_DEC_SetRenderNumSubfr( hIvasDec, arg.render_num_subframes ) ) != IVAS_ERR_OK ) { return error; } @@ -2201,6 +2203,15 @@ static ivas_error decodeG192( } } +#ifdef FIX_945_REMOVE_DUPLICATED_API_FUNC + IVAS_RENDER_NUM_SUBFR num_subframes; + if ( ( error = IVAS_DEC_GetRenderNumSubfr( hIvasDec, &num_subframes ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nIVAS_DEC_GetRenderNumSubfr failed: %s\n", IVAS_DEC_GetErrorMessage( error ) ); + goto cleanup; + } + +#else int16_t num_subframes; if ( ( error = IVAS_DEC_GetNumOrientationSubframes( hIvasDec, &num_subframes ) ) != IVAS_ERR_OK ) { @@ -2208,6 +2219,7 @@ static ivas_error decodeG192( goto cleanup; } /* Head-tracking input simulation */ +#endif /* Head-tracking input simulation */ if ( arg.enableHeadRotation ) { @@ -3128,6 +3140,16 @@ static ivas_error decodeVoIP( goto cleanup; } } + +#ifdef FIX_945_REMOVE_DUPLICATED_API_FUNC + IVAS_RENDER_NUM_SUBFR num_subframes; + if ( ( error = IVAS_DEC_GetRenderNumSubfr( hIvasDec, &num_subframes ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nIVAS_DEC_GetRenderNumSubfr failed: %s\n", IVAS_DEC_GetErrorMessage( error ) ); + goto cleanup; + } + +#else int16_t num_subframes; if ( ( error = IVAS_DEC_GetNumOrientationSubframes( hIvasDec, &num_subframes ) ) != IVAS_ERR_OK ) { @@ -3136,6 +3158,7 @@ static ivas_error decodeVoIP( } /* Head-tracking input simulation */ +#endif /* Head-tracking input simulation */ if ( arg.enableHeadRotation ) { diff --git a/lib_com/options.h b/lib_com/options.h index 356e84c929..856dceed4a 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -163,7 +163,7 @@ /*#define FIX_I4_OL_PITCH*/ /* fix open-loop pitch used for EVS core switching */ #define TMP_FIX_1119_SPLIT_RENDERING_VOIP /* FhG: Add error check for unsupported config: split rendering with VoIP mode */ #define FIX_1209_SID_SIGNALING /* VA: issue 1209: remove dead code in IVAS SID signaling */ - +#define FIX_945_REMOVE_DUPLICATED_API_FUNC /* VA: issue 945: remove duplicated API function for getting number of rendering subframes */ /* #################### End BE switches ################################## */ diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index c2a2d713d8..53067dfd3f 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -581,9 +581,10 @@ ivas_error IVAS_DEC_EnableSplitRendering( /*---------------------------------------------------------------------* * get_render_framesize_ms( ) * - * Get the 5ms flag + * Get render framesize in ms *---------------------------------------------------------------------*/ +/*! r: render framesize in ms */ static int16_t get_render_frame_size_ms( const IVAS_RENDER_NUM_SUBFR render_num_subframes ) { @@ -592,12 +593,12 @@ static int16_t get_render_frame_size_ms( /*---------------------------------------------------------------------* - * IVAS_DEC_SetRenderFramesize( ) + * IVAS_DEC_SetRenderNumSubfr( ) * - * Get the 5ms flag + * Set number of rendering subframes *---------------------------------------------------------------------*/ -ivas_error IVAS_DEC_SetRenderFramesize( +ivas_error IVAS_DEC_SetRenderNumSubfr( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ const IVAS_RENDER_NUM_SUBFR render_num_subframes /* i : renderer number of subframes */ ) @@ -644,8 +645,9 @@ ivas_error IVAS_DEC_GetRenderNumSubfr( return IVAS_ERR_OK; } + /*---------------------------------------------------------------------* - * IVAS_DEC_GetGetRenderFramesizeSamples( ) + * IVAS_DEC_GetRenderFramesizeSamples( ) * * Get render framesize in samples *---------------------------------------------------------------------*/ @@ -665,29 +667,31 @@ ivas_error IVAS_DEC_GetRenderFramesizeSamples( return IVAS_ERR_OK; } + /*---------------------------------------------------------------------* - * IVAS_DEC_GetGetRenderFramesizeMs( ) + * IVAS_DEC_GetRenderFramesizeMs( ) * * Get render framesize in milliseconds *---------------------------------------------------------------------*/ ivas_error IVAS_DEC_GetRenderFramesizeMs( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - uint32_t *render_framesize /* o : render framesize in samples */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + uint32_t *systemTime /* o : render framesize in ms */ ) { - if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL || render_framesize == NULL ) + if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL || systemTime == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } - *render_framesize = get_render_frame_size_ms( hIvasDec->st_ivas->hDecoderConfig->render_num_subframes ); + *systemTime = get_render_frame_size_ms( hIvasDec->st_ivas->hDecoderConfig->render_num_subframes ); return IVAS_ERR_OK; } + /*---------------------------------------------------------------------* - * IVAS_DEC_GetGetReferencesUpdateFrequency( ) + * IVAS_DEC_GetReferencesUpdateFrequency( ) * * Get update frequency of the reference vector/orientation *---------------------------------------------------------------------*/ @@ -707,6 +711,7 @@ ivas_error IVAS_DEC_GetReferencesUpdateFrequency( return IVAS_ERR_OK; } +#ifndef FIX_945_REMOVE_DUPLICATED_API_FUNC /*---------------------------------------------------------------------* * IVAS_DEC_GetGetNumOrientationSubframes( ) * @@ -727,7 +732,7 @@ ivas_error IVAS_DEC_GetNumOrientationSubframes( return IVAS_ERR_OK; } - +#endif /*---------------------------------------------------------------------* * IVAS_DEC_EnableVoIP( ) diff --git a/lib_dec/lib_dec.h b/lib_dec/lib_dec.h index f911465be9..007b3974d8 100644 --- a/lib_dec/lib_dec.h +++ b/lib_dec/lib_dec.h @@ -342,34 +342,36 @@ ivas_error IVAS_DEC_EnableSplitRendering( IVAS_DEC_HANDLE hIvasDec /* i/o: IVAS decoder handle */ ); -ivas_error IVAS_DEC_SetRenderFramesize( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - const IVAS_RENDER_NUM_SUBFR render_num_subframes /* i : rendering number of subframes */ +ivas_error IVAS_DEC_SetRenderNumSubfr( + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + const IVAS_RENDER_NUM_SUBFR render_num_subframes /* i : rendering number of subframes */ ); ivas_error IVAS_DEC_GetRenderNumSubfr( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - IVAS_RENDER_NUM_SUBFR *render_num_subframes /* o : rendering number of subframes */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + IVAS_RENDER_NUM_SUBFR *render_num_subframes /* o : rendering number of subframes */ ); ivas_error IVAS_DEC_GetRenderFramesizeSamples( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - int16_t *render_framesize /* o : render framesize in samples */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + int16_t *render_framesize /* o : render framesize in samples */ ); ivas_error IVAS_DEC_GetReferencesUpdateFrequency( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - int16_t *update_frequency /* o : update frequency */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + int16_t *update_frequency /* o : update frequency */ ); +#ifndef FIX_945_REMOVE_DUPLICATED_API_FUNC ivas_error IVAS_DEC_GetNumOrientationSubframes( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ int16_t *num_subframes /* o : render framesize */ ); +#endif ivas_error IVAS_DEC_GetRenderFramesizeMs( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - uint32_t *render_framesize /* o : render framesize in samples */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + uint32_t *systemTime /* o : render framesize in ms */ ); #ifdef DEBUGGING -- GitLab From fcaefcacd1b0a43f376ecf9840922e3a73e57c91 Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 20 Nov 2024 12:37:26 +0100 Subject: [PATCH 4/6] fix render framesize printout --- lib_dec/lib_dec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 53067dfd3f..b6d4f976f9 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -4077,7 +4077,7 @@ static ivas_error printConfigInfo_dec( if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { - fprintf( stdout, "Render number of subframes: %dms\n", get_render_frame_size_ms( st_ivas->hDecoderConfig->render_num_subframes ) ); + fprintf( stdout, "Render frame size: %d ms\n", get_render_frame_size_ms( st_ivas->hDecoderConfig->render_num_subframes ) ); } if ( st_ivas->hDecoderConfig->Opt_HRTF_binary ) { -- GitLab From 1f984fffdf5542e26a34845b5fb7215d42faff70 Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 20 Nov 2024 12:46:29 +0100 Subject: [PATCH 5/6] fix implicit data type conversion --- apps/decoder.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/apps/decoder.c b/apps/decoder.c index 2c323f3550..636ddec0b1 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -689,7 +689,7 @@ int main( /* ISAR frame size is set from command line, not renderer config file. * This will be ignored if output format is not split rendering. */ - renderConfig.split_rend_config.isar_frame_size_ms = (int16_t) arg.render_num_subframes * 5; + renderConfig.split_rend_config.isar_frame_size_ms = (int16_t) arg.render_num_subframes * BINAURAL_RENDERING_FRAME_SIZE_MS; if ( ( error = IVAS_DEC_FeedRenderConfig( hIvasDec, renderConfig ) ) != IVAS_ERR_OK ) { @@ -2227,7 +2227,11 @@ static ivas_error decodeG192( if ( headRotReader == NULL ) { +#ifdef FIX_945_REMOVE_DUPLICATED_API_FUNC + for ( i = 0; i < (int16_t) num_subframes; i++ ) +#else for ( i = 0; i < num_subframes; i++ ) +#endif { Quaternions[i].w = -3.0f; Quaternions[i].x = 0.0f; @@ -2240,7 +2244,11 @@ static ivas_error decodeG192( } else { +#ifdef FIX_945_REMOVE_DUPLICATED_API_FUNC + for ( i = 0; i < (int16_t) num_subframes; i++ ) +#else for ( i = 0; i < num_subframes; i++ ) +#endif { if ( ( error = HeadRotationFileReading( headRotReader, &Quaternions[i], &Pos[i] ) ) != IVAS_ERR_OK ) { @@ -2250,7 +2258,11 @@ static ivas_error decodeG192( } } +#ifdef FIX_945_REMOVE_DUPLICATED_API_FUNC + for ( i = 0; i < (int16_t) num_subframes; i++ ) +#else for ( i = 0; i < num_subframes; i++ ) +#endif { if ( ( error = IVAS_DEC_FeedHeadTrackData( hIvasDec, Quaternions[i], Pos[i], i, DEFAULT_AXIS ) ) != IVAS_ERR_OK ) { @@ -3166,7 +3178,11 @@ static ivas_error decodeVoIP( if ( headRotReader == NULL ) { +#ifdef FIX_945_REMOVE_DUPLICATED_API_FUNC + for ( i = 0; i < (int16_t) num_subframes; i++ ) +#else for ( i = 0; i < num_subframes; i++ ) +#endif { Quaternions[i].w = -3.0f; Quaternions[i].x = 0.0f; @@ -3179,7 +3195,11 @@ static ivas_error decodeVoIP( } else { +#ifdef FIX_945_REMOVE_DUPLICATED_API_FUNC + for ( i = 0; i < (int16_t) num_subframes; i++ ) +#else for ( i = 0; i < num_subframes; i++ ) +#endif { if ( ( error = HeadRotationFileReading( headRotReader, &Quaternions[i], &Pos[i] ) ) != IVAS_ERR_OK ) { @@ -3190,7 +3210,11 @@ static ivas_error decodeVoIP( } } +#ifdef FIX_945_REMOVE_DUPLICATED_API_FUNC + for ( i = 0; i < (int16_t) num_subframes; i++ ) +#else for ( i = 0; i < num_subframes; i++ ) +#endif { if ( ( error = IVAS_DEC_FeedHeadTrackData( hIvasDec, Quaternions[i], Pos[i], i, DEFAULT_AXIS ) ) != IVAS_ERR_OK ) { -- GitLab From c831ffe670c8b4d392d546fab6013eb0cfa021be Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 20 Nov 2024 12:50:59 +0100 Subject: [PATCH 6/6] fix implicit data type conversion --- apps/decoder.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/apps/decoder.c b/apps/decoder.c index 636ddec0b1..6bb3cbccfc 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -2280,7 +2280,11 @@ static ivas_error decodeG192( int8_t enableRotationInterpolation[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES]; int16_t numFramesToTargetOrientation[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES]; +#ifdef FIX_945_REMOVE_DUPLICATED_API_FUNC + for ( i = 0; i < (int16_t) num_subframes; i++ ) +#else for ( i = 0; i < num_subframes; i++ ) +#endif { if ( ( error = ExternalOrientationFileReading( externalOrientationFileReader, &Quaternions[i], &enableHeadRotation[i], &enableExternalOrientation[i], &enableRotationInterpolation[i], &numFramesToTargetOrientation[i] ) ) != IVAS_ERR_OK ) { @@ -2288,7 +2292,12 @@ static ivas_error decodeG192( goto cleanup; } } + +#ifdef FIX_945_REMOVE_DUPLICATED_API_FUNC + for ( i = 0; i < (int16_t) num_subframes; i++ ) +#else for ( i = 0; i < num_subframes; i++ ) +#endif { if ( ( error = IVAS_DEC_FeedExternalOrientationData( hIvasDec, Quaternions[i], enableHeadRotation[i], enableExternalOrientation[i], enableRotationInterpolation[i], numFramesToTargetOrientation[i], i ) ) != IVAS_ERR_OK ) { @@ -3232,7 +3241,11 @@ static ivas_error decodeVoIP( int8_t enableRotationInterpolation[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES]; int16_t numFramesToTargetOrientation[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES]; +#ifdef FIX_945_REMOVE_DUPLICATED_API_FUNC + for ( i = 0; i < (int16_t) num_subframes; i++ ) +#else for ( i = 0; i < num_subframes; i++ ) +#endif { if ( ( error = ExternalOrientationFileReading( externalOrientationFileReader, &Quaternions[i], &enableHeadRotation[i], &enableExternalOrientation[i], &enableRotationInterpolation[i], &numFramesToTargetOrientation[i] ) ) != IVAS_ERR_OK ) @@ -3242,7 +3255,12 @@ static ivas_error decodeVoIP( goto cleanup; } } + +#ifdef FIX_945_REMOVE_DUPLICATED_API_FUNC + for ( i = 0; i < (int16_t) num_subframes; i++ ) +#else for ( i = 0; i < num_subframes; i++ ) +#endif { if ( ( error = IVAS_DEC_FeedExternalOrientationData( hIvasDec, Quaternions[i], enableHeadRotation[i], enableExternalOrientation[i], enableRotationInterpolation[i], numFramesToTargetOrientation[i], i ) ) != IVAS_ERR_OK ) { -- GitLab