diff --git a/apps/decoder.c b/apps/decoder.c index 494f76ccbdf2326d2b9a4f64358dfe160c263f95..cd811b7a3bbc5d5a8acc94f1e6e6c42f20758469 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -124,7 +124,7 @@ typedef struct char *outputMdFilename; IVAS_DEC_COMPLEXITY_LEVEL complexityLevel; bool tsmEnabled; - IVAS_RENDER_FRAMESIZE renderFramesize; + IVAS_RENDER_NUM_SUBFR render_num_subframes; AcousticEnvironmentSequence aeSequence; bool dpidEnabled; uint16_t directivityPatternId[IVAS_MAX_NUM_OBJECTS]; @@ -198,7 +198,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_BINARY_WRAPPER hHrtfBinary; ObjectEditFileReader *objectEditFileReader = NULL; IVAS_ROOM_ACOUSTICS_CONFIG_DATA **pAE = NULL; @@ -415,11 +415,11 @@ 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] : IVAS_DEFAULT_AEID; arg.enableHeadRotation = arg.enableHeadRotation || arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM; - if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputConfig, arg.renderFramesize, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, + if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputConfig, arg.render_num_subframes, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled, arg.roomSize, arg.non_diegetic_pan_enabled, arg.non_diegetic_pan_gain_fx, arg.dpidEnabled, aeID, arg.objEditEnabled, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK ) { @@ -427,13 +427,13 @@ 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 ) ); + fprintf( stderr, "\nIVAS_DEC_GetRenderNumSubfr 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" ); } @@ -442,7 +442,7 @@ int main( * Configure Split rendering *------------------------------------------------------------------------------------------*/ - asked_frame_size = arg.renderFramesize; + asked_num_subframes = arg.render_num_subframes; 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 ) @@ -451,14 +451,14 @@ 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 ) ); + fprintf( stderr, "\nIVAS_DEC_GetRenderNumSubfr failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } #ifdef FIX_1449_RENDERER_FRAME_SIZE_UNCLEAR_IN_ISAR - if ( !arg.renderConfigEnabled && ( arg.renderFramesize != asked_frame_size ) ) + if ( !arg.renderConfigEnabled && ( arg.render_num_subframes != asked_num_subframes ) ) { fprintf( stderr, "\nChanged render framesize, only 20ms are allowed for non-0dof split rendering!\n" ); } @@ -574,24 +574,24 @@ 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_SetRenderNumSubfr( hIvasDec, arg.render_num_subframes ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "\nIVAS_DEC_SetRenderFramesize failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); + fprintf( stderr, "\nIVAS_DEC_SetRenderNumSubfr 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 non-0dof split rendering!\n" ); } @@ -616,7 +616,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 ) { @@ -938,7 +938,7 @@ static bool parseCmdlIVAS_dec( arg->non_diegetic_pan_enabled = false; 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; arg->aeSequence.count = 0; arg->aeSequence.pID = NULL; arg->aeSequence.pValidity = NULL; @@ -1105,13 +1105,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 ); @@ -2161,10 +2161,10 @@ static ivas_error decodeG192( } } - int16_t num_subframes; - if ( ( error = IVAS_DEC_GetNumOrientationSubframes( hIvasDec, &num_subframes ) ) != IVAS_ERR_OK ) + IVAS_RENDER_NUM_SUBFR num_subframes; + if ( ( error = IVAS_DEC_GetRenderNumSubfr( hIvasDec, &num_subframes ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "\nIVAS_DEC_GetNumOrientationSubframes failed: \n" ); + fprintf( stderr, "\nIVAS_DEC_GetRenderNumSubfr failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } @@ -2175,7 +2175,7 @@ static ivas_error decodeG192( if ( headRotReader == NULL ) { - for ( i = 0; i < num_subframes; i++ ) + for ( i = 0; i < (int16_t) num_subframes; i++ ) { Quaternions[i].w_fx = -12582912; Quaternions[i].x_fx = 0; @@ -2190,7 +2190,7 @@ static ivas_error decodeG192( } else { - for ( i = 0; i < num_subframes; i++ ) + for ( i = 0; i < (int16_t) num_subframes; i++ ) { if ( ( error = HeadRotationFileReading( headRotReader, &Quaternions[i], &Pos[i] ) ) != IVAS_ERR_OK ) { @@ -2200,7 +2200,7 @@ static ivas_error decodeG192( } } - for ( i = 0; i < num_subframes; i++ ) + for ( i = 0; i < (int16_t) num_subframes; i++ ) { if ( ( error = IVAS_DEC_FeedHeadTrackData( hIvasDec, Quaternions[i], Pos[i], i, DEFAULT_AXIS ) ) != IVAS_ERR_OK ) { @@ -2218,7 +2218,7 @@ static ivas_error decodeG192( int8_t enableRotationInterpolation[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES]; int16_t numFramesToTargetOrientation[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES]; - for ( i = 0; i < num_subframes; i++ ) + for ( i = 0; i < (int16_t) num_subframes; i++ ) { if ( ( error = ExternalOrientationFileReading( externalOrientationFileReader, &Quaternions[i], &enableHeadRotation[i], &enableExternalOrientation[i], &enableRotationInterpolation[i], &numFramesToTargetOrientation[i] ) ) != IVAS_ERR_OK ) { @@ -2226,7 +2226,7 @@ static ivas_error decodeG192( goto cleanup; } } - for ( i = 0; i < num_subframes; i++ ) + for ( i = 0; i < (int16_t) num_subframes; i++ ) { if ( ( error = IVAS_DEC_FeedExternalOrientationData( hIvasDec, Quaternions[i], enableHeadRotation[i], enableExternalOrientation[i], enableRotationInterpolation[i], numFramesToTargetOrientation[i], i ) ) != IVAS_ERR_OK ) { @@ -2992,10 +2992,10 @@ static ivas_error decodeVoIP( } } - int16_t num_subframes; - if ( ( error = IVAS_DEC_GetNumOrientationSubframes( hIvasDec, &num_subframes ) ) != IVAS_ERR_OK ) + IVAS_RENDER_NUM_SUBFR num_subframes; + if ( ( error = IVAS_DEC_GetRenderNumSubfr( hIvasDec, &num_subframes ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "\nIVAS_DEC_GetNumOrientationSubframes failed: \n" ); + fprintf( stderr, "\nIVAS_DEC_GetRenderNumSubfr failed: %s\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } @@ -3006,7 +3006,7 @@ static ivas_error decodeVoIP( if ( headRotReader == NULL ) { - for ( i = 0; i < num_subframes; i++ ) + for ( i = 0; i < (int16_t) num_subframes; i++ ) { Quaternions[i].w_fx = -12582912; Quaternions[i].x_fx = 0; @@ -3021,7 +3021,7 @@ static ivas_error decodeVoIP( } else { - for ( i = 0; i < num_subframes; i++ ) + for ( i = 0; i < (int16_t) num_subframes; i++ ) { if ( ( error = HeadRotationFileReading( headRotReader, &Quaternions[i], &Pos[i] ) ) != IVAS_ERR_OK ) { @@ -3031,7 +3031,7 @@ static ivas_error decodeVoIP( } } - for ( i = 0; i < num_subframes; i++ ) + for ( i = 0; i < (int16_t) num_subframes; i++ ) { if ( ( error = IVAS_DEC_FeedHeadTrackData( hIvasDec, Quaternions[i], Pos[i], i, DEFAULT_AXIS ) ) != IVAS_ERR_OK ) { @@ -3049,7 +3049,7 @@ static ivas_error decodeVoIP( int8_t enableRotationInterpolation[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES]; int16_t numFramesToTargetOrientation[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES]; - for ( i = 0; i < num_subframes; i++ ) + for ( i = 0; i < (int16_t) num_subframes; i++ ) { if ( ( error = ExternalOrientationFileReading( externalOrientationFileReader, &Quaternions[i], &enableHeadRotation[i], &enableExternalOrientation[i], &enableRotationInterpolation[i], &numFramesToTargetOrientation[i] ) ) != IVAS_ERR_OK ) @@ -3059,7 +3059,7 @@ static ivas_error decodeVoIP( goto cleanup; } } - for ( i = 0; i < num_subframes; i++ ) + for ( i = 0; i < (int16_t) num_subframes; i++ ) { if ( ( error = IVAS_DEC_FeedExternalOrientationData( hIvasDec, Quaternions[i], enableHeadRotation[i], enableExternalOrientation[i], enableRotationInterpolation[i], numFramesToTargetOrientation[i], i ) ) != IVAS_ERR_OK ) { @@ -3988,7 +3988,7 @@ static ivas_error restartDecoder( IVAS_AUDIO_CONFIG outputConfig = ( decMode == IVAS_DEC_MODE_IVAS ) ? arg->outputConfig : IVAS_AUDIO_CONFIG_MONO; - if ( ( error = IVAS_DEC_Configure( hIvasDec, arg->output_Fs, outputConfig, arg->renderFramesize, arg->customLsOutputEnabled, arg->hrtfReaderEnabled, + if ( ( error = IVAS_DEC_Configure( hIvasDec, arg->output_Fs, outputConfig, arg->render_num_subframes, arg->customLsOutputEnabled, arg->hrtfReaderEnabled, arg->enableHeadRotation, arg->enableExternalOrientation, arg->orientation_tracking, arg->renderConfigEnabled, arg->roomSize, arg->non_diegetic_pan_enabled, arg->non_diegetic_pan_gain_fx, arg->dpidEnabled, aeID, arg->objEditEnabled, arg->delayCompensationEnabled ) ) != IVAS_ERR_OK ) { @@ -3996,9 +3996,9 @@ static ivas_error restartDecoder( 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 ) ); + fprintf( stderr, "\nIVAS_DEC_GetRenderNumSubfr failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } @@ -4021,7 +4021,7 @@ static ivas_error restartDecoder( * This will be ignored if output format is not split rendering. */ if ( renderConfig != NULL ) { - 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 ( arg->renderConfigEnabled && renderConfig != NULL ) diff --git a/apps/isar_post_rend.c b/apps/isar_post_rend.c index 6ccf204ceb221c7c11035b9f01fb93b9c191853e..5c5d4ccc2c2cac187d02b27cffc63dc1bce9cbe9 100644 --- a/apps/isar_post_rend.c +++ b/apps/isar_post_rend.c @@ -114,7 +114,7 @@ typedef struct bool delayCompensationEnabled; bool quietModeEnabled; bool sceneDescriptionInput; - IVAS_RENDER_FRAMESIZE render_framesize; + IVAS_RENDER_NUM_SUBFR render_num_subframes; } CmdlnArgs; typedef enum @@ -340,13 +340,13 @@ static bool parseInConfig( } -static bool parseRenderFramesize( +static bool parseRenderNumSubfr( 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; @@ -355,13 +355,13 @@ static bool parseRenderFramesize( 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; @@ -476,7 +476,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; } @@ -559,7 +559,7 @@ static void parseOption( break; case CmdLnOptionId_framing: assert( numOptionValues == 1 ); - if ( !parseRenderFramesize( optionValues[0], &args->render_framesize ) ) + if ( !parseRenderNumSubfr( optionValues[0], &args->render_num_subframes ) ) { fprintf( stderr, "Unknown or invalid option for frame size: %s\n", optionValues[0] ); exit( -1 ); @@ -951,7 +951,7 @@ int main( audioReader = NULL; /* Force owerwrite of command line provided rendersize to align with codec frame size */ - args.render_framesize = bitsBuffer.config.isar_frame_size_ms / 5; + args.render_num_subframes = bitsBuffer.config.isar_frame_size_ms / 5; } /*if split renderer is running in post renderer mode*/ else if ( ( args.inConfig.numBinBuses > 0 ) && ( args.inConfig.binBuses[0].audioConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ) @@ -1023,9 +1023,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, (int16_t) args.render_framesize ) ) != IVAS_ERR_OK ) + if ( ( error = ISAR_POST_REND_open( &hIsarPostRend, args.sampleRate, args.outConfig.audioConfig, true, 0, 0, (int16_t) args.render_num_subframes ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError opening renderer handle: %s\n", ivas_error_to_string( error ) ); goto cleanup; @@ -1243,7 +1243,7 @@ int main( convertInputBuffer( inpInt16Buffer, numSamplesRead, inBuffer.config.numSamplesPerChannel, num_in_channels, inFloatBuffer_fx ); *inBuffer.pq_fact = 0; 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 c494ee0f139be0554f46fc48abb267d164e4d8e0..ffdf3192ced474cc427965bb663c887b2714275b 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -197,7 +197,7 @@ typedef struct bool lfeCustomRoutingEnabled; char inLfePanningMatrixFile[RENDERER_MAX_CLI_ARG_LENGTH]; int16_t syncMdDelay; - IVAS_RENDER_FRAMESIZE render_framesize; + IVAS_RENDER_NUM_SUBFR render_num_subframes; uint16_t directivityPatternId[RENDERER_MAX_ISM_INPUTS]; AcousticEnvironmentSequence aeSequence; IVAS_ROOM_SIZE_T reverbRoomSize; @@ -1002,12 +1002,12 @@ int main( goto cleanup; } - 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 * BINAURAL_RENDERING_FRAME_SIZE_MS / ( 1000 ) ); Word32 nonDiegeticPanGain_fx = ( args.nonDiegeticPanGain == 1.0f ) ? ONE_IN_Q31 : ( args.nonDiegeticPanGain == -1.0f ) ? L_negate( ONE_IN_Q31 ) : (Word32) ( args.nonDiegeticPanGain * ( 1LL << Q31 ) ); - IF( ( error = IVAS_REND_Open( &hIvasRend, args.sampleRate, args.outConfig.audioConfig, !isEmptyString( args.customHrtfFilePath ), args.nonDiegeticPan, nonDiegeticPanGain_fx, args.Opt_Headrotation, args.Opt_ExternalOrientation, (int16_t) args.render_framesize ) ) != IVAS_ERR_OK ) + IF( ( error = IVAS_REND_Open( &hIvasRend, args.sampleRate, args.outConfig.audioConfig, !isEmptyString( args.customHrtfFilePath ), args.nonDiegeticPan, nonDiegeticPanGain_fx, args.Opt_Headrotation, args.Opt_ExternalOrientation, (int16_t) args.render_num_subframes ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError opening renderer handle: %s\n", ivas_error_to_string( error ) ); goto cleanup; @@ -1235,7 +1235,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 * BINAURAL_RENDERING_FRAME_SIZE_MS; if ( ( error = IVAS_REND_FeedRenderConfig( hIvasRend, renderConfig ) ) != IVAS_ERR_OK ) { @@ -1663,7 +1663,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 % ( IVAS_RENDER_NUM_SUBFR_20MS / 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 ) @@ -1727,7 +1727,7 @@ int main( } int16_t num_subframes, sf_idx; - num_subframes = (int16_t) args.render_framesize; + num_subframes = (int16_t) args.render_num_subframes; if ( isCurrentFrameMultipleOf20ms && !flushRendererLastFrame ) { @@ -2436,13 +2436,13 @@ static bool parseDiegeticPan( } -static bool parseRenderFramesize( +static bool parseRenderNumSubfr( 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; @@ -2451,13 +2451,13 @@ static bool parseRenderFramesize( 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; @@ -2826,7 +2826,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 ( i = 0; i < RENDERER_MAX_ISM_INPUTS; ++i ) { @@ -2997,7 +2997,7 @@ static void parseOption( break; case CmdLnOptionId_framing: assert( numOptionValues == 1 ); - if ( !parseRenderFramesize( optionValues[0], &args->render_framesize ) ) + if ( !parseRenderNumSubfr( 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 34bc08d43462418057dd388586e2efcf505b7840..887d871198e3a833bb06c18e2163ec6bcca00fd1 100644 --- a/lib_com/common_api_types.h +++ b/lib_com/common_api_types.h @@ -173,12 +173,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 enum { @@ -186,6 +186,7 @@ typedef enum IVAS_ROOM_SIZE_SMALL, IVAS_ROOM_SIZE_MEDIUM, IVAS_ROOM_SIZE_LARGE + } IVAS_ROOM_SIZE_T; typedef struct ivas_masa_metadata_frame_struct *IVAS_MASA_METADATA_HANDLE; diff --git a/lib_dec/ivas_init_dec_fx.c b/lib_dec/ivas_init_dec_fx.c index 00cab0233d54f9c7b264f9b1f4b8618c33a7fe84..939f1d8c58a60e177bbda0e4fc815cf910100a16 100644 --- a/lib_dec/ivas_init_dec_fx.c +++ b/lib_dec/ivas_init_dec_fx.c @@ -1557,7 +1557,7 @@ ivas_error ivas_init_decoder_front( IF( st_ivas->hDecoderConfig->Opt_ExternalOrientation ) { - IF( NE_32( ( error = ivas_external_orientation_open_fx( &( st_ivas->hExtOrientationData ), st_ivas->hDecoderConfig->render_framesize ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = ivas_external_orientation_open_fx( &( st_ivas->hExtOrientationData ), st_ivas->hDecoderConfig->render_num_subframes ) ), IVAS_ERR_OK ) ) { return error; } @@ -1570,7 +1570,7 @@ ivas_error ivas_init_decoder_front( test(); IF( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation ) { - IF( NE_32( ( error = ivas_combined_orientation_open_fx( &( st_ivas->hCombinedOrientationData ), st_ivas->hDecoderConfig->output_Fs, st_ivas->hDecoderConfig->render_framesize ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = ivas_combined_orientation_open_fx( &( 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 34c07d1f1284cc6f3cbb209faaa2f2db555ce862..47a74c60bb7ea434778b2dbc65e8aa4bb60906b4 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -1073,8 +1073,8 @@ typedef struct decoder_config_structure Word16 Opt_aeid_on; /* indicates whether Acoustic environment option is used */ Word16 Opt_ObjEdit_on; /* indicates whether object editing option is used */ Word16 Opt_tsm; /* indicates whether time scaling modification is activated */ - IVAS_RENDER_FRAMESIZE render_framesize; - Word16 Opt_delay_comp; /* flag indicating delay compensation active */ + IVAS_RENDER_NUM_SUBFR render_num_subframes; /* renderer number of subframes */ + Word16 Opt_delay_comp; /* flag indicating delay compensation active */ } DECODER_CONFIG, *DECODER_CONFIG_HANDLE; diff --git a/lib_dec/lib_dec.h b/lib_dec/lib_dec.h index 58c33c92d81582f3048d2de103d6f762482afa12..5bbfd604e07eb1c33686e39217e04dadf6fff2d4 100644 --- a/lib_dec/lib_dec.h +++ b/lib_dec/lib_dec.h @@ -112,7 +112,7 @@ ivas_error IVAS_DEC_Configure( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ const UWord32 sampleRate, /* i : output sampling frequency */ const IVAS_AUDIO_CONFIG outputConfig, /* i : output configuration */ - const IVAS_RENDER_FRAMESIZE renderFramesize, /* i : rendering frame size */ + const IVAS_RENDER_NUM_SUBFR render_num_subframes, /* i : rendering number of subframes */ const bool customLsOutputEnabled, /* i : enable custom loudspeaker setup handle */ const bool hrtfReaderEnabled, /* i : enable HRTF binary file input */ const bool enableHeadRotation, /* i : enable head rotation for binaural output */ @@ -352,14 +352,14 @@ ivas_error IVAS_DEC_EnableSplitRendering( IVAS_DEC_HANDLE hIvasDec /* i/o: IVAS decoder handle */ ); -ivas_error IVAS_DEC_SetRenderFramesize( +ivas_error IVAS_DEC_SetRenderNumSubfr( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - const IVAS_RENDER_FRAMESIZE render_framesize /* i : render framesize */ + const IVAS_RENDER_NUM_SUBFR render_num_subframes /* i : rendering number of subframes */ ); -ivas_error IVAS_DEC_GetRenderFramesize( +ivas_error IVAS_DEC_GetRenderNumSubfr( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - IVAS_RENDER_FRAMESIZE *render_framesize /* o : render framesize */ + IVAS_RENDER_NUM_SUBFR *render_num_subframes /* o : rendering number of subframes */ ); ivas_error IVAS_DEC_GetRenderFramesizeSamples( @@ -372,14 +372,9 @@ ivas_error IVAS_DEC_GetReferencesUpdateFrequency( Word16 *update_frequency /* o : update frequency Q0 */ ); -ivas_error IVAS_DEC_GetNumOrientationSubframes( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - Word16 *num_subframes /* o : render framesize */ -); - ivas_error IVAS_DEC_GetRenderFramesizeMs( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - UWord32 *render_framesize /* o : render framesize in samples Q0 */ + UWord32 *render_framesize_ms /* o : render framesize in ms Q0 */ ); diff --git a/lib_dec/lib_dec_fx.c b/lib_dec/lib_dec_fx.c index c20a69451e8745b92db03eb14df03580b3dca8c7..f7d12e5d2d97a9ec9d7a932818cf279a0a00c393 100644 --- a/lib_dec/lib_dec_fx.c +++ b/lib_dec/lib_dec_fx.c @@ -116,7 +116,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 Word16 get_render_frame_size_ms( IVAS_RENDER_FRAMESIZE render_framesize ); +static Word16 get_render_frame_size_ms( const IVAS_RENDER_NUM_SUBFR render_num_subframes ); 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 ); static void update_voip_rendered20ms( IVAS_DEC_HANDLE hIvasDec, const Word16 nSamplesRendered ); @@ -502,23 +502,23 @@ static ivas_error create_flush_buffer_fx( *---------------------------------------------------------------------*/ ivas_error IVAS_DEC_Configure( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - const UWord32 sampleRate, /* i : output sampling frequency */ - const IVAS_AUDIO_CONFIG outputConfig, /* i : output configuration */ - const IVAS_RENDER_FRAMESIZE renderFramesize, /* i : rendering frame size */ - const bool customLsOutputEnabled, /* i : enable custom loudspeaker setup handle */ - const bool hrtfReaderEnabled, /* i : enable HRTF binary file input */ - const bool enableHeadRotation, /* i : enable head rotation for binaural output */ - const bool enableExternalOrientation, /* i : enable external orientations */ - const IVAS_HEAD_ORIENT_TRK_T orientation_tracking, /* i : head orientation tracking type */ - const bool renderConfigEnabled, /* i : enable Renderer config. file for binaural output */ - const IVAS_ROOM_SIZE_T roomSize, /* i : room size selector for reverb */ - const bool non_diegetic_pan_enabled, /* i : enabled diegetic panning */ - const Word16 non_diegetic_pan_gain_fx, /* i : non diegetic panning gain */ - const bool dpidEnabled, /* i : enable directivity pattern option */ - const UWord16 acousticEnvironmentId, /* i : Acoustic environment ID */ - const bool objEditEnabled, /* i : enable object editing */ - const bool delayCompensationEnabled /* i : enable delay compensation */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + const UWord32 sampleRate, /* i : output sampling frequency */ + const IVAS_AUDIO_CONFIG outputConfig, /* i : output configuration */ + const IVAS_RENDER_NUM_SUBFR render_num_subframes, /* i : rendering number of subframes */ + const bool customLsOutputEnabled, /* i : enable custom loudspeaker setup handle */ + const bool hrtfReaderEnabled, /* i : enable HRTF binary file input */ + const bool enableHeadRotation, /* i : enable head rotation for binaural output */ + const bool enableExternalOrientation, /* i : enable external orientations */ + const IVAS_HEAD_ORIENT_TRK_T orientation_tracking, /* i : head orientation tracking type */ + const bool renderConfigEnabled, /* i : enable Renderer config. file for binaural output */ + const IVAS_ROOM_SIZE_T roomSize, /* i : room size selector for reverb */ + const bool non_diegetic_pan_enabled, /* i : enabled diegetic panning */ + const Word16 non_diegetic_pan_gain_fx, /* i : non diegetic panning gain */ + const bool dpidEnabled, /* i : enable directivity pattern option */ + const UWord16 acousticEnvironmentId, /* i : Acoustic environment ID */ + const bool objEditEnabled, /* i : enable object editing */ + const bool delayCompensationEnabled /* i : enable delay compensation */ ) { Decoder_Struct *st_ivas; @@ -622,18 +622,18 @@ ivas_error IVAS_DEC_Configure( move16(); move16(); - IF( EQ_16( renderFramesize, IVAS_RENDER_FRAMESIZE_UNKNOWN ) ) + IF( EQ_16( render_num_subframes, IVAS_RENDER_NUM_SUBFR_UNKNOWN ) ) { return IVAS_ERR_WRONG_PARAMS; } IF( EQ_16( 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; } move16(); @@ -687,7 +687,7 @@ ivas_error IVAS_DEC_EnableSplitRendering( hDecoderConfig->Opt_Headrotation = 1; move16(); - hDecoderConfig->render_framesize = IVAS_RENDER_FRAMESIZE_20MS; + hDecoderConfig->render_num_subframes = IVAS_RENDER_NUM_SUBFR_20MS; move32(); return IVAS_ERR_OK; @@ -700,35 +700,23 @@ ivas_error IVAS_DEC_EnableSplitRendering( * Get render framesize in ms *---------------------------------------------------------------------*/ +/*! r: render framesize in ms */ static Word16 get_render_frame_size_ms( - const IVAS_RENDER_FRAMESIZE render_framesize ) + const IVAS_RENDER_NUM_SUBFR render_num_subframes ) { - IF( EQ_16( render_framesize, IVAS_RENDER_FRAMESIZE_5MS ) ) - { - return ( 1000 / ( FRAMES_PER_SEC * IVAS_MAX_PARAM_SPATIAL_SUBFRAMES ) ); - } - ELSE IF( EQ_16( render_framesize, IVAS_RENDER_FRAMESIZE_10MS ) ) - { - return ( ( 1000 / ( FRAMES_PER_SEC * IVAS_MAX_PARAM_SPATIAL_SUBFRAMES ) ) << 1 ); - } - ELSE IF( EQ_16( render_framesize, IVAS_RENDER_FRAMESIZE_20MS ) ) - { - return ( ( 1000 / ( FRAMES_PER_SEC * IVAS_MAX_PARAM_SPATIAL_SUBFRAMES ) ) << 2 ); - } - - return 0; + return (int16_t) ( render_num_subframes * ( 1000 / ( FRAMES_PER_SEC * IVAS_MAX_PARAM_SPATIAL_SUBFRAMES ) ) ); } /*---------------------------------------------------------------------* - * IVAS_DEC_SetRenderFramesize( ) + * IVAS_DEC_SetRenderNumSubfr( ) * - * Set render framesize + * Set number of rendering subrames *---------------------------------------------------------------------*/ -ivas_error IVAS_DEC_SetRenderFramesize( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - const IVAS_RENDER_FRAMESIZE render_framesize /* i : render framesize */ +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 */ ) { test(); @@ -738,18 +726,18 @@ 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; move16(); IF( hIvasDec->st_ivas->hExtOrientationData != NULL ) { - hIvasDec->st_ivas->hExtOrientationData->num_subframes = (Word16) render_framesize; + hIvasDec->st_ivas->hExtOrientationData->num_subframes = (Word16) render_num_subframes; move16(); } IF( hIvasDec->st_ivas->hCombinedOrientationData != NULL ) { - hIvasDec->st_ivas->hCombinedOrientationData->num_subframes = (Word16) render_framesize; + hIvasDec->st_ivas->hCombinedOrientationData->num_subframes = (Word16) render_num_subframes; move16(); } @@ -758,24 +746,24 @@ ivas_error IVAS_DEC_SetRenderFramesize( /*---------------------------------------------------------------------* - * IVAS_DEC_GetGetRenderFramesize( ) + * IVAS_DEC_GetRenderNumSubfr( ) * - * Get render framesize + * 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 */ ) { test(); test(); - 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; move16(); return IVAS_ERR_OK; @@ -796,15 +784,15 @@ static Word16 get_render_frame_size_samples( tmp = extract_l( Mpy_32_16_1( hDecoderConfig->output_Fs, ONE_BY_SUBFR_PER_SEC_Q15 ) ); - IF( EQ_16( hDecoderConfig->render_framesize, IVAS_RENDER_FRAMESIZE_5MS ) ) + IF( EQ_16( hDecoderConfig->render_num_subframes, IVAS_RENDER_NUM_SUBFR_5MS ) ) { /* correct value already in tmp */ } - ELSE IF( EQ_16( hDecoderConfig->render_framesize, IVAS_RENDER_FRAMESIZE_10MS ) ) + ELSE IF( EQ_16( hDecoderConfig->render_num_subframes, IVAS_RENDER_NUM_SUBFR_10MS ) ) { tmp = shl( tmp, 1 ); } - ELSE IF( EQ_16( hDecoderConfig->render_framesize, IVAS_RENDER_FRAMESIZE_20MS ) ) + ELSE IF( EQ_16( hDecoderConfig->render_num_subframes, IVAS_RENDER_NUM_SUBFR_20MS ) ) { tmp = shl( tmp, 2 ); } @@ -818,7 +806,7 @@ static Word16 get_render_frame_size_samples( /*---------------------------------------------------------------------* - * IVAS_DEC_GetGetRenderFramesizeSamples( ) + * IVAS_DEC_GetRenderFramesizeSamples( ) * * Get render framesize in samples *---------------------------------------------------------------------*/ @@ -860,7 +848,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 ); move32(); return IVAS_ERR_OK; @@ -885,17 +873,17 @@ ivas_error IVAS_DEC_GetReferencesUpdateFrequency( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } - IF( EQ_16( hIvasDec->st_ivas->hDecoderConfig->render_framesize, IVAS_RENDER_FRAMESIZE_5MS ) ) + IF( EQ_16( hIvasDec->st_ivas->hDecoderConfig->render_num_subframes, IVAS_RENDER_NUM_SUBFR_5MS ) ) { *update_frequency = IVAS_MAX_PARAM_SPATIAL_SUBFRAMES; move16(); } - ELSE IF( EQ_16( hIvasDec->st_ivas->hDecoderConfig->render_framesize, IVAS_RENDER_FRAMESIZE_10MS ) ) + ELSE IF( EQ_16( hIvasDec->st_ivas->hDecoderConfig->render_num_subframes, IVAS_RENDER_NUM_SUBFR_10MS ) ) { *update_frequency = IVAS_MAX_PARAM_SPATIAL_SUBFRAMES >> 1; move16(); } - ELSE IF( EQ_16( hIvasDec->st_ivas->hDecoderConfig->render_framesize, IVAS_RENDER_FRAMESIZE_20MS ) ) + ELSE IF( EQ_16( hIvasDec->st_ivas->hDecoderConfig->render_num_subframes, IVAS_RENDER_NUM_SUBFR_20MS ) ) { *update_frequency = IVAS_MAX_PARAM_SPATIAL_SUBFRAMES >> 2; move16(); @@ -904,30 +892,6 @@ ivas_error IVAS_DEC_GetReferencesUpdateFrequency( return IVAS_ERR_OK; } -/*---------------------------------------------------------------------* - * IVAS_DEC_GetGetNumOrientationSubframes( ) - * - * Get the number of subframes for head/external orientation per render frame - *---------------------------------------------------------------------*/ - -ivas_error IVAS_DEC_GetNumOrientationSubframes( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - Word16 *num_subframes /* o : render framesize */ -) -{ - test(); - test(); - IF( hIvasDec == NULL || hIvasDec->st_ivas == NULL || num_subframes == NULL ) - { - return IVAS_ERR_UNEXPECTED_NULL_POINTER; - } - - *num_subframes = (Word16) hIvasDec->st_ivas->hDecoderConfig->render_framesize; - move16(); - - return IVAS_ERR_OK; -} - /*---------------------------------------------------------------------* * IVAS_DEC_EnableVoIP( ) @@ -1158,12 +1122,12 @@ static Word16 isar_get_frame_size( test(); test(); - IF( NE_32( st_ivas->hDecoderConfig->render_framesize, IVAS_RENDER_FRAMESIZE_20MS ) && + IF( NE_32( st_ivas->hDecoderConfig->render_num_subframes, IVAS_RENDER_NUM_SUBFR_20MS ) && ( EQ_32( st_ivas->hRenderConfig->split_rend_config.poseCorrectionMode, ISAR_SPLIT_REND_POSE_CORRECTION_MODE_NONE ) || EQ_32( st_ivas->hRenderConfig->split_rend_config.dof, 0 ) ) ) { nSamplesPerChannel = extract_l( Mpy_32_16_1( output_Fs, ONE_BY_SUBFR_PER_SEC_Q15 ) ); - nSamplesPerChannel = imult1616( nSamplesPerChannel, st_ivas->hDecoderConfig->render_framesize ); + nSamplesPerChannel = imult1616( nSamplesPerChannel, st_ivas->hDecoderConfig->render_num_subframes ); } ELSE { @@ -1638,7 +1602,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 ); #endif #else - IF( EQ_32( st_ivas->hDecoderConfig->render_framesize, IVAS_RENDER_FRAMESIZE_5MS ) ) + IF( EQ_32( st_ivas->hDecoderConfig->render_num_subframes, IVAS_RENDER_FRAMESIZE_5MS ) ) { #ifndef DISABLE_LIMITER ivas_limiter_dec_fx( st_ivas->hLimiter, p_head_pose_buf, st_ivas->hDecoderConfig->nchan_out, numSamplesPerChannelToOutput, st_ivas->BER_detect, Q11 ); @@ -5011,7 +4975,7 @@ IF( hIvasDec->hasDecodedFirstGoodFrame &&splitRendBits != NULL ) ivas_limiter_dec_fx( st_ivas->hLimiter, p_head_pose_buf, st_ivas->hDecoderConfig->nchan_out, *nSamplesRendered, st_ivas->BER_detect, Q11 ); #endif #else - IF( EQ_32( st_ivas->hDecoderConfig->render_framesize, IVAS_RENDER_FRAMESIZE_5MS ) ) + IF( EQ_32( st_ivas->hDecoderConfig->render_num_subframes, IVAS_RENDER_FRAMESIZE_5MS ) ) { #ifndef DISABLE_LIMITER ivas_limiter_dec_fx( st_ivas->hLimiter, p_head_pose_buf, st_ivas->hDecoderConfig->nchan_out, *nSamplesRendered, st_ivas->BER_detect, Q11 ); @@ -5556,7 +5520,7 @@ static ivas_error printConfigInfo_dec( test(); IF( ( EQ_16( (Word16) output_config, IVAS_AUDIO_CONFIG_BINAURAL ) || EQ_16( (Word16) output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) || EQ_16( (Word16) output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) || EQ_16( (Word16) output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_16( (Word16) 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 framesize: %dms\n", get_render_frame_size_ms( st_ivas->hDecoderConfig->render_num_subframes ) ); } IF( st_ivas->hDecoderConfig->Opt_HRTF_binary ) { @@ -6395,7 +6359,7 @@ static ivas_error ivas_dec_init_split_rend( move16(); } - 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, 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, st_ivas->hDecoderConfig->render_num_subframes, mixed_td_cldfb_flag ); move16(); return error; @@ -6469,7 +6433,7 @@ static ivas_error feedSinglePIorientation( { IF( !st_ivas->hExtOrientationData ) { - IF( NE_32( error = ivas_external_orientation_open_fx( &( st_ivas->hExtOrientationData ), st_ivas->hDecoderConfig->render_framesize ), IVAS_ERR_OK ) ) + IF( NE_32( error = ivas_external_orientation_open_fx( &( st_ivas->hExtOrientationData ), st_ivas->hDecoderConfig->render_num_subframes ), IVAS_ERR_OK ) ) { return error; } @@ -6477,7 +6441,7 @@ static ivas_error feedSinglePIorientation( IF( !st_ivas->hCombinedOrientationData ) { - IF( NE_32( error = ivas_combined_orientation_open_fx( &( st_ivas->hCombinedOrientationData ), st_ivas->hDecoderConfig->output_Fs, st_ivas->hDecoderConfig->render_framesize ), IVAS_ERR_OK ) ) + IF( NE_32( error = ivas_combined_orientation_open_fx( &( st_ivas->hCombinedOrientationData ), st_ivas->hDecoderConfig->output_Fs, st_ivas->hDecoderConfig->render_num_subframes ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_isar/isar_prot.h b/lib_isar/isar_prot.h index 10aaa6db52cdb10e25a11801839c47542a38965e..fb7bfc11b8e6e2900177d0bf3abfcdf1874ffd60 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 Word32 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( @@ -370,8 +370,8 @@ Word32 isar_get_split_rend_md_target_brate( const Word16 pcm_out_flag /* i : flag to indicate PCM output */ ); -ivas_error isar_framesize_to_ms( - const IVAS_RENDER_FRAMESIZE frame_size, /* i : frame size enum */ +ivas_error isar_num_subfr_to_ms( + const IVAS_RENDER_NUM_SUBFR render_num_subframes, /* i : rendering number of subframes */ Word16 *ms /* o : frame size in ms */ ); diff --git a/lib_isar/isar_splitRendererPre.c b/lib_isar/isar_splitRendererPre.c index 7255e7716cc404ca8bb3f20e8f84320214661652..3b04f76735017ee058057f28b56a5528c48678e9 100644 --- a/lib_isar/isar_splitRendererPre.c +++ b/lib_isar/isar_splitRendererPre.c @@ -2705,17 +2705,18 @@ void isar_init_split_rend_handles( *------------------------------------------------------------------------*/ ivas_error split_renderer_open_lc3plus( - SPLIT_REND_WRAPPER *hSplitRendWrapper, - const ISAR_SPLIT_REND_CONFIG_DATA *pSplitRendConfig, - const Word32 OutSampleRate, - const IVAS_RENDER_FRAMESIZE isar_frame_size ) + 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 Word32 OutSampleRate, /* i : output sampling rate */ + const IVAS_RENDER_NUM_SUBFR render_num_subframes /* i : rendering number of subframes */ +) { ivas_error error; Word16 i, delayBufferLength; LC3PLUS_CONFIG config; Word16 isar_frame_size_ms; - IF( ( error = isar_framesize_to_ms( isar_frame_size, &isar_frame_size_ms ) ) != IVAS_ERR_OK ) + IF( ( error = isar_num_subfr_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 9aeda22896c7cb93aac12bbb6f0b4403b5a4ecdd..fc0ecf0d5090778f54f2fb43e6a4a0e08925a76f 100644 --- a/lib_isar/isar_splitRenderer_utils.c +++ b/lib_isar/isar_splitRenderer_utils.c @@ -1278,20 +1278,27 @@ void isar_init_multi_bin_pose_data_fx_enc( return; } -ivas_error isar_framesize_to_ms( - const IVAS_RENDER_FRAMESIZE frame_size, /* i : frame size enum */ - Word16 *ms /* o : frame size in ms */ + +/*------------------------------------------------------------------------- + * Function isar_num_subfr_to_ms() + * + * + *------------------------------------------------------------------------*/ + +ivas_error isar_num_subfr_to_ms( + const IVAS_RENDER_NUM_SUBFR render_num_subframes, /* i : rendering number of subframes */ + Word16 *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 61767c7702abd2b159ffbc6a033b117e8f7bfc6a..05b98f6a4bcdae122b96914da0c7c1a0124393bb 100644 --- a/lib_isar/lib_isar_pre_rend.c +++ b/lib_isar/lib_isar_pre_rend.c @@ -51,13 +51,14 @@ *------------------------------------------------------------------------*/ ivas_error ISAR_PRE_REND_open( - SPLIT_REND_WRAPPER *hSplitRendWrapper, - ISAR_SPLIT_REND_CONFIG_DATA *pSplitRendConfig, - const Word32 OutSampleRate, - const Word16 cldfb_in_flag, - const Word16 pcm_out_flag, - const IVAS_RENDER_FRAMESIZE ivas_frame_size, /* i: IVAS frame size */ - const Word16 mixed_td_cldfb_flag ) + SPLIT_REND_WRAPPER *hSplitRendWrapper, /* i/o: Split renderer pre-renderer handle */ + ISAR_SPLIT_REND_CONFIG_DATA *pSplitRendConfig, /* i/o: Split renderer pre-renderer config */ + const Word32 OutSampleRate, /* i : output sampling rate */ + const Word16 cldfb_in_flag, /* i : Flag to indicate CLDFB or time doamin input */ + const Word16 pcm_out_flag, /* i : Flag to indicate PCM output */ + const IVAS_RENDER_NUM_SUBFR render_num_subframes, /* i : rendering number of subframes */ + const Word16 mixed_td_cldfb_flag /* i : Flag to indicate combined TD and CLDFB input */ +) { ivas_error error, ch, num_ch; UWord8 isCldfbNeeded = 0; @@ -67,7 +68,7 @@ ivas_error ISAR_PRE_REND_open( &pSplitRendConfig->isar_frame_size_ms, &pSplitRendConfig->codec_frame_size_ms, cldfb_in_flag_local, - pcm_out_flag, (Word16) ivas_frame_size ) ) != IVAS_ERR_OK ) + pcm_out_flag, (Word16) render_num_subframes ) ) != IVAS_ERR_OK ) { return error; } @@ -150,7 +151,7 @@ ivas_error ISAR_PRE_REND_open( { IF( EQ_16( pSplitRendConfig->codec, ISAR_SPLIT_REND_CODEC_LC3PLUS ) ) { - IF( ( error = split_renderer_open_lc3plus( hSplitRendWrapper, pSplitRendConfig, OutSampleRate, ivas_frame_size ) ) != IVAS_ERR_OK ) + IF( ( error = split_renderer_open_lc3plus( hSplitRendWrapper, pSplitRendConfig, OutSampleRate, render_num_subframes ) ) != IVAS_ERR_OK ) { return error; } @@ -178,7 +179,7 @@ ivas_error ISAR_PRE_REND_open( *------------------------------------------------------------------------*/ void ISAR_PRE_REND_close( - SPLIT_REND_WRAPPER *hSplitBinRend, /* i/o: Split renderer pre-renerer handle */ + SPLIT_REND_WRAPPER *hSplitBinRend, /* i/o: Split renderer pre-renderer handle */ IVAS_REND_AudioBuffer *pSplitRendEncBuffer /* i/o: Split renderer data buffer */ ) { @@ -258,7 +259,7 @@ void ISAR_PRE_REND_close( *-------------------------------------------------------------------------*/ void ISAR_PRE_REND_GetMultiBinPoseData( - const ISAR_SPLIT_REND_CONFIG_DATA *pSplit_rend_config, /* i : Split renderer pre-renerer config */ + const ISAR_SPLIT_REND_CONFIG_DATA *pSplit_rend_config, /* i : Split renderer pre-renderer config */ MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, /* i/o: pose correction data handle */ const ISAR_SPLIT_REND_ROT_AXIS rot_axis /* i : Rotation axis */ ) @@ -276,13 +277,13 @@ void ISAR_PRE_REND_GetMultiBinPoseData( *------------------------------------------------------------------------*/ ivas_error ISAR_PRE_REND_MultiBinToSplitBinaural( - SPLIT_REND_WRAPPER *hSplitBin, /* i/o: Split renderer pre-renerer handle */ - const IVAS_QUATERNION headPosition, /* i : head rotation QUATERNION */ - const Word32 SplitRendBitRate, /* i : Split renderer bitrate */ - ISAR_SPLIT_REND_CODEC splitCodec, /* i/o: Split renderer codec */ - const Word16 isar_frame_size_ms, /* i : ISAR framesize */ - Word16 codec_frame_size_ms, /* i/o: ISAR transport codec framesize */ - ISAR_SPLIT_REND_BITS_HANDLE pBits, + SPLIT_REND_WRAPPER *hSplitBin, /* i/o: Split renderer pre-renderer handle */ + const IVAS_QUATERNION headPosition, /* i : head rotation QUATERNION */ + const Word32 SplitRendBitRate, /* i : Split renderer bitrate */ + ISAR_SPLIT_REND_CODEC splitCodec, /* i/o: Split renderer codec */ + const Word16 isar_frame_size_ms, /* i : ISAR framesize */ + Word16 codec_frame_size_ms, /* i/o: ISAR transport codec framesize */ + ISAR_SPLIT_REND_BITS_HANDLE pBits, /* i/o: ISAR bits handle */ Word32 *Cldfb_In_BinReal_fx[][CLDFB_NO_COL_MAX], /* i/o: CLDFB real buffer */ Word32 *Cldfb_In_BinImag_fx[][CLDFB_NO_COL_MAX], /* i/o: CLDFB imag buffer */ const Word16 max_bands, /* i : CLDFB bands */ @@ -298,9 +299,10 @@ ivas_error ISAR_PRE_REND_MultiBinToSplitBinaural( Word32 bit_len, target_md_bits, available_bits, tmp_32; Word16 q1 = 31, q2 = 31, q_final, Q_cldfb, tmp, tmp_e; Word16 i, j; - error = IVAS_ERR_OK; Word16 Q_buff_re, Q_buff_im; + error = IVAS_ERR_OK; + move16(); push_wmops( "ISAR_PRE_REND_MultiBinToSplitBinaural" ); Q_buff_re = Q_buff; diff --git a/lib_isar/lib_isar_pre_rend.h b/lib_isar/lib_isar_pre_rend.h index 0e1ca56724bb72b0090cca75890fc39e93396eed..f06877bbe11c3702ca1d0c020808207cc98f302a 100644 --- a/lib_isar/lib_isar_pre_rend.h +++ b/lib_isar/lib_isar_pre_rend.h @@ -42,42 +42,42 @@ *----------------------------------------------------------------------------------*/ 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 */ + SPLIT_REND_WRAPPER *hSplitBinRend, /* i/o: Split renderer pre-renderer handle */ + ISAR_SPLIT_REND_CONFIG_DATA *pSplitRendConfig, /* i/o: Split renderer pre-renderer config */ const Word32 output_Fs, /* i : output sampling rate */ const Word16 cldfb_in_flag, /* i : Flag to indicate CLDFB or time doamin input */ const Word16 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 Word16 mixed_td_cldfb_flag /* i : Flag to indicate combined TD and CLDFB input */ ); void ISAR_PRE_REND_close( - SPLIT_REND_WRAPPER *hSplitBinRend, /* i/o: Split renderer pre-renerer handle */ + SPLIT_REND_WRAPPER *hSplitBinRend, /* i/o: Split renderer pre-renderer handle */ IVAS_REND_AudioBuffer *pSplitRendEncBuffer /* i/o: Split renderer data buffer */ ); void ISAR_PRE_REND_GetMultiBinPoseData( - const ISAR_SPLIT_REND_CONFIG_DATA *pSplit_rend_config, /* i : Split renderer pre-renerer config */ + const ISAR_SPLIT_REND_CONFIG_DATA *pSplit_rend_config, /* i : Split renderer pre-renderer config */ MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, /* i/o: pose correction data handle */ const ISAR_SPLIT_REND_ROT_AXIS rot_axis /* i : Rotation axis */ ); ivas_error ISAR_PRE_REND_MultiBinToSplitBinaural( - SPLIT_REND_WRAPPER *hSplitBin, /* i/o: Split renderer pre-renerer handle */ - const IVAS_QUATERNION headPosition, /* i : head rotation QUATERNION */ - const Word32 SplitRendBitRate, /* i : Split renderer bitrate */ - ISAR_SPLIT_REND_CODEC splitCodec, /* i/o: Split renderer codec */ - const Word16 isar_frame_size_ms, /* i : ISAR framesize */ - Word16 codec_frame_size_ms, /* i/o: Split renderer codec framesize */ - ISAR_SPLIT_REND_BITS_HANDLE pBits, /* i/o: Split renderer bitstream handle */ - Word32* Cldfb_In_BinReal_fx[][CLDFB_NO_COL_MAX], /* i/o: CLDFB real buffer */ - Word32* Cldfb_In_BinImag_fx[][CLDFB_NO_COL_MAX], /* i/o: CLDFB imag buffer */ - const Word16 max_bands, /* i : CLDFB bands */ - Word32 *pOutput_fx[], /* i : low time resolution pre-renderer flag */ - const Word16 low_res_pre_rend_rot, /* i : low time resolution pre-renderer flag */ - const Word16 cldfb_in_flag, /* i : Flag to indicate CLDFB or time doamin input */ - const Word16 pcm_out_flag, /* i : Flag to indicate PCM output */ - const Word16 ro_md_flag, /* i : Flag to indicate real only metadata for yaw */ + SPLIT_REND_WRAPPER *hSplitBin, /* i/o: Split renderer pre-renderer handle */ + const IVAS_QUATERNION headPosition, /* i : head rotation QUATERNION */ + const Word32 SplitRendBitRate, /* i : Split renderer bitrate */ + ISAR_SPLIT_REND_CODEC splitCodec, /* i/o: Split renderer codec */ + const Word16 isar_frame_size_ms, /* i : ISAR framesize */ + Word16 codec_frame_size_ms, /* i/o: Split renderer codec framesize */ + ISAR_SPLIT_REND_BITS_HANDLE pBits, /* i/o: ISAR bits handle */ + Word32* Cldfb_In_BinReal_fx[][CLDFB_NO_COL_MAX], /* i/o: CLDFB real buffer */ + Word32* Cldfb_In_BinImag_fx[][CLDFB_NO_COL_MAX], /* i/o: CLDFB imag buffer */ + const Word16 max_bands, /* i : CLDFB bands */ + Word32 *pOutput_fx[], /* i : low time resolution pre-renderer flag */ + const Word16 low_res_pre_rend_rot, /* i : low time resolution pre-renderer flag */ + const Word16 cldfb_in_flag, /* i : Flag to indicate CLDFB or time doamin input */ + const Word16 pcm_out_flag, /* i : Flag to indicate PCM output */ + const Word16 ro_md_flag, /* i : Flag to indicate real only metadata for yaw */ Word16 Q_buff, Word16 *Q_out ); diff --git a/lib_rend/lib_rend_fx.c b/lib_rend/lib_rend_fx.c index c0882c6646facc1ba5ca1f38c90ad4a84c76e5c4..d0b14bb66d0e28ad703bbd69ed735485491a9e4a 100644 --- a/lib_rend/lib_rend_fx.c +++ b/lib_rend/lib_rend_fx.c @@ -11413,7 +11413,7 @@ static ivas_error printConfigInfo_rend( EQ_16( hIvasRend->outputConfig, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_16( hIvasRend->outputConfig, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { - fprintf( stdout, "Render framesize: %dms\n", i_mult( hIvasRend->num_subframes, 5 ) ); + fprintf( stdout, "Render framesize: %dms\n", i_mult( hIvasRend->num_subframes, BINAURAL_RENDERING_FRAME_SIZE_MS ) ); } return IVAS_ERR_OK;