Skip to content
Commits on Source (45)
...@@ -71,12 +71,11 @@ static ...@@ -71,12 +71,11 @@ static
#define NUM_BITS_SID_IVAS_5K2 104 #define NUM_BITS_SID_IVAS_5K2 104
#define MAX_OUTPUT_PCM_BUFFER_SIZE ( ( IVAS_MAX_OUTPUT_CHANNELS + IVAS_MAX_NUM_OBJECTS ) * IVAS_MAX_FRAME_SIZE ) #define MAX_OUTPUT_PCM_BUFFER_SIZE ( ( IVAS_MAX_OUTPUT_CHANNELS + IVAS_MAX_NUM_OBJECTS ) * IVAS_MAX_FRAME_SIZE )
#define ORIENT_TRK_NONE ( 0 )
#define IVAS_PUBLIC_ORIENT_TRK_NONE ( 0 ) #define ORIENT_TRK_REF ( 1 )
#define IVAS_PUBLIC_ORIENT_TRK_REF ( 1 ) #define ORIENT_TRK_AVG ( 2 )
#define IVAS_PUBLIC_ORIENT_TRK_AVG ( 2 ) #define ORIENT_TRK_REF_VEC ( 3 )
#define IVAS_PUBLIC_ORIENT_TRK_REF_VEC ( 3 ) #define ORIENT_TRK_REF_VEC_LEV ( 4 )
#define IVAS_PUBLIC_ORIENT_TRK_REF_VEC_LEV ( 4 )
#ifdef VARIABLE_SPEED_DECODING #ifdef VARIABLE_SPEED_DECODING
#define VARIABLE_SPEED_FETCH_FRAMESIZE_MS 20 #define VARIABLE_SPEED_FETCH_FRAMESIZE_MS 20
...@@ -161,24 +160,22 @@ static bool parseCmdlIVAS_dec( int16_t argc, char **argv, DecArguments *arg ); ...@@ -161,24 +160,22 @@ static bool parseCmdlIVAS_dec( int16_t argc, char **argv, DecArguments *arg );
static void usage_dec( void ); static void usage_dec( void );
static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader,
#ifdef SPLIT_REND_WITH_HEAD_ROT #ifdef SPLIT_REND_WITH_HEAD_ROT
uint8_t *splitRendBitsBuf, static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, uint8_t *splitRendBitsBuf, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf );
#else
static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf );
#endif #endif
IVAS_DEC_HANDLE hIvasDec,
int16_t *pcmBuf );
static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HANDLE hIvasDec ); static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HANDLE hIvasDec );
#ifdef DEBUGGING #ifdef DEBUGGING
#ifdef VARIABLE_SPEED_DECODING
static ivas_error decodeVariableSpeed( DecArguments arg, BS_READER_HANDLE hBsReader, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, IVAS_DEC_HANDLE hIvasDec );
#endif
static ivas_error printBitstreamInfoVoip( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HANDLE hIvasDec ); static ivas_error printBitstreamInfoVoip( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HANDLE hIvasDec );
static int16_t app_own_random( int16_t *seed ); static int16_t app_own_random( int16_t *seed );
static IVAS_DEC_FORCED_REND_MODE parseForcedRendModeDec( char *forcedRendModeChar ); static IVAS_DEC_FORCED_REND_MODE parseForcedRendModeDec( char *forcedRendModeChar );
#endif #endif
/*------------------------------------------------------------------------------------------* /*------------------------------------------------------------------------------------------*
* main() * main()
* *
...@@ -343,7 +340,7 @@ int main( ...@@ -343,7 +340,7 @@ int main(
} }
/* sanity check */ /* sanity check */
if ( arg.orientation_tracking != IVAS_PUBLIC_ORIENT_TRK_REF ) if ( arg.orientation_tracking != ORIENT_TRK_REF )
{ {
fprintf( stderr, "\nError: Reference rotation file can be used in '-otr ref' mode only.\n\n" ); fprintf( stderr, "\nError: Reference rotation file can be used in '-otr ref' mode only.\n\n" );
goto cleanup; goto cleanup;
...@@ -370,7 +367,7 @@ int main( ...@@ -370,7 +367,7 @@ int main(
} }
/* sanity check */ /* sanity check */
if ( arg.orientation_tracking != IVAS_PUBLIC_ORIENT_TRK_REF_VEC && arg.orientation_tracking != IVAS_PUBLIC_ORIENT_TRK_REF_VEC_LEV ) if ( arg.orientation_tracking != ORIENT_TRK_REF_VEC && arg.orientation_tracking != ORIENT_TRK_REF_VEC_LEV )
{ {
fprintf( stderr, "\nError: Reference trajectory file can be used in '-otr ref_vec' or '-otr ref_vec_lev' mode only.\n\n" ); fprintf( stderr, "\nError: Reference trajectory file can be used in '-otr ref_vec' or '-otr ref_vec_lev' mode only.\n\n" );
goto cleanup; goto cleanup;
...@@ -433,67 +430,10 @@ int main( ...@@ -433,67 +430,10 @@ int main(
} }
} }
/*-------------------------------------------------------------------*
* Load renderer configuration from file
*--------------------------------------------------------------------*/
IVAS_RENDER_CONFIG_DATA renderConfigSplit;
if ( ( error = IVAS_DEC_GetDefaultRenderConfig( &renderConfigSplit ) ) != IVAS_ERR_OK )
{
fprintf( stderr, "\nIVAS_DEC_GetDefaultRenderConfig failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
goto cleanup;
}
if ( arg.renderConfigEnabled )
{
/* sanity check */
#ifdef SPLIT_REND_WITH_HEAD_ROT
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 )
{
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" );
exit( -1 );
}
#else
if ( arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB )
{
fprintf( stderr, "\nExternal Renderer Config is supported only for binaural output configurations. Exiting. \n\n" );
goto cleanup;
}
#endif
if ( RenderConfigReader_read( renderConfigReader,
arg.renderConfigFilename,
&renderConfigSplit ) != IVAS_ERR_OK )
{
fprintf( stderr, "Failed to read renderer configuration from file %s\n\n", arg.renderConfigFilename );
goto cleanup;
}
}
/*------------------------------------------------------------------------------------------* /*------------------------------------------------------------------------------------------*
* Configure the decoder * Configure the decoder
*------------------------------------------------------------------------------------------*/ *------------------------------------------------------------------------------------------*/
#ifdef SPLIT_REND_WITH_HEAD_ROT
if ( arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
{
arg.enableHeadRotation = true;
if ( arg.enable5ms &&
( renderConfigSplit.split_rend_config.poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_NONE ||
renderConfigSplit.split_rend_config.dof == 0 ) )
{
/*TODO : needs to be refined as this wont work with LCLD codec*/
arg.enable5ms = true;
}
else
{
arg.enable5ms = false;
}
}
#endif
if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputConfig, arg.tsmEnabled, arg.enable5ms, if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputConfig, arg.tsmEnabled, arg.enable5ms,
arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled, arg.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled, arg.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain,
#ifdef FIX_708_DPID_COMMAND_LINE #ifdef FIX_708_DPID_COMMAND_LINE
...@@ -508,9 +448,8 @@ int main( ...@@ -508,9 +448,8 @@ int main(
goto cleanup; goto cleanup;
} }
/*------------------------------------------------------------------------------------------* /*------------------------------------------------------------------------------------------*
* Configure VoIP mode * Configure Split rendering
*------------------------------------------------------------------------------------------*/ *------------------------------------------------------------------------------------------*/
#ifdef SPLIT_REND_WITH_HEAD_ROT #ifdef SPLIT_REND_WITH_HEAD_ROT
...@@ -521,6 +460,8 @@ int main( ...@@ -521,6 +460,8 @@ int main(
fprintf( stderr, "\nConfigure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); fprintf( stderr, "\nConfigure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
goto cleanup; goto cleanup;
} }
arg.enableHeadRotation = true;
} }
#endif #endif
...@@ -672,6 +613,25 @@ int main( ...@@ -672,6 +613,25 @@ int main(
goto cleanup; goto cleanup;
} }
#ifdef SPLIT_REND_WITH_HEAD_ROT
if ( arg.enable5ms &&
( renderConfig.split_rend_config.poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_NONE ||
renderConfig.split_rend_config.dof == 0 ) )
{
/*TODO : needs to be refined as this wont work with LCLD codec*/
arg.enable5ms = true;
}
else
{
arg.enable5ms = false;
}
if ( ( error = IVAS_DEC_Set5msFlag( hIvasDec, arg.enable5ms ) ) != IVAS_ERR_OK )
{
return error;
}
#endif
if ( RenderConfigReader_read( renderConfigReader, arg.renderConfigFilename, &renderConfig ) != IVAS_ERR_OK ) if ( RenderConfigReader_read( renderConfigReader, arg.renderConfigFilename, &renderConfig ) != IVAS_ERR_OK )
{ {
fprintf( stderr, "Failed to read renderer configuration from file %s\n\n", arg.renderConfigFilename ); fprintf( stderr, "Failed to read renderer configuration from file %s\n\n", arg.renderConfigFilename );
...@@ -810,11 +770,11 @@ int main( ...@@ -810,11 +770,11 @@ int main(
} }
else else
{ {
error = decodeG192( arg, hBsReader, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader,
#ifdef SPLIT_REND_WITH_HEAD_ROT #ifdef SPLIT_REND_WITH_HEAD_ROT
splitRendBitsBuf, error = decodeG192( arg, hBsReader, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, splitRendBitsBuf, hIvasDec, pcmBuf );
#else
error = decodeG192( arg, hBsReader, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, hIvasDec, pcmBuf );
#endif #endif
hIvasDec, pcmBuf );
} }
if ( error == IVAS_ERR_OK || error == IVAS_ERR_END_OF_FILE ) if ( error == IVAS_ERR_OK || error == IVAS_ERR_END_OF_FILE )
...@@ -885,7 +845,6 @@ cleanup: ...@@ -885,7 +845,6 @@ cleanup:
print_wmops(); print_wmops();
print_mem( NULL ); print_mem( NULL );
#endif #endif
if ( !arg.quietModeEnabled ) if ( !arg.quietModeEnabled )
{ {
printf( "\n" ); printf( "\n" );
...@@ -897,7 +856,6 @@ cleanup: ...@@ -897,7 +856,6 @@ cleanup:
#endif #endif
dbgclose(); dbgclose();
#endif #endif
return mainFailed ? -1 : 0; return mainFailed ? -1 : 0;
} }
...@@ -1026,7 +984,7 @@ static bool parseCmdlIVAS_dec( ...@@ -1026,7 +984,7 @@ static bool parseCmdlIVAS_dec(
arg->enableHeadRotation = false; arg->enableHeadRotation = false;
arg->headrotTrajFileName = NULL; arg->headrotTrajFileName = NULL;
arg->orientation_tracking = IVAS_PUBLIC_ORIENT_TRK_NONE; arg->orientation_tracking = ORIENT_TRK_NONE;
arg->enableReferenceRotation = false; arg->enableReferenceRotation = false;
arg->headrotTrajFileName = NULL; arg->headrotTrajFileName = NULL;
arg->enableReferenceVectorTracking = false; arg->enableReferenceVectorTracking = false;
...@@ -1310,23 +1268,23 @@ static bool parseCmdlIVAS_dec( ...@@ -1310,23 +1268,23 @@ static bool parseCmdlIVAS_dec(
if ( strcmp( argv_to_upper, "NONE" ) == 0 ) if ( strcmp( argv_to_upper, "NONE" ) == 0 )
{ {
arg->orientation_tracking = IVAS_PUBLIC_ORIENT_TRK_NONE; arg->orientation_tracking = ORIENT_TRK_NONE;
} }
else if ( strcmp( argv_to_upper, "REF" ) == 0 ) else if ( strcmp( argv_to_upper, "REF" ) == 0 )
{ {
arg->orientation_tracking = IVAS_PUBLIC_ORIENT_TRK_REF; arg->orientation_tracking = ORIENT_TRK_REF;
} }
else if ( strcmp( argv_to_upper, "AVG" ) == 0 ) else if ( strcmp( argv_to_upper, "AVG" ) == 0 )
{ {
arg->orientation_tracking = IVAS_PUBLIC_ORIENT_TRK_AVG; arg->orientation_tracking = ORIENT_TRK_AVG;
} }
else if ( strcmp( argv_to_upper, "REF_VEC" ) == 0 ) else if ( strcmp( argv_to_upper, "REF_VEC" ) == 0 )
{ {
arg->orientation_tracking = IVAS_PUBLIC_ORIENT_TRK_REF_VEC; arg->orientation_tracking = ORIENT_TRK_REF_VEC;
} }
else if ( strcmp( argv_to_upper, "REF_VEC_LEV" ) == 0 ) else if ( strcmp( argv_to_upper, "REF_VEC_LEV" ) == 0 )
{ {
arg->orientation_tracking = IVAS_PUBLIC_ORIENT_TRK_REF_VEC_LEV; arg->orientation_tracking = ORIENT_TRK_REF_VEC_LEV;
} }
else else
{ {
...@@ -1762,7 +1720,7 @@ static ivas_error initOnFirstGoodFrame( ...@@ -1762,7 +1720,7 @@ static ivas_error initOnFirstGoodFrame(
IVAS_DEC_HANDLE hIvasDec, /* i/o: */ IVAS_DEC_HANDLE hIvasDec, /* i/o: */
const DecArguments arg, /* i : */ const DecArguments arg, /* i : */
const int16_t numInitialBadFrames, /* i : */ const int16_t numInitialBadFrames, /* i : */
#if defined( SPLIT_REND_WITH_HEAD_ROT ) #ifdef SPLIT_REND_WITH_HEAD_ROT
uint16_t *numOutSamples, /* i/o: */ uint16_t *numOutSamples, /* i/o: */
int16_t *vec_pos_len, /* i/o: */ int16_t *vec_pos_len, /* i/o: */
#else #else
...@@ -1779,7 +1737,7 @@ static ivas_error initOnFirstGoodFrame( ...@@ -1779,7 +1737,7 @@ static ivas_error initOnFirstGoodFrame(
uint16_t *pNumObj /* o : */ uint16_t *pNumObj /* o : */
#ifdef SPLIT_REND_WITH_HEAD_ROT #ifdef SPLIT_REND_WITH_HEAD_ROT
, ,
SplitFileReadWrite **hSplitRendFileReadWrite SplitFileReadWrite **splitRendWriter
#endif #endif
) )
{ {
...@@ -1834,7 +1792,7 @@ static ivas_error initOnFirstGoodFrame( ...@@ -1834,7 +1792,7 @@ static ivas_error initOnFirstGoodFrame(
if ( arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) if ( arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED )
{ {
if ( ( error = split_rend_writer_open( hSplitRendFileReadWrite, arg.outputWavFilename, delayNumSamples_temp[0], delayTimeScale_temp ) ) != IVAS_ERR_OK ) if ( ( error = split_rend_writer_open( splitRendWriter, arg.outputWavFilename, delayNumSamples_temp[0], delayTimeScale_temp ) ) != IVAS_ERR_OK )
{ {
fprintf( stderr, "\nUnable to open output split rendering metadata file %s\n", arg.outputWavFilename ); fprintf( stderr, "\nUnable to open output split rendering metadata file %s\n", arg.outputWavFilename );
return error; return error;
...@@ -1842,7 +1800,7 @@ static ivas_error initOnFirstGoodFrame( ...@@ -1842,7 +1800,7 @@ static ivas_error initOnFirstGoodFrame(
} }
else else
{ {
if ( ( error = split_rend_writer_open( hSplitRendFileReadWrite, arg.outputMdFilename, delayNumSamples_temp[0], delayTimeScale_temp ) ) != IVAS_ERR_OK ) if ( ( error = split_rend_writer_open( splitRendWriter, arg.outputMdFilename, delayNumSamples_temp[0], delayTimeScale_temp ) ) != IVAS_ERR_OK )
{ {
fprintf( stderr, "\nUnable to open output split rendering metadata file %s\n", arg.outputWavFilename ); fprintf( stderr, "\nUnable to open output split rendering metadata file %s\n", arg.outputWavFilename );
return error; return error;
...@@ -1869,7 +1827,7 @@ static ivas_error initOnFirstGoodFrame( ...@@ -1869,7 +1827,7 @@ static ivas_error initOnFirstGoodFrame(
for ( int16_t i = 0; i < numInitialBadFrames; ++i ) for ( int16_t i = 0; i < numInitialBadFrames; ++i )
{ {
#ifdef SPLIT_REND_WITH_HEAD_ROT #ifdef SPLIT_REND_WITH_HEAD_ROT
if ( *hSplitRendFileReadWrite != NULL ) if ( *splitRendWriter != NULL )
{ {
IVAS_SPLIT_REND_BITS_DATA splitRendBitsZero; IVAS_SPLIT_REND_BITS_DATA splitRendBitsZero;
splitRendBitsZero.bits_buf = NULL; splitRendBitsZero.bits_buf = NULL;
...@@ -1879,33 +1837,28 @@ static ivas_error initOnFirstGoodFrame( ...@@ -1879,33 +1837,28 @@ static ivas_error initOnFirstGoodFrame(
splitRendBitsZero.codec = IVAS_SPLIT_REND_CODEC_DEFAULT; splitRendBitsZero.codec = IVAS_SPLIT_REND_CODEC_DEFAULT;
splitRendBitsZero.pose_correction = IVAS_SPLIT_REND_POSE_CORRECTION_MODE_NONE; splitRendBitsZero.pose_correction = IVAS_SPLIT_REND_POSE_CORRECTION_MODE_NONE;
splitRendBitsZero.codec_frame_size_ms = 20; splitRendBitsZero.codec_frame_size_ms = 20;
if ( split_rend_write_bitstream_to_file( *hSplitRendFileReadWrite, splitRendBitsZero.bits_buf, &splitRendBitsZero.bits_read, &splitRendBitsZero.bits_written,
-1, IVAS_SPLIT_REND_POSE_CORRECTION_MODE_NONE, if ( split_rend_write_bitstream_to_file( *splitRendWriter, splitRendBitsZero.bits_buf, &splitRendBitsZero.bits_read, &splitRendBitsZero.bits_written, -1, IVAS_SPLIT_REND_POSE_CORRECTION_MODE_NONE, splitRendBitsZero.codec_frame_size_ms ) != IVAS_ERR_OK )
splitRendBitsZero.codec_frame_size_ms ) != IVAS_ERR_OK )
{ {
fprintf( stderr, "\nUnable to write to bitstream file!\n" ); fprintf( stderr, "\nUnable to write to bitstream file!\n" );
exit( -1 ); return error;
} }
} }
else else
{ {
#endif #endif
if ( *pRemainingDelayNumSamples <
#if defined( SPLIT_REND_WITH_HEAD_ROT ) #ifdef SPLIT_REND_WITH_HEAD_ROT
*numOutSamples if ( *pRemainingDelayNumSamples < *numOutSamples )
#else #else
numOutSamples if ( *pRemainingDelayNumSamples < numOutSamples )
#endif #endif
)
{ {
if ( ( error = AudioFileWriter_write( *ppAfWriter, zeroBuf, #ifdef SPLIT_REND_WITH_HEAD_ROT
#if defined( SPLIT_REND_WITH_HEAD_ROT ) if ( ( error = AudioFileWriter_write( *ppAfWriter, zeroBuf, *numOutSamples * *pNumOutChannels - ( *pRemainingDelayNumSamples * *pNumOutChannels ) ) ) != IVAS_ERR_OK )
*numOutSamples
#else #else
numOutSamples if ( ( error = AudioFileWriter_write( *ppAfWriter, zeroBuf, numOutSamples * *pNumOutChannels - ( *pRemainingDelayNumSamples * *pNumOutChannels ) ) ) != IVAS_ERR_OK )
#endif #endif
* *pNumOutChannels -
( *pRemainingDelayNumSamples * *pNumOutChannels ) ) ) != IVAS_ERR_OK )
{ {
fprintf( stderr, "\nOutput audio file writer error\n" ); fprintf( stderr, "\nOutput audio file writer error\n" );
return error; return error;
...@@ -1914,13 +1867,11 @@ static ivas_error initOnFirstGoodFrame( ...@@ -1914,13 +1867,11 @@ static ivas_error initOnFirstGoodFrame(
} }
else else
{ {
*pRemainingDelayNumSamples -= #ifdef SPLIT_REND_WITH_HEAD_ROT
#if defined( SPLIT_REND_WITH_HEAD_ROT ) *pRemainingDelayNumSamples -= *numOutSamples;
*numOutSamples
#else #else
numOutSamples *pRemainingDelayNumSamples -= numOutSamples;
#endif #endif
;
} }
#ifdef SPLIT_REND_WITH_HEAD_ROT #ifdef SPLIT_REND_WITH_HEAD_ROT
} }
...@@ -1937,10 +1888,9 @@ static ivas_error initOnFirstGoodFrame( ...@@ -1937,10 +1888,9 @@ static ivas_error initOnFirstGoodFrame(
fprintf( stderr, "\nError in IVAS_DEC_GetFormat, code: %d\n", error ); fprintf( stderr, "\nError in IVAS_DEC_GetFormat, code: %d\n", error );
return error; return error;
} }
/* If outputting ISM, get number of objects, open output files and write zero metadata for initial bad frames */
if ( *pBsFormat == IVAS_DEC_BS_OBJ || *pBsFormat == IVAS_DEC_BS_MASA_ISM
|| *pBsFormat == IVAS_DEC_BS_SBA_ISM ) /* If outputting ISM, get number of objects, open output files and write zero metadata for initial bad frames */
if ( *pBsFormat == IVAS_DEC_BS_OBJ || *pBsFormat == IVAS_DEC_BS_MASA_ISM || *pBsFormat == IVAS_DEC_BS_SBA_ISM )
{ {
if ( ( error = IVAS_DEC_GetNumObjects( hIvasDec, pNumObj ) ) != IVAS_ERR_OK ) if ( ( error = IVAS_DEC_GetNumObjects( hIvasDec, pNumObj ) ) != IVAS_ERR_OK )
{ {
...@@ -2010,10 +1960,9 @@ static ivas_error initOnFirstGoodFrame( ...@@ -2010,10 +1960,9 @@ static ivas_error initOnFirstGoodFrame(
} }
} }
#if defined( SPLIT_REND_WITH_HEAD_ROT ) #ifdef SPLIT_REND_WITH_HEAD_ROT
if ( *hSplitRendFileReadWrite != NULL ) if ( *splitRendWriter != NULL )
{ {
int16_t enable5ms; int16_t enable5ms;
if ( numOutSamples == NULL || vec_pos_len == NULL ) if ( numOutSamples == NULL || vec_pos_len == NULL )
...@@ -2021,7 +1970,10 @@ static ivas_error initOnFirstGoodFrame( ...@@ -2021,7 +1970,10 @@ static ivas_error initOnFirstGoodFrame(
return IVAS_ERR_UNEXPECTED_NULL_POINTER; return IVAS_ERR_UNEXPECTED_NULL_POINTER;
} }
IVAS_DEC_Get5msFlag( hIvasDec, &enable5ms ); if ( ( error = IVAS_DEC_Get5msFlag( hIvasDec, &enable5ms ) ) != IVAS_ERR_OK )
{
return error;
}
/* real setting of the 5ms mode for split rendering is only known after the decoded first good frame, reset the variables needed in the main decoding loop accordingly here*/ /* real setting of the 5ms mode for split rendering is only known after the decoded first good frame, reset the variables needed in the main decoding loop accordingly here*/
if ( enable5ms ) if ( enable5ms )
...@@ -2040,11 +1992,13 @@ static ivas_error initOnFirstGoodFrame( ...@@ -2040,11 +1992,13 @@ static ivas_error initOnFirstGoodFrame(
return IVAS_ERR_OK; return IVAS_ERR_OK;
} }
/*---------------------------------------------------------------------* /*---------------------------------------------------------------------*
* decodeG192() * decodeG192()
* *
* Read G.192 bitstream and decode in regular decoder * Read G.192 bitstream and decode in regular decoder
*---------------------------------------------------------------------*/ *---------------------------------------------------------------------*/
static ivas_error decodeG192( static ivas_error decodeG192(
DecArguments arg, DecArguments arg,
BS_READER_HANDLE hBsReader, BS_READER_HANDLE hBsReader,
...@@ -2073,7 +2027,7 @@ static ivas_error decodeG192( ...@@ -2073,7 +2027,7 @@ static ivas_error decodeG192(
int16_t nOutChannels = 0; int16_t nOutChannels = 0;
int16_t delayNumSamples = -1; int16_t delayNumSamples = -1;
int16_t delayNumSamples_orig[3]; int16_t delayNumSamples_orig[3];
#if defined( SPLIT_REND_WITH_HEAD_ROT ) #ifdef SPLIT_REND_WITH_HEAD_ROT
uint16_t nOutSamples = 0; uint16_t nOutSamples = 0;
#else #else
int16_t nOutSamples = 0; int16_t nOutSamples = 0;
...@@ -2094,10 +2048,8 @@ static ivas_error decodeG192( ...@@ -2094,10 +2048,8 @@ static ivas_error decodeG192(
IsmFileWriter *ismWriters[IVAS_MAX_NUM_OBJECTS]; IsmFileWriter *ismWriters[IVAS_MAX_NUM_OBJECTS];
IVAS_VECTOR3 Pos[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES] = { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }; IVAS_VECTOR3 Pos[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES] = { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } };
int16_t vec_pos_update, vec_pos_len; int16_t vec_pos_update, vec_pos_len;
#ifdef SPLIT_REND_WITH_HEAD_ROT #ifdef SPLIT_REND_WITH_HEAD_ROT
IVAS_SPLIT_REND_BITS_DATA splitRendBits; SplitFileReadWrite *splitRendWriter = NULL;
SplitFileReadWrite *hSplitRendFileReadWrite;
#endif #endif
for ( i = 0; i < IVAS_MAX_NUM_OBJECTS; ++i ) for ( i = 0; i < IVAS_MAX_NUM_OBJECTS; ++i )
...@@ -2126,7 +2078,11 @@ static ivas_error decodeG192( ...@@ -2126,7 +2078,11 @@ static ivas_error decodeG192(
} }
else else
{ {
IVAS_DEC_VoIP_SetScale( hIvasDec, arg.tsmScale, arg.tsmScale ); if ( ( error = IVAS_DEC_VoIP_SetScale( hIvasDec, arg.tsmScale, arg.tsmScale ) ) != IVAS_ERR_OK )
{
fprintf( stderr, "\nIVAS_DEC_VoIP_SetScale failed: %s \n", IVAS_DEC_GetErrorMessage( error ) );
goto cleanup;
}
} }
} }
#endif #endif
...@@ -2162,17 +2118,6 @@ static ivas_error decodeG192( ...@@ -2162,17 +2118,6 @@ static ivas_error decodeG192(
vec_pos_len = 1; vec_pos_len = 1;
} }
#ifdef SPLIT_REND_WITH_HEAD_ROT
splitRendBits.bits_buf = splitRendBitsBuf;
splitRendBits.bits_read = 0;
splitRendBits.bits_written = 0;
splitRendBits.buf_len = IVAS_MAX_SPLIT_REND_BITS_BUFFER_SIZE_IN_BYTES;
splitRendBits.codec = IVAS_SPLIT_REND_CODEC_DEFAULT;
splitRendBits.pose_correction = IVAS_SPLIT_REND_POSE_CORRECTION_MODE_NONE;
splitRendBits.codec_frame_size_ms = 0;
hSplitRendFileReadWrite = NULL;
#endif
/*------------------------------------------------------------------------------------------* /*------------------------------------------------------------------------------------------*
* Loop for every packet (frame) of bitstream data * Loop for every packet (frame) of bitstream data
* - Read the bitstream packet * - Read the bitstream packet
...@@ -2217,8 +2162,12 @@ static ivas_error decodeG192( ...@@ -2217,8 +2162,12 @@ static ivas_error decodeG192(
goto cleanup; goto cleanup;
} }
} }
int16_t enable5ms, num_subframes; int16_t enable5ms, num_subframes;
IVAS_DEC_Get5msFlag( hIvasDec, &enable5ms ); if ( ( error = IVAS_DEC_Get5msFlag( hIvasDec, &enable5ms ) ) != IVAS_ERR_OK )
{
return error;
}
arg.enable5ms = enable5ms; arg.enable5ms = enable5ms;
num_subframes = ( arg.enable5ms ) ? 1 : IVAS_MAX_PARAM_SPATIAL_SUBFRAMES; num_subframes = ( arg.enable5ms ) ? 1 : IVAS_MAX_PARAM_SPATIAL_SUBFRAMES;
...@@ -2249,8 +2198,7 @@ static ivas_error decodeG192( ...@@ -2249,8 +2198,7 @@ static ivas_error decodeG192(
{ {
if ( ( error = HeadRotationFileReading( headRotReader, &Quaternions[i], &Pos[i] ) ) != IVAS_ERR_OK ) if ( ( error = HeadRotationFileReading( headRotReader, &Quaternions[i], &Pos[i] ) ) != IVAS_ERR_OK )
{ {
fprintf( stderr, "\nError %s while reading head orientation from %s\n", IVAS_DEC_GetErrorMessage( error ), fprintf( stderr, "\nError %s while reading head orientation from %s\n", IVAS_DEC_GetErrorMessage( error ), RotationFileReader_getFilePath( headRotReader ) );
RotationFileReader_getFilePath( headRotReader ) );
goto cleanup; goto cleanup;
} }
} }
...@@ -2260,12 +2208,11 @@ static ivas_error decodeG192( ...@@ -2260,12 +2208,11 @@ static ivas_error decodeG192(
for ( i = 0; i < num_subframes; i++ ) for ( i = 0; i < num_subframes; i++ )
{ {
if ( ( error = IVAS_DEC_FeedHeadTrackData( hIvasDec, Quaternions[i], Pos[i], i
#ifdef SPLIT_REND_WITH_HEAD_ROT #ifdef SPLIT_REND_WITH_HEAD_ROT
, if ( ( error = IVAS_DEC_FeedHeadTrackData( hIvasDec, Quaternions[i], Pos[i], i, DEFAULT_AXIS ) ) != IVAS_ERR_OK )
DEFAULT_AXIS #else
if ( ( error = IVAS_DEC_FeedHeadTrackData( hIvasDec, Quaternions[i], Pos[i], i ) ) != IVAS_ERR_OK )
#endif #endif
) ) != IVAS_ERR_OK )
{ {
fprintf( stderr, "\nIVAS_DEC_FeedHeadTrackData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) ); fprintf( stderr, "\nIVAS_DEC_FeedHeadTrackData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) );
goto cleanup; goto cleanup;
...@@ -2283,11 +2230,9 @@ static ivas_error decodeG192( ...@@ -2283,11 +2230,9 @@ static ivas_error decodeG192(
for ( i = 0; i < num_subframes; i++ ) for ( i = 0; i < num_subframes; i++ )
{ {
if ( ( error = ExternalOrientationFileReading( externalOrientationFileReader, &Quaternions[i], &enableHeadRotation[i], &enableExternalOrientation[i], &enableRotationInterpolation[i], &numFramesToTargetOrientation[i] ) ) != IVAS_ERR_OK ) if ( ( error = ExternalOrientationFileReading( externalOrientationFileReader, &Quaternions[i], &enableHeadRotation[i], &enableExternalOrientation[i], &enableRotationInterpolation[i], &numFramesToTargetOrientation[i] ) ) != IVAS_ERR_OK )
{ {
fprintf( stderr, "\nError %s while reading external orientation from %s\n", IVAS_DEC_GetErrorMessage( error ), fprintf( stderr, "\nError %s while reading external orientation from %s\n", IVAS_DEC_GetErrorMessage( error ), RotationFileReader_getFilePath( externalOrientationFileReader ) );
RotationFileReader_getFilePath( externalOrientationFileReader ) );
goto cleanup; goto cleanup;
} }
} }
...@@ -2317,11 +2262,14 @@ static ivas_error decodeG192( ...@@ -2317,11 +2262,14 @@ static ivas_error decodeG192(
fprintf( stderr, "\nError: input bitstream file couldn't be read: %s \n\n", arg.inputBitstreamFilename ); fprintf( stderr, "\nError: input bitstream file couldn't be read: %s \n\n", arg.inputBitstreamFilename );
goto cleanup; goto cleanup;
} }
IVAS_DEC_VoIP_SetScale( hIvasDec, scale, scale ); if ( ( error = IVAS_DEC_VoIP_SetScale( hIvasDec, scale, scale ) ) != IVAS_ERR_OK )
{
fprintf( stderr, "\nIVAS_DEC_VoIP_SetScale failed: %s \n", IVAS_DEC_GetErrorMessage( error ) );
goto cleanup;
}
} }
#endif #endif
#endif #endif
if ( ( error = BS_Reader_ReadFrame_short( hBsReader, bit_stream, &num_bits, &bfi ) ) != IVAS_ERR_OK ) if ( ( error = BS_Reader_ReadFrame_short( hBsReader, bit_stream, &num_bits, &bfi ) ) != IVAS_ERR_OK )
{ {
if ( error == IVAS_ERR_END_OF_FILE ) if ( error == IVAS_ERR_END_OF_FILE )
...@@ -2347,7 +2295,6 @@ static ivas_error decodeG192( ...@@ -2347,7 +2295,6 @@ static ivas_error decodeG192(
} }
} }
#endif #endif
/* Feed into decoder */ /* Feed into decoder */
if ( ( error = IVAS_DEC_FeedFrame_Serial( hIvasDec, bit_stream, num_bits, bfi ) ) != IVAS_ERR_OK ) if ( ( error = IVAS_DEC_FeedFrame_Serial( hIvasDec, bit_stream, num_bits, bfi ) ) != IVAS_ERR_OK )
{ {
...@@ -2359,42 +2306,35 @@ static ivas_error decodeG192( ...@@ -2359,42 +2306,35 @@ static ivas_error decodeG192(
#ifdef SPLIT_REND_WITH_HEAD_ROT #ifdef SPLIT_REND_WITH_HEAD_ROT
if ( arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) if ( arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
{ {
error = IVAS_DEC_GetSplitBinauralBitstream( hIvasDec, if ( ( error = IVAS_DEC_GetSplitBinauralBitstream( hIvasDec, (void *) ( pcmBuf + nOutChannels * nSamplesRendered ), splitRendBitsBuf, &nSamplesRendered_loop, &needNewFrame ) ) != IVAS_ERR_OK )
(void *) ( pcmBuf + nOutChannels * nSamplesRendered ),
&splitRendBits,
&nSamplesRendered_loop,
&needNewFrame );
nSamplesRendered += nSamplesRendered_loop;
nSamplesToRender -= nSamplesRendered_loop;
if ( error != IVAS_ERR_OK )
{ {
fprintf( stderr, "\nError in IVAS_DEC_GetSplitBinauralBitstream: %s\n", IVAS_DEC_GetErrorMessage( error ) ); fprintf( stderr, "\nError in IVAS_DEC_GetSplitBinauralBitstream: %s\n", IVAS_DEC_GetErrorMessage( error ) );
goto cleanup; goto cleanup;
} }
nSamplesRendered += nSamplesRendered_loop;
nSamplesToRender -= nSamplesRendered_loop;
} }
else else
{ {
#endif #endif
error = IVAS_DEC_GetSamples( hIvasDec, nSamplesToRender, #ifdef SPLIT_REND_WITH_HEAD_ROT
#if defined SPLIT_REND_WITH_HEAD_ROT if ( ( error = IVAS_DEC_GetSamples( hIvasDec, nSamplesToRender, IVAS_DEC_PCM_INT16, (void *) ( pcmBuf + nOutChannels * nSamplesRendered ), &nSamplesRendered_loop, &needNewFrame ) ) != IVAS_ERR_OK )
IVAS_DEC_PCM_INT16,
(void *) #else
if ( ( error = IVAS_DEC_GetSamples( hIvasDec, nSamplesToRender, ( pcmBuf + nOutChannels * nSamplesRendered ), &nSamplesRendered_loop, &needNewFrame ) ) != IVAS_ERR_OK )
#endif #endif
( pcmBuf + nOutChannels * nSamplesRendered ),
&nSamplesRendered_loop,
&needNewFrame );
nSamplesRendered += nSamplesRendered_loop;
nSamplesToRender -= nSamplesRendered_loop;
if ( error != IVAS_ERR_OK )
{ {
fprintf( stderr, "\nError in IVAS_DEC_GetSamples: %s\n", IVAS_DEC_GetErrorMessage( error ) ); fprintf( stderr, "\nError in IVAS_DEC_GetSamples: %s\n", IVAS_DEC_GetErrorMessage( error ) );
goto cleanup; goto cleanup;
} }
nSamplesRendered += nSamplesRendered_loop;
nSamplesToRender -= nSamplesRendered_loop;
#ifdef SPLIT_REND_WITH_HEAD_ROT #ifdef SPLIT_REND_WITH_HEAD_ROT
} }
#endif #endif
} while ( nSamplesRendered < nOutSamples && error == IVAS_ERR_OK ); } while ( nSamplesRendered < nOutSamples && error == IVAS_ERR_OK );
if ( error == IVAS_ERR_END_OF_FILE ) if ( error == IVAS_ERR_END_OF_FILE )
...@@ -2414,31 +2354,11 @@ static ivas_error decodeG192( ...@@ -2414,31 +2354,11 @@ static ivas_error decodeG192(
/* Once good frame decoded, catch up */ /* Once good frame decoded, catch up */
if ( decodedGoodFrame ) if ( decodedGoodFrame )
{ {
error = initOnFirstGoodFrame(
hIvasDec,
arg,
numInitialBadFrames,
#if defined( SPLIT_REND_WITH_HEAD_ROT )
&nOutSamples,
&vec_pos_len,
#else
nOutSamples,
#endif
delayNumSamples_orig,
&delayNumSamples,
&delayTimeScale,
&bsFormat,
&afWriter,
&masaWriter,
ismWriters,
&nOutChannels,
&numObj
#ifdef SPLIT_REND_WITH_HEAD_ROT #ifdef SPLIT_REND_WITH_HEAD_ROT
, if ( ( error = initOnFirstGoodFrame( hIvasDec, arg, numInitialBadFrames, &nOutSamples, &vec_pos_len, delayNumSamples_orig, &delayNumSamples, &delayTimeScale, &bsFormat, &afWriter, &masaWriter, ismWriters, &nOutChannels, &numObj, &splitRendWriter ) ) != IVAS_ERR_OK )
&hSplitRendFileReadWrite #else
if ( ( error = initOnFirstGoodFrame( hIvasDec, arg, numInitialBadFrames, nOutSamples, delayNumSamples_orig, &delayNumSamples, &delayTimeScale, &bsFormat, &afWriter, &masaWriter, ismWriters, &nOutChannels, &numObj ) ) != IVAS_ERR_OK )
#endif #endif
);
if ( error != IVAS_ERR_OK )
{ {
goto cleanup; goto cleanup;
} }
...@@ -2453,28 +2373,25 @@ static ivas_error decodeG192( ...@@ -2453,28 +2373,25 @@ static ivas_error decodeG192(
if ( decodedGoodFrame ) if ( decodedGoodFrame )
{ {
#ifdef SPLIT_REND_WITH_HEAD_ROT #ifdef SPLIT_REND_WITH_HEAD_ROT
if ( ( hSplitRendFileReadWrite != NULL ) && ( arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ) if ( arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
{ {
if ( split_rend_write_bitstream_to_file( hSplitRendFileReadWrite, splitRendBits.bits_buf, &splitRendBits.bits_read, &splitRendBits.bits_written, IVAS_SPLIT_REND_BITS_DATA splitRendBits;
splitRendBits.codec, splitRendBits.pose_correction,
splitRendBits.codec_frame_size_ms ) != IVAS_ERR_OK ) if ( ( error = IVAS_DEC_GetSplitRendBits( hIvasDec, &splitRendBits ) ) != IVAS_ERR_OK )
{ {
fprintf( stderr, "\nUnable to write to bitstream file!\n" ); fprintf( stderr, "\nError in IVAS_DEC_SplitRendBits: %s\n", IVAS_DEC_GetErrorMessage( error ) );
goto cleanup; goto cleanup;
} }
}
else if ( split_rend_write_bitstream_to_file( splitRendWriter, splitRendBits.bits_buf, &splitRendBits.bits_read, &splitRendBits.bits_written, splitRendBits.codec, splitRendBits.pose_correction, splitRendBits.codec_frame_size_ms ) != IVAS_ERR_OK )
{
if ( ( hSplitRendFileReadWrite != NULL ) && ( arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
{
if ( split_rend_write_bitstream_to_file( hSplitRendFileReadWrite, splitRendBits.bits_buf, &splitRendBits.bits_read, &splitRendBits.bits_written,
splitRendBits.codec, splitRendBits.pose_correction,
splitRendBits.codec_frame_size_ms ) != IVAS_ERR_OK )
{ {
fprintf( stderr, "\nUnable to write to bitstream file!\n" ); fprintf( stderr, "\nUnable to write to bitstream file!\n" );
goto cleanup; goto cleanup;
} }
} }
if ( arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED )
{
#endif #endif
if ( delayNumSamples < nOutSamples ) if ( delayNumSamples < nOutSamples )
{ {
...@@ -2497,7 +2414,7 @@ static ivas_error decodeG192( ...@@ -2497,7 +2414,7 @@ static ivas_error decodeG192(
/* Write ISm metadata to external file(s) */ /* Write ISm metadata to external file(s) */
if ( decodedGoodFrame && arg.outputConfig == IVAS_AUDIO_CONFIG_EXTERNAL ) if ( decodedGoodFrame && arg.outputConfig == IVAS_AUDIO_CONFIG_EXTERNAL )
{ {
if ( bsFormat == IVAS_DEC_BS_OBJ ) if ( bsFormat == IVAS_DEC_BS_OBJ || bsFormat == IVAS_DEC_BS_MASA_ISM || bsFormat == IVAS_DEC_BS_SBA_ISM )
{ {
if ( ( error = IVAS_DEC_GetNumObjects( hIvasDec, &numObj ) ) != IVAS_ERR_OK ) if ( ( error = IVAS_DEC_GetNumObjects( hIvasDec, &numObj ) ) != IVAS_ERR_OK )
{ {
...@@ -2522,7 +2439,8 @@ static ivas_error decodeG192( ...@@ -2522,7 +2439,8 @@ static ivas_error decodeG192(
} }
} }
} }
else if ( bsFormat == IVAS_DEC_BS_MASA )
if ( bsFormat == IVAS_DEC_BS_MASA || bsFormat == IVAS_DEC_BS_MASA_ISM )
{ {
IVAS_MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta; IVAS_MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta;
if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &hMasaExtOutMeta, 0 ) ) != IVAS_ERR_OK ) if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &hMasaExtOutMeta, 0 ) ) != IVAS_ERR_OK )
...@@ -2556,6 +2474,7 @@ static ivas_error decodeG192( ...@@ -2556,6 +2474,7 @@ static ivas_error decodeG192(
#ifdef WMOPS #ifdef WMOPS
if ( vec_pos_update == 0 ) if ( vec_pos_update == 0 )
{ {
// update_mem(); TODO: verify this
update_wmops(); update_wmops();
#ifdef FIX_RAM_COUNTING_5MS_RENDERING #ifdef FIX_RAM_COUNTING_5MS_RENDERING
update_mem(); update_mem();
...@@ -2572,7 +2491,6 @@ static ivas_error decodeG192( ...@@ -2572,7 +2491,6 @@ static ivas_error decodeG192(
#endif #endif
} }
/*------------------------------------------------------------------------------------------* /*------------------------------------------------------------------------------------------*
* Flush what is still left in the VoIP Buffers.... * Flush what is still left in the VoIP Buffers....
*------------------------------------------------------------------------------------------*/ *------------------------------------------------------------------------------------------*/
...@@ -2599,6 +2517,7 @@ static ivas_error decodeG192( ...@@ -2599,6 +2517,7 @@ static ivas_error decodeG192(
goto cleanup; goto cleanup;
} }
} }
/* Reference rotation */ /* Reference rotation */
if ( arg.enableReferenceRotation ) if ( arg.enableReferenceRotation )
{ {
...@@ -2615,25 +2534,22 @@ static ivas_error decodeG192( ...@@ -2615,25 +2534,22 @@ static ivas_error decodeG192(
goto cleanup; goto cleanup;
} }
} }
/* Head-tracking input simulation */ /* Head-tracking input simulation */
if ( arg.enableHeadRotation ) if ( arg.enableHeadRotation )
{ {
IVAS_QUATERNION Quaternion; IVAS_QUATERNION Quaternion;
if ( ( error = HeadRotationFileReading( headRotReader, &Quaternion, &Pos[0] ) ) != IVAS_ERR_OK ) if ( ( error = HeadRotationFileReading( headRotReader, &Quaternion, &Pos[0] ) ) != IVAS_ERR_OK )
{ {
fprintf( stderr, "\nError %s while reading head orientation from %s\n", IVAS_DEC_GetErrorMessage( error ), RotationFileReader_getFilePath( headRotReader ) ); fprintf( stderr, "\nError %s while reading head orientation from %s\n", IVAS_DEC_GetErrorMessage( error ), RotationFileReader_getFilePath( headRotReader ) );
goto cleanup; goto cleanup;
} }
if ( ( error = IVAS_DEC_FeedHeadTrackData( hIvasDec, Quaternion, Pos[0], 0
#ifdef SPLIT_REND_WITH_HEAD_ROT #ifdef SPLIT_REND_WITH_HEAD_ROT
, if ( ( error = IVAS_DEC_FeedHeadTrackData( hIvasDec, Quaternion, Pos[0], 0, DEFAULT_AXIS ) ) != IVAS_ERR_OK )
DEFAULT_AXIS #else
if ( ( error = IVAS_DEC_FeedHeadTrackData( hIvasDec, Quaternion, Pos[0], 0 ) ) != IVAS_ERR_OK )
#endif #endif
) ) != IVAS_ERR_OK )
{ {
fprintf( stderr, "\nIVAS_DEC_FeedHeadTrackData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) ); fprintf( stderr, "\nIVAS_DEC_FeedHeadTrackData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) );
goto cleanup; goto cleanup;
...@@ -2641,13 +2557,11 @@ static ivas_error decodeG192( ...@@ -2641,13 +2557,11 @@ static ivas_error decodeG192(
} }
/* decode and get samples */ /* decode and get samples */
if ( ( error = IVAS_DEC_Flush( hIvasDec, nOutSamples, #ifdef SPLIT_REND_WITH_HEAD_ROT
#if defined SPLIT_REND_WITH_HEAD_ROT if ( ( error = IVAS_DEC_Flush( hIvasDec, nOutSamples, IVAS_DEC_PCM_INT16, (void *) pcmBuf, &nSamplesFlushed ) ) != IVAS_ERR_OK )
IVAS_DEC_PCM_INT16, #else
(void *) if ( ( error = IVAS_DEC_Flush( hIvasDec, nOutSamples, pcmBuf, &nSamplesFlushed ) ) != IVAS_ERR_OK )
#endif #endif
pcmBuf,
&nSamplesFlushed ) ) != IVAS_ERR_OK )
{ {
fprintf( stderr, "\nError in IVAS_DEC_VoIP_Flush: %s\n", IVAS_DEC_GetErrorMessage( error ) ); fprintf( stderr, "\nError in IVAS_DEC_VoIP_Flush: %s\n", IVAS_DEC_GetErrorMessage( error ) );
goto cleanup; goto cleanup;
...@@ -2663,7 +2577,7 @@ static ivas_error decodeG192( ...@@ -2663,7 +2577,7 @@ static ivas_error decodeG192(
/* Write ISm metadata to external file(s) */ /* Write ISm metadata to external file(s) */
if ( decodedGoodFrame && arg.outputConfig == IVAS_AUDIO_CONFIG_EXTERNAL ) if ( decodedGoodFrame && arg.outputConfig == IVAS_AUDIO_CONFIG_EXTERNAL )
{ {
if ( bsFormat == IVAS_DEC_BS_OBJ ) if ( bsFormat == IVAS_DEC_BS_OBJ || bsFormat == IVAS_DEC_BS_MASA_ISM || bsFormat == IVAS_DEC_BS_SBA_ISM )
{ {
if ( ( error = IVAS_DEC_GetNumObjects( hIvasDec, &numObj ) ) != IVAS_ERR_OK ) if ( ( error = IVAS_DEC_GetNumObjects( hIvasDec, &numObj ) ) != IVAS_ERR_OK )
{ {
...@@ -2688,7 +2602,8 @@ static ivas_error decodeG192( ...@@ -2688,7 +2602,8 @@ static ivas_error decodeG192(
} }
} }
} }
else if ( bsFormat == IVAS_DEC_BS_MASA )
if ( bsFormat == IVAS_DEC_BS_MASA || bsFormat == IVAS_DEC_BS_MASA_ISM )
{ {
IVAS_MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta; IVAS_MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta;
if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &hMasaExtOutMeta, 0 ) ) != IVAS_ERR_OK ) if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &hMasaExtOutMeta, 0 ) ) != IVAS_ERR_OK )
...@@ -2736,21 +2651,25 @@ static ivas_error decodeG192( ...@@ -2736,21 +2651,25 @@ static ivas_error decodeG192(
/* Print output metadata file name(s) */ /* Print output metadata file name(s) */
if ( arg.outputConfig == IVAS_AUDIO_CONFIG_EXTERNAL ) if ( arg.outputConfig == IVAS_AUDIO_CONFIG_EXTERNAL )
{ {
if ( bsFormat == IVAS_DEC_BS_OBJ ) if ( bsFormat == IVAS_DEC_BS_OBJ || bsFormat == IVAS_DEC_BS_MASA_ISM || bsFormat == IVAS_DEC_BS_SBA_ISM )
{ {
for ( i = 0; i < numObj; i++ ) for ( i = 0; i < numObj; i++ )
{ {
fprintf( stdout, "\nOutput metadata file: %s", IsmFileWriter_getFilePath( ismWriters[i] ) ); fprintf( stdout, "\nOutput ISM metadata file: %s", IsmFileWriter_getFilePath( ismWriters[i] ) );
} }
fprintf( stdout, "\n" ); fprintf( stdout, "\n" );
} }
else if ( bsFormat == IVAS_DEC_BS_MASA )
if ( bsFormat == IVAS_DEC_BS_MASA || bsFormat == IVAS_DEC_BS_MASA_ISM )
{ {
fprintf( stdout, "\nOutput metadata file: %s\n", MasaFileWriter_getFilePath( masaWriter ) ); fprintf( stdout, "\nOutput MASA metadata file: %s\n", MasaFileWriter_getFilePath( masaWriter ) );
} }
} }
/* add zeros at the end to have equal length of synthesized signals */ /*------------------------------------------------------------------------------------------*
* Add zeros at the end to have equal length of synthesized signals
*------------------------------------------------------------------------------------------*/
memset( pcmBuf, 0, delayNumSamples_orig[0] * nOutChannels * sizeof( int16_t ) ); memset( pcmBuf, 0, delayNumSamples_orig[0] * nOutChannels * sizeof( int16_t ) );
#ifdef SPLIT_REND_WITH_HEAD_ROT #ifdef SPLIT_REND_WITH_HEAD_ROT
if ( afWriter != NULL ) if ( afWriter != NULL )
...@@ -2774,7 +2693,7 @@ static ivas_error decodeG192( ...@@ -2774,7 +2693,7 @@ static ivas_error decodeG192(
cleanup: cleanup:
#ifdef SPLIT_REND_WITH_HEAD_ROT #ifdef SPLIT_REND_WITH_HEAD_ROT
split_rend_reader_writer_close( &hSplitRendFileReadWrite ); split_rend_reader_writer_close( &splitRendWriter );
#endif #endif
AudioFileWriter_close( &afWriter ); AudioFileWriter_close( &afWriter );
MasaFileWriter_close( &masaWriter ); MasaFileWriter_close( &masaWriter );
...@@ -2862,10 +2781,8 @@ static ivas_error printBitstreamInfoVoip( ...@@ -2862,10 +2781,8 @@ static ivas_error printBitstreamInfoVoip(
else else
{ {
auPtr = au; /* might have been set to RTP packet in prev call */ auPtr = au; /* might have been set to RTP packet in prev call */
rtpdumpDepackerError = EVS_RTPDUMP_DEPACKER_readNextFrame( &rtpdumpDepacker, &rtpSequenceNumber, &rtpTimeStamp, rtpdumpDepackerError = EVS_RTPDUMP_DEPACKER_readNextFrame( &rtpdumpDepacker, &rtpSequenceNumber, &rtpTimeStamp, &nextPacketRcvTime_ms, &isAMRWB_IOmode, &frameTypeIndex, &qBit, &auPtr, (uint16_t *) &auSizeBits );
&nextPacketRcvTime_ms,
&isAMRWB_IOmode, &frameTypeIndex, &qBit,
&auPtr, (uint16_t *) &auSizeBits );
/* EVS RTP payload format has timescale 16000, JBM uses 1000 internally */ /* EVS RTP payload format has timescale 16000, JBM uses 1000 internally */
rtpTimeStamp = rtpTimeStamp / 16; rtpTimeStamp = rtpTimeStamp / 16;
} }
...@@ -2926,7 +2843,6 @@ static ivas_error decodeVoIP( ...@@ -2926,7 +2843,6 @@ static ivas_error decodeVoIP(
uint32_t systemTimeInc_ms = (uint32_t) JBM_FRONTEND_FETCH_FRAMESIZE_MS; uint32_t systemTimeInc_ms = (uint32_t) JBM_FRONTEND_FETCH_FRAMESIZE_MS;
int32_t nFramesFed = 0; int32_t nFramesFed = 0;
uint8_t au[( IVAS_MAX_BITS_PER_FRAME + 7 ) >> 3]; uint8_t au[( IVAS_MAX_BITS_PER_FRAME + 7 ) >> 3];
int16_t auSize; int16_t auSize;
uint16_t rtpSequenceNumber; uint16_t rtpSequenceNumber;
...@@ -2948,7 +2864,7 @@ static ivas_error decodeVoIP( ...@@ -2948,7 +2864,7 @@ static ivas_error decodeVoIP(
int16_t delayNumSamples_orig[3]; /* stores: overall delay, dec+rend delay, and binauralization delay */ int16_t delayNumSamples_orig[3]; /* stores: overall delay, dec+rend delay, and binauralization delay */
int16_t delayNumSamples = -1; int16_t delayNumSamples = -1;
int32_t delayTimeScale = -1; int32_t delayTimeScale = -1;
int16_t i;
FILE *f_rtpstream = NULL; FILE *f_rtpstream = NULL;
EVS_RTPDUMP_DEPACKER rtpdumpDepacker; EVS_RTPDUMP_DEPACKER rtpdumpDepacker;
EVS_RTPDUMP_DEPACKER_ERROR rtpdumpDepackerError = EVS_RTPDUMP_DEPACKER_NO_ERROR; EVS_RTPDUMP_DEPACKER_ERROR rtpdumpDepackerError = EVS_RTPDUMP_DEPACKER_NO_ERROR;
...@@ -2960,7 +2876,7 @@ static ivas_error decodeVoIP( ...@@ -2960,7 +2876,7 @@ static ivas_error decodeVoIP(
IVAS_DEC_BS_FORMAT bsFormat = IVAS_DEC_BS_UNKOWN; IVAS_DEC_BS_FORMAT bsFormat = IVAS_DEC_BS_UNKOWN;
IsmFileWriter *ismWriters[IVAS_MAX_NUM_OBJECTS]; IsmFileWriter *ismWriters[IVAS_MAX_NUM_OBJECTS];
for ( int16_t i = 0; i < IVAS_MAX_NUM_OBJECTS; ++i ) for ( i = 0; i < IVAS_MAX_NUM_OBJECTS; ++i )
{ {
ismWriters[i] = NULL; ismWriters[i] = NULL;
} }
...@@ -3027,10 +2943,8 @@ static ivas_error decodeVoIP( ...@@ -3027,10 +2943,8 @@ static ivas_error decodeVoIP(
else else
{ {
auPtr = au; /* might have been set to RTP packet in prev call */ auPtr = au; /* might have been set to RTP packet in prev call */
rtpdumpDepackerError = EVS_RTPDUMP_DEPACKER_readNextFrame( &rtpdumpDepacker, &rtpSequenceNumber, &rtpTimeStamp, rtpdumpDepackerError = EVS_RTPDUMP_DEPACKER_readNextFrame( &rtpdumpDepacker, &rtpSequenceNumber, &rtpTimeStamp, &nextPacketRcvTime_ms, &isAMRWB_IOmode, &frameTypeIndex, &qBit, &auPtr, (uint16_t *) &auSize );
&nextPacketRcvTime_ms,
&isAMRWB_IOmode, &frameTypeIndex, &qBit,
&auPtr, (uint16_t *) &auSize );
/* EVS RTP payload format has timescale 16000, JBM uses 1000 internally */ /* EVS RTP payload format has timescale 16000, JBM uses 1000 internally */
rtpTimeStamp = rtpTimeStamp / 16; rtpTimeStamp = rtpTimeStamp / 16;
} }
...@@ -3065,7 +2979,7 @@ static ivas_error decodeVoIP( ...@@ -3065,7 +2979,7 @@ static ivas_error decodeVoIP(
while ( 1 ) while ( 1 )
{ {
#if defined( SPLIT_REND_WITH_HEAD_ROT ) #ifdef SPLIT_REND_WITH_HEAD_ROT
uint16_t nOutSamples = 0; uint16_t nOutSamples = 0;
#else #else
int16_t nOutSamples = 0; int16_t nOutSamples = 0;
...@@ -3075,6 +2989,7 @@ static ivas_error decodeVoIP( ...@@ -3075,6 +2989,7 @@ static ivas_error decodeVoIP(
#else #else
nOutSamples = (int16_t) ( arg.output_Fs / 1000 * JBM_FRONTEND_FETCH_FRAMESIZE_MS ); nOutSamples = (int16_t) ( arg.output_Fs / 1000 * JBM_FRONTEND_FETCH_FRAMESIZE_MS );
#endif #endif
/* read all packets with a receive time smaller than the system time */ /* read all packets with a receive time smaller than the system time */
while ( nextPacketRcvTime_ms <= systemTime_ms ) while ( nextPacketRcvTime_ms <= systemTime_ms )
{ {
...@@ -3126,25 +3041,26 @@ static ivas_error decodeVoIP( ...@@ -3126,25 +3041,26 @@ static ivas_error decodeVoIP(
/* decode and get samples */ /* decode and get samples */
if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples,
#if defined SPLIT_REND_WITH_HEAD_ROT #ifdef SPLIT_REND_WITH_HEAD_ROT
IVAS_DEC_PCM_INT16,
(void *) #ifdef SUPPORT_JBM_TRACEFILE
if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, IVAS_DEC_PCM_INT16, (void *) pcmBuf, systemTime_ms, writeJbmTraceFileFrameWrapper, jbmTraceWriter ) ) != IVAS_ERR_OK )
#else
if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, IVAS_DEC_PCM_INT16, (void *) pcmBuf, systemTime_ms ) ) != IVAS_ERR_OK )
#endif #endif
pcmBuf, #else
systemTime_ms
#ifdef SUPPORT_JBM_TRACEFILE #ifdef SUPPORT_JBM_TRACEFILE
, if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, pcmBuf, systemTime_ms, writeJbmTraceFileFrameWrapper, jbmTraceWriter ) ) != IVAS_ERR_OK )
writeJbmTraceFileFrameWrapper, #else
jbmTraceWriter if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, pcmBuf, systemTime_ms ) ) != IVAS_ERR_OK )
#endif
#endif #endif
) ) != IVAS_ERR_OK )
{ {
fprintf( stderr, "\nError in IVAS_DEC_VoIP_GetSamples: %s\n", IVAS_DEC_GetErrorMessage( error ) ); fprintf( stderr, "\nError in IVAS_DEC_VoIP_GetSamples: %s\n", IVAS_DEC_GetErrorMessage( error ) );
goto cleanup; goto cleanup;
} }
/* write JBM Offset file entry */ /* write JBM Offset file entry */
if ( jbmOffsetWriter != NULL ) if ( jbmOffsetWriter != NULL )
{ {
...@@ -3176,34 +3092,14 @@ static ivas_error decodeVoIP( ...@@ -3176,34 +3092,14 @@ static ivas_error decodeVoIP(
if ( decodedGoodFrame ) if ( decodedGoodFrame )
{ {
#ifdef SPLIT_REND_WITH_HEAD_ROT #ifdef SPLIT_REND_WITH_HEAD_ROT
SplitFileReadWrite *splitRendWriter = NULL;
SplitFileReadWrite *hSplitRendFileReadWrite = NULL; if ( ( error = initOnFirstGoodFrame( hIvasDec, arg, numInitialBadFrames, &nOutSamples, NULL, delayNumSamples_orig, &delayNumSamples, &delayTimeScale,
#endif &bsFormat, &afWriter, &masaWriter, ismWriters, &nOutChannels, &numObj, &splitRendWriter ) ) != IVAS_ERR_OK )
error = initOnFirstGoodFrame(
hIvasDec,
arg,
numInitialBadFrames,
#if defined( SPLIT_REND_WITH_HEAD_ROT )
&nOutSamples,
NULL,
#else #else
nOutSamples, if ( ( error = initOnFirstGoodFrame( hIvasDec, arg, numInitialBadFrames, nOutSamples, delayNumSamples_orig, &delayNumSamples, &delayTimeScale,
#endif &bsFormat, &afWriter, &masaWriter, ismWriters, &nOutChannels, &numObj ) ) != IVAS_ERR_OK )
delayNumSamples_orig,
&delayNumSamples,
&delayTimeScale,
&bsFormat,
&afWriter,
&masaWriter,
ismWriters,
&nOutChannels,
&numObj
#ifdef SPLIT_REND_WITH_HEAD_ROT
,
&hSplitRendFileReadWrite
#endif #endif
);
if ( error != IVAS_ERR_OK )
{ {
goto cleanup; goto cleanup;
} }
...@@ -3218,7 +3114,6 @@ static ivas_error decodeVoIP( ...@@ -3218,7 +3114,6 @@ static ivas_error decodeVoIP(
} }
} }
/* Write current frame */ /* Write current frame */
if ( decodedGoodFrame ) if ( decodedGoodFrame )
{ {
...@@ -3239,9 +3134,7 @@ static ivas_error decodeVoIP( ...@@ -3239,9 +3134,7 @@ static ivas_error decodeVoIP(
/* Write ISM metadata to external file(s) */ /* Write ISM metadata to external file(s) */
if ( decodedGoodFrame && arg.outputConfig == IVAS_AUDIO_CONFIG_EXTERNAL ) if ( decodedGoodFrame && arg.outputConfig == IVAS_AUDIO_CONFIG_EXTERNAL )
{ {
int16_t i; if ( bsFormat == IVAS_DEC_BS_OBJ || bsFormat == IVAS_DEC_BS_MASA_ISM || bsFormat == IVAS_DEC_BS_SBA_ISM )
if ( bsFormat == IVAS_DEC_BS_OBJ || bsFormat == IVAS_DEC_BS_MASA_ISM )
{ {
if ( ( error = IVAS_DEC_GetNumObjects( hIvasDec, &numObj ) ) != IVAS_ERR_OK ) if ( ( error = IVAS_DEC_GetNumObjects( hIvasDec, &numObj ) ) != IVAS_ERR_OK )
{ {
...@@ -3325,6 +3218,24 @@ static ivas_error decodeVoIP( ...@@ -3325,6 +3218,24 @@ static ivas_error decodeVoIP(
} }
} }
/* Print output metadata file name(s) */
if ( arg.outputConfig == IVAS_AUDIO_CONFIG_EXTERNAL )
{
if ( bsFormat == IVAS_DEC_BS_OBJ || bsFormat == IVAS_DEC_BS_MASA_ISM || bsFormat == IVAS_DEC_BS_SBA_ISM )
{
for ( i = 0; i < numObj; i++ )
{
fprintf( stdout, "\nOutput ISM metadata file: %s", IsmFileWriter_getFilePath( ismWriters[i] ) );
}
fprintf( stdout, "\n" );
}
if ( bsFormat == IVAS_DEC_BS_MASA || bsFormat == IVAS_DEC_BS_MASA_ISM )
{
fprintf( stdout, "\nOutput MASA metadata file: %s\n", MasaFileWriter_getFilePath( masaWriter ) );
}
}
/*------------------------------------------------------------------------------------------* /*------------------------------------------------------------------------------------------*
* Close files and deallocate resources * Close files and deallocate resources
*------------------------------------------------------------------------------------------*/ *------------------------------------------------------------------------------------------*/
...@@ -3340,7 +3251,7 @@ cleanup: ...@@ -3340,7 +3251,7 @@ cleanup:
JbmTraceFileWriter_close( &jbmTraceWriter ); JbmTraceFileWriter_close( &jbmTraceWriter );
#endif #endif
MasaFileWriter_close( &masaWriter ); MasaFileWriter_close( &masaWriter );
for ( int16_t i = 0; i < IVAS_MAX_NUM_OBJECTS; i++ ) for ( i = 0; i < IVAS_MAX_NUM_OBJECTS; i++ )
{ {
IsmFileWriter_close( &ismWriters[i] ); IsmFileWriter_close( &ismWriters[i] );
} }
......
...@@ -406,16 +406,7 @@ int main( ...@@ -406,16 +406,7 @@ int main(
} }
break; break;
case IVAS_ENC_INPUT_SBA: case IVAS_ENC_INPUT_SBA:
if ( ( error = if ( ( error = IVAS_ENC_ConfigureForAmbisonics( hIvasEnc, arg.inputFs, totalBitrate, arg.max_bwidth_user, bandwidth, arg.dtxConfig, arg.inputFormatConfig.sba.order, arg.inputFormatConfig.sba.isPlanar,
IVAS_ENC_ConfigureForAmbisonics(
hIvasEnc,
arg.inputFs,
totalBitrate,
arg.max_bwidth_user,
bandwidth,
arg.dtxConfig,
arg.inputFormatConfig.sba.order,
arg.inputFormatConfig.sba.isPlanar,
#ifdef DEBUG_AGC_ENCODER_CMD_OPTION #ifdef DEBUG_AGC_ENCODER_CMD_OPTION
arg.agc, arg.agc,
#endif #endif
...@@ -445,7 +436,6 @@ int main( ...@@ -445,7 +436,6 @@ int main(
goto cleanup; goto cleanup;
} }
break; break;
case IVAS_ENC_INPUT_SBA_ISM: case IVAS_ENC_INPUT_SBA_ISM:
if ( ( error = IVAS_ENC_ConfigureForSBAObjects( hIvasEnc, arg.inputFs, totalBitrate, bandwidth, arg.dtxConfig, arg.inputFormatConfig.sba_ism.numObjects, arg.inputFormatConfig.sba_ism.order, arg.inputFormatConfig.sba_ism.isPlanar, arg.pca ) ) != IVAS_ERR_OK ) if ( ( error = IVAS_ENC_ConfigureForSBAObjects( hIvasEnc, arg.inputFs, totalBitrate, bandwidth, arg.dtxConfig, arg.inputFormatConfig.sba_ism.numObjects, arg.inputFormatConfig.sba_ism.order, arg.inputFormatConfig.sba_ism.isPlanar, arg.pca ) ) != IVAS_ERR_OK )
{ {
...@@ -453,7 +443,6 @@ int main( ...@@ -453,7 +443,6 @@ int main(
exit( -1 ); exit( -1 );
} }
break; break;
case IVAS_ENC_INPUT_MASA_ISM: case IVAS_ENC_INPUT_MASA_ISM:
if ( ( error = IVAS_ENC_ConfigureForMASAObjects( hIvasEnc, arg.inputFs, totalBitrate, bandwidth, arg.dtxConfig, arg.inputFormatConfig.masa_ism.numObjects, arg.inputFormatConfig.masa_ism.masaVariant ) ) != IVAS_ERR_OK ) if ( ( error = IVAS_ENC_ConfigureForMASAObjects( hIvasEnc, arg.inputFs, totalBitrate, bandwidth, arg.dtxConfig, arg.inputFormatConfig.masa_ism.numObjects, arg.inputFormatConfig.masa_ism.masaVariant ) ) != IVAS_ERR_OK )
{ {
...@@ -461,7 +450,6 @@ int main( ...@@ -461,7 +450,6 @@ int main(
exit( -1 ); exit( -1 );
} }
break; break;
default: default:
fprintf( stderr, "\nInvalid input type\n\n" ); fprintf( stderr, "\nInvalid input type\n\n" );
goto cleanup; goto cleanup;
...@@ -512,6 +500,7 @@ int main( ...@@ -512,6 +500,7 @@ int main(
fprintf( stderr, "\nError: %s\n", ivas_error_to_string( error ) ); fprintf( stderr, "\nError: %s\n", ivas_error_to_string( error ) );
goto cleanup; goto cleanup;
} }
int16_t inFileNumChannels = 0; int16_t inFileNumChannels = 0;
error = AudioFileReader_getNumChannels( audioReader, &inFileNumChannels ); error = AudioFileReader_getNumChannels( audioReader, &inFileNumChannels );
switch ( error ) switch ( error )
...@@ -546,9 +535,7 @@ int main( ...@@ -546,9 +535,7 @@ int main(
} }
} }
const int16_t numIsmInputs = ( arg.inputFormat == IVAS_ENC_INPUT_ISM || arg.inputFormat == IVAS_ENC_INPUT_MASA_ISM || arg.inputFormat == IVAS_ENC_INPUT_SBA_ISM ) const int16_t numIsmInputs = ( arg.inputFormat == IVAS_ENC_INPUT_ISM || arg.inputFormat == IVAS_ENC_INPUT_MASA_ISM || arg.inputFormat == IVAS_ENC_INPUT_SBA_ISM ) ? arg.inputFormatConfig.ism.numObjects : 0;
? arg.inputFormatConfig.ism.numObjects
: 0;
for ( i = 0; i < numIsmInputs; ++i ) for ( i = 0; i < numIsmInputs; ++i )
{ {
......
This diff is collapsed.
...@@ -1662,8 +1662,7 @@ static ivas_error write_indices_element( ...@@ -1662,8 +1662,7 @@ static ivas_error write_indices_element(
reset_indices_enc( st_ivas->hSCE[element_id]->hMetaData, st_ivas->hSCE[element_id]->hMetaData->nb_ind_tot ); reset_indices_enc( st_ivas->hSCE[element_id]->hMetaData, st_ivas->hSCE[element_id]->hMetaData->nb_ind_tot );
} }
reset_indices_enc( sts[0]->hBstr, reset_indices_enc( sts[0]->hBstr, sts[0]->hBstr->nb_ind_tot );
sts[0]->hBstr->nb_ind_tot );
} }
else else
{ {
...@@ -1674,8 +1673,7 @@ static ivas_error write_indices_element( ...@@ -1674,8 +1673,7 @@ static ivas_error write_indices_element(
for ( n = 0; n < n_channels; n++ ) for ( n = 0; n < n_channels; n++ )
{ {
reset_indices_enc( sts[n]->hBstr, reset_indices_enc( sts[n]->hBstr, sts[n]->hBstr->nb_ind_tot );
sts[n]->hBstr->nb_ind_tot );
} }
} }
......
...@@ -95,6 +95,12 @@ static uint16_t ivas_ari_get_symbol( ...@@ -95,6 +95,12 @@ static uint16_t ivas_ari_get_symbol(
} }
/*---------------------------------------------------------------
* Function ivas_ari_decode_14bits_bit_ext_1_lfe()
*
*
*-------------------------------------------------------------*/
uint16_t ivas_ari_decode_14bits_bit_ext_1_lfe( uint16_t ivas_ari_decode_14bits_bit_ext_1_lfe(
Decoder_State *st, Decoder_State *st,
Tastat *s, Tastat *s,
...@@ -164,6 +170,12 @@ uint16_t ivas_ari_decode_14bits_bit_ext_1_lfe( ...@@ -164,6 +170,12 @@ uint16_t ivas_ari_decode_14bits_bit_ext_1_lfe(
} }
/*---------------------------------------------------------------
* Function ivas_ari_done_decoding_14bits_ext_1_lfe()
*
*
*-------------------------------------------------------------*/
void ivas_ari_done_decoding_14bits_ext_1_lfe( void ivas_ari_done_decoding_14bits_ext_1_lfe(
Decoder_State *st, Decoder_State *st,
const int16_t extra_bits_read ) const int16_t extra_bits_read )
...@@ -216,6 +228,7 @@ void ivas_ari_done_encoding_14bits( ...@@ -216,6 +228,7 @@ void ivas_ari_done_encoding_14bits(
return; return;
} }
/*--------------------------------------------------------------- /*---------------------------------------------------------------
* Function ivas_ari_encode_14bits_ext() * Function ivas_ari_encode_14bits_ext()
* *
......
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
void ordr_esti( void ordr_esti(
const int16_t svLength, /* i : sub-vector index */ const int16_t svLength, /* i : sub-vector index */
int16_t *Mpos, /* i/o: dominant sub-vector position from ACV */ int16_t *Mpos, /* i/o: dominant sub-vector position from ACV */
int16_t svOrder[], /* i/o: AVQ sub-vecotr order */ int16_t svOrder[], /* i/o: AVQ sub-vector order */
const int16_t Nsv /* i : total sub-vectors in a sub-frames */ const int16_t Nsv /* i : total sub-vectors in a sub-frames */
) )
{ {
......
...@@ -121,7 +121,7 @@ typedef enum ...@@ -121,7 +121,7 @@ typedef enum
RENDERER_OSBA_LS RENDERER_OSBA_LS
} RENDERER_TYPE; } RENDERER_TYPE;
#if defined SPLIT_REND_WITH_HEAD_ROT #ifdef SPLIT_REND_WITH_HEAD_ROT
typedef enum typedef enum
{ {
PCM_INT16, PCM_INT16,
...@@ -367,6 +367,7 @@ typedef enum ...@@ -367,6 +367,7 @@ typedef enum
#ifndef FIX_747_ISM_TODOS #ifndef FIX_747_ISM_TODOS
#define BRATE_ISM_INACTIVE 2450 /* CoreCoder bitrate in ISM inactive frames */ #define BRATE_ISM_INACTIVE 2450 /* CoreCoder bitrate in ISM inactive frames */
#endif #endif
/* ISM modes */
typedef enum typedef enum
{ {
ISM_MODE_NONE, ISM_MODE_NONE,
...@@ -375,7 +376,7 @@ typedef enum ...@@ -375,7 +376,7 @@ typedef enum
ISM_MASA_MODE_MASA_ONE_OBJ, /* MASA ISM mode when one object is encoded separately and remainder using MASA parameters */ ISM_MASA_MODE_MASA_ONE_OBJ, /* MASA ISM mode when one object is encoded separately and remainder using MASA parameters */
ISM_MASA_MODE_PARAM_ONE_OBJ, /* MASA ISM mode when one object is encoded separately and remainder using parametric object model */ ISM_MASA_MODE_PARAM_ONE_OBJ, /* MASA ISM mode when one object is encoded separately and remainder using parametric object model */
ISM_MASA_MODE_DISC, /* MASA ISM mode when all objects are encoded separarately */ ISM_MASA_MODE_DISC, /* MASA ISM mode when all objects are encoded separarately */
ISM_SBA_MODE_DISC /* MASA ISM mode when all objects are encoded separarately */ ISM_SBA_MODE_DISC /* SBA ISM mode when all objects are encoded separarately */
} ISM_MODE; } ISM_MODE;
......
...@@ -49,8 +49,6 @@ ...@@ -49,8 +49,6 @@
static void ivas_get_active_bins( const int16_t **pActive_bins, const int16_t **pActive_bins_abs, const int16_t **pStart_offset, const int16_t **pStart_offset_ab, const int32_t sampling_rate ); static void ivas_get_active_bins( const int16_t **pActive_bins, const int16_t **pActive_bins_abs, const int16_t **pStart_offset, const int16_t **pStart_offset_ab, const int32_t sampling_rate );
static void ivas_get_ld_fb_resp( float **ppIdeal_FRs_re, float **ppIdeal_FRs_im, float **ppNew_FRs_re, float **ppNew_FRs_im, const int16_t *pActive_bins, const int16_t *pStart_offset, const int16_t num_bands, const int16_t delay, const int32_t sampling_rate ); static void ivas_get_ld_fb_resp( float **ppIdeal_FRs_re, float **ppIdeal_FRs_im, float **ppNew_FRs_re, float **ppNew_FRs_im, const int16_t *pActive_bins, const int16_t *pStart_offset, const int16_t num_bands, const int16_t delay, const int32_t sampling_rate );
static const float *ivas_get_cheby_ramp( const int16_t delay );
static void ivas_get_hanning_win( const int16_t len, float *pH_win );
static ivas_error ivas_filterbank_setup( IVAS_FB_MIXER_HANDLE hFbMixer, const int32_t sampling_rate ); static ivas_error ivas_filterbank_setup( IVAS_FB_MIXER_HANDLE hFbMixer, const int32_t sampling_rate );
static ivas_error ivas_fb_mixer_get_window( const int16_t fade_len, const int32_t sampling_rate, const float **pWindow ); static ivas_error ivas_fb_mixer_get_window( const int16_t fade_len, const int32_t sampling_rate, const float **pWindow );
...@@ -317,7 +315,6 @@ ivas_error ivas_FB_mixer_open( ...@@ -317,7 +315,6 @@ ivas_error ivas_FB_mixer_open(
} }
else else
{ {
/* ignore all the deeper filter bank stuff for now */ /* ignore all the deeper filter bank stuff for now */
hFbMixer->num_diff_bands = 0; hFbMixer->num_diff_bands = 0;
} }
...@@ -399,7 +396,6 @@ void ivas_FB_mixer_close( ...@@ -399,7 +396,6 @@ void ivas_FB_mixer_close(
num_chs_alloc = max( fb_cfg->num_in_chans, fb_cfg->nchan_fb_in ); num_chs_alloc = max( fb_cfg->num_in_chans, fb_cfg->nchan_fb_in );
} }
for ( i = 0; i < num_chs_alloc; i++ ) for ( i = 0; i < num_chs_alloc; i++ )
{ {
free( hFbMixer->ppFilterbank_prior_input[i] ); free( hFbMixer->ppFilterbank_prior_input[i] );
...@@ -560,9 +556,7 @@ void ivas_fb_mixer_get_windowed_fr( ...@@ -560,9 +556,7 @@ void ivas_fb_mixer_get_windowed_fr(
rev_offset = (int16_t) ( 2 * mdft_len - hFbMixer->ana_window_offset ); rev_offset = (int16_t) ( 2 * mdft_len - hFbMixer->ana_window_offset );
set_zero( fr_in_block, offset ); set_zero( fr_in_block, offset );
for ( ch_idx = 0; ch_idx < for ( ch_idx = 0; ch_idx < nchan_fb_in; ch_idx++ )
nchan_fb_in;
ch_idx++ )
{ {
mvr2r( &hFbMixer->ppFilterbank_prior_input[ch_idx][offset + hFbMixer->fb_cfg->windowed_fr_offset], &fr_in_block[offset], n_old_samples - offset ); mvr2r( &hFbMixer->ppFilterbank_prior_input[ch_idx][offset + hFbMixer->fb_cfg->windowed_fr_offset], &fr_in_block[offset], n_old_samples - offset );
mvr2r( pcm_in[ch_idx], &fr_in_block[n_old_samples], n_new_samples ); mvr2r( pcm_in[ch_idx], &fr_in_block[n_old_samples], n_new_samples );
......
...@@ -109,7 +109,8 @@ void ivas_filters_init( ...@@ -109,7 +109,8 @@ void ivas_filters_init(
void ivas_filter_process( void ivas_filter_process(
ivas_filters_process_state_t *filter_state, /* i/o: filter state handle */ ivas_filters_process_state_t *filter_state, /* i/o: filter state handle */
float *pIn_Out, /* i/o: signal subject to filtering */ float *pIn_Out, /* i/o: signal subject to filtering */
const int16_t length ) /* i : filter order */ const int16_t length /* i : filter order */
)
{ {
switch ( filter_state->order ) switch ( filter_state->order )
......
...@@ -557,6 +557,7 @@ void ivas_param_ism_config( ...@@ -557,6 +557,7 @@ void ivas_param_ism_config(
hParamIsm->last_dmx_gain = 1.0f; hParamIsm->last_dmx_gain = 1.0f;
set_f( hParamIsm->last_cardioid_left, 1.0f, MAX_NUM_OBJECTS ); set_f( hParamIsm->last_cardioid_left, 1.0f, MAX_NUM_OBJECTS );
return; return;
} }
......
...@@ -169,7 +169,6 @@ void generate_gridEq( ...@@ -169,7 +169,6 @@ void generate_gridEq(
SPHERICAL_GRID_DATA *data /* o : data structure for grid */ SPHERICAL_GRID_DATA *data /* o : data structure for grid */
) )
{ {
int32_t cum_n, cum_n_prev; int32_t cum_n, cum_n_prev;
float theta; float theta;
int16_t i; int16_t i;
...@@ -256,7 +255,6 @@ void ivas_masa_set_coding_config( ...@@ -256,7 +255,6 @@ void ivas_masa_set_coding_config(
} }
idx_bands = i; idx_bands = i;
if ( config->numberOfDirections > 1 ) if ( config->numberOfDirections > 1 )
{ {
nTwoDirBands = config->joinedSubframes ? masa_twodir_bands_joined[i] : masa_twodir_bands[i]; nTwoDirBands = config->joinedSubframes ? masa_twodir_bands_joined[i] : masa_twodir_bands[i];
......
...@@ -231,10 +231,10 @@ void ivas_mdft( ...@@ -231,10 +231,10 @@ void ivas_mdft(
float im[L_FRAME48k]; float im[L_FRAME48k];
int16_t j, len_by_2; int16_t j, len_by_2;
const float *pTwid; const float *pTwid;
len_by_2 = mdft_length >> 1; len_by_2 = mdft_length >> 1;
ivas_get_mdft_twid_factors( mdft_length, ivas_get_mdft_twid_factors( mdft_length, &pTwid );
&pTwid );
if ( mdft_length == input_length ) if ( mdft_length == input_length )
{ {
......
...@@ -301,7 +301,7 @@ void stereo_dmx_evs_close_encoder( ...@@ -301,7 +301,7 @@ void stereo_dmx_evs_close_encoder(
ivas_error ivas_dec( ivas_error ivas_dec(
Decoder_Struct *st_ivas, /* i : IVAS decoder structure */ Decoder_Struct *st_ivas, /* i : IVAS decoder structure */
#if defined SPLIT_REND_WITH_HEAD_ROT #ifdef SPLIT_REND_WITH_HEAD_ROT
const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */
void *data /* o : output synthesis signal */ void *data /* o : output synthesis signal */
#else #else
...@@ -312,7 +312,7 @@ ivas_error ivas_dec( ...@@ -312,7 +312,7 @@ ivas_error ivas_dec(
ivas_error ivas_dec_setup( ivas_error ivas_dec_setup(
Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */
uint16_t *nSamplesRendered, /* o : number of samples flushed from the previous frame (JBM) */ uint16_t *nSamplesRendered, /* o : number of samples flushed from the previous frame (JBM) */
#if defined SPLIT_REND_WITH_HEAD_ROT #ifdef SPLIT_REND_WITH_HEAD_ROT
const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */
void *data /* o : output synthesis signal */ void *data /* o : output synthesis signal */
#else #else
...@@ -657,7 +657,7 @@ ivas_error ivas_mc_dec_config( ...@@ -657,7 +657,7 @@ ivas_error ivas_mc_dec_config(
Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */
const int16_t idx, /* i : LS config. index */ const int16_t idx, /* i : LS config. index */
uint16_t *nSamplesRendered, /* o : samples flushed from last frame (JBM) */ uint16_t *nSamplesRendered, /* o : samples flushed from last frame (JBM) */
#if defined SPLIT_REND_WITH_HEAD_ROT #ifdef SPLIT_REND_WITH_HEAD_ROT
const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */
void *data /* o : output synthesis signal */ void *data /* o : output synthesis signal */
#else #else
...@@ -785,7 +785,7 @@ ivas_error ivas_jbm_dec_render( ...@@ -785,7 +785,7 @@ ivas_error ivas_jbm_dec_render(
const uint16_t nSamplesAsked, /* i : number of samples wanted */ const uint16_t nSamplesAsked, /* i : number of samples wanted */
uint16_t *nSamplesRendered, /* o : number of samples rendered */ uint16_t *nSamplesRendered, /* o : number of samples rendered */
uint16_t *nSamplesAvailableNext, /* o : number of samples still available in the rendering pipeline */ uint16_t *nSamplesAvailableNext, /* o : number of samples still available in the rendering pipeline */
#if defined SPLIT_REND_WITH_HEAD_ROT #ifdef SPLIT_REND_WITH_HEAD_ROT
const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */
void *data /* o : output synthesis signal */ void *data /* o : output synthesis signal */
#else #else
...@@ -802,7 +802,7 @@ ivas_error ivas_jbm_dec_flush_renderer( ...@@ -802,7 +802,7 @@ ivas_error ivas_jbm_dec_flush_renderer(
const MC_MODE mc_mode_old, /* i : old MC mode */ const MC_MODE mc_mode_old, /* i : old MC mode */
const ISM_MODE ism_mode_old, /* i : old ISM mode */ const ISM_MODE ism_mode_old, /* i : old ISM mode */
uint16_t *nSamplesRendered, /* o : number of samples flushed */ uint16_t *nSamplesRendered, /* o : number of samples flushed */
#if defined SPLIT_REND_WITH_HEAD_ROT #ifdef SPLIT_REND_WITH_HEAD_ROT
const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */
void *data /* o : output synthesis signal */ void *data /* o : output synthesis signal */
#else #else
...@@ -849,7 +849,8 @@ int16_t ivas_jbm_dec_get_num_tc_channels( ...@@ -849,7 +849,8 @@ int16_t ivas_jbm_dec_get_num_tc_channels(
void ivas_jbm_dec_copy_tc_no_tsm( void ivas_jbm_dec_copy_tc_no_tsm(
Decoder_Struct *st_ivas, Decoder_Struct *st_ivas,
float *tc[], float *tc[],
const int16_t output_frame ); const int16_t output_frame
);
void ivas_jbm_dec_get_md_map_even_spacing( void ivas_jbm_dec_get_md_map_even_spacing(
const int16_t len, /* i : length of the modfied frames in metadata slots */ const int16_t len, /* i : length of the modfied frames in metadata slots */
...@@ -1078,7 +1079,7 @@ ivas_error ivas_ism_dec_config( ...@@ -1078,7 +1079,7 @@ ivas_error ivas_ism_dec_config(
Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */
const ISM_MODE last_ism_mode, /* i/o: last ISM mode */ const ISM_MODE last_ism_mode, /* i/o: last ISM mode */
uint16_t *nSamplesRendered, /* o : number of samples flushed on renderer change*/ uint16_t *nSamplesRendered, /* o : number of samples flushed on renderer change*/
#if defined SPLIT_REND_WITH_HEAD_ROT #ifdef SPLIT_REND_WITH_HEAD_ROT
const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */
void *data /* o : output synthesis signal */ void *data /* o : output synthesis signal */
#else #else
...@@ -2668,7 +2669,7 @@ void sns_avq_cod_stereo( ...@@ -2668,7 +2669,7 @@ void sns_avq_cod_stereo(
void sns_avq_dec( void sns_avq_dec(
int16_t *index, /* i : Quantization indices */ int16_t *index, /* i : Quantization indices */
float SNS_Q[NB_DIV][M], /* o : Quantized SNS vectors */ float SNS_Q[NB_DIV][M], /* o : Quantized SNS vectors */
const int16_t L_frame, const int16_t L_frame, /* i : frame length */
const int16_t numlpc /* i : Number of sets of lpc */ const int16_t numlpc /* i : Number of sets of lpc */
); );
...@@ -3606,7 +3607,7 @@ void ivas_dirac_enc_close( ...@@ -3606,7 +3607,7 @@ void ivas_dirac_enc_close(
const int32_t input_Fs /* i : input sampling_rate */ const int32_t input_Fs /* i : input sampling_rate */
); );
void ivas_dirac_enc( ivas_error ivas_dirac_enc(
DIRAC_ENC_HANDLE hDirAC, /* i/o: encoder DirAC handle */ DIRAC_ENC_HANDLE hDirAC, /* i/o: encoder DirAC handle */
IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata handle */ IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata handle */
BSTR_ENC_HANDLE hMetaData, /* i/o: Metadata bitstream handle */ BSTR_ENC_HANDLE hMetaData, /* i/o: Metadata bitstream handle */
...@@ -3616,7 +3617,7 @@ void ivas_dirac_enc( ...@@ -3616,7 +3617,7 @@ void ivas_dirac_enc(
const int16_t input_frame, /* i : input frame length */ const int16_t input_frame, /* i : input frame length */
const int16_t dtx_vad, /* i : DTX vad flag */ const int16_t dtx_vad, /* i : DTX vad flag */
const IVAS_FORMAT ivas_format, /* i : ivas format */ const IVAS_FORMAT ivas_format, /* i : ivas format */
int16_t hodirac_flag /* i : hodirac flag */ const int16_t hodirac_flag /* i : hodirac flag */
); );
ivas_error ivas_dirac_config( ivas_error ivas_dirac_config(
...@@ -3686,8 +3687,8 @@ void ivas_dirac_dec_set_md_map( ...@@ -3686,8 +3687,8 @@ void ivas_dirac_dec_set_md_map(
void ivas_dirac_dec( void ivas_dirac_dec(
Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */
float *output_f[], /* i/o: synthesized core-coder transport channels/DirAC output */ float *output_f[], /* i/o: synthesized core-coder transport channels/DirAC output */
const int16_t nchan_transport /* i : number of transport channels */ const int16_t nchan_transport, /* i : number of transport channels */
,const int16_t num_subframes /* i : number of subframes to render */ const int16_t num_subframes /* i : number of subframes to render */
); );
void ivas_dirac_dec_render( void ivas_dirac_dec_render(
...@@ -4365,7 +4366,7 @@ ivas_error ivas_sba_dec_digest_tc( ...@@ -4365,7 +4366,7 @@ ivas_error ivas_sba_dec_digest_tc(
const int16_t nSamplesForRendering /* i : number of samples provided */ const int16_t nSamplesForRendering /* i : number of samples provided */
); );
void ivas_sba_dec_render( ivas_error ivas_sba_dec_render(
Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */
const uint16_t nSamplesAsked, /* i : number of CLDFB slots requested */ const uint16_t nSamplesAsked, /* i : number of CLDFB slots requested */
uint16_t *nSamplesRendered, /* o : number of CLDFB slots rendered */ uint16_t *nSamplesRendered, /* o : number of CLDFB slots rendered */
...@@ -4997,7 +4998,7 @@ void ivas_masa_enc_reconfigure( ...@@ -4997,7 +4998,7 @@ void ivas_masa_enc_reconfigure(
ivas_error ivas_masa_dec_reconfigure( ivas_error ivas_masa_dec_reconfigure(
Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */
uint16_t *nSamplesRendered, /* o : number of samples flushed from the previous frame (JBM) */ uint16_t *nSamplesRendered, /* o : number of samples flushed from the previous frame (JBM) */
#if defined SPLIT_REND_WITH_HEAD_ROT #ifdef SPLIT_REND_WITH_HEAD_ROT
const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */
void *data /* o : output synthesis signal */ void *data /* o : output synthesis signal */
#else #else
...@@ -5194,8 +5195,7 @@ void update_bits_next_block( ...@@ -5194,8 +5195,7 @@ void update_bits_next_block(
void ivas_masa_prerender( void ivas_masa_prerender(
Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */
float *output[], /* i/o: synthesized core-coder transport channels */ float *output[], /* i/o: synthesized core-coder transport channels */
const int16_t output_frame /* i : output frame length per channel */ const int16_t output_frame, /* i : output frame length per channel */
,
const int16_t nchan_remapped /* i : number of transports used in core */ const int16_t nchan_remapped /* i : number of transports used in core */
); );
...@@ -5695,14 +5695,19 @@ void ivas_osba_enc( ...@@ -5695,14 +5695,19 @@ void ivas_osba_enc(
#endif #endif
); );
#ifdef FIX_782_OSBA_FUNCTION_NAMES
ivas_error ivas_osba_data_open(
#else
ivas_error ivas_masa_ism_data_open( ivas_error ivas_masa_ism_data_open(
#endif
Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */
); );
#ifndef FIX_782_OSBA_FUNCTION_NAMES
ivas_error ivas_sba_ism_separate_object_renderer_open( ivas_error ivas_sba_ism_separate_object_renderer_open(
Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */
); );
#endif
ivas_error ivas_osba_dirac_td_binaural( ivas_error ivas_osba_dirac_td_binaural(
Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */
float *output[], /* o : output synthesis signal */ float *output[], /* o : output synthesis signal */
...@@ -5722,9 +5727,15 @@ ivas_error ivas_osba_render( ...@@ -5722,9 +5727,15 @@ ivas_error ivas_osba_render(
const int16_t output_frame /* i : output frame length per channel */ const int16_t output_frame /* i : output frame length per channel */
); );
#ifdef FIX_782_OSBA_FUNCTION_NAMES
void ivas_osba_data_close(
SBA_ISM_DATA_HANDLE *hSbaIsmData /* i/o: OSBA rendering handle */
);
#else
void ivas_masa_ism_data_close( void ivas_masa_ism_data_close(
MASA_ISM_DATA_HANDLE *hMasaIsmData /* i/o: MASA_ISM rendering handle */ MASA_ISM_DATA_HANDLE *hMasaIsmData /* i/o: MASA_ISM rendering handle */
); );
#endif
/*----------------------------------------------------------------------------------* /*----------------------------------------------------------------------------------*
...@@ -5746,7 +5757,7 @@ ivas_error ivas_omasa_enc_config( ...@@ -5746,7 +5757,7 @@ ivas_error ivas_omasa_enc_config(
ivas_error ivas_omasa_dec_config( ivas_error ivas_omasa_dec_config(
Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */
uint16_t *nSamplesRendered, /* o : number of samples flushed from the previous frame (JBM) */ uint16_t *nSamplesRendered, /* o : number of samples flushed from the previous frame (JBM) */
#if defined SPLIT_REND_WITH_HEAD_ROT #ifdef SPLIT_REND_WITH_HEAD_ROT
const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */
void *data /* o : output synthesis signal */ void *data /* o : output synthesis signal */
#else #else
......
...@@ -130,7 +130,6 @@ ivas_error ivas_qmetadata_allocate_memory( ...@@ -130,7 +130,6 @@ ivas_error ivas_qmetadata_allocate_memory(
return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for Q MetaData" ); return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for Q MetaData" );
} }
for ( dir = 0; dir < hQMetaData->no_directions; dir++ ) for ( dir = 0; dir < hQMetaData->no_directions; dir++ )
{ {
hQMetaData->q_direction[dir].cfg.nbands = nbands; hQMetaData->q_direction[dir].cfg.nbands = nbands;
...@@ -336,6 +335,7 @@ ivas_error only_reduce_bits_direction( ...@@ -336,6 +335,7 @@ ivas_error only_reduce_bits_direction(
} }
} }
} }
rem = reduce_bits; /* -coding_subbands*no_subframes*red_times; */ rem = reduce_bits; /* -coding_subbands*no_subframes*red_times; */
while ( n < rem ) while ( n < rem )
{ {
...@@ -372,6 +372,7 @@ ivas_error only_reduce_bits_direction( ...@@ -372,6 +372,7 @@ ivas_error only_reduce_bits_direction(
reduce_bits = 0; reduce_bits = 0;
} }
if ( ind_order[0] == -1 ) if ( ind_order[0] == -1 )
{ {
for ( j = 0; j < coding_subbands; j++ ) for ( j = 0; j < coding_subbands; j++ )
......
...@@ -237,6 +237,7 @@ int16_t ivas_sba_get_nchan_metadata( ...@@ -237,6 +237,7 @@ int16_t ivas_sba_get_nchan_metadata(
return ( nb_channels ); return ( nb_channels );
} }
/*-------------------------------------------------------------------* /*-------------------------------------------------------------------*
* ivas_sba_get_spar_hoa_ch_ind() * ivas_sba_get_spar_hoa_ch_ind()
* *
......
...@@ -68,8 +68,7 @@ static void SpectrumWeighting_Init( ...@@ -68,8 +68,7 @@ static void SpectrumWeighting_Init(
* initialize a PsychoacousticParameters structure * initialize a PsychoacousticParameters structure
*-------------------------------------------------------------------*/ *-------------------------------------------------------------------*/
ivas_error ivas_error PsychoacousticParameters_Init(
PsychoacousticParameters_Init(
const int32_t sr_core, /* i : sampling rate of core-coder */ const int32_t sr_core, /* i : sampling rate of core-coder */
const int16_t nBins, /* i : Number of bins (spectral lines) */ const int16_t nBins, /* i : Number of bins (spectral lines) */
const int8_t nBands, /* i : Number of spectrum subbands */ const int8_t nBands, /* i : Number of spectrum subbands */
......
...@@ -65,7 +65,6 @@ static const float ivas_hadamard_decorr_APD_coeff[IVAS_APD_16_SECT][IVAS_APD_16_ ...@@ -65,7 +65,6 @@ static const float ivas_hadamard_decorr_APD_coeff[IVAS_APD_16_SECT][IVAS_APD_16_
{ 0.4f, -0.4f, -0.4f, 0.4f, -0.4f, 0.4f, 0.4f, -0.4f, -0.4f, 0.4f, 0.4f, -0.4f, 0.4f, -0.4f, -0.4f, 0.4f } { 0.4f, -0.4f, -0.4f, 0.4f, -0.4f, 0.4f, 0.4f, -0.4f, -0.4f, 0.4f, 0.4f, -0.4f, 0.4f, -0.4f, -0.4f, 0.4f }
}; };
/* For R = 3.^([0:obj.parm_APD_nSections-1]/4); */ /* For R = 3.^([0:obj.parm_APD_nSections-1]/4); */
static const float ivas_three_pow_frac[IVAS_MAX_DECORR_APD_SECTIONS] = { static const float ivas_three_pow_frac[IVAS_MAX_DECORR_APD_SECTIONS] = {
1.000000000000000f, 1.000000000000000f,
...@@ -86,7 +85,6 @@ static const float ivas_three_pow_frac[IVAS_MAX_DECORR_APD_SECTIONS] = { ...@@ -86,7 +85,6 @@ static const float ivas_three_pow_frac[IVAS_MAX_DECORR_APD_SECTIONS] = {
61.54669053777900f, 61.54669053777900f,
}; };
#define IVAS_TDET_DUCK_MULT_FAC_PARA_BIN ( 2.0f ) #define IVAS_TDET_DUCK_MULT_FAC_PARA_BIN ( 2.0f )
#define IVAS_TDET_DUCK_MULT_FAC_PARA_BIN_LOW_BR ( 3.0f ) #define IVAS_TDET_DUCK_MULT_FAC_PARA_BIN_LOW_BR ( 3.0f )
...@@ -348,6 +346,7 @@ static int16_t ivas_get_APD_filt_orders( ...@@ -348,6 +346,7 @@ static int16_t ivas_get_APD_filt_orders(
{ {
APD_filt_orders[i] = (int16_t) ceil( output_Fs * IVAS_DECORR_PARM_APD_TAU * R[i] / sum_R ); APD_filt_orders[i] = (int16_t) ceil( output_Fs * IVAS_DECORR_PARM_APD_TAU * R[i] / sum_R );
} }
return num_apd_sections; return num_apd_sections;
} }
...@@ -387,6 +386,7 @@ static void ivas_td_decorr_init( ...@@ -387,6 +386,7 @@ static void ivas_td_decorr_init(
* *
* APD IIR filter * APD IIR filter
*-----------------------------------------------------------------------------------------*/ *-----------------------------------------------------------------------------------------*/
void ivas_td_decorr_APD_iir_filter( void ivas_td_decorr_APD_iir_filter(
ivas_td_decorr_APD_filt_state_t *filter_state, ivas_td_decorr_APD_filt_state_t *filter_state,
float *pIn_out, float *pIn_out,
...@@ -465,7 +465,6 @@ void ivas_td_decorr_process( ...@@ -465,7 +465,6 @@ void ivas_td_decorr_process(
int16_t i, j; int16_t i, j;
float in_duck_gain[L_FRAME48k], out_duck_gain[L_FRAME48k]; float in_duck_gain[L_FRAME48k], out_duck_gain[L_FRAME48k];
/* Look-ahead delay */ /* Look-ahead delay */
mvr2r( pcm_in[0], ppOut_pcm[0], output_frame ); mvr2r( pcm_in[0], ppOut_pcm[0], output_frame );
delay_signal( ppOut_pcm[0], output_frame, hTdDecorr->look_ahead_buf, hTdDecorr->offset ); delay_signal( ppOut_pcm[0], output_frame, hTdDecorr->look_ahead_buf, hTdDecorr->offset );
......
...@@ -173,8 +173,10 @@ ...@@ -173,8 +173,10 @@
#define FIX_764_HARM_CODE /* VA: issue 764: introduce new function for the same code block at four different places */ #define FIX_764_HARM_CODE /* VA: issue 764: introduce new function for the same code block at four different places */
#define FIX_747_ISM_TODOS /* VA: issue 747 - address ISM ToDos */ #define FIX_747_ISM_TODOS /* VA: issue 747 - address ISM ToDos */
#define FIX_ISMRENDERER_HANDLE_DEALLOC /* VA: issue 781: harmonize Deallocation of handle 'hIsmRendererData' */ #define FIX_ISMRENDERER_HANDLE_DEALLOC /* VA: issue 781: harmonize Deallocation of handle 'hIsmRendererData' */
#define FIX_782_OSBA_FUNCTION_NAMES /* VA: fix 782: correct OSBA function names */
#define PARAM_ISM_REFACTOR /* FhG: Issue 768: Refactoring to decouple hDirAC and hParamISM */ #define PARAM_ISM_REFACTOR /* FhG: Issue 768: Refactoring to decouple hDirAC and hParamISM */
/* #################### End BE switches ################################## */ /* #################### End BE switches ################################## */
/* #################### Start NON-BE switches ############################ */ /* #################### Start NON-BE switches ############################ */
......