diff --git a/apps/decoder.c b/apps/decoder.c index c3852c20e20f2360850a7427bf352b401cedb189..9a20474542dd7c9c05aec360909f544ebb6c735a 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -122,7 +122,11 @@ typedef struct bool customLsOutputEnabled; char *customLsSetupFilename; int16_t orientation_tracking; +#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION + bool non_diegetic_pan_enabled; +#else int16_t Opt_non_diegetic_pan; +#endif float non_diegetic_pan_gain; Word16 non_diegetic_pan_gain_fx; /* Q15 */ bool renderConfigEnabled; @@ -136,7 +140,11 @@ typedef struct #else uint16_t acousticEnvironmentId; #endif +#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION + bool dpidEnabled; +#else int16_t Opt_dpid_on; +#endif uint16_t directivityPatternId[IVAS_MAX_NUM_OBJECTS]; } DecArguments; @@ -385,8 +393,12 @@ int main( if ( arg.renderConfigEnabled ) { /* sanity check */ +#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION + if ( arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM && arg.non_diegetic_pan_enabled == false ) +#else if ( arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM && arg.Opt_non_diegetic_pan == 0 ) +#endif { fprintf( stderr, "\nError: Renderer configuration file cannot be used in this output configuration.\n\n" ); goto cleanup; @@ -407,8 +419,13 @@ int main( asked_frame_size = arg.renderFramesize; #ifdef FIX_1053_REVERB_RECONFIGURATION uint16_t aeID = arg.aeSequence.count > 0 ? arg.aeSequence.pID[0] : 65535; +#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION + 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.non_diegetic_pan_enabled, arg.non_diegetic_pan_gain_fx, + arg.dpidEnabled, aeID, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK ) +#else 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_fx, arg.Opt_dpid_on, aeID, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK ) +#endif #else 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_fx, arg.Opt_dpid_on, arg.acousticEnvironmentId, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK ) @@ -488,7 +505,11 @@ int main( /* 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 && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM && +#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION + arg.non_diegetic_pan_enabled == false ) +#else arg.Opt_non_diegetic_pan == 0 ) +#endif { fprintf( stderr, "\nExternal Renderer Config is supported only when binaural output configurations is used as output OR when Split rendering mode is enabled. Exiting. \n" ); goto cleanup; @@ -972,12 +993,20 @@ static bool parseCmdlIVAS_dec( arg->renderConfigEnabled = false; arg->renderConfigFilename = NULL; +#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION + arg->dpidEnabled = false; +#else arg->Opt_dpid_on = 0; +#endif arg->outputMdFilename = NULL; arg->inputFormat = IVAS_DEC_INPUT_FORMAT_G192; +#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION + arg->non_diegetic_pan_enabled = false; +#else arg->Opt_non_diegetic_pan = 0; +#endif arg->non_diegetic_pan_gain = 0.f; arg->tsmEnabled = false; arg->renderFramesize = IVAS_RENDER_FRAMESIZE_20MS; @@ -1244,7 +1273,11 @@ static bool parseCmdlIVAS_dec( else if ( strcmp( argv_to_upper, "-NON_DIEGETIC_PAN" ) == 0 ) { i++; +#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION + arg->non_diegetic_pan_enabled = true; +#else arg->Opt_non_diegetic_pan = 1; +#endif strncpy( argv_to_upper, argv[i], sizeof( argv_to_upper ) - 1 ); argv_to_upper[sizeof( argv_to_upper ) - 1] = '\0'; to_upper( argv_to_upper ); @@ -1400,7 +1433,11 @@ static bool parseCmdlIVAS_dec( { int16_t id, tmp; +#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION + arg->dpidEnabled = true; +#else arg->Opt_dpid_on = 1; +#endif ++i; tmp = 0; while ( is_number( argv[i + tmp] ) && tmp < IVAS_MAX_NUM_OBJECTS ) @@ -1480,7 +1517,12 @@ static bool parseCmdlIVAS_dec( arg->customLsSetupFilename = argv[i]; } i++; + +#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION + if ( arg->non_diegetic_pan_enabled && arg->outputConfig != IVAS_AUDIO_CONFIG_STEREO ) +#else if ( ( arg->Opt_non_diegetic_pan ) && ( arg->outputConfig != IVAS_AUDIO_CONFIG_STEREO ) ) +#endif { fprintf( stderr, "Error: non-diegetic panning is supported in stereo only\n\n" ); usage_dec(); @@ -1497,7 +1539,12 @@ static bool parseCmdlIVAS_dec( { arg->outputConfig = IVAS_AUDIO_CONFIG_MONO; arg->decMode = IVAS_DEC_MODE_EVS; + +#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION + if ( arg->non_diegetic_pan_enabled ) +#else if ( ( arg->Opt_non_diegetic_pan ) ) +#endif { arg->outputConfig = IVAS_AUDIO_CONFIG_STEREO; } diff --git a/lib_com/options.h b/lib_com/options.h index 4e4d157cae9f07a81b221a55558109581619eff6..5d3d3ab97258b2a48ce70d8df62058b7d577982f 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -121,7 +121,8 @@ #define NONBE_FIX_1128_OSBA_EXT_OUTPUT_ORDER /* FhG: issue 1128: set output ambisonics order to input order for EXT output */ #define FIX_1138_SBA_EXT_ERROR_PRINTOUT /* VA: issue 1138: Fix SBA EXT output call of audioCfg2channels() */ #define NONBE_1244_FIX_SWB_BWE_MEMORY /* VA: issue 1244: fix to SWB BWE memory in case of switching from FB coding - pending a review by Huawei */ -#define NONBE_FIX_981_PARAMBIN_DEFAULT_EARLY_PART /* Nokia: Set default early part energy correction to unity for BINAURAL_ROOM_REVERB */ +#define FIX_745_FIX_DATA_TYPE_CONVERSION /* VA: issue 745: implicit data type conversion when calling IVAS_DEC_Configure() */ +#define NONBE_FIX_981_PARAMBIN_DEFAULT_EARLY_PART /* Nokia: Set default early part energy correction to unity for BINAURAL_ROOM_REVERB */ #define NONBE_FIX_1174_MCMASA_LBR_LOOP_ERROR /* Nokia: Fix issue 1174 by removing the unnecessary inner loop causing problems. */ #define FIX_587_DEFAULT_REVERB /* Philips: issue 587: inconsistent default reverb parameters across renderers */ #define NONBE_FIX_1097_SBA_DTX_BRATE_SWITCHING_ENC /* FhG: fix out-of-bound errors when switching from SID frame to active frame*/ diff --git a/lib_dec/lib_dec.h b/lib_dec/lib_dec.h index 2e8457373ce6960637969e426a5bd0d82d83a61a..cc5185a72d7055d7a402f81fc013002a37e3daa7 100644 --- a/lib_dec/lib_dec.h +++ b/lib_dec/lib_dec.h @@ -96,12 +96,30 @@ typedef ivas_error ( *JbmTraceFileWriterFn )( const void *data, void *writer ); /*! r: error code */ ivas_error IVAS_DEC_Open( - IVAS_DEC_HANDLE *phIvasDec, /* i/o: pointer to an IVAS decoder handle to be opened */ - IVAS_DEC_MODE mode /* i : compatibility mode (EVS or IVAS) */ + IVAS_DEC_HANDLE *phIvasDec, /* i/o: pointer to an IVAS decoder handle to be opened */ + IVAS_DEC_MODE mode /* i : compatibility mode (EVS or IVAS) */ ); /*! r: error code */ ivas_error IVAS_DEC_Configure( +#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION + 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 bool tsmEnabled, /* i : enable time scale modification */ + 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 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 delayCompensationEnabled /* i : enable delay compensation */ +#else IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ const UWord32 sampleRate, /* i : output sampling frequency */ const IVAS_AUDIO_CONFIG outputConfig, /* i : audio configuration */ @@ -118,10 +136,11 @@ ivas_error IVAS_DEC_Configure( const Word16 Opt_dpid_on, /* i : enable directivity pattern option */ const UWord16 acousticEnvironmentId, /* i : Acoustic environment ID */ const Word16 delayCompensationEnabled /* i : enable delay compensation */ +#endif ); void IVAS_DEC_Close( - IVAS_DEC_HANDLE *phIvasDec /* i/o: pointer to IVAS decoder handle */ + IVAS_DEC_HANDLE *phIvasDec /* i/o: pointer to IVAS decoder handle */ ); @@ -129,19 +148,19 @@ void IVAS_DEC_Close( /*! r: error code */ ivas_error IVAS_DEC_FeedFrame_Serial( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - UWord16 *serial, /* i : buffer containing serial input bitstream. Each bit should be stored as a single UWord16 value */ - const UWord16 num_bits, /* i : number of bits in input bitstream */ - Word16 bfi /* i : bad frame indicator flag */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + UWord16 *serial, /* i : buffer containing serial input bitstream. Each bit should be stored as a single UWord16 value */ + const UWord16 num_bits, /* i : number of bits in input bitstream */ + Word16 bfi /* i : bad frame indicator flag */ ); /*! r: decoder error code */ ivas_error IVAS_DEC_GetSamples( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - const Word16 nSamplesAsked, /* i : number of samples wanted by the caller */ - Word16 *pcmBuf, /* i/o: buffer for decoded PCM output. The memory must already be allocated and be able to hold the expected number of output samples, based on frame size and number of output channels Q0 */ - Word16 *nOutSamples, /* o : number of samples per channel written to output buffer */ - bool *needNewFrame /* o : indication that the decoder needs a new frame */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + const Word16 nSamplesAsked, /* i : number of samples wanted by the caller */ + Word16 *pcmBuf, /* i/o: buffer for decoded PCM output. The memory must already be allocated and be able to hold the expected number of output samples, based on frame size and number of output channels Q0 */ + Word16 *nOutSamples, /* o : number of samples per channel written to output buffer */ + bool *needNewFrame /* o : indication that the decoder needs a new frame */ ); ivas_error IVAS_DEC_GetSplitBinauralBitstream( @@ -183,10 +202,10 @@ int16_t IVAS_DEC_is_split_rendering_coded_out( /*! r: error code */ ivas_error IVAS_DEC_GetObjectMetadata( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - IVAS_ISM_METADATA *metadata, /* o : struct where metadata decoded in most recently decoded frame will be written */ - const UWord16 zero_flag, /* i : if this flag is enabled, this function outputs a zero-initialized metadata struct */ - const UWord16 objectIdx /* i : index of the queried object */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + IVAS_ISM_METADATA *metadata, /* o : struct where metadata decoded in most recently decoded frame will be written */ + const UWord16 zero_flag, /* i : if this flag is enabled, this function outputs a zero-initialized metadata struct */ + const UWord16 objectIdx /* i : index of the queried object */ ); /*! r: error code */ @@ -198,24 +217,24 @@ ivas_error IVAS_DEC_GetMasaMetadata( /*! r: error code */ ivas_error IVAS_DEC_FeedHeadTrackData( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - IVAS_QUATERNION orientation, /* i : head-tracking data, listener orientation */ - IVAS_VECTOR3 Pos, /* i : listener position */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + IVAS_QUATERNION orientation, /* i : head-tracking data, listener orientation */ + IVAS_VECTOR3 Pos, /* i : listener position */ const Word16 subframe_idx, /* i : subframe index */ const ISAR_SPLIT_REND_ROT_AXIS rot_axis /* i : external control for rotation axis for split rendering */ ); /*! r: error code */ ivas_error IVAS_DEC_FeedRefRotData( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - IVAS_QUATERNION rotation /* i : reference rotation data */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + IVAS_QUATERNION rotation /* i : reference rotation data */ ); /*! r: error code */ ivas_error IVAS_DEC_FeedRefVectorData( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - IVAS_VECTOR3 listenerPos, /* i : Listener position */ - IVAS_VECTOR3 refPos /* i : Reference position */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + IVAS_VECTOR3 listenerPos, /* i : Listener position */ + IVAS_VECTOR3 refPos /* i : Reference position */ ); /*! r: error code */ @@ -231,43 +250,43 @@ ivas_error IVAS_DEC_FeedExternalOrientationData( /*! r: error code */ ivas_error IVAS_DEC_VoIP_FeedFrame( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - UWord8 *au, /* i : buffer containing input access unit */ - const UWord16 auSize, /* i : size of the access unit */ - const UWord16 rtpSequenceNumber, /* i : RTP sequence number (16 bits) */ - const UWord32 rtpTimeStamp, /* i : RTP timestamp (32 bits) */ - const UWord32 rcvTime_ms, /* i : receive time of the RTP packet in milliseconds */ - const bool qBit /* i : Q bit for AMR-WB IO */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + UWord8 *au, /* i : buffer containing input access unit */ + const UWord16 auSize, /* i : size of the access unit */ + const UWord16 rtpSequenceNumber, /* i : RTP sequence number (16 bits) */ + const UWord32 rtpTimeStamp, /* i : RTP timestamp (32 bits) */ + const UWord32 rcvTime_ms, /* i : receive time of the RTP packet in milliseconds */ + const bool qBit /* i : Q bit for AMR-WB IO */ ); ivas_error IVAS_DEC_VoIP_SetScale( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - const Word16 maxScaling, /* i : maximum allowed TSM scale */ - const Word16 scale /* i : TSM scale to set */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + const Word16 maxScaling, /* i : maximum allowed TSM scale */ + const Word16 scale /* i : TSM scale to set */ ); ivas_error IVAS_DEC_TSM_SetQuality( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - const Word16 quality /* i : target TSM quality Q14 */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + const Word16 quality /* i : target TSM quality Q14 */ ); /*! r: error code */ ivas_error IVAS_DEC_VoIP_GetSamples( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - UWord16 nSamplesPerChannel, /* i : number of samples per channel requested to be written to output buffer */ - Word16 *pcmBuf, /* i/o: buffer for decoded PCM output. The memory must already be allocated and be able to hold the expected number of output samples, based on frame size and number of output channels Q0 */ - const UWord32 systemTimestamp_ms /* i : current system timestamp */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + UWord16 nSamplesPerChannel, /* i : number of samples per channel requested to be written to output buffer */ + Word16 *pcmBuf, /* i/o: buffer for decoded PCM output. The memory must already be allocated and be able to hold the expected number of output samples, based on frame size and number of output channels Q0 */ + const UWord32 systemTimestamp_ms /* i : current system timestamp */ #ifdef SUPPORT_JBM_TRACEFILE - , JbmTraceFileWriterFn jbmWriterFn, - void* jbmWriter + , JbmTraceFileWriterFn jbmWriterFn, + void* jbmWriter #endif ); ivas_error IVAS_DEC_Flush( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - const Word16 nSamplesPerChannel, /* i : number of samples per channel requested to be written to output buffer */ - Word16 *pcmBuf, /* i/o: buffer for decoded PCM output. The memory must already be allocated and be able to hold the expected number of output samples, based on frame size and number of output channels Q0 */ - Word16 *nSamplesFlushed /* o : number of samples flushed */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + const Word16 nSamplesPerChannel, /* i : number of samples per channel requested to be written to output buffer */ + Word16 *pcmBuf, /* i/o: buffer for decoded PCM output. The memory must already be allocated and be able to hold the expected number of output samples, based on frame size and number of output channels Q0 */ + Word16 *nSamplesFlushed /* o : number of samples flushed */ ); /* Setter functions - apply changes to decoder configuration */ @@ -285,33 +304,33 @@ 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_FRAMESIZE render_framesize /* i : render framesize */ ); ivas_error IVAS_DEC_GetRenderFramesize( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - IVAS_RENDER_FRAMESIZE *render_framesize /* o : render framesize */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + IVAS_RENDER_FRAMESIZE *render_framesize /* o : render framesize */ ); ivas_error IVAS_DEC_GetRenderFramesizeSamples( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - Word16 *render_framesize /* o : render framesize in samples Q0 */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + Word16 *render_framesize /* o : render framesize in samples Q0 */ ); ivas_error IVAS_DEC_GetReferencesUpdateFrequency( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - Word16 *update_frequency /* o : update frequency Q0 */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + 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_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 */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + UWord32 *render_framesize /* o : render framesize in samples Q0 */ ); @@ -319,113 +338,113 @@ ivas_error IVAS_DEC_GetRenderFramesizeMs( /*! r: error code */ ivas_error IVAS_DEC_GetNumObjects( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - UWord16 *numObjects /* o : number of objects for which the decoder has been configured */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + UWord16 *numObjects /* o : number of objects for which the decoder has been configured */ ); /*! r: error code */ ivas_error IVAS_DEC_GetFormat( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - IVAS_DEC_BS_FORMAT *format /* o : format detected from bitstream fed to the decoder */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + IVAS_DEC_BS_FORMAT *format /* o : format detected from bitstream fed to the decoder */ ); /*! r: error code */ ivas_error IVAS_DEC_GetOutputBufferSize( - const IVAS_DEC_HANDLE hIvasDec, /* i : IVAS decoder handle */ - Word16 *outputBufferSize /* o : total number of samples expected in the output buffer for current decoder configuration*/ + const IVAS_DEC_HANDLE hIvasDec, /* i : IVAS decoder handle */ + Word16 *outputBufferSize /* o : total number of samples expected in the output buffer for current decoder configuration*/ ); /*! r: error code */ ivas_error IVAS_DEC_GetNumOutputChannels( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - Word16 *numOutputChannels /* o : number of PCM output channels */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + Word16 *numOutputChannels /* o : number of PCM output channels */ ); /*! r: error code */ ivas_error IVAS_DEC_FeedCustomLsData( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - const IVAS_CUSTOM_LS_DATA hLsCustomData /* i : Custom loudspeaker setup data */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + const IVAS_CUSTOM_LS_DATA hLsCustomData /* i : Custom loudspeaker setup data */ ); /*! r: error code */ ivas_error IVAS_DEC_GetHrtfHandle( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - IVAS_DEC_HRTF_HANDLE **hHrtfTD /* o : HRTF handle */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + IVAS_DEC_HRTF_HANDLE **hHrtfTD /* o : HRTF handle */ ); /*! r: error code */ ivas_error IVAS_DEC_GetHrtfCRendHandle( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ -IVAS_DEC_HRTF_CREND_HANDLE **hSetOfHRTF /* o : Set of HRTF handle */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + IVAS_DEC_HRTF_CREND_HANDLE **hSetOfHRTF /* o : Set of HRTF handle */ ); ivas_error IVAS_DEC_GetHrtfFastConvHandle( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - IVAS_DEC_HRTF_FASTCONV_HANDLE **hHrtfFastConv /* o : FASTCONV HRTF handle */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + IVAS_DEC_HRTF_FASTCONV_HANDLE **hHrtfFastConv /* o : FASTCONV HRTF handle */ ); ivas_error IVAS_DEC_GetHrtfParamBinHandle( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - IVAS_DEC_HRTF_PARAMBIN_HANDLE **hHrtfParambin /* o : Parametric binauralizer HRTF handle */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + IVAS_DEC_HRTF_PARAMBIN_HANDLE **hHrtfParambin /* o : Parametric binauralizer HRTF handle */ ); ivas_error IVAS_DEC_GetHrtfStatisticsHandle( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - IVAS_DEC_HRTF_STATISTICS_HANDLE **hHrtfStatistics /* o : HRTF statistics handle */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + IVAS_DEC_HRTF_STATISTICS_HANDLE **hHrtfStatistics /* o : HRTF statistics handle */ ); /*! r: error code*/ ivas_error IVAS_DEC_GetRenderConfig( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - const IVAS_RENDER_CONFIG_HANDLE hRCout /* o : Render config handle */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + const IVAS_RENDER_CONFIG_HANDLE hRCout /* o : Render config handle */ ); /*! r: error code*/ ivas_error IVAS_DEC_GetDefaultRenderConfig( - IVAS_RENDER_CONFIG_HANDLE hRCout /* o : Render config handle */ + IVAS_RENDER_CONFIG_HANDLE hRCout /* o : Render config handle */ ); /*! r: error code*/ ivas_error IVAS_DEC_FeedRenderConfig( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - const IVAS_RENDER_CONFIG_DATA hRenderConfig /* i : Render config data structure */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + const IVAS_RENDER_CONFIG_DATA hRenderConfig /* i : Render config data structure */ ); /*! r: error code */ ivas_error IVAS_DEC_GetDelay( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - Word16 *nSamples, /* o : decoder delay in samples */ - Word32 *timeScale /* o : time scale of the delay, equal to decoder output sampling rate */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + Word16 *nSamples, /* o : decoder delay in samples */ + Word32 *timeScale /* o : time scale of the delay, equal to decoder output sampling rate */ ); /*! r: error code */ ivas_error IVAS_DEC_HasDecodedFirstGoodFrame( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - bool *hasDecodedFirstGoodFrame /* o : flag indicating if the decoder has decoded a good frame since it was configured */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + bool *hasDecodedFirstGoodFrame /* o : flag indicating if the decoder has decoded a good frame since it was configured */ ); /*! r: error code */ ivas_error IVAS_DEC_GetPcmFrameSize( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - Word32 *pcmFrameSize /* o : total size of the PCM output frame. This takes into account the number of output channels Q0 */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + Word32 *pcmFrameSize /* o : total size of the PCM output frame. This takes into account the number of output channels Q0 */ ); /*! r: true if decoder has no data in VoIP jitter buffer */ bool IVAS_DEC_VoIP_IsEmpty( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - const Word16 nSamplesAsked + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + const Word16 nSamplesAsked ); ivas_error IVAS_DEC_VoIP_Get_CA_offset( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - Word16 *optimum_offset, //Q0 - Word16 *FEC_hi //Q0 + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + Word16 *optimum_offset, //Q0 + Word16 *FEC_hi //Q0 ); #ifdef SUPPORT_JBM_TRACEFILE ivas_error IVAS_DEC_GetJbmData( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - IVAS_JBM_TRACE_DATA *JbmTraceData /* o : JBM Trace data */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + IVAS_JBM_TRACE_DATA *JbmTraceData /* o : JBM Trace data */ ); #endif @@ -433,7 +452,7 @@ ivas_error IVAS_DEC_GetJbmData( /*! r: pointer to an error message string */ const char *IVAS_DEC_GetErrorMessage( - ivas_error error /* i : decoder error code enum */ + ivas_error error /* i : decoder error code enum */ ); #ifdef FIX_VOIP_FUNCTIONS @@ -441,14 +460,13 @@ ivas_error IVAS_DEC_PrintConfig( #else void IVAS_DEC_PrintConfig( #endif - const IVAS_DEC_HANDLE hIvasDec, /* i : IVAS decoder handle */ - const bool quietModeEnabled, /* i : quiet mode flag: if true, reduces the amount of config info printed */ - const bool voipMode + const IVAS_DEC_HANDLE hIvasDec, /* i : IVAS decoder handle */ + const bool quietModeEnabled, /* i : quiet mode flag: if true, reduces the amount of config info printed */ + const bool voipMode ); - void IVAS_DEC_PrintDisclaimer( - void + void ); /* clang-format on */ diff --git a/lib_dec/lib_dec_fx.c b/lib_dec/lib_dec_fx.c index bdb15ff181642098c4625b5d8f1f4915e2a33846..264cb0b44240f96cd1d38af092d10ef39ea7a405 100644 --- a/lib_dec/lib_dec_fx.c +++ b/lib_dec/lib_dec_fx.c @@ -455,22 +455,41 @@ static IVAS_DEC_BS_FORMAT mapIvasFormat( *---------------------------------------------------------------------*/ ivas_error IVAS_DEC_Configure( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - const UWord32 sampleRate, /* i : output sampling frequency */ - const AUDIO_CONFIG outputConfig, /* i : output configuration */ - const Word16 tsmEnabled, /* i : enable time scale modification */ - const IVAS_RENDER_FRAMESIZE renderFramesize, /* i : rendering frame size */ - const Word16 customLsOutputEnabled, /* i : enable custom loudspeaker setup handle */ - const Word16 hrtfReaderEnabled, /* i : enable HRTF binary file input */ - const Word16 enableHeadRotation, /* i : enable head rotation for binaural output */ - const Word16 enableExternalOrientation, /* i : enable external orientations */ - const IVAS_HEAD_ORIENT_TRK_T orientation_tracking, /* i : head orientation tracking type */ +#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION + 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 bool tsmEnabled, /* i : enable time scale modification */ + 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 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 delayCompensationEnabled /* i : enable delay compensation */ +#else + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + const UWord32 sampleRate, /* i : output sampling frequency */ + const AUDIO_CONFIG outputConfig, /* i : output configuration */ + const Word16 tsmEnabled, /* i : enable time scale modification */ + const IVAS_RENDER_FRAMESIZE renderFramesize, /* i : rendering frame size */ + const Word16 customLsOutputEnabled, /* i : enable custom loudspeaker setup handle */ + const Word16 hrtfReaderEnabled, /* i : enable HRTF binary file input */ + const Word16 enableHeadRotation, /* i : enable head rotation for binaural output */ + const Word16 enableExternalOrientation, /* i : enable external orientations */ + const IVAS_HEAD_ORIENT_TRK_T orientation_tracking, /* i : head orientation tracking type */ const Word16 renderConfigEnabled, /* i : enable Renderer config. file for binaural output */ const Word16 Opt_non_diegetic_pan, /* i : diegetic or not */ const Word16 non_diegetic_pan_gain_fx, /* i : non diegetic panning gain Q15 */ const Word16 Opt_dpid_on, /* i : enable directivity pattern option */ const UWord16 acousticEnvironmentId, /* i : Acoustic environment ID */ const Word16 delayCompensationEnabled /* i : enable delay compensation */ +#endif ) { Decoder_Struct *st_ivas; @@ -495,18 +514,22 @@ ivas_error IVAS_DEC_Configure( test(); test(); test(); +#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION + IF( EQ_16( hIvasDec->mode, IVAS_DEC_MODE_EVS ) && !( ( EQ_16( outputConfig, IVAS_AUDIO_CONFIG_MONO ) && non_diegetic_pan_enabled == false ) || + ( EQ_16( outputConfig, IVAS_AUDIO_CONFIG_STEREO ) && non_diegetic_pan_enabled ) ) ) +#else IF( EQ_16( hIvasDec->mode, IVAS_DEC_MODE_EVS ) && !( ( EQ_16( outputConfig, IVAS_AUDIO_CONFIG_MONO ) && Opt_non_diegetic_pan == 0 ) || ( EQ_16( outputConfig, IVAS_AUDIO_CONFIG_STEREO ) && EQ_16( Opt_non_diegetic_pan, 1 ) ) ) ) +#endif { return IVAS_ERR_WRONG_MODE; } st_ivas = hIvasDec->st_ivas; - hDecoderConfig = st_ivas->hDecoderConfig; - hDecoderConfig->output_config = outputConfig; move16(); + IF( EQ_16( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_INVALID ) ) { return IVAS_ERR_WRONG_PARAMS; @@ -529,17 +552,37 @@ ivas_error IVAS_DEC_Configure( move16(); } +#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION + hDecoderConfig->Opt_tsm = (Word16) tsmEnabled; + hDecoderConfig->Opt_LsCustom = (Word16) customLsOutputEnabled; + hDecoderConfig->Opt_Headrotation = (Word16) enableHeadRotation; +#else hDecoderConfig->Opt_tsm = tsmEnabled; hDecoderConfig->Opt_LsCustom = customLsOutputEnabled; hDecoderConfig->Opt_Headrotation = enableHeadRotation; +#endif hDecoderConfig->orientation_tracking = orientation_tracking; +#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION + hDecoderConfig->Opt_HRTF_binary = (Word16) hrtfReaderEnabled; + hDecoderConfig->Opt_RendConfigCustom = (Word16) renderConfigEnabled; + hDecoderConfig->Opt_non_diegetic_pan = (Word16) non_diegetic_pan_enabled; +#else hDecoderConfig->Opt_HRTF_binary = hrtfReaderEnabled; hDecoderConfig->Opt_RendConfigCustom = renderConfigEnabled; hDecoderConfig->Opt_non_diegetic_pan = Opt_non_diegetic_pan; +#endif hDecoderConfig->non_diegetic_pan_gain_fx = non_diegetic_pan_gain_fx; // Q15 +#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION + hDecoderConfig->Opt_delay_comp = (Word16) delayCompensationEnabled; +#else hDecoderConfig->Opt_delay_comp = delayCompensationEnabled; +#endif hDecoderConfig->Opt_ExternalOrientation = enableExternalOrientation; +#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION + hDecoderConfig->Opt_dpid_on = (Word16) dpidEnabled; +#else hDecoderConfig->Opt_dpid_on = Opt_dpid_on; +#endif IF( NE_32( (Word32) acousticEnvironmentId, 65535 ) ) { hDecoderConfig->Opt_aeid_on = TRUE;