diff --git a/apps/decoder.c b/apps/decoder.c index 7b02e26b4d16f550b669b01e04535c1158f4b054..4fb8053dfbb4636f5707458be57af24fffc692cc 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -178,19 +178,27 @@ typedef struct static bool parseCmdlIVAS_dec( int16_t argc, char **argv, DecArguments *arg ); static void usage_dec( void ); static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtfBinary, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, ObjectEditFileReader *objectEditFileReader, ISAR_SPLIT_REND_BITS_DATA *splitRendBits, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf ); +static ivas_error decodeVoIP( + DecArguments arg, + BS_READER_HANDLE hBsReader, + IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtf, + RotFileReader *headRotReader, + RotFileReader *externalOrientationFileReader, + RotFileReader *refRotReader, + Vector3PairFileReader *referenceVectorReader, + ObjectEditFileReader *objectEditFileReader, #ifdef FIX_1119_SPLIT_RENDERING_VOIP -#ifdef DECODER_FORMAT_SWITCHING -static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtf, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, ObjectEditFileReader *objectEditFileReader, ISAR_SPLIT_REND_BITS_DATA *splitRendBits, IVAS_DEC_HANDLE *phIvasDec, int16_t *pcmBuf ); -#else -static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtf, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, ObjectEditFileReader *objectEditFileReader, ISAR_SPLIT_REND_BITS_DATA *splitRendBits, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf ); + ISAR_SPLIT_REND_BITS_DATA *splitRendBits, #endif -#else -#ifdef DDECODER_FORMAT_SWITCHING -static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtfBinary, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, ObjectEditFileReader *objectEditFileReader, IVAS_DEC_HANDLE *phIvasDec, int16_t *pcmBuf ); -#else -static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtfBinary, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, ObjectEditFileReader *objectEditFileReader, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf ); +#ifdef FIX_SPLIT_RENDERING_ON_DECODER_RESTART + IVAS_RENDER_CONFIG_DATA *renderConfig, #endif +#ifdef DECODER_FORMAT_SWITCHING + IVAS_DEC_HANDLE *phIvasDec, +#else + IVAS_DEC_HANDLE hIvasDec, #endif + int16_t *pcmBuf ); static ivas_error load_hrtf_from_file( IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtfBinary, IVAS_DEC_HANDLE hIvasDec, const IVAS_AUDIO_CONFIG OutputConfig, const int32_t output_Fs ); static void do_object_editing_fx( IVAS_EDITABLE_PARAMETERS *editableParameters, ObjectEditFileReader *objectEditFileReader ); @@ -232,6 +240,9 @@ int main( IVAS_ROOM_ACOUSTICS_CONFIG_DATA **pAE = NULL; uint32_t aeCount = 0; #endif +#ifdef FIX_SPLIT_RENDERING_ON_DECODER_RESTART + IVAS_RENDER_CONFIG_DATA renderConfig = { 0 }; +#endif #ifdef WMOPS reset_wmops(); reset_mem( USE_BYTES ); @@ -530,7 +541,9 @@ int main( if ( arg.renderConfigEnabled ) { +#ifndef FIX_SPLIT_RENDERING_ON_DECODER_RESTART IVAS_RENDER_CONFIG_DATA renderConfig; +#endif /* sanity check */ if ( arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB && @@ -730,19 +743,19 @@ int main( if ( arg.voipMode ) { + error = decodeVoIP( arg, hBsReader, &hHrtfBinary, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, objectEditFileReader, #ifdef FIX_1119_SPLIT_RENDERING_VOIP -#ifdef DECODER_FORMAT_SWITCHING - error = decodeVoIP( arg, hBsReader, &hHrtfBinary, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, objectEditFileReader, &splitRendBits, &hIvasDec, pcmBuf ); -#else - error = decodeVoIP( arg, hBsReader, &hHrtfBinary, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, objectEditFileReader, &splitRendBits, hIvasDec, pcmBuf ); + &splitRendBits, #endif -#else -#ifdef DDECODER_FORMAT_SWITCHING - error = decodeVoIP( arg, hBsReader, &hHrtfBinary, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, objectEditFileReader, &hIvasDec, pcmBuf ); -#else - error = decodeVoIP( arg, hBsReader, &hHrtfBinary, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, objectEditFileReader, hIvasDec, pcmBuf ); +#ifdef FIX_SPLIT_RENDERING_ON_DECODER_RESTART + &renderConfig, #endif +#ifdef DECODER_FORMAT_SWITCHING + &hIvasDec, +#else + hIvasDec, #endif + pcmBuf ); } else { @@ -3008,6 +3021,9 @@ static ivas_error decodeVoIP( #ifdef FIX_1119_SPLIT_RENDERING_VOIP ISAR_SPLIT_REND_BITS_DATA *splitRendBits, #endif +#ifdef FIX_SPLIT_RENDERING_ON_DECODER_RESTART + IVAS_RENDER_CONFIG_DATA *renderConfig, +#endif #ifdef DECODER_FORMAT_SWITCHING IVAS_DEC_HANDLE *phIvasDec, #else @@ -3249,8 +3265,12 @@ static ivas_error decodeVoIP( &hIvasDec, newCodecInPacket, &arg, +#ifdef FIX_SPLIT_RENDERING_ON_DECODER_RESTART + renderConfig, +#else NULL, /* ToDo : Provide rendererConfig */ - NULL /* ToDo : Provide LS Custom Data */ +#endif + NULL /* ToDo : Provide LS Custom Data */ ); if ( error != IVAS_ERR_OK ) { @@ -4374,6 +4394,7 @@ ivas_error restartDecoder( goto cleanup; } +#ifndef FIX_SPLIT_RENDERING_ON_DECODER_RESTART 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 ) @@ -4390,6 +4411,7 @@ ivas_error restartDecoder( arg->enableHeadRotation = true; } +#endif if ( arg->voipMode ) { @@ -4406,6 +4428,15 @@ ivas_error restartDecoder( goto cleanup; } +#ifdef FIX_SPLIT_RENDERING_ON_DECODER_RESTART + /* ISAR frame size is set from command line, not renderer config file. + * 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; + } +#endif + if ( arg->renderConfigEnabled && renderConfig != NULL ) { if ( ( error = IVAS_DEC_FeedRenderConfig( hIvasDec, *renderConfig ) ) != IVAS_ERR_OK ) diff --git a/lib_com/options.h b/lib_com/options.h index 6a092898a498fa48132c8fe6117b9fb6ae45bbb5..b4a928e23c75d0ef900725d736e386e36d12cb90 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -157,6 +157,7 @@ #define REVERSE_ISM_PI_DATA /* Add reading and packing/unpacking of reverse ISM PI data */ #define PI_LATENCY /* Support for PI latency */ #define DECODER_FORMAT_SWITCHING /* Re-initialize the decoder when the format/subformat of the incoming stream is changed */ +#define FIX_SPLIT_RENDERING_ON_DECODER_RESTART /* Re-configure split rendering on decoder restart */ /* #################### End BASOP porting switches ############################ */