diff --git a/apps/decoder.c b/apps/decoder.c index 72854f50dab0e6a34c52d44f4ee7740c62bf481b..db9c49695b98f5571467a09636d5e582ff33ce01 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -43,9 +43,7 @@ #include "masa_file_writer.h" #include "render_config_reader.h" #include "rotation_file_reader.h" -#ifdef SPLIT_REND_WITH_HEAD_ROT #include "split_render_file_read_write.h" -#endif #ifdef VARIABLE_SPEED_DECODING #include "tsm_scale_file_reader.h" #include @@ -124,9 +122,7 @@ typedef struct float non_diegetic_pan_gain; bool renderConfigEnabled; char *renderConfigFilename; -#ifdef SPLIT_REND_WITH_HEAD_ROT char *outputMdFilename; -#endif IVAS_DEC_COMPLEXITY_LEVEL complexityLevel; bool tsmEnabled; IVAS_RENDER_FRAMESIZE renderFramesize; @@ -154,11 +150,7 @@ typedef struct static bool parseCmdlIVAS_dec( int16_t argc, char **argv, DecArguments *arg ); static void usage_dec( void ); -#ifdef SPLIT_REND_WITH_HEAD_ROT static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, ISAR_SPLIT_REND_BITS_DATA *splitRendBits, 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 static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, IVAS_DEC_HANDLE hIvasDec ); #ifdef DEBUGGING @@ -180,10 +172,8 @@ int main( bool mainFailed = true; /* Assume main failed until cleanup is reached without errors */ DecArguments arg; ivas_error error = IVAS_ERR_UNKNOWN; -#ifdef SPLIT_REND_WITH_HEAD_ROT ISAR_SPLIT_REND_BITS_DATA splitRendBits; uint8_t splitRendBitsBuf[ISAR_MAX_SPLIT_REND_BITS_BUFFER_SIZE_IN_BYTES]; -#endif /* Any handles that require cleanup must be declared here and initialized to NULL */ IVAS_DEC_HANDLE hIvasDec = NULL; @@ -218,9 +208,7 @@ int main( reset_mem( USE_BYTES ); #endif -#ifdef SPLIT_REND_WITH_HEAD_ROT splitRendBits.bits_buf = splitRendBitsBuf; -#endif /*------------------------------------------------------------------------------------------* * Parse command-line arguments @@ -268,7 +256,6 @@ int main( } } -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) { fprintf( stdout, "Output metadata file: %s\n", arg.outputWavFilename ); @@ -279,7 +266,6 @@ int main( fprintf( stdout, "Output metadata file: %s\n", arg.outputMdFilename ); } else -#endif { fprintf( stdout, "Output synthesis file: %s\n", arg.outputWavFilename ); } @@ -313,11 +299,7 @@ int main( if ( arg.enableHeadRotation ) { /* 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 -#ifdef SPLIT_REND_WITH_HEAD_ROT - && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM -#endif - ) + 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, "\nError: Head-rotation file file cannot be used in this output configuration.\n\n" ); goto cleanup; @@ -417,12 +399,8 @@ int main( if ( arg.renderConfigEnabled ) { /* 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 -#ifdef SPLIT_REND_WITH_HEAD_ROT - && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM && - arg.Opt_non_diegetic_pan == 0 -#endif - ) + 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 ) { fprintf( stderr, "\nError: Renderer configuration file cannot be used in this output configuration.\n\n" ); goto cleanup; @@ -458,7 +436,6 @@ int main( fprintf( stderr, "\nChanged render framesize, only 20ms are allowed for decoding to EXT!\n" ); } -#ifdef SPLIT_REND_WITH_HEAD_ROT /*------------------------------------------------------------------------------------------* * Configure Split rendering *------------------------------------------------------------------------------------------*/ @@ -480,7 +457,6 @@ int main( arg.enableHeadRotation = true; } -#endif /*------------------------------------------------------------------------------------------* * Configure VoIP mode @@ -609,7 +585,6 @@ int main( IVAS_RENDER_CONFIG_DATA renderConfig; /* 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 && arg.Opt_non_diegetic_pan == 0 ) @@ -617,13 +592,6 @@ int main( 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; } -#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 ( ( error = IVAS_DEC_GetRenderConfig( hIvasDec, &renderConfig ) ) != IVAS_ERR_OK ) { @@ -642,7 +610,6 @@ int main( fprintf( stderr, "Failed to get directivity patterns for one or more of IDs: %d %d %d %d\n\n", arg.directivityPatternId[0], arg.directivityPatternId[1], arg.directivityPatternId[2], arg.directivityPatternId[3] ); goto cleanup; } -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { @@ -667,7 +634,6 @@ int main( fprintf( stderr, "\nChanged render framesize, only 20ms are allowed for non-0dof split rendering!\n" ); } } -#endif if ( arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { @@ -686,13 +652,9 @@ int main( } renderConfig.roomAcoustics.override = true; } -#ifdef SPLIT_REND_WITH_HEAD_ROT -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS /* ISAR frame size is set from command line, not renderer config file. * This will be ignored if output format is not split rendering. */ renderConfig.split_rend_config.isar_frame_size_ms = (int16_t) arg.renderFramesize /* given in number of 5ms subframes */ * 5; -#endif -#endif if ( ( error = IVAS_DEC_FeedRenderConfig( hIvasDec, renderConfig ) ) != IVAS_ERR_OK ) { @@ -921,11 +883,7 @@ int main( } else { -#ifdef SPLIT_REND_WITH_HEAD_ROT error = decodeG192( arg, hBsReader, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, &splitRendBits, hIvasDec, pcmBuf ); -#else - error = decodeG192( arg, hBsReader, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, hIvasDec, pcmBuf ); -#endif } if ( error == IVAS_ERR_OK || error == IVAS_ERR_END_OF_FILE ) @@ -1086,7 +1044,6 @@ static IVAS_AUDIO_CONFIG cmdline2config( { output_config = IVAS_AUDIO_CONFIG_BINAURAL; } -#ifdef SPLIT_REND_WITH_HEAD_ROT else if ( strcmp( argv_to_upper, "BINAURAL_SPLIT_CODED" ) == 0 ) { output_config = IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED; @@ -1095,7 +1052,6 @@ static IVAS_AUDIO_CONFIG cmdline2config( { output_config = IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM; } -#endif else if ( strcmp( argv_to_upper, "BINAURAL_ROOM_IR" ) == 0 ) { output_config = IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR; @@ -1171,9 +1127,7 @@ static bool parseCmdlIVAS_dec( arg->renderConfigFilename = NULL; arg->Opt_dpid_on = 0; -#ifdef SPLIT_REND_WITH_HEAD_ROT arg->outputMdFilename = NULL; -#endif arg->inputFormat = IVAS_DEC_INPUT_FORMAT_G192; arg->Opt_non_diegetic_pan = 0; @@ -1497,7 +1451,6 @@ static bool parseCmdlIVAS_dec( } i += 2; } -#ifdef SPLIT_REND_WITH_HEAD_ROT else if ( strcmp( argv_to_upper, "-OM" ) == 0 ) { arg->outputMdFilename = argv[i + 1]; @@ -1509,7 +1462,6 @@ static bool parseCmdlIVAS_dec( } i += 2; } -#endif else if ( strcmp( argv_to_upper, "-NON_DIEGETIC_PAN" ) == 0 ) { i++; @@ -1667,14 +1619,12 @@ static bool parseCmdlIVAS_dec( usage_dec(); return false; } -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( arg->outputMdFilename != NULL && arg->outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { fprintf( stderr, "Error: Output split rendering metadata file is supported for BINAURAL_SPLIT_PCM output config. only\n\n" ); usage_dec(); return false; } -#endif } else { @@ -1751,13 +1701,8 @@ static void usage_dec( void ) fprintf( stdout, "Mandatory parameters:\n" ); fprintf( stdout, "---------------------\n" ); -#ifdef SPLIT_REND_WITH_HEAD_ROT fprintf( stdout, "OutputConf : Output configuration: MONO, STEREO, 5_1, 7_1, 5_1_2, 5_1_4, 7_1_4, FOA,\n" ); fprintf( stdout, " HOA2, HOA3, BINAURAL, BINAURAL_ROOM_IR, BINAURAL_ROOM_REVERB, BINAURAL_SPLIT_CODED, BINAURAL_SPLIT_PCM, EXT\n" ); -#else - fprintf( stdout, "OutputConf : Output configuration: MONO, STEREO, 5_1, 7_1, 5_1_2, 5_1_4, 7_1_4, FOA,\n" ); - fprintf( stdout, " HOA2, HOA3, BINAURAL, BINAURAL_ROOM_IR, BINAURAL_ROOM_REVERB, EXT\n" ); -#endif fprintf( stdout, " By default, channel order and loudspeaker positions are equal to the\n" ); fprintf( stdout, " encoder. For loudspeaker outputs, OutputConf can be a custom loudspeaker\n" ); fprintf( stdout, " layout file. See readme.txt for details.\n" ); @@ -1803,9 +1748,7 @@ static void usage_dec( void ) fprintf( stdout, "-rvf File : Reference vector specified by external trajectory File\n" ); fprintf( stdout, " works only in combination with '-otr ref_vec' and 'ref_vec_lev' modes\n" ); fprintf( stdout, "-render_config File : Renderer configuration File\n" ); -#ifdef SPLIT_REND_WITH_HEAD_ROT fprintf( stdout, "-om File : Metadata output File for BINAURAL_SPLIT_PCM OutputConf (only for Fs = 48 kHz)\n" ); -#endif fprintf( stdout, "-non_diegetic_pan P : panning mono non-diegetic sound to stereo with paning P, -90<= P <=90,\n" ); fprintf( stdout, " left or l or 90->left, right or r or -90->right, center or c or 0->middle\n" ); #ifdef DEBUGGING @@ -1860,15 +1803,11 @@ static int16_t app_own_random( int16_t *seed ) *---------------------------------------------------------------------*/ static ivas_error initOnFirstGoodFrame( - IVAS_DEC_HANDLE hIvasDec, /* i/o: */ - const DecArguments arg, /* i : */ - const int16_t numInitialBadFrames, /* i : */ -#ifdef SPLIT_REND_WITH_HEAD_ROT - int16_t *numOutSamples, /* i/o: */ - int16_t *vec_pos_len, /* i/o: */ -#else - const uint16_t numOutSamples, /* i : */ -#endif + IVAS_DEC_HANDLE hIvasDec, /* i/o: */ + const DecArguments arg, /* i : */ + const int16_t numInitialBadFrames, /* i : */ + int16_t *numOutSamples, /* i/o: */ + int16_t *vec_pos_len, /* i/o: */ int16_t *pFullDelayNumSamples, /* o : */ int16_t *pRemainingDelayNumSamples, /* o : */ int32_t *delayTimeScale, /* o : */ @@ -1877,13 +1816,8 @@ static ivas_error initOnFirstGoodFrame( MasaFileWriter **ppMasaWriter, /* o : */ IsmFileWriter *ismWriters[IVAS_MAX_NUM_OBJECTS], /* o : */ int16_t *pNumOutChannels, /* o : */ -#ifdef SPLIT_REND_WITH_HEAD_ROT - uint16_t *pNumObj, /* o : */ - SplitFileReadWrite **splitRendWriter -#else - uint16_t *pNumObj /* o : */ -#endif -) + uint16_t *pNumObj, /* o : */ + SplitFileReadWrite **splitRendWriter ) { ivas_error error = IVAS_ERR_UNKNOWN; @@ -1894,12 +1828,10 @@ static ivas_error initOnFirstGoodFrame( return error; } -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( IVAS_DEC_is_split_rendering_enabled( hIvasDec ) ) { pFullDelayNumSamples[0] = 0; } -#endif if ( !arg.delayCompensationEnabled ) { @@ -1921,7 +1853,6 @@ static ivas_error initOnFirstGoodFrame( return error; } -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( IVAS_DEC_is_split_rendering_enabled( hIvasDec ) ) { /* Open split rendering metadata writer */ @@ -1930,10 +1861,8 @@ static ivas_error initOnFirstGoodFrame( ISAR_SPLIT_REND_CODEC splitRendCodec; int16_t splitRendCodecFrameSizeMs; ISAR_SPLIT_REND_POSE_CORRECTION_MODE poseCorrection; -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS int16_t splitRendIsarFrameSizeMs; int16_t lc3plusHighRes; -#endif if ( ( error = IVAS_DEC_GetDelay( hIvasDec, delayNumSamples_temp, &delayTimeScale_temp ) ) != IVAS_ERR_OK ) { @@ -1944,15 +1873,9 @@ static ivas_error initOnFirstGoodFrame( if ( ( error = IVAS_DEC_GetSplitRendBitstreamHeader( hIvasDec, &splitRendCodec, &poseCorrection, -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS &splitRendIsarFrameSizeMs, -#endif - &splitRendCodecFrameSizeMs -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS - , - &lc3plusHighRes -#endif - ) ) != IVAS_ERR_OK ) + &splitRendCodecFrameSizeMs, + &lc3plusHighRes ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nUnable to get split renderer bitstream header: %s\n", ivas_error_to_string( error ) ); return error; @@ -1966,14 +1889,10 @@ static ivas_error initOnFirstGoodFrame( delayTimeScale_temp, splitRendCodec, poseCorrection, - splitRendCodecFrameSizeMs -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS - , + splitRendCodecFrameSizeMs, splitRendIsarFrameSizeMs, arg.output_Fs, - lc3plusHighRes -#endif - ) ) != IVAS_ERR_OK ) + lc3plusHighRes ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nUnable to open output split rendering metadata file %s\n", arg.outputWavFilename ); return error; @@ -1993,14 +1912,10 @@ static ivas_error initOnFirstGoodFrame( delayTimeScale_temp, splitRendCodec, poseCorrection, - splitRendCodecFrameSizeMs -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS - , + splitRendCodecFrameSizeMs, splitRendIsarFrameSizeMs, arg.output_Fs, - lc3plusHighRes -#endif - ) ) != IVAS_ERR_OK ) + lc3plusHighRes ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nUnable to open output split rendering metadata file %s\n", arg.outputWavFilename ); return error; @@ -2010,23 +1925,19 @@ static ivas_error initOnFirstGoodFrame( if ( IVAS_DEC_is_split_rendering_coded_out( hIvasDec ) == 0 ) { -#endif /* Open audio writer and write all previously skipped bad frames now that frame size is known */ if ( ( error = AudioFileWriter_open( ppAfWriter, arg.outputWavFilename, arg.output_Fs, *pNumOutChannels ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nUnable to open output file %s\n", arg.outputWavFilename ); return error; } -#ifdef SPLIT_REND_WITH_HEAD_ROT } -#endif int16_t *zeroBuf = malloc( pcmFrameSize * sizeof( int16_t ) ); memset( zeroBuf, 0, pcmFrameSize * sizeof( int16_t ) ); for ( int16_t i = 0; i < numInitialBadFrames; ++i ) { -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( *splitRendWriter != NULL ) { ISAR_SPLIT_REND_BITS_DATA splitRendBitsZero; @@ -2036,12 +1947,8 @@ static ivas_error initOnFirstGoodFrame( splitRendBitsZero.buf_len = 0; splitRendBitsZero.codec = ISAR_SPLIT_REND_CODEC_DEFAULT; splitRendBitsZero.pose_correction = ISAR_SPLIT_REND_POSE_CORRECTION_MODE_NONE; -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS splitRendBitsZero.codec_frame_size_ms = 0; splitRendBitsZero.isar_frame_size_ms = 20; -#else - splitRendBitsZero.codec_frame_size_ms = 20; -#endif if ( split_rend_write_bitstream_to_file( *splitRendWriter, splitRendBitsZero.bits_buf, &splitRendBitsZero.bits_read, &splitRendBitsZero.bits_written ) != IVAS_ERR_OK ) { @@ -2051,19 +1958,10 @@ static ivas_error initOnFirstGoodFrame( } else { -#endif -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( *pRemainingDelayNumSamples < *numOutSamples ) -#else - if ( *pRemainingDelayNumSamples < numOutSamples ) -#endif { -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = AudioFileWriter_write( *ppAfWriter, zeroBuf, *numOutSamples * *pNumOutChannels - ( *pRemainingDelayNumSamples * *pNumOutChannels ) ) ) != IVAS_ERR_OK ) -#else - if ( ( error = AudioFileWriter_write( *ppAfWriter, zeroBuf, numOutSamples * *pNumOutChannels - ( *pRemainingDelayNumSamples * *pNumOutChannels ) ) ) != IVAS_ERR_OK ) -#endif { fprintf( stderr, "\nOutput audio file writer error\n" ); return error; @@ -2072,15 +1970,9 @@ static ivas_error initOnFirstGoodFrame( } else { -#ifdef SPLIT_REND_WITH_HEAD_ROT *pRemainingDelayNumSamples -= *numOutSamples; -#else - *pRemainingDelayNumSamples -= numOutSamples; -#endif } -#ifdef SPLIT_REND_WITH_HEAD_ROT } -#endif } free( zeroBuf ); @@ -2166,7 +2058,6 @@ static ivas_error initOnFirstGoodFrame( } } -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( *splitRendWriter != NULL ) { if ( numOutSamples == NULL || vec_pos_len == NULL ) @@ -2186,7 +2077,6 @@ static ivas_error initOnFirstGoodFrame( return error; } } -#endif return IVAS_ERR_OK; } @@ -2205,9 +2095,7 @@ static ivas_error decodeG192( RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, -#ifdef SPLIT_REND_WITH_HEAD_ROT ISAR_SPLIT_REND_BITS_DATA *splitRendBits, -#endif IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf ) @@ -2243,9 +2131,7 @@ static ivas_error decodeG192( 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 } }; int16_t vec_pos_update, vec_pos_len; -#ifdef SPLIT_REND_WITH_HEAD_ROT SplitFileReadWrite *splitRendWriter = NULL; -#endif for ( i = 0; i < IVAS_MAX_NUM_OBJECTS; ++i ) { @@ -2380,7 +2266,6 @@ static ivas_error decodeG192( { IVAS_QUATERNION Quaternions[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES]; -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( headRotReader == NULL ) { for ( i = 0; i < num_subframes; i++ ) @@ -2396,7 +2281,6 @@ static ivas_error decodeG192( } else { -#endif for ( i = 0; i < num_subframes; i++ ) { if ( ( error = HeadRotationFileReading( headRotReader, &Quaternions[i], &Pos[i] ) ) != IVAS_ERR_OK ) @@ -2405,17 +2289,11 @@ static ivas_error decodeG192( goto cleanup; } } -#ifdef SPLIT_REND_WITH_HEAD_ROT } -#endif for ( i = 0; i < num_subframes; i++ ) { -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = IVAS_DEC_FeedHeadTrackData( hIvasDec, Quaternions[i], Pos[i], i, DEFAULT_AXIS ) ) != IVAS_ERR_OK ) -#else - if ( ( error = IVAS_DEC_FeedHeadTrackData( hIvasDec, Quaternions[i], Pos[i], i ) ) != IVAS_ERR_OK ) -#endif { fprintf( stderr, "\nIVAS_DEC_FeedHeadTrackData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; @@ -2462,11 +2340,7 @@ static ivas_error decodeG192( { if ( ( error = TsmScaleFileReader_readScale( tsmScaleFileReader, &scale ) ) != IVAS_ERR_OK ) { -#ifdef FIX_699_FILE_READER_JBM_TSM fprintf( stderr, "\nError (%s) when reading TSM data from %s \n\n", arg.inputBitstreamFilename, TsmScaleFileReader_getFilePath( tsmScaleFileReader ) ); -#else - fprintf( stderr, "\nError: input bitstream file couldn't be read: %s \n\n", arg.inputBitstreamFilename ); -#endif goto cleanup; } int16_t maxScaling; @@ -2513,7 +2387,6 @@ static ivas_error decodeG192( } } -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( IVAS_DEC_is_split_rendering_enabled( hIvasDec ) ) { if ( ( error = IVAS_DEC_GetSplitBinauralBitstream( hIvasDec, (void *) ( pcmBuf + nOutChannels * nSamplesRendered ), splitRendBits, &nSamplesRendered_loop, &needNewFrame ) ) != IVAS_ERR_OK ) @@ -2527,21 +2400,14 @@ static ivas_error decodeG192( } else { -#endif -#ifdef 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 ) -#else - if ( ( error = IVAS_DEC_GetSamples( hIvasDec, nSamplesToRender, ( pcmBuf + nOutChannels * nSamplesRendered ), &nSamplesRendered_loop, &needNewFrame ) ) != IVAS_ERR_OK ) -#endif { fprintf( stderr, "\nError in IVAS_DEC_GetSamples: %s\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } nSamplesRendered += nSamplesRendered_loop; nSamplesToRender -= nSamplesRendered_loop; -#ifdef SPLIT_REND_WITH_HEAD_ROT } -#endif if ( needNewFrame ) { frame++; @@ -2575,11 +2441,7 @@ static ivas_error decodeG192( /* Once good frame decoded, catch up */ if ( decodedGoodFrame ) { -#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 ) -#else - if ( ( error = initOnFirstGoodFrame( hIvasDec, arg, numInitialBadFrames, nOutSamples, delayNumSamples_orig, &delayNumSamples, &delayTimeScale, &bsFormat, &afWriter, &masaWriter, ismWriters, &nOutChannels, &numObj ) ) != IVAS_ERR_OK ) -#endif { goto cleanup; } @@ -2593,7 +2455,6 @@ static ivas_error decodeG192( /* Write current frame */ if ( decodedGoodFrame ) { -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( IVAS_DEC_is_split_rendering_enabled( hIvasDec ) ) { if ( split_rend_write_bitstream_to_file( splitRendWriter, splitRendBits->bits_buf, &splitRendBits->bits_read, &splitRendBits->bits_written ) != IVAS_ERR_OK ) @@ -2605,7 +2466,6 @@ static ivas_error decodeG192( if ( IVAS_DEC_is_split_rendering_coded_out( hIvasDec ) == 0 ) { -#endif if ( delayNumSamples < nOutSamples ) { if ( ( error = AudioFileWriter_write( afWriter, &pcmBuf[delayNumSamples * nOutChannels], nOutSamples * nOutChannels - ( delayNumSamples * nOutChannels ) ) ) != IVAS_ERR_OK ) @@ -2619,9 +2479,7 @@ static ivas_error decodeG192( { delayNumSamples -= nOutSamples; } -#ifdef SPLIT_REND_WITH_HEAD_ROT } -#endif } @@ -2737,11 +2595,7 @@ static ivas_error decodeG192( goto cleanup; } -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = IVAS_DEC_FeedHeadTrackData( hIvasDec, Quaternion, Pos[0], 0, DEFAULT_AXIS ) ) != IVAS_ERR_OK ) -#else - if ( ( error = IVAS_DEC_FeedHeadTrackData( hIvasDec, Quaternion, Pos[0], 0 ) ) != IVAS_ERR_OK ) -#endif { fprintf( stderr, "\nIVAS_DEC_FeedHeadTrackData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; @@ -2749,11 +2603,7 @@ static ivas_error decodeG192( } /* decode and get samples */ -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = IVAS_DEC_Flush( hIvasDec, nOutSamples, IVAS_DEC_PCM_INT16, (void *) pcmBuf, &nSamplesFlushed ) ) != IVAS_ERR_OK ) -#else - if ( ( error = IVAS_DEC_Flush( hIvasDec, nOutSamples, pcmBuf, &nSamplesFlushed ) ) != IVAS_ERR_OK ) -#endif { fprintf( stderr, "\nError in IVAS_DEC_VoIP_Flush: %s\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; @@ -2863,18 +2713,14 @@ static ivas_error decodeG192( *------------------------------------------------------------------------------------------*/ memset( pcmBuf, 0, delayNumSamples_orig[0] * nOutChannels * sizeof( int16_t ) ); -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( afWriter != NULL ) { -#endif if ( ( error = AudioFileWriter_write( afWriter, pcmBuf, delayNumSamples_orig[0] * nOutChannels ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError writing output file: %s\n", ivas_error_to_string( error ) ); goto cleanup; } -#ifdef SPLIT_REND_WITH_HEAD_ROT } -#endif /*------------------------------------------------------------------------------------------* * Close files and deallocate resources @@ -2884,9 +2730,7 @@ static ivas_error decodeG192( cleanup: -#ifdef SPLIT_REND_WITH_HEAD_ROT split_rend_reader_writer_close( &splitRendWriter ); -#endif AudioFileWriter_close( &afWriter ); MasaFileWriter_close( &masaWriter ); #ifdef DEBUGGING @@ -3238,7 +3082,6 @@ static ivas_error decodeVoIP( { IVAS_QUATERNION Quaternions[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES]; -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( headRotReader == NULL ) { for ( i = 0; i < num_subframes; i++ ) @@ -3254,7 +3097,6 @@ static ivas_error decodeVoIP( } else { -#endif for ( i = 0; i < num_subframes; i++ ) { if ( ( error = HeadRotationFileReading( headRotReader, &Quaternions[i], &Pos[i] ) ) != IVAS_ERR_OK ) @@ -3264,18 +3106,12 @@ static ivas_error decodeVoIP( goto cleanup; } } -#ifdef SPLIT_REND_WITH_HEAD_ROT } -#endif for ( i = 0; i < num_subframes; i++ ) { - if ( ( error = IVAS_DEC_FeedHeadTrackData( hIvasDec, Quaternions[i], Pos[i], i -#ifdef SPLIT_REND_WITH_HEAD_ROT - , - DEFAULT_AXIS -#endif - ) ) != IVAS_ERR_OK ) + if ( ( error = IVAS_DEC_FeedHeadTrackData( hIvasDec, Quaternions[i], Pos[i], i, + DEFAULT_AXIS ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_DEC_FeedHeadTrackData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; @@ -3363,18 +3199,10 @@ static ivas_error decodeVoIP( /* decode and get samples */ -#ifdef SPLIT_REND_WITH_HEAD_ROT #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 -#else -#ifdef SUPPORT_JBM_TRACEFILE - if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, pcmBuf, systemTime_ms, writeJbmTraceFileFrameWrapper, jbmTraceWriter ) ) != IVAS_ERR_OK ) -#else - if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, pcmBuf, systemTime_ms ) ) != IVAS_ERR_OK ) -#endif #endif { fprintf( stderr, "\nError in IVAS_DEC_VoIP_GetSamples: %s\n", IVAS_DEC_GetErrorMessage( error ) ); @@ -3411,15 +3239,10 @@ static ivas_error decodeVoIP( /* Once good frame decoded, catch up */ if ( decodedGoodFrame ) { -#ifdef SPLIT_REND_WITH_HEAD_ROT SplitFileReadWrite *splitRendWriter = NULL; if ( ( error = initOnFirstGoodFrame( hIvasDec, arg, numInitialBadFrames, &nOutSamples, NULL, delayNumSamples_orig, &delayNumSamples, &delayTimeScale, &bsFormat, &afWriter, &masaWriter, ismWriters, &nOutChannels, &numObj, &splitRendWriter ) ) != IVAS_ERR_OK ) -#else - if ( ( error = initOnFirstGoodFrame( hIvasDec, arg, numInitialBadFrames, nOutSamples, delayNumSamples_orig, &delayNumSamples, &delayTimeScale, - &bsFormat, &afWriter, &masaWriter, ismWriters, &nOutChannels, &numObj ) ) != IVAS_ERR_OK ) -#endif { goto cleanup; } diff --git a/apps/encoder.c b/apps/encoder.c index 904fb4fbd8365a5f959a36a5a86eae7b1c88261a..1ae2be6d22da31b1827675114f15927a41ba1f7b 100644 --- a/apps/encoder.c +++ b/apps/encoder.c @@ -709,11 +709,7 @@ int main( { if ( ( error = JbmFileReader_readCAconfig( jbmReader, &caConfig ) ) != IVAS_ERR_OK ) { -#ifdef FIX_699_FILE_READER_JBM_TSM fprintf( stderr, "\nError (%s) while reading Channel-Aware Config. from: %s\n\n", IVAS_ENC_GetErrorMessage( error ), JbmFileReader_getFilePath( jbmReader ) ); -#else - fprintf( stderr, "JbmFileReader_readCAconfig() failed: %s\n\n", IVAS_ENC_GetErrorMessage( error ) ); -#endif goto cleanup; } diff --git a/apps/isar_post_rend.c b/apps/isar_post_rend.c index 210b8933c6762824a6a8417befabf63e0cd5871b..08c3c6e2546cdbae00dd75fca2571b41c97a93c7 100644 --- a/apps/isar_post_rend.c +++ b/apps/isar_post_rend.c @@ -32,17 +32,6 @@ #include "lib_isar_post_rend.h" -#ifndef SPLIT_REND_WITH_HEAD_ROT - -int main( int argc, char **argv ) -{ - (void) argc; - (void) argv; - ISAR_POST_REND_void_func(); - return 0; -} - -#else #include #include @@ -730,13 +719,9 @@ int main( bitsBuffer.config.bufLenInBytes = 0; bitsBuffer.config.codec = ISAR_SPLIT_REND_CODEC_DEFAULT; bitsBuffer.config.poseCorrection = ISAR_SPLIT_REND_POSE_CORRECTION_MODE_NONE; -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS bitsBuffer.config.codec_frame_size_ms = 5; bitsBuffer.config.isar_frame_size_ms = 20; bitsBuffer.config.lc3plusHighRes = 0; -#else - bitsBuffer.config.codec_frame_size_ms = 20; -#endif CmdlnArgs args = parseCmdlnArgs( argc, argv ); @@ -760,9 +745,7 @@ int main( SplitRendBFIFileReader_open( args.splitRendBFIFilePath, &splitRendBFIReader ); } -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS int32_t inFileSampleRate = 0; -#endif strncpy( audioFilePath, args.inputFilePath, FILENAME_MAX - 1 ); hSplitRendFileReadWrite = NULL; if ( ( args.inConfig.numBinBuses > 0 ) && ( args.inConfig.binBuses[0].audioConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) @@ -771,14 +754,10 @@ int main( args.inMetadataFilePaths[0], &bitsBuffer.config.codec, &bitsBuffer.config.poseCorrection, - &bitsBuffer.config.codec_frame_size_ms -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS - , + &bitsBuffer.config.codec_frame_size_ms, &bitsBuffer.config.isar_frame_size_ms, &inFileSampleRate, - &bitsBuffer.config.lc3plusHighRes -#endif - ); + &bitsBuffer.config.lc3plusHighRes ); if ( error != IVAS_ERR_OK ) { fprintf( stderr, "Could not open split rend metadata file %s\n", args.inMetadataFilePaths[0] ); @@ -799,14 +778,10 @@ int main( args.inputFilePath, &bitsBuffer.config.codec, &bitsBuffer.config.poseCorrection, - &bitsBuffer.config.codec_frame_size_ms -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS - , + &bitsBuffer.config.codec_frame_size_ms, &bitsBuffer.config.isar_frame_size_ms, &inFileSampleRate, - &bitsBuffer.config.lc3plusHighRes -#endif - ); + &bitsBuffer.config.lc3plusHighRes ); if ( error != IVAS_ERR_OK ) { fprintf( stderr, "Could not open split rend metadata file %s\n", args.inputFilePath ); @@ -815,17 +790,11 @@ int main( audioReader = NULL; } -#ifndef ISAR_BITSTREAM_UPDATE_LC3PLUS - int32_t inFileSampleRate = 0; -#endif if ( audioReader != NULL ) { error = AudioFileReader_getSamplingRate( audioReader, &inFileSampleRate ); } - else -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS - if ( hSplitRendFileReadWrite == NULL ) -#endif + else if ( hSplitRendFileReadWrite == NULL ) { inFileSampleRate = args.sampleRate; } @@ -887,13 +856,9 @@ int main( if ( ( error = ISAR_REND_SetSplitRendBitstreamHeader( hIsarPostRend, bitsBuffer.config.codec, bitsBuffer.config.poseCorrection, - bitsBuffer.config.codec_frame_size_ms -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS - , + bitsBuffer.config.codec_frame_size_ms, bitsBuffer.config.isar_frame_size_ms, - bitsBuffer.config.lc3plusHighRes -#endif - ) ) != IVAS_ERR_OK ) + bitsBuffer.config.lc3plusHighRes ) ) != IVAS_ERR_OK ) { fprintf( stderr, "Error in getting split renderer bitstream header: %s\n", ivas_error_to_string( error ) ); exit( -1 ); @@ -1249,5 +1214,3 @@ int main( #undef WMC_TOOL_SKIP - -#endif /* SPLIT_REND_WITH_HEAD_ROT */ diff --git a/apps/renderer.c b/apps/renderer.c index 1decda322641b273f2afa0dd35520a8440961cb5..8fc138d56ce5c1f711adec4c2b551de33ce2efb4 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -45,10 +45,8 @@ #include "masa_file_writer.h" #include "render_config_reader.h" #include "rotation_file_reader.h" -#ifdef SPLIT_REND_WITH_HEAD_ROT #include "split_render_file_read_write.h" #include "split_rend_bfi_file_reader.h" -#endif #include "vector3_pair_file_reader.h" #ifdef DEBUGGING #include "debug.h" @@ -152,13 +150,9 @@ typedef struct OutputConfig outConfig; char inMetadataFilePaths[RENDERER_MAX_ISM_INPUTS][RENDERER_MAX_CLI_ARG_LENGTH]; int16_t numInMetadataFiles; -#ifdef SPLIT_REND_WITH_HEAD_ROT char outMetadataFilePath[RENDERER_MAX_CLI_ARG_LENGTH]; -#endif char headRotationFilePath[RENDERER_MAX_CLI_ARG_LENGTH]; -#ifdef SPLIT_REND_WITH_HEAD_ROT char splitRendBFIFilePath[RENDERER_MAX_CLI_ARG_LENGTH]; -#endif char referenceVectorFilePath[RENDERER_MAX_CLI_ARG_LENGTH]; char referenceRotationFilePath[RENDERER_MAX_CLI_ARG_LENGTH]; char externalOrientationFilePath[RENDERER_MAX_CLI_ARG_LENGTH]; @@ -205,10 +199,8 @@ typedef enum CmdLnOptionId_inputMetadata, CmdLnOptionId_listFormats, CmdLnOptionId_inputGain, -#ifdef SPLIT_REND_WITH_HEAD_ROT CmdLnOptionId_outputMetadata, CmdLnOptionId_SplitRendBFIFile, -#endif CmdLnOptionId_referenceVectorFile, CmdLnOptionId_exteriorOrientationFile, CmdLnOptionId_framing, @@ -234,11 +226,7 @@ static const CmdLnParser_Option cliOptions[] = { .id = CmdLnOptionId_inputMetadata, .match = "input_metadata", .matchShort = "im", -#ifdef SPLIT_REND_WITH_HEAD_ROT .description = "Space-separated list of path to metadata files for ISM or MASA inputs or BINAURAL_SPLIT_PCM input mode", -#else - .description = "Space-separated list of path to metadata files for ISM or MASA inputs", -#endif }, { .id = CmdLnOptionId_outputFile, @@ -264,7 +252,6 @@ static const CmdLnParser_Option cliOptions[] = { .matchShort = "T", .description = "Head rotation trajectory file for simulation of head tracking (only for binaural outputs)", }, -#ifdef SPLIT_REND_WITH_HEAD_ROT { .id = CmdLnOptionId_outputMetadata, .match = "output_metadata", @@ -277,7 +264,6 @@ static const CmdLnParser_Option cliOptions[] = { .matchShort = "prbfi", .description = "Split rendering option: bfi file", }, -#endif { .id = CmdLnOptionId_refRotFile, .match = "reference_rotation_file", @@ -435,15 +421,9 @@ static void printSupportedAudioConfigs( void ); static IVAS_AUDIO_CONFIG parseAudioConfig( const char *configString ); -#ifdef SPLIT_REND_WITH_HEAD_ROT static void convertInputBuffer( const int16_t *intBuffer, const int16_t numIntSamplesPerChannel, const int16_t numFloatSamplesPerChannel, const int16_t numChannels, float *floatBuffer, const int16_t cldfb_in, IVAS_CLDFB_FILTER_BANK_HANDLE *cldfbAna ); static void convertOutputBuffer( const float *floatBuffer, const int16_t numSamplesPerChannel, const int16_t numChannels, int16_t *intBuffer, const int16_t cldfb_in, IVAS_CLDFB_FILTER_BANK_HANDLE *cldfbSyn ); -#else -static void convertInputBuffer( const int16_t *intBuffer, const int16_t numIntSamplesPerChannel, const int16_t numFloatSamplesPerChannel, const int16_t numChannels, float *floatBuffer ); - -static void convertOutputBuffer( const float *floatBuffer, const int16_t numSamplesPerChannel, const int16_t numChannels, int16_t *intBuffer ); -#endif /*------------------------------------------------------------------------------------------* @@ -613,7 +593,6 @@ static float dBToLin( return powf( 10.0f, gain_dB / 20.0f ); } -#ifdef SPLIT_REND_WITH_HEAD_ROT static int16_t get_cldfb_in_flag( const IVAS_AUDIO_CONFIG audioConfig, const IVAS_RENDER_CONFIG_DATA *renderConfig ) @@ -648,7 +627,6 @@ static int16_t is_split_pre_rend_mode( return flag; } -#endif /*------------------------------------------------------------------------------------------* * main() @@ -664,12 +642,10 @@ int main( RotFileReader *headRotReader = NULL; RotFileReader *externalOrientationFileReader = NULL; RotFileReader *referenceRotReader = NULL; -#ifdef SPLIT_REND_WITH_HEAD_ROT IVAS_CLDFB_FILTER_BANK_HANDLE cldfbAna[IVAS_MAX_INPUT_CHANNELS]; IVAS_CLDFB_FILTER_BANK_HANDLE cldfbSyn[IVAS_MAX_INPUT_CHANNELS]; int16_t cldfb_in_flag, CLDFBframeSize_smpls; SplitRendBFIFileReader *splitRendBFIReader = NULL; -#endif Vector3PairFileReader *referenceVectorReader = NULL; hrtfFileReader *hrtfFileReader = NULL; IVAS_DEC_HRTF_CREND_HANDLE *hSetOfHRTF = NULL; @@ -690,24 +666,18 @@ int main( AudioFileWriter *audioWriter; int32_t inBufferSize; int32_t outBufferSize; -#ifdef SPLIT_REND_WITH_HEAD_ROT int32_t bitsBufferSize; -#endif int16_t *inpInt16Buffer; float *inFloatBuffer; int16_t *outInt16Buffer; float *outFloatBuffer; -#ifdef SPLIT_REND_WITH_HEAD_ROT uint8_t *bitsBufferData = NULL; -#endif IVAS_REND_AudioBuffer inBuffer; IVAS_REND_AudioBuffer outBuffer; -#ifdef SPLIT_REND_WITH_HEAD_ROT IVAS_REND_BitstreamBuffer bitsBuffer; SplitFileReadWrite *hSplitRendFileReadWrite; int16_t delayNumSamples_temp; int32_t delayTimeScale_temp; -#endif int16_t numSamplesRead; int16_t delayNumSamples = -1; int16_t delayNumSamples_orig = 0; @@ -728,7 +698,6 @@ int main( hMasaMetadata[i] = NULL; } -#ifdef SPLIT_REND_WITH_HEAD_ROT hSplitRendFileReadWrite = NULL; CLDFBframeSize_smpls = 0; cldfb_in_flag = 0; @@ -738,14 +707,9 @@ int main( bitsBuffer.config.bufLenInBytes = 0; bitsBuffer.config.codec = ISAR_SPLIT_REND_CODEC_DEFAULT; bitsBuffer.config.poseCorrection = ISAR_SPLIT_REND_POSE_CORRECTION_MODE_NONE; -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS bitsBuffer.config.codec_frame_size_ms = 5; bitsBuffer.config.isar_frame_size_ms = 20; bitsBuffer.config.lc3plus_highres = 0; -#else - bitsBuffer.config.codec_frame_size_ms = 20; -#endif -#endif for ( i = 0; i < RENDERER_MAX_MC_INPUTS; ++i ) { lfeRoutingConfigs[i] = NULL; @@ -804,13 +768,11 @@ int main( } } -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( !isEmptyString( args.splitRendBFIFilePath ) ) { convert_backslash( args.splitRendBFIFilePath ); SplitRendBFIFileReader_open( args.splitRendBFIFilePath, &splitRendBFIReader ); } -#endif if ( !isEmptyString( args.externalOrientationFilePath ) ) { if ( RotationFileReader_open( args.externalOrientationFilePath, &externalOrientationFileReader ) != IVAS_ERR_OK ) @@ -1137,28 +1099,16 @@ int main( IVAS_RENDER_CONFIG_DATA renderConfig; /* sanity check */ -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( args.outConfig.audioConfig != IVAS_AUDIO_CONFIG_BINAURAL ) && ( args.outConfig.audioConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) && ( args.outConfig.audioConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) && !is_split_pre_rend_mode( &args ) ) { fprintf( stderr, "\nExternal Renderer Config is supported only when binaural output configurations is used as output OR when Split pre-rendering mode is enabled. Exiting. \n" ); exit( -1 ); } -#else - if ( ( args.outConfig.audioConfig != IVAS_AUDIO_CONFIG_BINAURAL ) && ( args.outConfig.audioConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) && ( args.outConfig.audioConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) - { - fprintf( stderr, "\nExternal Renderer Config is only supported for binaural output configurations. Exiting. \n" ); - exit( -1 ); - } -#endif if ( ( error = IVAS_REND_GetRenderConfig( hIvasRend, &renderConfig ) ) != IVAS_ERR_OK ) { -#ifdef SPLIT_REND_WITH_HEAD_ROT fprintf( stderr, "\nIVAS_DEC_GetRenderConfig failed: %s\n", ivas_error_to_string( error ) ); -#else - fprintf( stderr, "\nIVAS_DEC_GetRenderConfig failed\n" ); -#endif exit( -1 ); } @@ -1186,28 +1136,18 @@ int main( renderConfig.roomAcoustics.override = 1; } -#ifdef SPLIT_REND_WITH_HEAD_ROT -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS /* ISAR frame size is set from command line, not renderer config file. * This will be ignored if output format is not split rendering. */ renderConfig.split_rend_config.isar_frame_size_ms = (int16_t) args.render_framesize /* given in number of 5ms subframes */ * 5; -#endif -#endif if ( ( error = IVAS_REND_FeedRenderConfig( hIvasRend, renderConfig ) ) != IVAS_ERR_OK ) { -#ifdef SPLIT_REND_WITH_HEAD_ROT fprintf( stderr, "\nIVAS_REND_FeedRenderConfig failed: %s\n", ivas_error_to_string( error ) ); -#else - fprintf( stderr, "\nIVAS_DEC_FeedRenderConfig failed\n" ); -#endif exit( -1 ); } -#ifdef SPLIT_REND_WITH_HEAD_ROT CLDFBframeSize_smpls = frameSize_smpls * 2; cldfb_in_flag = get_cldfb_in_flag( args.outConfig.audioConfig, &renderConfig ); -#endif } if ( ( error = IVAS_REND_SetOrientationTrackingMode( hIvasRend, args.orientation_tracking ) ) != IVAS_ERR_OK ) @@ -1441,7 +1381,6 @@ int main( exit( -1 ); } -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( cldfb_in_flag ) { if ( ( error = IVAS_REND_openCldfb( cldfbAna, cldfbSyn, totalNumInChannels, numOutChannels, args.sampleRate ) ) != IVAS_ERR_OK ) @@ -1457,12 +1396,8 @@ int main( IVAS_REND_GetSplitRendBitstreamHeader( hIvasRend, &bitsBuffer.config.codec, &bitsBuffer.config.poseCorrection, - &bitsBuffer.config.codec_frame_size_ms -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS - , - &bitsBuffer.config.isar_frame_size_ms -#endif - ); + &bitsBuffer.config.codec_frame_size_ms, + &bitsBuffer.config.isar_frame_size_ms ); if ( IVAS_REND_GetDelay( hIvasRend, &delayNumSamples_temp, &delayTimeScale_temp ) != IVAS_ERR_OK ) { @@ -1476,14 +1411,10 @@ int main( delayTimeScale_temp, bitsBuffer.config.codec, bitsBuffer.config.poseCorrection, - bitsBuffer.config.codec_frame_size_ms -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS - , + bitsBuffer.config.codec_frame_size_ms, bitsBuffer.config.isar_frame_size_ms, args.sampleRate, - bitsBuffer.config.lc3plus_highres -#endif - ) ) != IVAS_ERR_OK ) + bitsBuffer.config.lc3plus_highres ) ) != IVAS_ERR_OK ) { fprintf( stderr, "Could not open split rend metadata file %s\n", args.outputFilePath ); exit( -1 ); @@ -1498,12 +1429,8 @@ int main( IVAS_REND_GetSplitRendBitstreamHeader( hIvasRend, &bitsBuffer.config.codec, &bitsBuffer.config.poseCorrection, - &bitsBuffer.config.codec_frame_size_ms -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS - , - &bitsBuffer.config.isar_frame_size_ms -#endif - ); + &bitsBuffer.config.codec_frame_size_ms, + &bitsBuffer.config.isar_frame_size_ms ); if ( IVAS_REND_GetDelay( hIvasRend, &delayNumSamples_temp, &delayTimeScale_temp ) != IVAS_ERR_OK ) { @@ -1517,35 +1444,27 @@ int main( delayTimeScale_temp, bitsBuffer.config.codec, bitsBuffer.config.poseCorrection, - bitsBuffer.config.codec_frame_size_ms -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS - , + bitsBuffer.config.codec_frame_size_ms, bitsBuffer.config.isar_frame_size_ms, args.sampleRate, - bitsBuffer.config.lc3plus_highres -#endif - ) ) != IVAS_ERR_OK ) + bitsBuffer.config.lc3plus_highres ) ) != IVAS_ERR_OK ) { fprintf( stderr, "Could not open split rend metadata file %s\n", args.outMetadataFilePath ); exit( -1 ); } } -#endif if ( AudioFileWriter_open( &audioWriter, args.outputFilePath, args.sampleRate, numOutChannels ) != IVAS_ERR_OK ) { fprintf( stderr, "Failed to open file: %s\n", args.outputFilePath ); exit( -1 ); } -#ifdef SPLIT_REND_WITH_HEAD_ROT } -#endif inBufferSize = frameSize_smpls * totalNumInChannels; outBufferSize = frameSize_smpls * numOutChannels; inpInt16Buffer = malloc( inBufferSize * sizeof( int16_t ) ); -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( cldfb_in_flag == 0 ) { inFloatBuffer = malloc( inBufferSize * sizeof( float ) ); @@ -1594,19 +1513,6 @@ int main( bitsBuffer.config.bitsRead = 0; bitsBuffer.config.bitsWritten = 0; bitsBuffer.config.bufLenInBytes = bitsBufferSize; -#else - inFloatBuffer = malloc( inBufferSize * sizeof( float ) ); - outInt16Buffer = malloc( outBufferSize * sizeof( int16_t ) ); - outFloatBuffer = malloc( outBufferSize * sizeof( float ) ); - - inBuffer.config.numSamplesPerChannel = (int16_t) frameSize_smpls; - inBuffer.config.numChannels = (int16_t) totalNumInChannels; - inBuffer.data = inFloatBuffer; - - outBuffer.config.numSamplesPerChannel = (int16_t) frameSize_smpls; - outBuffer.config.numChannels = (int16_t) numOutChannels; - outBuffer.data = outFloatBuffer; -#endif #ifdef WMOPS reset_stack(); @@ -1647,11 +1553,7 @@ int main( } /* Convert from int to float and from interleaved to packed */ -#ifdef SPLIT_REND_WITH_HEAD_ROT convertInputBuffer( inpInt16Buffer, numSamplesRead, inBuffer.config.numSamplesPerChannel, num_in_channels, inFloatBuffer, inBuffer.config.is_cldfb, cldfbAna ); -#else - convertInputBuffer( inpInt16Buffer, numSamplesRead, inBuffer.config.numSamplesPerChannel, num_in_channels, inFloatBuffer ); -#endif int16_t num_subframes, sf_idx; num_subframes = (int16_t) args.render_framesize; @@ -1709,11 +1611,7 @@ int main( exit( -1 ); } -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = IVAS_REND_SetHeadRotation( hIvasRend, headRot, Pos, DEFAULT_AXIS, sf_idx ) ) != IVAS_ERR_OK ) -#else - if ( ( error = IVAS_REND_SetHeadRotation( hIvasRend, headRot, Pos, sf_idx ) ) != IVAS_ERR_OK ) -#endif { fprintf( stderr, "Error setting Head Rotation: %s\n", ivas_error_to_string( error ) ); exit( -1 ); @@ -1869,7 +1767,6 @@ int main( } } -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( args.outConfig.audioConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || args.outConfig.audioConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { if ( ( error = IVAS_REND_GetSplitBinauralBitstream( hIvasRend, outBuffer, &bitsBuffer ) ) != IVAS_ERR_OK ) @@ -1880,38 +1777,23 @@ int main( } else { -#endif if ( ( error = IVAS_REND_GetSamples( hIvasRend, outBuffer ) ) != IVAS_ERR_OK ) { -#ifdef SPLIT_REND_WITH_HEAD_ROT fprintf( stderr, "Error %s\n", ivas_error_to_string( error ) ); -#else - fprintf( stderr, "Error in getting samples\n" ); -#endif exit( -1 ); } -#ifdef SPLIT_REND_WITH_HEAD_ROT } -#endif int16_t num_out_channels; num_out_channels = outBuffer.config.numChannels; /* Convert from float to int and from packed to interleaved. * Values in outFloatBuffer are guaranteed to be within range INT16_MIN:INT16_MAX */ -#ifdef SPLIT_REND_WITH_HEAD_ROT convertOutputBuffer( outFloatBuffer, outBuffer.config.numSamplesPerChannel, num_out_channels, outInt16Buffer, cldfb_in_flag, cldfbSyn ); -#else - convertOutputBuffer( outFloatBuffer, outBuffer.config.numSamplesPerChannel, num_out_channels, outInt16Buffer ); -#endif if ( delayNumSamples == -1 ) { -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( args.delayCompensationEnabled && !is_split_pre_rend_mode( &args ) ) -#else - if ( args.delayCompensationEnabled ) -#endif { if ( IVAS_REND_GetDelay( hIvasRend, &delayNumSamples, &delayTimeScale ) != IVAS_ERR_OK ) { @@ -1928,7 +1810,6 @@ int main( zeroPad = delayNumSamples; } -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( is_split_pre_rend_mode( &args ) ) { if ( split_rend_write_bitstream_to_file( hSplitRendFileReadWrite, bitsBuffer.bits, &bitsBuffer.config.bitsRead, @@ -1941,7 +1822,6 @@ int main( if ( audioWriter != NULL ) { -#endif if ( delayNumSamples * num_out_channels < outBufferSize ) { if ( AudioFileWriter_write( audioWriter, &outInt16Buffer[delayNumSamples * num_out_channels], outBufferSize - ( delayNumSamples * num_out_channels ) ) != IVAS_ERR_OK ) @@ -1955,13 +1835,10 @@ int main( { delayNumSamples -= (int16_t) ( outBufferSize / num_out_channels ); } - -#ifdef SPLIT_REND_WITH_HEAD_ROT } bitsBuffer.config.bitsRead = 0; bitsBuffer.config.bitsWritten = 0; -#endif /* Write MASA metadata for MASA outputs */ @@ -2067,10 +1944,8 @@ int main( } /* add zeros at the end to have equal length of synthesized signals */ -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( audioWriter != NULL ) { -#endif for ( zeroPadToWrite = zeroPad; zeroPadToWrite > frameSize_smpls; zeroPadToWrite -= frameSize_smpls ) { memset( outInt16Buffer, 0, outBufferSize * sizeof( int16_t ) ); @@ -2088,9 +1963,7 @@ int main( exit( -1 ); } zeroPadToWrite = 0; -#ifdef SPLIT_REND_WITH_HEAD_ROT } -#endif if ( args.inConfig.numAudioObjects != 0 && ( args.outConfig.audioConfig == IVAS_AUDIO_CONFIG_BINAURAL || args.outConfig.audioConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) @@ -2125,18 +1998,15 @@ int main( cleanup: -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( bitsBufferData != NULL ) { free( bitsBufferData ); } -#endif for ( i = 0; i < RENDERER_MAX_MASA_INPUTS; ++i ) { MasaFileReader_close( &masaReaders[i] ); } -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( cldfb_in_flag ) { IVAS_REND_closeCldfb( cldfbAna, cldfbSyn ); @@ -2144,7 +2014,6 @@ cleanup: split_rend_reader_writer_close( &hSplitRendFileReadWrite ); SplitRendBFIFileReader_close( &splitRendBFIReader ); -#endif for ( i = 0; i < RENDERER_MAX_MC_INPUTS; ++i ) { @@ -2458,13 +2327,8 @@ static bool parseOrientationTracking( static IVAS_AUDIO_CONFIG parseAudioConfig( const char *configString ) { -#ifndef SPLIT_REND_WITH_HEAD_ROT - char charBuf[21]; - charBuf[20] = '\0'; -#else char charBuf[25]; charBuf[24] = '\0'; -#endif strncpy( charBuf, configString, sizeof( charBuf ) - 1 ); charBuf[sizeof( charBuf ) - 1] = '\0'; @@ -2539,7 +2403,6 @@ static IVAS_AUDIO_CONFIG parseAudioConfig( { return IVAS_AUDIO_CONFIG_BINAURAL; } -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( strcmp( charBuf, "BINAURAL_SPLIT_PCM" ) == 0 ) { return IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM; @@ -2548,7 +2411,6 @@ static IVAS_AUDIO_CONFIG parseAudioConfig( { return IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED; } -#endif if ( strcmp( charBuf, "BINAURAL_ROOM_IR" ) == 0 ) { return IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR; @@ -2681,10 +2543,8 @@ static CmdlnArgs defaultArgs( args.numInMetadataFiles = 0; clearString( args.headRotationFilePath ); -#ifdef SPLIT_REND_WITH_HEAD_ROT clearString( args.outMetadataFilePath ); clearString( args.splitRendBFIFilePath ); -#endif clearString( args.referenceVectorFilePath ); clearString( args.referenceRotationFilePath ); clearString( args.customHrtfFilePath ); @@ -2777,7 +2637,6 @@ static void parseOption( assert( numOptionValues == 1 ); strncpy( args->headRotationFilePath, optionValues[0], RENDERER_MAX_CLI_ARG_LENGTH - 1 ); break; -#ifdef SPLIT_REND_WITH_HEAD_ROT case CmdLnOptionId_outputMetadata: assert( numOptionValues == 1 ); strncpy( args->outMetadataFilePath, optionValues[0], RENDERER_MAX_CLI_ARG_LENGTH - 1 ); @@ -2786,7 +2645,6 @@ static void parseOption( assert( numOptionValues == 1 ); strncpy( args->splitRendBFIFilePath, optionValues[0], RENDERER_MAX_CLI_ARG_LENGTH - 1 ); break; -#endif case CmdLnOptionId_referenceVectorFile: assert( numOptionValues == 1 ); strncpy( args->referenceVectorFilePath, optionValues[0], RENDERER_MAX_CLI_ARG_LENGTH - 1 ); @@ -3789,10 +3647,8 @@ static void printSupportedAudioConfigs( void ) "ISMx (input only)", "MASAx", "BINAURAL (output only)", -#ifdef SPLIT_REND_WITH_HEAD_ROT "BINAURAL_SPLIT_PCM", "BINAURAL_SPLIT_CODED", -#endif "BINAURAL_ROOM_IR (output only)", "BINAURAL_ROOM_REVERB (output only)", }; @@ -3889,20 +3745,14 @@ static void convertInputBuffer( const int16_t numIntSamplesPerChannel, const int16_t numFloatSamplesPerChannel, const int16_t numChannels, -#ifdef SPLIT_REND_WITH_HEAD_ROT float *floatBuffer, const int16_t cldfb_in_flag, - IVAS_CLDFB_FILTER_BANK_HANDLE *cldfbAna -#else - float *floatBuffer -#endif -) + IVAS_CLDFB_FILTER_BANK_HANDLE *cldfbAna ) { int16_t chnl, smpl, i; i = 0; -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( cldfb_in_flag ) { int16_t slotIdx, numCldfbBands, numFloatPcmSamples; @@ -3943,7 +3793,6 @@ static void convertInputBuffer( } else { -#endif for ( smpl = 0; smpl < numFloatSamplesPerChannel; ++smpl ) { for ( chnl = 0; chnl < numChannels; ++chnl ) @@ -3960,9 +3809,7 @@ static void convertInputBuffer( ++i; } } -#ifdef SPLIT_REND_WITH_HEAD_ROT } -#endif return; } @@ -3978,21 +3825,15 @@ static void convertOutputBuffer( const float *floatBuffer, const int16_t numSamplesPerChannel, const int16_t numChannels, -#ifdef SPLIT_REND_WITH_HEAD_ROT int16_t *intBuffer, const int16_t cldfb_in_flag, - IVAS_CLDFB_FILTER_BANK_HANDLE *cldfbSyn -#else - int16_t *intBuffer -#endif -) + IVAS_CLDFB_FILTER_BANK_HANDLE *cldfbSyn ) { int16_t chnl, smpl, i; float temp; i = 0; -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( cldfb_in_flag ) { int16_t slotIdx, numCldfbBands, numPcmSamples, b; @@ -4041,7 +3882,6 @@ static void convertOutputBuffer( } else { -#endif for ( smpl = 0; smpl < numSamplesPerChannel; ++smpl ) { for ( chnl = 0; chnl < numChannels; ++chnl ) @@ -4061,9 +3901,7 @@ static void convertOutputBuffer( ++i; } } -#ifdef SPLIT_REND_WITH_HEAD_ROT } -#endif return; } diff --git a/lib_com/ari_hm.c b/lib_com/ari_hm.c index e858a9ff2e15ee8a7ce1c3e4878b7d5b2bd46513..71ed483c671e70a71e8b1783e2df8d60f50ef916 100644 --- a/lib_com/ari_hm.c +++ b/lib_com/ari_hm.c @@ -205,11 +205,7 @@ int16_t CountIndexBits( *-------------------------------------------------------------------*/ int16_t tcx_hm_render( -#ifdef FIX_1001_ARI_HM_OVERFLOW - const int32_t lag, /* i : pitch lag */ -#else - const int16_t lag, /* i : pitch lag */ -#endif + const int32_t lag, /* i : pitch lag */ const int16_t fract_res, /* i : fractional resolution of the lag */ Word16 p[] /* o : harmonic model (Q13) */ ) @@ -269,22 +265,14 @@ int16_t tcx_hm_render( void tcx_hm_modify_envelope( const Word16 gain, /* i : HM gain (Q11) */ -#ifdef FIX_1001_ARI_HM_OVERFLOW const int32_t lag, -#else - const int16_t lag, -#endif const int16_t fract_res, const Word16 p[], /* i : harmonic model (Q13) */ Word32 env[], /* i/o: envelope (Q16) */ const int16_t L_frame /* i : number of spectral lines */ ) { -#ifdef FIX_966_VAR_OVERFLOW_IN_HARM_MODEL_ARI int32_t k, h, x; -#else - int16_t k, h, x; -#endif Word16 inv_shape[2 * kTcxHmParabolaHalfWidth + 1]; /* Q15 */ if ( gain == 0 ) diff --git a/lib_com/common_api_types.h b/lib_com/common_api_types.h index 4d953547176813ad83ffb672498c3b02d5c77a22..6046bc2a5bab268051dc23dcc6a800ac26923851 100644 --- a/lib_com/common_api_types.h +++ b/lib_com/common_api_types.h @@ -204,7 +204,6 @@ typedef struct _IVAS_JBM_TRACE_DATA } IVAS_JBM_TRACE_DATA; -#ifdef SPLIT_REND_WITH_HEAD_ROT /*----------------------------------------------------------------------------------* * Split rendering API constants, structures, and enums *----------------------------------------------------------------------------------*/ @@ -261,38 +260,31 @@ typedef struct _ISAR_SPLIT_REND_BITS_DATA int16_t codec_frame_size_ms; ISAR_SPLIT_REND_CODEC codec; ISAR_SPLIT_REND_POSE_CORRECTION_MODE pose_correction; -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS int16_t isar_frame_size_ms; int16_t lc3plus_highres; -#endif } ISAR_SPLIT_REND_BITS_DATA, *ISAR_SPLIT_REND_BITS_HANDLE; typedef struct _ISAR_SPLIT_REND_CONFIG { - int32_t splitRendBitRate; /*Bit rate for split rendering mode, if "pcm_out" is set then "splitRendBitRate" is used as a limit for MD bitrate */ - int16_t hq_mode; /*High quality 3DOF mode with additional side information. Requires more pre-renditions. */ - int16_t dof; /*flag to specify if pose correction is needed for 1, 2 or 3 degree of freedoms*/ - /*The axis can be set dynamically per frame based on a file input */ - /*possible values: - 1 - (1dof correction. By default YAW correction) - 2 - (2dof correction. By default YAW and PITCH correction) - 3 - (3dof correction. By default YAW, PITCH and ROLL correction) - */ - int16_t codec_delay_ms; /*PLACEHOLDER (currently being ignored) : look ahead delay of the codec that is used to code BIN signal output of pre-renderer*/ -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS - int16_t isar_frame_size_ms; /* ISAR bit stream frame size in milliseconds */ -#endif + int32_t splitRendBitRate; /*Bit rate for split rendering mode, if "pcm_out" is set then "splitRendBitRate" is used as a limit for MD bitrate */ + int16_t hq_mode; /*High quality 3DOF mode with additional side information. Requires more pre-renditions. */ + int16_t dof; /*flag to specify if pose correction is needed for 1, 2 or 3 degree of freedoms*/ + /*The axis can be set dynamically per frame based on a file input */ + /*possible values: + 1 - (1dof correction. By default YAW correction) + 2 - (2dof correction. By default YAW and PITCH correction) + 3 - (3dof correction. By default YAW, PITCH and ROLL correction) + */ + int16_t codec_delay_ms; /*PLACEHOLDER (currently being ignored) : look ahead delay of the codec that is used to code BIN signal output of pre-renderer*/ + int16_t isar_frame_size_ms; /* ISAR bit stream frame size in milliseconds */ int16_t codec_frame_size_ms; /* Codec frame size in milliseconds, only relevant with LC3plus */ ISAR_SPLIT_REND_POSE_CORRECTION_MODE poseCorrectionMode; ISAR_SPLIT_REND_CODEC codec; ISAR_SPLIT_REND_RENDERER_SELECTION rendererSelection; -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS int16_t lc3plus_highres; -#endif } ISAR_SPLIT_REND_CONFIG_DATA, *ISAR_SPLIT_REND_CONFIG_HANDLE; -#endif /*----------------------------------------------------------------------------------* * Renderer API structures and enums @@ -333,9 +325,7 @@ typedef struct _IVAS_RENDER_CONFIG IVAS_RENDER_TYPE_OVERRIDE renderer_type_override; #endif IVAS_ROOM_ACOUSTICS_CONFIG_DATA roomAcoustics; -#ifdef SPLIT_REND_WITH_HEAD_ROT ISAR_SPLIT_REND_CONFIG_DATA split_rend_config; -#endif float directivity[IVAS_MAX_NUM_OBJECTS * 3]; } IVAS_RENDER_CONFIG_DATA, *IVAS_RENDER_CONFIG_HANDLE; @@ -344,9 +334,7 @@ typedef struct { int16_t numSamplesPerChannel; int16_t numChannels; -#ifdef SPLIT_REND_WITH_HEAD_ROT int16_t is_cldfb; -#endif } IVAS_REND_AudioBufferConfig; typedef struct diff --git a/lib_com/delay_comp.c b/lib_com/delay_comp.c index 1ab401c3ab2056c0d1ee8b0c0614d455d6ef1dde..2cd342fb3211be657adb4dd828ec85ecee2a6819 100644 --- a/lib_com/delay_comp.c +++ b/lib_com/delay_comp.c @@ -51,15 +51,11 @@ /*! r: delay value in ns */ int32_t get_delay( - const int16_t enc_dec, /* i : encoder/decoder flag */ - const int32_t io_fs, /* i : input/output sampling frequency */ - const IVAS_FORMAT ivas_format, /* i : IVAS format */ -#ifdef SPLIT_REND_WITH_HEAD_ROT + const int16_t enc_dec, /* i : encoder/decoder flag */ + const int32_t io_fs, /* i : input/output sampling frequency */ + const IVAS_FORMAT ivas_format, /* i : IVAS format */ HANDLE_CLDFB_FILTER_BANK hCldfb, /* i : Handle of Cldfb analysis */ const AUDIO_CONFIG output_config /* i : decoder output config */ -#else - HANDLE_CLDFB_FILTER_BANK hCldfb /* i : Handle of Cldfb analysis */ -#endif ) { int32_t delay = 0; @@ -102,18 +98,14 @@ int32_t get_delay( { delay = IVAS_DEC_DELAY_NS; -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( output_config != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) { -#endif if ( hCldfb != NULL ) { /* compensate for filterbank delay */ delay += IVAS_FB_DEC_DELAY_NS; } -#ifdef SPLIT_REND_WITH_HEAD_ROT } -#endif if ( ivas_format == MASA_FORMAT || ivas_format == MASA_ISM_FORMAT ) { diff --git a/lib_com/ivas_error.h b/lib_com/ivas_error.h index 2f824dce2dd29a27836ad473f4ded9ae7bc30573..a276367a83a85cf3d945dbb2f7c31b627e258ec3 100644 --- a/lib_com/ivas_error.h +++ b/lib_com/ivas_error.h @@ -104,12 +104,8 @@ typedef enum * input data errors * *----------------------------------------*/ IVAS_ERR_INVALID_BITSTREAM = 0x2000, -#ifdef SPLIT_REND_WITH_HEAD_ROT -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS IVAS_ERR_UNEXPECTED_LC3PLUS_BITSTREAM, IVAS_ERR_UNEXPECTED_LC3PLUS_BITSTREAM_CONFIG, -#endif -#endif /*----------------------------------------* * hardware errors * @@ -148,10 +144,8 @@ typedef enum IVAS_ERR_ACOUSTIC_ENVIRONMENT_MISSING, IVAS_ERR_INVALID_ER_PARAM, IVAS_ERR_DIRECTIVITY_PATTERN_ID_MISSING, -#ifdef SPLIT_REND_WITH_HEAD_ROT IVAS_ERR_LC3PLUS_INVALID_BITRATE, IVAS_ERR_INVALID_SPLIT_REND_CONFIG, -#endif /*----------------------------------------* * unknown error * @@ -250,12 +244,10 @@ static inline const char *ivas_error_to_string( ivas_error error_code ) return "Wrong mode"; case IVAS_ERR_HEAD_ROTATION_NOT_SUPPORTED: return "Head rotation not supported"; -#ifdef SPLIT_REND_WITH_HEAD_ROT case IVAS_ERR_LC3PLUS_INVALID_BITRATE: return "Specified split rendering bit rate is not supported"; case IVAS_ERR_INVALID_SPLIT_REND_CONFIG: return "Specified split rendering configuration is invalid"; -#endif case IVAS_ERR_EXT_ORIENTATION_NOT_SUPPORTED: return "External orientation not supported"; case IVAS_ERR_DIRECTIVITY_NOT_SUPPORTED: diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 61cf9a92acec389f2be4b7f389412cadf06441e8..2382e10ebed7583271791845390d449cf18944b5 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -328,12 +328,8 @@ ivas_error ivas_dec( ivas_error ivas_dec_setup( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ uint16_t *nSamplesRendered, /* o : number of samples flushed from the previous frame (JBM) */ -#ifdef SPLIT_REND_WITH_HEAD_ROT const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ void *data /* o : output synthesis signal */ -#else - int16_t *data /* o : output synthesis signal */ -#endif ); ivas_error create_sce_dec( @@ -673,12 +669,8 @@ ivas_error ivas_mc_dec_config( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const int16_t idx, /* i : LS config. index */ uint16_t *nSamplesRendered, /* o : samples flushed from last frame (JBM) */ -#ifdef SPLIT_REND_WITH_HEAD_ROT const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ void *data /* o : output synthesis signal */ -#else - int16_t *data /* o : output synthesis signal */ -#endif ); /*! r: MC format mode (MCT, McMASA, ParamMC) */ @@ -826,12 +818,8 @@ ivas_error ivas_jbm_dec_render( const uint16_t nSamplesAsked, /* i : number of samples wanted */ uint16_t *nSamplesRendered, /* o : number of samples rendered */ uint16_t *nSamplesAvailableNext, /* o : number of samples still available in the rendering pipeline */ -#ifdef SPLIT_REND_WITH_HEAD_ROT const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ void *data /* o : output synthesis signal */ -#else - int16_t *data /* o : output synthesis signal */ -#endif ); ivas_error ivas_jbm_dec_flush_renderer( @@ -843,12 +831,8 @@ ivas_error ivas_jbm_dec_flush_renderer( const MC_MODE mc_mode_old, /* i : old MC mode */ const ISM_MODE ism_mode_old, /* i : old ISM mode */ uint16_t *nSamplesRendered, /* o : number of samples flushed */ -#ifdef SPLIT_REND_WITH_HEAD_ROT const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ void *data /* o : output synthesis signal */ -#else - int16_t *data /* o : output synthesis signal */ -#endif ); void ivas_jbm_dec_feed_tc_to_renderer( @@ -1113,12 +1097,8 @@ ivas_error ivas_ism_dec_config( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const ISM_MODE last_ism_mode, /* i/o: last ISM mode */ uint16_t *nSamplesRendered, /* o : number of samples flushed on renderer change*/ -#ifdef SPLIT_REND_WITH_HEAD_ROT const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ void *data /* o : output synthesis signal */ -#else - int16_t *data /* o : output synthesis signal */ -#endif ); ivas_error ivas_param_ism_dec_open( @@ -3504,12 +3484,8 @@ void ivas_sba_set_cna_cng_flag( ivas_error ivas_sba_dec_reconfigure( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ uint16_t *nSamplesFlushed, /* o : number of samples flushed */ -#ifdef SPLIT_REND_WITH_HEAD_ROT const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ void *data /* o : output synthesis signal */ -#else - int16_t *data /* o : output synthesis signal */ -#endif ); ivas_error ivas_sba_digest_tc( @@ -4382,15 +4358,6 @@ void ivas_spar_dec_upmixer_sf( float *output[], /* o : output audio channels */ const int16_t nchan_internal /* i : number of internal channels */ ); -#ifndef FIX_997_REMOVE_SPAR_DEC_UPMIXER -void ivas_spar_dec_upmixer( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - float *output[], /* i/o: input/output audio channels */ - const int16_t nchan_internal, /* i : number of internal channels */ - const int16_t output_frame /* i : output frame length */ -); - -#endif /* MD module */ ivas_error ivas_spar_md_enc_open( ivas_spar_md_enc_state_t **hMdEnc, /* i/o: SPAR MD encoder handle */ @@ -4973,12 +4940,8 @@ void ivas_masa_enc_reconfigure( ivas_error ivas_masa_dec_reconfigure( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ uint16_t *nSamplesRendered, /* o : number of samples flushed from the previous frame (JBM) */ -#ifdef SPLIT_REND_WITH_HEAD_ROT const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ void *data /* o : output synthesis signal */ -#else - int16_t *data /* o : output synthesis signal */ -#endif ); ivas_error ivas_masa_encode( @@ -5212,21 +5175,14 @@ ivas_error ivas_allocate_binaural_hrtf( void ivas_binRenderer( BINAURAL_RENDERER_HANDLE hBinRenderer, /* i/o: binaural renderer handle */ -#ifdef SPLIT_REND_WITH_HEAD_ROT const MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, -#endif COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, /* i : combined head and external orientation handle */ const int16_t numTimeSlots, /* i : number of time slots to process */ #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG HEAD_TRACK_DATA_HANDLE hPostRendHeadTrackData, #endif -#ifdef SPLIT_REND_WITH_HEAD_ROT float Cldfb_RealBuffer_Binaural[][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Rotated Binaural signals */ float Cldfb_ImagBuffer_Binaural[][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Rotated Binaural signals */ -#else - float Cldfb_RealBuffer_Binaural[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Binaural signals */ - float Cldfb_ImagBuffer_Binaural[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Binaural signals */ -#endif float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : LS signals */ float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX] /* i : LS signals */ ); @@ -5671,12 +5627,8 @@ ivas_error ivas_omasa_enc_config( ivas_error ivas_omasa_dec_config( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ uint16_t *nSamplesRendered, /* o : number of samples flushed from the previous frame (JBM) */ -#ifdef SPLIT_REND_WITH_HEAD_ROT const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ void *data /* o : output synthesis signal */ -#else - int16_t *data /* o : output synthesis signal */ -#endif ); void ivas_omasa_set_config( @@ -5960,14 +5912,12 @@ float deg2rad( float degrees ); -#ifdef SPLIT_REND_WITH_HEAD_ROT void Quat2EulerDegree( const IVAS_QUATERNION quat, /* i : quaternion describing the rotation */ float *yaw, /* o : yaw */ float *pitch, /* o : pitch */ float *roll /* o : roll */ ); -#endif /*----------------------------------------------------------------------------------* * Limiter prototypes diff --git a/lib_com/ivas_rotation_com.c b/lib_com/ivas_rotation_com.c index 8aaa04e7b1bba407009b6cfde3c37e89b4336194..4dbf7e828e509ca48097b275e37128af0fb7a3b9 100644 --- a/lib_com/ivas_rotation_com.c +++ b/lib_com/ivas_rotation_com.c @@ -71,7 +71,6 @@ void Euler2Quat( } -#ifdef SPLIT_REND_WITH_HEAD_ROT /*------------------------------------------------------------------------- * Quat2EulerDegree() * @@ -112,7 +111,6 @@ void Quat2EulerDegree( return; } -#endif /*------------------------------------------------------------------------- diff --git a/lib_com/options.h b/lib_com/options.h index cb08159303f5215c5129596de859bec0ea978b2c..550f0e086731b5a53f946f62e52e12cb483fc8a4 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -176,17 +176,11 @@ /* #################### Start BASOP porting switches ############################ */ -#define SPLIT_REND_WITH_HEAD_ROT /* Dlb,FhG: Split Rendering contributions 21 and 35 */ -#ifdef SPLIT_REND_WITH_HEAD_ROT -#define SPLIT_REND_POSE_CORRECTION_UNUSED_BITS -#define ISAR_BITSTREAM_UPDATE_LC3PLUS /* FhG: Multiple improvements to the ISAR bitstream when LC3plus is used. See MR 1456 for details. */ -#endif #define NONBE_FIX_1058_DECODER_ERROR_WITH_REVERB_ROOM /* FhG: issue 1058: do not initialize EFAP when IntSetup is HOA3 */ #ifdef NONBE_FIX_1058_DECODER_ERROR_WITH_REVERB_ROOM #define NONBE_FIX_AVG_IAC_CLDFB_REVERB #endif - //#define USE_NEW_HRTF_BINARY_FILE_FORMAT /* Orange: to activate when decided to change the hrtf binary file format */ #ifdef USE_NEW_HRTF_BINARY_FILE_FORMAT #define NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES /* Philips: Use pre-computed HRTF average L/R energies and IAC in all renderers */ @@ -206,22 +200,8 @@ #define FIX_INV_DIFFUSE_WEIGHT /* Orange : Fix error in energy compensation in late binaural */ #endif - //#define FIX_777_COMBI_RENDER_CONFIG_FILE /* Philips: Fix for combined renderer config file support */ -#define FIX_966_VAR_OVERFLOW_IN_HARM_MODEL_ARI /* FhG: fix and undef behaviour bug in the harmonic TCX model arithmetic coder */ -#define FIX_944_REMOVE_LS_RENDERER_CALL_IN_STEREO /* VA: issue 994: remove an obsolete call of function ivas_ls_setup_conversion() in stereo */ - -#define NONBE_FIX_978_MC_TDREND_REVERB /* Eri : activate reverb for TDREND with headtracking */ -#define NONBE_FIX_999_JBM_MCT_FLUSH /* FhG: issue #999: fix wrong flushing for MCT at a JBM rate switch */ -#define NONBE_FIX_1000_G1_G2_SWB_TBE /* VA: issue 1000: avoid div by zero due to g1 + g2 being zero in SWB TBE */ - -#define FIX_699_FILE_READER_JBM_TSM /* VA: issue 699: complement FileReader_getFilePath() logic for TSM and JBM */ -#define FIX_997_REMOVE_SPAR_DEC_UPMIXER /* VA: issue 997: remove obsolete function ivas_spar_dec_upmixer() */ -#define FIX_1003_PARAMISM_BINAURAL_RECONFIG_USAN /* FhG: fix for #1003: fix USAN caused by ParamISM reconfig */ -#define FIX_1001_ARI_HM_OVERFLOW /* FhG: fix for undef behaviour in in the harmonic TCX model arithmetic coder */ -#define NONBE_FIX_1005_MC_RS_TCBUFFER_UPDATE /* FhG: issue #1005: fix TC Buffer update at a MC rate switch */ #define NONBE_FIX_1004_USAN_DTX_MASA_NO_DIRS /* Nokia: fix USAN error caused by non-setting of correctly the number of MASA directions in DTX */ -#define FIX_1008_EXTORIENT_TARGET_INTERPOLATION /* FhG: issue #1008, external orientation init was wrong for 5ms */ /* #define NONBE_FIX_991_PARAMBIN_BINARY_HRTF */ /* Nokia: issue #991: fix using of binary file HRTF in ParamBin (to actiate when USE_NEW_HRTF_BINARY_FILE_FORMAT and FIX_777_COMBI_RENDER_CONFIG_FILE are on )*/ #define FIX_1009_ISM_NONDIEGETIC_PANNING /* FhG: issue #1009: use correct object buffer for ISM1 non-diegetic pan */ #define NONBE_FIX_1012_1013_JBM_FLUSH_BUFFER /* FhG: issues #1012, 1013: JBM flush function uses wrong output buffer */ diff --git a/lib_com/prot.h b/lib_com/prot.h index c789bff632045a63e87224a7ed953e8cb3083cf4..5dd083e86764389625a1de7ba048ece22a2972de 100644 --- a/lib_com/prot.h +++ b/lib_com/prot.h @@ -695,10 +695,8 @@ int32_t get_delay( const int32_t io_fs, /* i : input/output sampling frequency */ const IVAS_FORMAT ivas_format, /* i : IVAS format */ HANDLE_CLDFB_FILTER_BANK hCldfb /* i : Handle of Cldfb analysis */ -#ifdef SPLIT_REND_WITH_HEAD_ROT , const AUDIO_CONFIG output_config /* i : decoder output config */ -#endif ); void decision_matrix_enc( @@ -7800,22 +7798,14 @@ int16_t DecodeIndex( #define GET_ADJ2( T, L, F ) ( ( ( L ) << ( F ) ) - ( T ) ) int16_t tcx_hm_render( -#ifdef FIX_1001_ARI_HM_OVERFLOW - const int32_t lag, /* i : pitch lag */ -#else - const int16_t lag, /* i : pitch lag */ -#endif + const int32_t lag, /* i : pitch lag */ const int16_t fract_res, /* i : fractional resolution of the lag */ Word16 p[] /* o : harmonic model (Q13) */ ); void tcx_hm_modify_envelope( const Word16 gain, /* i : HM gain (Q11) */ -#ifdef FIX_1001_ARI_HM_OVERFLOW const int32_t lag, -#else - const int16_t lag, -#endif const int16_t fract_res, const Word16 p[], /* i : harmonic model (Q13) */ Word32 env[], /* i/o: envelope (Q16) */ diff --git a/lib_com/swb_tbe_com.c b/lib_com/swb_tbe_com.c index f10a8e15207ce350b1145daf9a5b1a21e40c2f1c..a8d88c2b0fb5f5bb0386c946d3d18e2a7f3b5f3c 100644 --- a/lib_com/swb_tbe_com.c +++ b/lib_com/swb_tbe_com.c @@ -939,12 +939,10 @@ void GenShapedSHBExcitation( den = 4.0f * c0 * c2 - c4 * c4; -#ifdef NONBE_FIX_1000_G1_G2_SWB_TBE if ( den == 0.0f ) { den = 1e-7f; } -#endif g1 = ( c3 * c4 - 2 * c1 * c2 ) / den; g2 = ( c1 * c4 - 2 * c0 * c3 ) / den; @@ -972,7 +970,6 @@ void GenShapedSHBExcitation( else { /* normalize gain */ -#ifdef NONBE_FIX_1000_G1_G2_SWB_TBE temp = 0.0f; if ( g1 + g2 == 0.0f ) { @@ -980,9 +977,6 @@ void GenShapedSHBExcitation( } g = g2 / ( g1 + g2 + temp ); -#else - g = g2 / ( g1 + g2 ); -#endif /* quantization of the mixing factor */ cbsize = 1 << NUM_BITS_SHB_VF; diff --git a/lib_dec/ari_hm_dec.c b/lib_dec/ari_hm_dec.c index 67be41d6e7df0ed83af4108a4cc35e9428ea6b25..86d836cfa552a11563dcdd4fe4f6b91d0acaef53 100644 --- a/lib_dec/ari_hm_dec.c +++ b/lib_dec/ari_hm_dec.c @@ -120,11 +120,7 @@ void tcx_hm_decode( int16_t *hm_bits /* o : bit consumption */ ) { -#ifdef FIX_1001_ARI_HM_OVERFLOW int32_t lag; -#else - int16_t lag; -#endif int32_t tmpL; int16_t NumTargetBits, fract_res; Word16 p[2 * kTcxHmParabolaHalfWidth + 1], gain; @@ -148,11 +144,7 @@ void tcx_hm_decode( /* Convert the index to lag */ UnmapIndex( prm_hm[1], L_frame >= 256, LtpPitchLag, ( NumTargetBits <= kSmallerLagsTargetBitsThreshold ) || ( L_frame < 256 ), &fract_res, &tmpL ); -#ifdef FIX_1001_ARI_HM_OVERFLOW lag = tmpL; -#else - lag = (int16_t) tmpL; -#endif /* Render the harmonic model */ if ( tcx_hm_render( lag, fract_res, p ) ) diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index f3fe81dcde230106023a6360a885fd9996f8f1a0..deffa8ed17c26aae62b8e0584d3c7880172906ab 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -60,12 +60,8 @@ static void ivas_binRenderer_filterModule( float CLDFB_real[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : real part of LS signals */ float CLDFB_imag[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : imag part of LS signals */ const int16_t numTimeSlots, /* i : number of time slots to process */ -#ifdef SPLIT_REND_WITH_HEAD_ROT - BINAURAL_RENDERER_HANDLE hBinRenderer, /* i/o: fastconv binaural renderer handle */ - const int16_t pos_idx /* i : pose index */ -#else - BINAURAL_RENDERER_HANDLE hBinRenderer /* i/o: fastconv binaural renderer handle */ -#endif + BINAURAL_RENDERER_HANDLE hBinRenderer, /* i/o: fastconv binaural renderer handle */ + const int16_t pos_idx /* i : pose index */ ) { int16_t bandIdx, k, chIdx, tapIdx; @@ -76,13 +72,8 @@ static void ivas_binRenderer_filterModule( { for ( chIdx = 0; chIdx < hBinRenderer->nInChannels; chIdx++ ) { -#ifdef SPLIT_REND_WITH_HEAD_ROT filterStatesLeftRealPtr = (float *) &( hBinRenderer->hBinRenConvModule->filterStatesLeftReal[pos_idx][bandIdx][chIdx][0] ); filterStatesLeftImagPtr = (float *) &( hBinRenderer->hBinRenConvModule->filterStatesLeftImag[pos_idx][bandIdx][chIdx][0] ); -#else - filterStatesLeftRealPtr = (float *) &( hBinRenderer->hBinRenConvModule->filterStatesLeftReal[bandIdx][chIdx][0] ); - filterStatesLeftImagPtr = (float *) &( hBinRenderer->hBinRenConvModule->filterStatesLeftImag[bandIdx][chIdx][0] ); -#endif filterTapsLeftRealPtr = hBinRenderer->hBinRenConvModule->filterTapsLeftReal[bandIdx][chIdx]; filterTapsLeftImagPtr = hBinRenderer->hBinRenConvModule->filterTapsLeftImag[bandIdx][chIdx]; @@ -137,19 +128,12 @@ static ivas_error ivas_binRenderer_convModuleOpen( const int16_t renderer_type, const int16_t isLoudspeaker, const AUDIO_CONFIG input_config, -#ifdef SPLIT_REND_WITH_HEAD_ROT const HRTFS_FASTCONV_HANDLE hHrtf, - const int16_t num_poses -#else - const HRTFS_FASTCONV_HANDLE hHrtf -#endif -) + const int16_t num_poses ) { int16_t bandIdx, chIdx; BINRENDERER_CONV_MODULE_HANDLE hBinRenConvModule; -#ifdef SPLIT_REND_WITH_HEAD_ROT int16_t pos_idx; -#endif /*-----------------------------------------------------------------* * prepare library opening @@ -260,7 +244,6 @@ static ivas_error ivas_binRenderer_convModuleOpen( } } -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( hBinRenConvModule->filterStatesLeftReal = (float ****) malloc( num_poses * sizeof( float *** ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); @@ -309,44 +292,6 @@ static ivas_error ivas_binRenderer_convModuleOpen( } } } -#else - - if ( ( hBinRenConvModule->filterStatesLeftReal = (float ***) malloc( hBinRenderer->conv_band * sizeof( float ** ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); - } - - if ( ( hBinRenConvModule->filterStatesLeftImag = (float ***) malloc( hBinRenderer->conv_band * sizeof( float ** ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); - } - - for ( bandIdx = 0; bandIdx < hBinRenderer->conv_band; bandIdx++ ) - { - if ( ( hBinRenConvModule->filterStatesLeftReal[bandIdx] = (float **) malloc( hBinRenderer->nInChannels * sizeof( float * ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); - } - - if ( ( hBinRenConvModule->filterStatesLeftImag[bandIdx] = (float **) malloc( hBinRenderer->nInChannels * sizeof( float * ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); - } - - for ( chIdx = 0; chIdx < hBinRenderer->nInChannels; chIdx++ ) - { - if ( ( hBinRenConvModule->filterStatesLeftReal[bandIdx][chIdx] = (float *) malloc( hBinRenConvModule->numTapsArray[bandIdx] * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); - } - - if ( ( hBinRenConvModule->filterStatesLeftImag[bandIdx][chIdx] = (float *) malloc( hBinRenConvModule->numTapsArray[bandIdx] * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); - } - } - } -#endif /* SPLIT_REND_WITH_HEAD_ROT */ /* set memories */ for ( bandIdx = 0; bandIdx < hBinRenderer->conv_band; bandIdx++ ) @@ -387,11 +332,6 @@ static ivas_error ivas_binRenderer_convModuleOpen( if ( renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) { -#ifndef SPLIT_REND_WITH_HEAD_ROT - /* set the memories to zero */ - set_zero( hBinRenConvModule->filterStatesLeftReal[bandIdx][chIdx], hBinRenConvModule->numTapsArray[bandIdx] ); - set_zero( hBinRenConvModule->filterStatesLeftImag[bandIdx][chIdx], hBinRenConvModule->numTapsArray[bandIdx] ); -#endif if ( isLoudspeaker ) { hBinRenConvModule->filterTapsLeftReal[bandIdx][chIdx] = hHrtf->leftBRIRReal[bandIdx][tmp]; @@ -409,11 +349,6 @@ static ivas_error ivas_binRenderer_convModuleOpen( } else { -#ifndef SPLIT_REND_WITH_HEAD_ROT - /* set the memories to zero */ - set_zero( hBinRenConvModule->filterStatesLeftReal[bandIdx][chIdx], hBinRenConvModule->numTaps ); - set_zero( hBinRenConvModule->filterStatesLeftImag[bandIdx][chIdx], hBinRenConvModule->numTaps ); -#endif if ( isLoudspeaker ) { hBinRenConvModule->filterTapsLeftReal[bandIdx][chIdx] = hHrtf->leftHRIRReal[bandIdx][tmp]; @@ -456,7 +391,6 @@ static ivas_error ivas_binRenderer_convModuleOpen( } } -#ifdef SPLIT_REND_WITH_HEAD_ROT for ( pos_idx = 0; pos_idx < num_poses; pos_idx++ ) { for ( bandIdx = 0; bandIdx < hBinRenderer->conv_band; bandIdx++ ) @@ -469,7 +403,6 @@ static ivas_error ivas_binRenderer_convModuleOpen( } } } -#endif hBinRenderer->hBinRenConvModule = hBinRenConvModule; @@ -971,7 +904,6 @@ static void ivas_binaural_obtain_DMX( } -#ifdef SPLIT_REND_WITH_HEAD_ROT /*------------------------------------------------------------------------- * ivas_rend_openCldfbRend() * @@ -1063,7 +995,6 @@ ivas_rend_openCldfbRend( return error; } -#endif /*------------------------------------------------------------------------- * ivas_binRenderer_open() @@ -1099,7 +1030,6 @@ ivas_error ivas_binRenderer_open( hBinRenderer->rotInCldfb = 1; } -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG @@ -1112,7 +1042,6 @@ ivas_error ivas_binRenderer_open( { hBinRenderer->numPoses = 1; } -#endif /* Declare some common variables needed for renderer */ /* Which format used for binaural rendering (needed for late reverb) ? MC or SBA */ @@ -1157,11 +1086,7 @@ ivas_error ivas_binRenderer_open( IVAS_OUTPUT_SETUP out_setup; /* Allocate memories and buffers needed for convolutional module in CICP19 */ -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = ivas_binRenderer_convModuleOpen( hBinRenderer, st_ivas->renderer_type, 1, IVAS_AUDIO_CONFIG_7_1_4, st_ivas->hHrtfFastConv, hBinRenderer->numPoses ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_binRenderer_convModuleOpen( hBinRenderer, st_ivas->renderer_type, 1, IVAS_AUDIO_CONFIG_7_1_4, st_ivas->hHrtfFastConv ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -1182,11 +1107,7 @@ ivas_error ivas_binRenderer_open( else { /* Allocate memories and buffers needed for convolutional module */ -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = ivas_binRenderer_convModuleOpen( hBinRenderer, st_ivas->renderer_type, st_ivas->hIntSetup.is_loudspeaker_setup, st_ivas->hIntSetup.output_config, st_ivas->hHrtfFastConv, hBinRenderer->numPoses ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_binRenderer_convModuleOpen( hBinRenderer, st_ivas->renderer_type, st_ivas->hIntSetup.is_loudspeaker_setup, st_ivas->hIntSetup.output_config, st_ivas->hHrtfFastConv ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -1300,18 +1221,12 @@ ivas_error ivas_binRenderer_open( *------------------------------------------------------------------------*/ static void ivas_binRenderer_convModuleClose( -#ifdef SPLIT_REND_WITH_HEAD_ROT BINAURAL_RENDERER_HANDLE *hBinRenderer, /* i/o: fastconv binaural renderer handle */ const int16_t num_poses /* i : number of poses */ -#else - BINAURAL_RENDERER_HANDLE *hBinRenderer /* i/o: fastconv binaural renderer handle */ -#endif ) { int16_t bandIdx, chIdx; -#ifdef SPLIT_REND_WITH_HEAD_ROT int16_t posIdx; -#endif BINRENDERER_CONV_MODULE_HANDLE hBinRenConvModule; hBinRenConvModule = ( *hBinRenderer )->hBinRenConvModule; @@ -1348,7 +1263,6 @@ static void ivas_binRenderer_convModuleClose( free( hBinRenConvModule->filterTapsRightImag ); hBinRenConvModule->filterTapsRightImag = NULL; -#ifdef SPLIT_REND_WITH_HEAD_ROT for ( posIdx = 0; posIdx < num_poses; posIdx++ ) { for ( bandIdx = 0; bandIdx < ( *hBinRenderer )->conv_band; bandIdx++ ) @@ -1380,31 +1294,6 @@ static void ivas_binRenderer_convModuleClose( free( hBinRenConvModule->filterStatesLeftImag ); hBinRenConvModule->filterStatesLeftImag = NULL; -#else - for ( bandIdx = 0; bandIdx < ( *hBinRenderer )->conv_band; bandIdx++ ) - { - for ( chIdx = 0; chIdx < ( *hBinRenderer )->nInChannels; chIdx++ ) - { - free( hBinRenConvModule->filterStatesLeftReal[bandIdx][chIdx] ); - hBinRenConvModule->filterStatesLeftReal[bandIdx][chIdx] = NULL; - - free( hBinRenConvModule->filterStatesLeftImag[bandIdx][chIdx] ); - hBinRenConvModule->filterStatesLeftImag[bandIdx][chIdx] = NULL; - } - - free( hBinRenConvModule->filterStatesLeftReal[bandIdx] ); - hBinRenConvModule->filterStatesLeftReal[bandIdx] = NULL; - - free( hBinRenConvModule->filterStatesLeftImag[bandIdx] ); - hBinRenConvModule->filterStatesLeftImag[bandIdx] = NULL; - } - - free( hBinRenConvModule->filterStatesLeftReal ); - hBinRenConvModule->filterStatesLeftReal = NULL; - - free( hBinRenConvModule->filterStatesLeftImag ); - hBinRenConvModule->filterStatesLeftImag = NULL; -#endif free( ( *hBinRenderer )->hBinRenConvModule ); ( *hBinRenderer )->hBinRenConvModule = NULL; @@ -1430,11 +1319,7 @@ void ivas_binRenderer_close( if ( ( *hBinRenderer )->hBinRenConvModule != NULL ) { -#ifdef SPLIT_REND_WITH_HEAD_ROT ivas_binRenderer_convModuleClose( hBinRenderer, ( *hBinRenderer )->numPoses ); -#else - ivas_binRenderer_convModuleClose( hBinRenderer ); -#endif } if ( ( *hBinRenderer )->hReverb != NULL ) @@ -1591,40 +1476,28 @@ void ivas_binaural_add_LFE( void ivas_binRenderer( BINAURAL_RENDERER_HANDLE hBinRenderer, /* i/o: binaural renderer handle */ -#ifdef SPLIT_REND_WITH_HEAD_ROT const MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, -#endif COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, /* i : combined head and external orientation handle*/ const int16_t numTimeSlots, /* i : number of time slots to render */ #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG HEAD_TRACK_DATA_HANDLE hPostRendHeadTrackData, #endif -#ifdef SPLIT_REND_WITH_HEAD_ROT float Cldfb_RealBuffer_Binaural[][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Rotated Binaural signals */ float Cldfb_ImagBuffer_Binaural[][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Rotated Binaural signals */ -#else - float Cldfb_RealBuffer_Binaural[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Binaural signals */ - float Cldfb_ImagBuffer_Binaural[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Binaural signals */ -#endif - float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : LS signals */ - float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX] /* i : LS signals */ + float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : LS signals */ + float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX] /* i : LS signals */ ) { int16_t chIdx, k; -#ifdef SPLIT_REND_WITH_HEAD_ROT int16_t pos_idx, num_poses; float RealBuffer_local[MAX_OUTPUT_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; float ImagBuffer_local[MAX_OUTPUT_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; -#endif push_wmops( "fastconv_binaural_rendering" ); -#ifdef SPLIT_REND_WITH_HEAD_ROT num_poses = hBinRenderer->numPoses; -#endif /* Compute Convolution */ /* memory reset for the binaural output */ -#ifdef SPLIT_REND_WITH_HEAD_ROT for ( pos_idx = 0; pos_idx < num_poses; pos_idx++ ) { for ( chIdx = 0; chIdx < BINAURAL_CHANNELS; chIdx++ ) @@ -1645,16 +1518,6 @@ void ivas_binRenderer( mvr2r( ImagBuffer[chIdx][k], ImagBuffer_local[chIdx][k], CLDFB_NO_CHANNELS_MAX ); } } -#else - for ( chIdx = 0; chIdx < BINAURAL_CHANNELS; chIdx++ ) - { - for ( k = 0; k < numTimeSlots; k++ ) - { - set_zero( Cldfb_RealBuffer_Binaural[chIdx][k], CLDFB_NO_CHANNELS_MAX ); - set_zero( Cldfb_ImagBuffer_Binaural[chIdx][k], CLDFB_NO_CHANNELS_MAX ); - } - } -#endif /* Head rotation in HOA3 or CICPx */ if ( hCombinedOrientationData != NULL && hCombinedOrientationData->enableCombinedOrientation[hCombinedOrientationData->subframe_idx] && hBinRenderer->rotInCldfb ) @@ -1684,13 +1547,8 @@ void ivas_binRenderer( ivas_sba2mc_cldfb( *( hBinRenderer->hInputSetup ), RealBuffer, ImagBuffer, hBinRenderer->nInChannels, hBinRenderer->conv_band, numTimeSlots, hBinRenderer->hoa_dec_mtx ); } -#ifdef SPLIT_REND_WITH_HEAD_ROT ivas_binRenderer_filterModule( Cldfb_RealBuffer_Binaural[0], Cldfb_ImagBuffer_Binaural[0], RealBuffer, ImagBuffer, numTimeSlots, hBinRenderer, 0 ); -#else - ivas_binRenderer_filterModule( Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, RealBuffer, ImagBuffer, numTimeSlots, hBinRenderer ); -#endif -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( pMultiBinPoseData != NULL ) { if ( pMultiBinPoseData->num_poses > 1 ) @@ -1750,7 +1608,6 @@ void ivas_binRenderer( } } } -#endif /* Obtain the binaural dmx and compute the reverb */ if ( hBinRenderer->hReverb != NULL ) @@ -1778,18 +1635,12 @@ void ivas_binRenderer( { for ( k = 0; k < numTimeSlots; k++ ) { -#ifdef SPLIT_REND_WITH_HEAD_ROT for ( pos_idx = 0; pos_idx < num_poses; pos_idx++ ) { /* Combine first and second parts to generate binaural output signal with room effect */ v_add( Cldfb_RealBuffer_Binaural[pos_idx][chIdx][k], reverbRe[chIdx][k], Cldfb_RealBuffer_Binaural[pos_idx][chIdx][k], hBinRenderer->conv_band ); v_add( Cldfb_ImagBuffer_Binaural[pos_idx][chIdx][k], reverbIm[chIdx][k], Cldfb_ImagBuffer_Binaural[pos_idx][chIdx][k], hBinRenderer->conv_band ); } -#else - /* Combine first and second parts to generate binaural output signal with room effect */ - v_add( Cldfb_RealBuffer_Binaural[chIdx][k], reverbRe[chIdx][k], Cldfb_RealBuffer_Binaural[chIdx][k], hBinRenderer->conv_band ); - v_add( Cldfb_ImagBuffer_Binaural[chIdx][k], reverbIm[chIdx][k], Cldfb_ImagBuffer_Binaural[chIdx][k], hBinRenderer->conv_band ); -#endif } } } @@ -1799,7 +1650,6 @@ void ivas_binRenderer( } -#ifdef SPLIT_REND_WITH_HEAD_ROT /*------------------------------------------------------------------------- * ivas_rend_CldfbMultiBinRendProcess() * @@ -1885,4 +1735,3 @@ void ivas_rend_CldfbMultiBinRendProcess( return; } -#endif diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 6c813e7144a8ec6c68d58c0c5a2fc4a510da44c6..1bb88db20dd269978d1cbd851fcbe4bf208b8e43 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -765,9 +765,7 @@ ivas_error ivas_dirac_dec_config( int16_t need_parambin; int16_t dec_param_estim_old; int16_t dec_param_estim_new; -#ifdef SPLIT_REND_WITH_HEAD_ROT int16_t num_poses, pos_idx; -#endif error = IVAS_ERR_OK; @@ -778,13 +776,11 @@ ivas_error ivas_dirac_dec_config( hodirac_flag = ivas_get_hodirac_flag( st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->sba_analysis_order ); dec_param_estim_old = ( dec_config_flag == DIRAC_RECONFIGURE ) ? st_ivas->hDirAC->hConfig->dec_param_estim : FALSE; -#ifdef SPLIT_REND_WITH_HEAD_ROT num_poses = 1; if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { num_poses = st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses; } -#endif sparfoa_flag = 0; if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_FOA && st_ivas->ivas_format == SBA_FORMAT && !hodirac_flag ) @@ -821,11 +817,7 @@ ivas_error ivas_dirac_dec_config( if ( !need_parambin ) { -#ifdef SPLIT_REND_WITH_HEAD_ROT ivas_dirac_dec_close_binaural_data( st_ivas->hDiracDecBin ); -#else - ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin ); -#endif } need_dirac_rend = 0; @@ -877,11 +869,7 @@ ivas_error ivas_dirac_dec_config( } } -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( st_ivas->hDiracDecBin[0] == NULL ) -#else - if ( st_ivas->hDiracDecBin == NULL ) -#endif { #ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF if ( ( error = ivas_dirac_dec_init_binaural_data( st_ivas, &( st_ivas->hHrtfParambin ) ) ) != IVAS_ERR_OK ) @@ -895,29 +883,16 @@ ivas_error ivas_dirac_dec_config( else { /* This is required to keep BE in rate switching. This probably means that 1TC and 2TC MASA perform differently. */ -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( st_ivas->hDiracDecBin[0]->h_freq_domain_decorr_ap_params != NULL && !( st_ivas->ivas_format == MASA_FORMAT && st_ivas->nSCE > 0 ) ) -#else - if ( st_ivas->hDiracDecBin->h_freq_domain_decorr_ap_params != NULL && !( st_ivas->ivas_format == MASA_FORMAT && st_ivas->nSCE > 0 ) ) -#endif { -#ifdef SPLIT_REND_WITH_HEAD_ROT ivas_dirac_dec_decorr_close( &st_ivas->hDiracDecBin[0]->h_freq_domain_decorr_ap_params, &st_ivas->hDiracDecBin[0]->h_freq_domain_decorr_ap_state ); -#else - ivas_dirac_dec_decorr_close( &st_ivas->hDiracDecBin->h_freq_domain_decorr_ap_params, &st_ivas->hDiracDecBin->h_freq_domain_decorr_ap_state ); -#endif } -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = ivas_td_decorr_reconfig_dec( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hDecoderConfig->output_Fs, &( st_ivas->hDiracDecBin[0]->hTdDecorr ), &( st_ivas->hDiracDecBin[0]->useTdDecorr ) ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_td_decorr_reconfig_dec( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hDecoderConfig->output_Fs, &( st_ivas->hDiracDecBin->hTdDecorr ), &( st_ivas->hDiracDecBin->useTdDecorr ) ) ) != IVAS_ERR_OK ) -#endif { return error; } -#ifdef SPLIT_REND_WITH_HEAD_ROT /* copy td-decorr flag to split renderer side rendereres */ for ( pos_idx = 1; pos_idx < num_poses; pos_idx++ ) { @@ -925,27 +900,16 @@ ivas_error ivas_dirac_dec_config( } if ( !st_ivas->hDiracDecBin[0]->useTdDecorr ) -#else - if ( !st_ivas->hDiracDecBin->useTdDecorr ) -#endif { -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( st_ivas->hDiracDecBin[0]->h_freq_domain_decorr_ap_params == NULL ) -#else - if ( st_ivas->hDiracDecBin->h_freq_domain_decorr_ap_params == NULL ) -#endif { float frequency_axis[CLDFB_NO_CHANNELS_MAX]; ivas_dirac_dec_get_frequency_axis( frequency_axis, st_ivas->hDecoderConfig->output_Fs, st_ivas->hSpatParamRendCom->num_freq_bands ); if ( ( error = ivas_dirac_dec_decorr_open( -#ifdef SPLIT_REND_WITH_HEAD_ROT &( st_ivas->hDiracDecBin[0]->h_freq_domain_decorr_ap_params ), &( st_ivas->hDiracDecBin[0]->h_freq_domain_decorr_ap_state ), st_ivas->hSpatParamRendCom->num_freq_bands, BINAURAL_CHANNELS, BINAURAL_CHANNELS, -#else - &( st_ivas->hDiracDecBin->h_freq_domain_decorr_ap_params ), &( st_ivas->hDiracDecBin->h_freq_domain_decorr_ap_state ), st_ivas->hSpatParamRendCom->num_freq_bands, BINAURAL_CHANNELS, BINAURAL_CHANNELS, -#endif DIRAC_SYNTHESIS_PSD_LS, frequency_axis, BINAURAL_CHANNELS, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) { return error; @@ -953,14 +917,10 @@ ivas_error ivas_dirac_dec_config( } } -#ifdef SPLIT_REND_WITH_HEAD_ROT for ( pos_idx = 0; pos_idx < num_poses; pos_idx++ ) { st_ivas->hDiracDecBin[pos_idx]->reqularizationFactor = configure_reqularization_factor( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate ); } -#else - st_ivas->hDiracDecBin->reqularizationFactor = configure_reqularization_factor( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate ); -#endif } } } @@ -1689,13 +1649,8 @@ void ivas_dirac_dec_render_sf( /*CLDFB: last output channels reserved to LFT for CICPx*/ float Cldfb_RealBuffer[MAX_OUTPUT_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; float Cldfb_ImagBuffer[MAX_OUTPUT_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; -#ifdef SPLIT_REND_WITH_HEAD_ROT float Cldfb_RealBuffer_Binaural[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; float Cldfb_ImagBuffer_Binaural[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; -#else - float Cldfb_RealBuffer_Binaural[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; - float Cldfb_ImagBuffer_Binaural[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; -#endif float Cldfb_RealBuffer_Temp[2][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; float Cldfb_ImagBuffer_Temp[2][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; int16_t index, num_freq_bands; @@ -2391,7 +2346,6 @@ void ivas_dirac_dec_render_sf( } } -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { if ( st_ivas->hSplitBinRend->hCldfbDataOut != NULL ) @@ -2407,13 +2361,10 @@ void ivas_dirac_dec_render_sf( st_ivas->hSplitBinRend->hCldfbDataOut->config = st_ivas->hIntSetup.output_config; } } -#endif /* Perform binaural rendering */ ivas_binRenderer( st_ivas->hBinRenderer, -#ifdef SPLIT_REND_WITH_HEAD_ROT ( st_ivas->hSplitBinRend == NULL ) ? NULL : &st_ivas->hSplitBinRend->splitrend.multiBinPoseData, -#endif st_ivas->hCombinedOrientationData, hSpatParamRendCom->subframe_nbslots[subframe_idx], @@ -2421,7 +2372,6 @@ void ivas_dirac_dec_render_sf( NULL, #endif Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, Cldfb_RealBuffer, Cldfb_ImagBuffer ); -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { int16_t pos_idx; @@ -2437,7 +2387,6 @@ void ivas_dirac_dec_render_sf( } } } -#endif /* Inverse CLDFB*/ for ( ch = 0; ch < st_ivas->hDecoderConfig->nchan_out; ch++ ) @@ -2448,13 +2397,8 @@ void ivas_dirac_dec_render_sf( for ( i = 0; i < hSpatParamRendCom->subframe_nbslots[subframe_idx]; i++ ) { -#ifdef SPLIT_REND_WITH_HEAD_ROT RealBuffer[i] = Cldfb_RealBuffer_Binaural[0][ch][i]; ImagBuffer[i] = Cldfb_ImagBuffer_Binaural[0][ch][i]; -#else - RealBuffer[i] = Cldfb_RealBuffer_Binaural[ch][i]; - ImagBuffer[i] = Cldfb_ImagBuffer_Binaural[ch][i]; -#endif } cldfbSynthesis( RealBuffer, ImagBuffer, &( output_f[ch][index_slot * hSpatParamRendCom->num_freq_bands] ), hSpatParamRendCom->num_freq_bands * hSpatParamRendCom->subframe_nbslots[subframe_idx], st_ivas->cldfbSynDec[ch] ); diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index cafc8126a0c988273d9f627bbf469c08a524e117..a9ec15a79c5cc0f7ba5c96a359c1b3849f2d50e8 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -37,11 +37,9 @@ #include "ivas_rom_com.h" #include "ivas_stat_enc.h" #include "prot.h" -#ifdef SPLIT_REND_WITH_HEAD_ROT #include "lib_isar_pre_rend.h" #include "isar_prot.h" #include "isar_stat.h" -#endif #include #include #include @@ -59,7 +57,6 @@ static ivas_error ivas_read_format( Decoder_Struct *st_ivas, int16_t *num_bits_r static ivas_error doSanityChecks_IVAS( Decoder_Struct *st_ivas ); -#ifdef SPLIT_REND_WITH_HEAD_ROT static ivas_error ivas_dec_reconfig_split_rend( Decoder_Struct *st_ivas ); @@ -238,7 +235,6 @@ static ivas_error ivas_dec_init_split_rend( error = ISAR_PRE_REND_open( &st_ivas->hSplitBinRend->splitrend, &st_ivas->hRenderConfig->split_rend_config, st_ivas->hDecoderConfig->output_Fs, cldfb_in_flag, pcm_out_flag, (int16_t) st_ivas->hDecoderConfig->render_framesize, mixed_td_cldfb_flag ); return error; } -#endif /*-------------------------------------------------------------------* * ivas_dec_setup() @@ -247,14 +243,10 @@ static ivas_error ivas_dec_init_split_rend( *-------------------------------------------------------------------*/ ivas_error ivas_dec_setup( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - uint16_t *nSamplesRendered, /* o : number of samples flushed from the previous frame (JBM) */ -#ifdef SPLIT_REND_WITH_HEAD_ROT + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + uint16_t *nSamplesRendered, /* o : number of samples flushed from the previous frame (JBM) */ const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ void *data /* o : output synthesis signal */ -#else - int16_t *data /* o : output synthesis signal */ -#endif ) { int16_t k, idx, num_bits_read; @@ -308,11 +300,7 @@ ivas_error ivas_dec_setup( st_ivas->nchan_ism = nchan_ism; -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = ivas_ism_dec_config( st_ivas, st_ivas->ism_mode, nSamplesRendered, pcm_resolution, data ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_ism_dec_config( st_ivas, st_ivas->ism_mode, nSamplesRendered, data ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -330,11 +318,7 @@ ivas_error ivas_dec_setup( num_bits_read += SBA_ORDER_BITS; if ( st_ivas->ini_frame > 0 && ivas_total_brate != st_ivas->last_active_ivas_total_brate && ivas_total_brate > IVAS_SID_5k2 ) { -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = ivas_sba_dec_reconfigure( st_ivas, nSamplesRendered, pcm_resolution, data ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_sba_dec_reconfigure( st_ivas, nSamplesRendered, data ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -374,11 +358,7 @@ ivas_error ivas_dec_setup( else { -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = ivas_masa_dec_reconfigure( st_ivas, nSamplesRendered, pcm_resolution, data ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_masa_dec_reconfigure( st_ivas, nSamplesRendered, data ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -386,11 +366,7 @@ ivas_error ivas_dec_setup( } else { -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = ivas_omasa_dec_config( st_ivas, nSamplesRendered, pcm_resolution, data ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_omasa_dec_config( st_ivas, nSamplesRendered, data ) ) != IVAS_ERR_OK ) -#endif { return error; @@ -412,11 +388,7 @@ ivas_error ivas_dec_setup( /* reconfigure in case a change of operation mode is detected */ if ( ( ivas_total_brate > IVAS_SID_5k2 && ivas_total_brate != st_ivas->hDecoderConfig->last_ivas_total_brate ) || ( st_ivas->ini_active_frame == 0 ) ) { -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = ivas_omasa_dec_config( st_ivas, nSamplesRendered, pcm_resolution, data ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_omasa_dec_config( st_ivas, nSamplesRendered, data ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -447,11 +419,7 @@ ivas_error ivas_dec_setup( if ( st_ivas->ini_frame > 0 && ivas_total_brate != st_ivas->last_active_ivas_total_brate ) { -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = ivas_sba_dec_reconfigure( st_ivas, nSamplesRendered, pcm_resolution, data ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_sba_dec_reconfigure( st_ivas, nSamplesRendered, data ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -493,17 +461,10 @@ ivas_error ivas_dec_setup( num_bits_read += MC_LS_SETUP_BITS; /* select MC format mode; reconfigure the MC format decoder */ -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = ivas_mc_dec_config( st_ivas, idx, nSamplesRendered, pcm_resolution, data ) ) != IVAS_ERR_OK ) { return error; } -#else - if ( ( error = ivas_mc_dec_config( st_ivas, idx, nSamplesRendered, data ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif } /*-------------------------------------------------------------------* @@ -585,11 +546,7 @@ ivas_error ivas_dec_setup( st_ivas->hDecoderConfig->ivas_total_brate = IVAS_24k4; } -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = ivas_sba_dec_reconfigure( st_ivas, nSamplesRendered, pcm_resolution, data ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_sba_dec_reconfigure( st_ivas, nSamplesRendered, data ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -635,11 +592,7 @@ ivas_error ivas_dec_setup( last_ism_mode = st_ivas->ism_mode; } -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = ivas_ism_dec_config( st_ivas, last_ism_mode, nSamplesRendered, pcm_resolution, data ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_ism_dec_config( st_ivas, last_ism_mode, nSamplesRendered, data ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -664,7 +617,6 @@ ivas_error ivas_dec_setup( } } -#ifdef SPLIT_REND_WITH_HEAD_ROT /*-----------------------------------------------------------------* * reconfig split rendering as renderer might change after bitrate switching *-----------------------------------------------------------------*/ @@ -676,7 +628,6 @@ ivas_error ivas_dec_setup( return error; } } -#endif /*----------------------------------------------------------------* * Reset bitstream pointers @@ -1053,12 +1004,8 @@ ivas_error ivas_init_decoder_front( * Allocate and initialize Binaural Renderer configuration handle *--------------------------------------------------------------------*/ - if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB -#ifdef SPLIT_REND_WITH_HEAD_ROT - || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM || - ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_STEREO && st_ivas->hDecoderConfig->Opt_non_diegetic_pan ) -#endif - ) + if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM || + ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_STEREO && st_ivas->hDecoderConfig->Opt_non_diegetic_pan ) ) { if ( ( error = ivas_render_config_open( &( st_ivas->hRenderConfig ) ) ) != IVAS_ERR_OK ) { @@ -1215,7 +1162,6 @@ ivas_error ivas_init_decoder( } #endif -#ifdef SPLIT_REND_WITH_HEAD_ROT /*-----------------------------------------------------------------* * Initialize binuaral split rendering *-----------------------------------------------------------------*/ @@ -1228,7 +1174,6 @@ ivas_error ivas_init_decoder( return error; } } -#endif /*-----------------------------------------------------------------* * Allocate and initialize SCE/CPE and other handles @@ -1965,11 +1910,7 @@ ivas_error ivas_init_decoder( return error; } -#ifdef NONBE_FIX_978_MC_TDREND_REVERB if ( st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) -#else - if ( st_ivas->hIntSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) -#endif { #ifdef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES @@ -2014,21 +1955,11 @@ ivas_error ivas_init_decoder( } } -#ifdef SPLIT_REND_WITH_HEAD_ROT #ifdef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES if ( ( error = ivas_reverb_open( &st_ivas->hReverb, st_ivas->hHrtfStatistics, st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) #else if ( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hDecoderConfig->output_config, st_ivas->hRenderConfig, st_ivas->hSetOfHRTF, st_ivas->hDecoderConfig->output_Fs, ( st_ivas->hSplitBinRend == NULL ) ? 1 : st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses ) ) != IVAS_ERR_OK ) -#endif -#else -#ifdef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES - if ( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hDecoderConfig->output_config, - st_ivas->hRenderConfig, st_ivas->hSetOfHRTF, st_ivas->hHrtfStatistics, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hDecoderConfig->output_config, - st_ivas->hRenderConfig, st_ivas->hSetOfHRTF, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) -#endif #endif { return error; @@ -2128,9 +2059,7 @@ ivas_error ivas_init_decoder( { if ( st_ivas->hBinRenderer->render_lfe ) { -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( st_ivas->hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED && st_ivas->hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) -#endif { /* Account for filterbank delay */ binauralization_delay_ns += IVAS_FB_DEC_DELAY_NS; @@ -2454,14 +2383,10 @@ void ivas_initialize_handles_dec( /* rendering handles */ st_ivas->hBinRenderer = NULL; -#ifdef SPLIT_REND_WITH_HEAD_ROT for ( i = 0; i < MAX_HEAD_ROT_POSES; i++ ) { st_ivas->hDiracDecBin[i] = NULL; } -#else - st_ivas->hDiracDecBin = NULL; -#endif st_ivas->hDirACRend = NULL; st_ivas->hSpatParamRendCom = NULL; st_ivas->hLsSetUpConversion = NULL; @@ -2489,13 +2414,11 @@ void ivas_initialize_handles_dec( st_ivas->hExtOrientationData = NULL; st_ivas->hCombinedOrientationData = NULL; -#ifdef SPLIT_REND_WITH_HEAD_ROT st_ivas->hSplitBinRend = NULL; for ( i = 0; i < MAX_HEAD_ROT_POSES - 1; ++i ) { st_ivas->hTdRendHandles[i] = NULL; } -#endif /* JBM handles */ st_ivas->hTcBuffer = NULL; @@ -2633,7 +2556,6 @@ void ivas_destroy_dec( /* Fastconv binaural renderer handle */ ivas_binRenderer_close( &st_ivas->hBinRenderer ); -#ifdef SPLIT_REND_WITH_HEAD_ROT /* TD binaural renderer handles */ for ( i = 0; i < MAX_HEAD_ROT_POSES - 1; ++i ) { @@ -2643,22 +2565,13 @@ void ivas_destroy_dec( ivas_td_binaural_close( &st_ivas->hTdRendHandles[i] ); } } -#endif /* Parametric binaural renderer handle */ -#ifdef SPLIT_REND_WITH_HEAD_ROT ivas_dirac_dec_close_binaural_data( st_ivas->hDiracDecBin ); -#else - ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin ); -#endif /* Crend handle */ -#ifdef SPLIT_REND_WITH_HEAD_ROT ivas_rend_closeCrend( &( st_ivas->hCrendWrapper ), ( st_ivas->hSplitBinRend == NULL ) ? 1 : st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses ); -#else - ivas_rend_closeCrend( &( st_ivas->hCrendWrapper ) ); -#endif /* Reverb handle */ ivas_reverb_close( &st_ivas->hReverb ); @@ -2810,11 +2723,7 @@ void ivas_init_dec_get_num_cldfb_instances( *numCldfbAnalyses = st_ivas->nchan_transport + 1; } } -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( st_ivas->hDiracDecBin[0]->useTdDecorr ) -#else - if ( st_ivas->hDiracDecBin->useTdDecorr ) -#endif { *numCldfbAnalyses += 2; } @@ -3048,20 +2957,14 @@ static ivas_error doSanityChecks_IVAS( } } -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) && output_Fs != 48000 ) { return IVAS_ERROR( IVAS_ERR_INVALID_SAMPLING_RATE, "Error: Only 48kHz output sampling rate is supported for split rendering." ); } -#endif if ( st_ivas->hDecoderConfig->Opt_Headrotation ) { - if ( !( output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB -#ifdef SPLIT_REND_WITH_HEAD_ROT - || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM -#endif - ) ) + if ( !( output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { return IVAS_ERROR( IVAS_ERR_HEAD_ROTATION_NOT_SUPPORTED, "Wrong set-up: Head-rotation not supported in this configuration" ); } diff --git a/lib_dec/ivas_ism_dec.c b/lib_dec/ivas_ism_dec.c index 007a4f07e05dbd188680bf317bb860f7556662b0..eac4c045723233f3b6c5b79c61c3003d1b65c9d3 100644 --- a/lib_dec/ivas_ism_dec.c +++ b/lib_dec/ivas_ism_dec.c @@ -47,16 +47,12 @@ *-------------------------------------------------------------------------*/ static ivas_error ivas_ism_bitrate_switching_dec( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - const int16_t nchan_transport_old, /* i : last number of transport channels */ - const ISM_MODE last_ism_mode, /* i : last ISM mode */ - uint16_t *nSamplesRendered, /* o : number of samples rendered */ -#ifdef SPLIT_REND_WITH_HEAD_ROT + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const int16_t nchan_transport_old, /* i : last number of transport channels */ + const ISM_MODE last_ism_mode, /* i : last ISM mode */ + uint16_t *nSamplesRendered, /* o : number of samples rendered */ const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ void *data /* o : output synthesis signal */ -#else - int16_t *data /* o : output synthesis signal */ -#endif ) { ivas_error error; @@ -145,11 +141,7 @@ static ivas_error ivas_ism_bitrate_switching_dec( if ( tc_granularity_new < st_ivas->hTcBuffer->n_samples_granularity ) { -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = ivas_jbm_dec_flush_renderer( st_ivas, tc_granularity_new, renderer_type_old, intern_config_old, &hIntSetupOld, MC_MODE_NONE, last_ism_mode, nSamplesRendered, pcm_resolution, data ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_jbm_dec_flush_renderer( st_ivas, tc_granularity_new, renderer_type_old, intern_config_old, &hIntSetupOld, MC_MODE_NONE, last_ism_mode, nSamplesRendered, data ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -180,18 +172,10 @@ static ivas_error ivas_ism_bitrate_switching_dec( /* Deallocate the ParamISM struct */ ivas_param_ism_dec_close( &( st_ivas->hParamIsmDec ), &( st_ivas->hSpatParamRendCom ), st_ivas->hDecoderConfig->output_config ); - if ( st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL || st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB -#ifdef SPLIT_REND_WITH_HEAD_ROT - || st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM -#endif - ) + if ( st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL || st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB || st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { /* close the parametric binaural renderer */ -#ifdef SPLIT_REND_WITH_HEAD_ROT ivas_dirac_dec_close_binaural_data( st_ivas->hDiracDecBin ); -#else - ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin ); -#endif /* Open the TD Binaural renderer */ if ( st_ivas->hHrtfTD == NULL || st_ivas->hBinRendererTd == NULL ) { @@ -199,11 +183,7 @@ static ivas_error ivas_ism_bitrate_switching_dec( { return error; } -#ifdef NONBE_FIX_978_MC_TDREND_REVERB if ( st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) -#else - if ( st_ivas->hIntSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) -#endif { #ifdef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES if ( ( error = ivas_reverb_open( &st_ivas->hReverb, st_ivas->hHrtfStatistics, st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) @@ -231,25 +211,13 @@ static ivas_error ivas_ism_bitrate_switching_dec( if ( st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) { /* close the parametric binaural renderer */ -#ifdef SPLIT_REND_WITH_HEAD_ROT ivas_dirac_dec_close_binaural_data( st_ivas->hDiracDecBin ); -#else - ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin ); -#endif /* Open Crend Binaural renderer */ -#ifdef SPLIT_REND_WITH_HEAD_ROT #ifdef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES if ( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hRenderConfig, st_ivas->hSetOfHRTF, st_ivas->hHrtfStatistics, st_ivas->hDecoderConfig->output_Fs, st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses ) ) != IVAS_ERR_OK ) #else if ( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hRenderConfig, st_ivas->hSetOfHRTF, st_ivas->hDecoderConfig->output_Fs, ( st_ivas->hSplitBinRend == NULL ) ? 1 : st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses ) ) != IVAS_ERR_OK ) -#endif -#else -#ifdef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES - if ( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hRenderConfig, st_ivas->hSetOfHRTF, st_ivas->hHrtfStatistics, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hRenderConfig, st_ivas->hSetOfHRTF, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) -#endif #endif { return error; @@ -268,11 +236,7 @@ static ivas_error ivas_ism_bitrate_switching_dec( return error; } - if ( st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL || st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB -#ifdef SPLIT_REND_WITH_HEAD_ROT - || st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM -#endif - ) + if ( st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL || st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB || st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { /* open the parametric binaural renderer */ if ( ( error = ivas_dirac_dec_binaural_copy_hrtfs( &st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) @@ -325,11 +289,7 @@ static ivas_error ivas_ism_bitrate_switching_dec( } /* close the crend binaural renderer */ -#ifdef SPLIT_REND_WITH_HEAD_ROT ivas_rend_closeCrend( &( st_ivas->hCrendWrapper ), ( st_ivas->hSplitBinRend == NULL ) ? 1 : st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses ); -#else - ivas_rend_closeCrend( &( st_ivas->hCrendWrapper ) ); -#endif } } @@ -368,13 +328,6 @@ static ivas_error ivas_ism_bitrate_switching_dec( tc_nchan_allocate_new = tc_nchan_tc_new; tc_nchan_full_new = tc_nchan_tc_new; -#ifndef FIX_1003_PARAMISM_BINAURAL_RECONFIG_USAN - if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) - { - tc_nchan_allocate_new = 2 * BINAURAL_CHANNELS; - tc_nchan_full_new = tc_nchan_allocate_new; - } -#endif if ( st_ivas->ism_mode == ISM_MODE_PARAM && ( st_ivas->renderer_type != RENDERER_MONO_DOWNMIX && st_ivas->renderer_type != RENDERER_DISABLE && st_ivas->renderer_type != RENDERER_BINAURAL_PARAMETRIC && st_ivas->renderer_type != RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) { @@ -415,15 +368,11 @@ static ivas_error ivas_ism_bitrate_switching_dec( *-------------------------------------------------------------------------*/ ivas_error ivas_ism_dec_config( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - const ISM_MODE last_ism_mode, /* i/o: last ISM mode */ - uint16_t *nSamplesRendered, /* o : number of samples flushed when the renderer granularity changes */ -#ifdef SPLIT_REND_WITH_HEAD_ROT + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const ISM_MODE last_ism_mode, /* i/o: last ISM mode */ + uint16_t *nSamplesRendered, /* o : number of samples flushed when the renderer granularity changes */ const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ void *data /* o : output synthesis signal */ -#else - int16_t *data /* o : output synthesis signal */ -#endif ) { int32_t ivas_total_brate; @@ -463,9 +412,7 @@ ivas_error ivas_ism_dec_config( if ( ( st_ivas->ism_mode != last_ism_mode ) || ( st_ivas->hDecoderConfig->ivas_total_brate != st_ivas->hDecoderConfig->last_ivas_total_brate ) ) { if ( ( error = ivas_ism_bitrate_switching_dec( st_ivas, nchan_transport_old, last_ism_mode, nSamplesRendered, -#ifdef SPLIT_REND_WITH_HEAD_ROT pcm_resolution, -#endif data ) ) != IVAS_ERR_OK ) { return error; @@ -490,9 +437,7 @@ ivas_error ivas_ism_dec_config( if ( st_ivas->ism_mode != last_ism_mode ) { if ( ( error = ivas_ism_bitrate_switching_dec( st_ivas, nchan_transport_old, last_ism_mode, nSamplesRendered, -#ifdef SPLIT_REND_WITH_HEAD_ROT pcm_resolution, -#endif data ) ) != IVAS_ERR_OK ) { return error; diff --git a/lib_dec/ivas_ism_param_dec.c b/lib_dec/ivas_ism_param_dec.c index e8839f27037e5b1fa457c1eb517e1305d5aa8eee..78eef073c4e390b86876eb1bd30ca7acfd882440 100644 --- a/lib_dec/ivas_ism_param_dec.c +++ b/lib_dec/ivas_ism_param_dec.c @@ -388,11 +388,7 @@ static ivas_error ivas_param_ism_rendering_init( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for interpolator\n" ) ); } -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( !( output_config == IVAS_AUDIO_CONFIG_EXTERNAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) -#else - if ( !( output_config == IVAS_AUDIO_CONFIG_EXTERNAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) -#endif { /* computation of proto matrix */ ivas_ism_get_proto_matrix( hOutSetup, nchan_transport, hParamIsmRendering->proto_matrix ); @@ -545,13 +541,8 @@ ivas_error ivas_param_ism_dec_open( } } -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( !( output_config == IVAS_AUDIO_CONFIG_EXTERNAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB || output_config == IVAS_AUDIO_CONFIG_MONO || output_config == IVAS_AUDIO_CONFIG_STEREO || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) -#else - if ( !( output_config == IVAS_AUDIO_CONFIG_EXTERNAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB || - output_config == IVAS_AUDIO_CONFIG_MONO || output_config == IVAS_AUDIO_CONFIG_STEREO ) ) -#endif { /* Initialize efap handle */ if ( ( error = efap_init_data( &( st_ivas->hEFAPdata ), hOutSetup.ls_azimuth, hOutSetup.ls_elevation, hOutSetup.nchan_out_woLFE, EFAP_MODE_EFAP ) ) != IVAS_ERR_OK ) @@ -568,11 +559,7 @@ ivas_error ivas_param_ism_dec_open( hSpatParamRendCom->dirac_bs_md_write_idx = 0; hSpatParamRendCom->dirac_read_idx = 0; -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) -#else - if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) -#endif { if ( ( error = ivas_dirac_allocate_parameters( hSpatParamRendCom, 1 ) ) != IVAS_ERR_OK ) { diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 16a24af62ba3bc10c431098d961eb6acc1031b52..2ce6d0620247d6f4d2986fa8197b32a9ff97b887 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -143,13 +143,6 @@ ivas_error ivas_jbm_dec_tc( { hp20( p_output[n], output_frame, st_ivas->mem_hp20_out[n], output_Fs ); } -#ifndef FIX_944_REMOVE_LS_RENDERER_CALL_IN_STEREO - - if ( st_ivas->renderer_type == RENDERER_MC && st_ivas->hDecoderConfig->nchan_out == 1 ) - { - ivas_ls_setup_conversion( st_ivas, st_ivas->nchan_transport, output_frame, p_output, p_output ); - } -#endif } else if ( st_ivas->ivas_format == ISM_FORMAT ) { @@ -844,19 +837,13 @@ void ivas_jbm_dec_feed_tc_to_renderer( /* delay the objects here for all renderers where it is needed */ if ( -#ifdef SPLIT_REND_WITH_HEAD_ROT ( -#endif st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM || st_ivas->renderer_type == RENDERER_OSBA_AMBI || st_ivas->renderer_type == RENDERER_OSBA_LS || - st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_EXTERNAL -#ifdef SPLIT_REND_WITH_HEAD_ROT - ) && - ( st_ivas->hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED && st_ivas->hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) -#endif - ) + st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_EXTERNAL ) && + ( st_ivas->hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED && st_ivas->hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { for ( n = 0; n < st_ivas->nchan_ism; n++ ) { @@ -951,16 +938,12 @@ void ivas_jbm_dec_feed_tc_to_renderer( *--------------------------------------------------------------------------*/ ivas_error ivas_jbm_dec_render( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - const uint16_t nSamplesAsked, /* i : number of samples wanted */ - uint16_t *nSamplesRendered, /* o : number of samples rendered */ - uint16_t *nSamplesAvailableNext, /* o : number of samples still available in the rendering pipeline */ -#ifdef SPLIT_REND_WITH_HEAD_ROT + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const uint16_t nSamplesAsked, /* i : number of samples wanted */ + uint16_t *nSamplesRendered, /* o : number of samples rendered */ + uint16_t *nSamplesAvailableNext, /* o : number of samples still available in the rendering pipeline */ const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ void *data /* o : output synthesis signal */ -#else - int16_t *data /* o : output synthesis signal */ -#endif ) { int16_t n, nchan_out; @@ -973,9 +956,7 @@ ivas_error ivas_jbm_dec_render( float *p_output[MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS]; float *p_tc[MAX_TRANSPORT_CHANNELS + MAX_NUM_OBJECTS]; SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; -#ifdef SPLIT_REND_WITH_HEAD_ROT int16_t nchan_out_syn_output; -#endif push_wmops( "ivas_dec_render" ); /*----------------------------------------------------------------* @@ -1100,7 +1081,6 @@ ivas_error ivas_jbm_dec_render( /* Binaural rendering */ if ( st_ivas->renderer_type == RENDERER_BINAURAL_OBJECTS_TD ) { -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { if ( ( error = ivas_td_binaural_renderer_sf_splitBinaural( st_ivas, p_output, *nSamplesRendered ) ) != IVAS_ERR_OK ) @@ -1110,23 +1090,16 @@ ivas_error ivas_jbm_dec_render( } else { -#endif if ( ( error = ivas_td_binaural_renderer_sf( st_ivas, p_output, *nSamplesRendered ) ) != IVAS_ERR_OK ) { return error; } -#ifdef SPLIT_REND_WITH_HEAD_ROT } -#endif } else if ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) { -#if defined SPLIT_REND_WITH_HEAD_ROT if ( ( error = ivas_rend_crendProcessSubframe( st_ivas->hCrendWrapper, IVAS_AUDIO_CONFIG_7_1_4, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR, st_ivas->hDecoderConfig, NULL, NULL, NULL, st_ivas->hTcBuffer, p_output, p_output, *nSamplesRendered, output_Fs, 0 ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_rend_crendProcessSubframe( st_ivas->hCrendWrapper, IVAS_AUDIO_CONFIG_7_1_4, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR, st_ivas->hDecoderConfig, NULL, NULL, NULL, st_ivas->hTcBuffer, p_output, p_output, *nSamplesRendered, output_Fs ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -1293,7 +1266,6 @@ ivas_error ivas_jbm_dec_render( /* Rendering */ if ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) { -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { if ( ( error = ivas_rend_crendProcessSubframesSplitBin( st_ivas->hCrendWrapper, st_ivas->intern_config, st_ivas->hOutSetup.output_config, ( st_ivas->hSplitBinRend == NULL ) ? NULL : &st_ivas->hSplitBinRend->splitrend.multiBinPoseData, st_ivas->hDecoderConfig, st_ivas->hCombinedOrientationData, @@ -1304,25 +1276,16 @@ ivas_error ivas_jbm_dec_render( } else { -#endif -#if defined SPLIT_REND_WITH_HEAD_ROT if ( ( error = ivas_rend_crendProcessSubframe( st_ivas->hCrendWrapper, st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hDecoderConfig, st_ivas->hCombinedOrientationData, &st_ivas->hIntSetup, st_ivas->hEFAPdata, st_ivas->hTcBuffer, crendInPlaceRotation ? p_output : p_tc, p_output, *nSamplesRendered, output_Fs, 0 ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_rend_crendProcessSubframe( st_ivas->hCrendWrapper, st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hDecoderConfig, st_ivas->hCombinedOrientationData, - &st_ivas->hIntSetup, st_ivas->hEFAPdata, st_ivas->hTcBuffer, crendInPlaceRotation ? p_output : p_tc, p_output, *nSamplesRendered, output_Fs ) ) != IVAS_ERR_OK ) - -#endif { return error; } ivas_binaural_add_LFE( st_ivas, *nSamplesRendered, p_tc, p_output ); -#ifdef SPLIT_REND_WITH_HEAD_ROT } -#endif } else if ( st_ivas->renderer_type == RENDERER_MC ) { @@ -1336,7 +1299,6 @@ ivas_error ivas_jbm_dec_render( else if ( st_ivas->renderer_type == RENDERER_BINAURAL_OBJECTS_TD ) { -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { if ( ( error = ivas_td_binaural_renderer_sf_splitBinaural( st_ivas, p_output, *nSamplesRendered ) ) != IVAS_ERR_OK ) @@ -1346,16 +1308,13 @@ ivas_error ivas_jbm_dec_render( } else { -#endif if ( ( error = ivas_td_binaural_renderer_sf( st_ivas, p_output, *nSamplesRendered ) ) != IVAS_ERR_OK ) { return error; } ivas_binaural_add_LFE( st_ivas, *nSamplesRendered, p_tc, p_output ); -#ifdef SPLIT_REND_WITH_HEAD_ROT } -#endif } } else if ( st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) @@ -1366,10 +1325,8 @@ ivas_error ivas_jbm_dec_render( /* Rendering */ if ( ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) && !st_ivas->hDecoderConfig->Opt_Headrotation ) { -#ifdef SPLIT_REND_WITH_HEAD_ROT /*handled in CLDFB domain already*/ if ( output_config != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED && output_config != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) -#endif { ivas_binaural_add_LFE( st_ivas, *nSamplesRendered, p_output, p_output ); } @@ -1459,7 +1416,6 @@ ivas_error ivas_jbm_dec_render( st_ivas->hTcBuffer->n_samples_discard = 0; } -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { nchan_out_syn_output = BINAURAL_CHANNELS * st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses; @@ -1470,7 +1426,6 @@ ivas_error ivas_jbm_dec_render( } if ( st_ivas->hDecoderConfig->Opt_Limiter ) -#endif { if ( st_ivas->ivas_format != MONO_FORMAT ) { @@ -1480,21 +1435,14 @@ ivas_error ivas_jbm_dec_render( } } -#ifdef SPLIT_REND_WITH_HEAD_ROT switch ( pcm_resolution ) { case PCM_INT16: -#endif #ifdef DEBUGGING st_ivas->noClipping += #endif -#ifdef SPLIT_REND_WITH_HEAD_ROT ivas_syn_output( p_output, *nSamplesRendered, nchan_out_syn_output, (int16_t *) data ); -#else - ivas_syn_output( p_output, *nSamplesRendered, nchan_out, data ); -#endif -#ifdef SPLIT_REND_WITH_HEAD_ROT break; case PCM_FLOAT32: ivas_syn_output_f( p_output, *nSamplesRendered, nchan_out_syn_output, (float *) data ); @@ -1503,7 +1451,6 @@ ivas_error ivas_jbm_dec_render( error = IVAS_ERR_UNKNOWN; break; } -#endif *nSamplesAvailableNext = st_ivas->hTcBuffer->n_samples_available; @@ -1527,12 +1474,8 @@ ivas_error ivas_jbm_dec_flush_renderer( const MC_MODE mc_mode_old, /* i : old MC mode */ const ISM_MODE ism_mode_old, /* i : old ISM mode */ uint16_t *nSamplesRendered, /* o : number of samples flushed */ -#ifdef SPLIT_REND_WITH_HEAD_ROT - const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ - void *data /* o : output synthesis signal */ -#else - int16_t *data /* o : output synthesis signal */ -#endif + const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ + void *data /* o : output synthesis signal */ ) { ivas_error error; @@ -1621,13 +1564,8 @@ ivas_error ivas_jbm_dec_flush_renderer( ivas_ism_render_sf( st_ivas, p_output, hTcBuffer->n_samples_granularity ); -#if defined SPLIT_REND_WITH_HEAD_ROT if ( ( error = ivas_rend_crendProcessSubframe( st_ivas->hCrendWrapper, IVAS_AUDIO_CONFIG_7_1_4, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR, st_ivas->hDecoderConfig, NULL, NULL, NULL, st_ivas->hTcBuffer, p_output, p_output, hTcBuffer->n_samples_granularity, st_ivas->hDecoderConfig->output_Fs, 0 ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_rend_crendProcessSubframe( st_ivas->hCrendWrapper, IVAS_AUDIO_CONFIG_7_1_4, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR, st_ivas->hDecoderConfig, NULL, - NULL, NULL, st_ivas->hTcBuffer, p_output, p_output, hTcBuffer->n_samples_granularity, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -1644,24 +1582,15 @@ ivas_error ivas_jbm_dec_flush_renderer( { if ( renderer_type_old == RENDERER_BINAURAL_MIXER_CONV || renderer_type_old == RENDERER_BINAURAL_MIXER_CONV_ROOM ) { -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = ivas_rend_crendProcessSubframe( st_ivas->hCrendWrapper, intern_config_old, st_ivas->hOutSetup.output_config, st_ivas->hDecoderConfig, st_ivas->hCombinedOrientationData, hIntSetupOld, st_ivas->hEFAPdata, st_ivas->hTcBuffer, hTcBuffer->tc, p_output, hTcBuffer->n_samples_granularity, st_ivas->hDecoderConfig->output_Fs, 0 ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_rend_crendProcessSubframe( st_ivas->hCrendWrapper, intern_config_old, st_ivas->hOutSetup.output_config, st_ivas->hDecoderConfig, st_ivas->hCombinedOrientationData, - hIntSetupOld, st_ivas->hEFAPdata, st_ivas->hTcBuffer, hTcBuffer->tc, p_output, hTcBuffer->n_samples_granularity, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) -#endif { return error; } ivas_binaural_add_LFE( st_ivas, hTcBuffer->n_samples_granularity, st_ivas->hTcBuffer->tc, p_output ); } -#ifdef NONBE_FIX_999_JBM_MCT_FLUSH else if ( renderer_type_old == RENDERER_BINAURAL_OBJECTS_TD ) -#else - else if ( st_ivas->renderer_type == RENDERER_BINAURAL_OBJECTS_TD ) -#endif { if ( ( error = ivas_td_binaural_renderer_sf( st_ivas, p_output, hTcBuffer->n_samples_granularity ) ) != IVAS_ERR_OK ) { @@ -1670,12 +1599,10 @@ ivas_error ivas_jbm_dec_flush_renderer( ivas_binaural_add_LFE( st_ivas, hTcBuffer->n_samples_granularity, st_ivas->hTcBuffer->tc, p_output ); } -#ifdef NONBE_FIX_999_JBM_MCT_FLUSH else { return IVAS_ERROR( IVAS_ERR_WRONG_MODE, "Wrong renderer in MCT VoIP renderer flushing!" ); } -#endif } else { @@ -1766,9 +1693,7 @@ ivas_error ivas_jbm_dec_flush_renderer( *nSamplesRendered = n_samples_to_render; /* Only write out the valid data*/ -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( st_ivas->hDecoderConfig->Opt_Limiter ) -#endif { if ( st_ivas->ivas_format != MONO_FORMAT ) { @@ -1778,21 +1703,16 @@ ivas_error ivas_jbm_dec_flush_renderer( } } -#ifdef SPLIT_REND_WITH_HEAD_ROT switch ( pcm_resolution ) { case PCM_INT16: -#endif #ifdef DEBUGGING st_ivas->noClipping += #endif ivas_syn_output( p_output, *nSamplesRendered, st_ivas->hDecoderConfig->nchan_out, -#ifdef SPLIT_REND_WITH_HEAD_ROT (int16_t *) -#endif data ); -#ifdef SPLIT_REND_WITH_HEAD_ROT break; case PCM_FLOAT32: ivas_syn_output_f( p_output, *nSamplesRendered, st_ivas->hDecoderConfig->nchan_out, (float *) data ); @@ -1801,7 +1721,6 @@ ivas_error ivas_jbm_dec_flush_renderer( error = IVAS_ERR_UNKNOWN; break; } -#endif return IVAS_ERR_OK; } diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index bb43a73855f2504dc7e1b593b19e9c3b7239b3dc..6344ba3409db2546172b720b25bbe00eb973cda1 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -1238,14 +1238,10 @@ static int16_t decode_lfe_to_total_energy_ratio( *-------------------------------------------------------------------*/ ivas_error ivas_masa_dec_reconfigure( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - uint16_t *nSamplesRendered, /* o : number of samples flushed from the previous frame (JBM) */ -#ifdef SPLIT_REND_WITH_HEAD_ROT + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + uint16_t *nSamplesRendered, /* o : number of samples flushed from the previous frame (JBM) */ const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ void *data /* o : output synthesis signal */ -#else - int16_t *data /* o : output synthesis signal */ -#endif ) { int16_t n, tmp, num_bits; @@ -1255,9 +1251,7 @@ ivas_error ivas_masa_dec_reconfigure( int32_t ivas_total_brate, last_ivas_total_brate; int16_t numCldfbAnalyses_old, numCldfbSyntheses_old; ivas_error error; -#ifdef SPLIT_REND_WITH_HEAD_ROT int16_t pos_idx; -#endif int32_t ism_total_brate; error = IVAS_ERR_OK; @@ -1277,13 +1271,8 @@ ivas_error ivas_masa_dec_reconfigure( /* renderer might have changed, reselect */ ivas_renderer_select( st_ivas ); -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( st_ivas->renderer_type == RENDERER_DIRAC && st_ivas->hDirACRend == NULL ) || ( ( st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) && st_ivas->hDiracDecBin[0] == NULL ) ) -#else - if ( ( st_ivas->renderer_type == RENDERER_DIRAC && st_ivas->hDirACRend == NULL ) || - ( ( st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) && st_ivas->hDiracDecBin == NULL ) ) -#endif { /* init a new DirAC dec */ if ( ( error = ivas_dirac_dec_config( st_ivas, DIRAC_OPEN ) ) != IVAS_ERR_OK ) @@ -1296,11 +1285,7 @@ ivas_error ivas_masa_dec_reconfigure( if ( st_ivas->hDirAC != NULL ) { /* close all unnecessary parametric decoding and rendering */ -#ifdef SPLIT_REND_WITH_HEAD_ROT ivas_dirac_dec_close_binaural_data( st_ivas->hDiracDecBin ); -#else - ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin ); -#endif ivas_dirac_rend_close( &( st_ivas->hDirACRend ) ); ivas_spat_hSpatParamRendCom_close( &( st_ivas->hSpatParamRendCom ) ); ivas_dirac_dec_close( &( st_ivas->hDirAC ) ); @@ -1324,11 +1309,7 @@ ivas_error ivas_masa_dec_reconfigure( sts[0]->bit_stream = bit_stream + num_bits; num_bits += (int16_t) ( st_ivas->hSCE[sce_id]->element_brate / FRAMES_PER_SEC ); -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) && st_ivas->hDiracDecBin[0] != NULL ) -#else - if ( ( st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) && st_ivas->hDiracDecBin != NULL ) -#endif { if ( ( error = ivas_dirac_dec_config( st_ivas, DIRAC_RECONFIGURE ) ) != IVAS_ERR_OK ) { @@ -1354,11 +1335,7 @@ ivas_error ivas_masa_dec_reconfigure( { st_ivas->hCPE[cpe_id]->nchan_out = 1; -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( st_ivas->renderer_type == RENDERER_DIRAC && st_ivas->hDirACRend != NULL ) || ( ( st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) && st_ivas->hDiracDecBin[0] != NULL ) ) -#else - if ( ( st_ivas->renderer_type == RENDERER_DIRAC && st_ivas->hDirACRend != NULL ) || ( ( st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) && st_ivas->hDiracDecBin != NULL ) ) -#endif { if ( ( error = ivas_dirac_dec_config( st_ivas, DIRAC_RECONFIGURE ) ) != IVAS_ERR_OK ) { @@ -1370,11 +1347,7 @@ ivas_error ivas_masa_dec_reconfigure( { st_ivas->hCPE[cpe_id]->nchan_out = CPE_CHANNELS; -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( st_ivas->renderer_type == RENDERER_DIRAC && st_ivas->hDirACRend != NULL ) || ( ( st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) && st_ivas->hDiracDecBin[0] != NULL ) ) -#else - if ( ( st_ivas->renderer_type == RENDERER_DIRAC && st_ivas->hDirACRend != NULL ) || ( ( st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) && st_ivas->hDiracDecBin != NULL ) ) -#endif { if ( ( error = ivas_dirac_dec_config( st_ivas, DIRAC_RECONFIGURE ) ) != IVAS_ERR_OK ) { @@ -1384,7 +1357,6 @@ ivas_error ivas_masa_dec_reconfigure( } } -#ifdef SPLIT_REND_WITH_HEAD_ROT for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES; pos_idx++ ) { if ( st_ivas->hDiracDecBin[pos_idx] != NULL ) @@ -1393,30 +1365,15 @@ ivas_error ivas_masa_dec_reconfigure( st_ivas->hDiracDecBin[pos_idx]->reqularizationFactor = configure_reqularization_factor( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate ); } } -#else - if ( st_ivas->hDiracDecBin != NULL ) - { - /* regularization factor is bitrate-dependent */ - st_ivas->hDiracDecBin->reqularizationFactor = configure_reqularization_factor( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate ); - } -#endif if ( st_ivas->ivas_format == MASA_FORMAT && st_ivas->last_ivas_format == MASA_FORMAT ) /* note: switching within OMASA is handled in ivas_omasa_dec_config() */ { /*-----------------------------------------------------------------* * TD Decorrelator *-----------------------------------------------------------------*/ -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( st_ivas->hDiracDecBin[0] != NULL ) -#else - if ( st_ivas->hDiracDecBin != NULL ) -#endif { -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = ivas_td_decorr_reconfig_dec( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hDecoderConfig->output_Fs, &( st_ivas->hDiracDecBin[0]->hTdDecorr ), &( st_ivas->hDiracDecBin[0]->useTdDecorr ) ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_td_decorr_reconfig_dec( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hDecoderConfig->output_Fs, &( st_ivas->hDiracDecBin->hTdDecorr ), &( st_ivas->hDiracDecBin->useTdDecorr ) ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -1489,11 +1446,7 @@ ivas_error ivas_masa_dec_reconfigure( { if ( n_samples_granularity < st_ivas->hTcBuffer->n_samples_granularity ) { -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = ivas_jbm_dec_flush_renderer( st_ivas, n_samples_granularity, st_ivas->renderer_type, st_ivas->intern_config, &st_ivas->hIntSetup, MC_MODE_NONE, ISM_MASA_MODE_DISC, nSamplesRendered, pcm_resolution, data ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_jbm_dec_flush_renderer( st_ivas, n_samples_granularity, st_ivas->renderer_type, st_ivas->intern_config, &st_ivas->hIntSetup, MC_MODE_NONE, ISM_MASA_MODE_DISC, nSamplesRendered, data ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -1576,11 +1529,7 @@ void ivas_spar_param_to_masa_param_mapping( hSpatParamRendCom = st_ivas->hSpatParamRendCom; hSpatParamRendCom->numParametricDirections = 1; hSpatParamRendCom->numSimultaneousDirections = 1; -#ifdef SPLIT_REND_WITH_HEAD_ROT hDiffuseDist = st_ivas->hDiracDecBin[0]->hDiffuseDist; -#else - hDiffuseDist = st_ivas->hDiracDecBin->hDiffuseDist; -#endif nchan_transport = st_ivas->nchan_transport; band_grouping = hDirAC->band_grouping; hSpar = st_ivas->hSpar; diff --git a/lib_dec/ivas_mc_param_dec.c b/lib_dec/ivas_mc_param_dec.c index ee9c7f8ebe286257314183895ddf4397256e7d26..22ad5e34b45abf1b6be93158412bd92d565dcb09 100644 --- a/lib_dec/ivas_mc_param_dec.c +++ b/lib_dec/ivas_mc_param_dec.c @@ -1551,13 +1551,8 @@ void ivas_param_mc_dec_render( /*CLDFB*/ float Cldfb_RealBuffer[MAX_INTERN_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; float Cldfb_ImagBuffer[MAX_INTERN_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; -#ifdef SPLIT_REND_WITH_HEAD_ROT float Cldfb_RealBuffer_Binaural[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; float Cldfb_ImagBuffer_Binaural[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; -#else - float Cldfb_RealBuffer_Binaural[BINAURAL_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; - float Cldfb_ImagBuffer_Binaural[BINAURAL_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; -#endif /*Decorrelator*/ float onset_filter[MAX_CICP_CHANNELS * CLDFB_NO_CHANNELS_MAX]; /* format converter */ @@ -1753,7 +1748,6 @@ void ivas_param_mc_dec_render( if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) { -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { if ( st_ivas->hSplitBinRend->hCldfbDataOut != NULL ) @@ -1769,20 +1763,16 @@ void ivas_param_mc_dec_render( st_ivas->hSplitBinRend->hCldfbDataOut->config = st_ivas->hIntSetup.output_config; } } -#endif ivas_binRenderer( st_ivas->hBinRenderer, -#ifdef SPLIT_REND_WITH_HEAD_ROT ( st_ivas->hSplitBinRend == NULL ) ? NULL : &st_ivas->hSplitBinRend->splitrend.multiBinPoseData, #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG NULL, -#endif #endif st_ivas->hCombinedOrientationData, hParamMC->subframe_nbslots[subframe_idx], Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, Cldfb_RealBuffer, Cldfb_ImagBuffer ); -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { int16_t pos_idx; @@ -1798,7 +1788,6 @@ void ivas_param_mc_dec_render( } } } -#endif /* update combined orientation access index */ ivas_combined_orientation_update_index( st_ivas->hCombinedOrientationData, hParamMC->num_freq_bands * hParamMC->subframe_nbslots[subframe_idx] ); @@ -1822,13 +1811,8 @@ void ivas_param_mc_dec_render( { if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) { -#ifdef SPLIT_REND_WITH_HEAD_ROT RealBuffer[i] = Cldfb_RealBuffer_Binaural[0][ch][i]; ImagBuffer[i] = Cldfb_ImagBuffer_Binaural[0][ch][i]; -#else - RealBuffer[i] = Cldfb_RealBuffer_Binaural[ch][i]; - ImagBuffer[i] = Cldfb_ImagBuffer_Binaural[ch][i]; -#endif } else { diff --git a/lib_dec/ivas_mc_paramupmix_dec.c b/lib_dec/ivas_mc_paramupmix_dec.c index 5f0ef7afcf07d8e41a0d659b45919e561a38ac8b..60933be28cd6a930f5a287a1510c235e538d09a7 100644 --- a/lib_dec/ivas_mc_paramupmix_dec.c +++ b/lib_dec/ivas_mc_paramupmix_dec.c @@ -652,22 +652,15 @@ static void ivas_mc_paramupmix_dec_sf( int16_t subframeIdx, idx_in, maxBand; float Cldfb_RealBuffer_subfr[MAX_INTERN_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; float Cldfb_ImagBuffer_subfr[MAX_INTERN_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; -#ifdef SPLIT_REND_WITH_HEAD_ROT float Cldfb_RealBuffer_Binaural[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; float Cldfb_ImagBuffer_Binaural[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; int16_t slot_index_start; -#else - float Cldfb_RealBuffer_Binaural[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; - float Cldfb_ImagBuffer_Binaural[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; -#endif hMCParamUpmix = st_ivas->hMCParamUpmix; assert( hMCParamUpmix ); push_wmops( "ivas_mc_paramupmix_dec_sf" ); -#ifdef SPLIT_REND_WITH_HEAD_ROT slot_index_start = st_ivas->hTcBuffer->slots_rendered; -#endif for ( i = 0; i < MC_PARAMUPMIX_COMBINATIONS; i++ ) { pPcm_temp[2 * i] = output_f[i + 4]; /* un-decorrelated */ @@ -758,7 +751,6 @@ static void ivas_mc_paramupmix_dec_sf( } } -#ifdef SPLIT_REND_WITH_HEAD_ROT /*LFE handling for split rendering cases*/ if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { @@ -776,20 +768,16 @@ static void ivas_mc_paramupmix_dec_sf( st_ivas->hSplitBinRend->hCldfbDataOut->config = st_ivas->hIntSetup.output_config; } } -#endif /* Implement binaural rendering */ ivas_binRenderer( st_ivas->hBinRenderer, -#ifdef SPLIT_REND_WITH_HEAD_ROT ( st_ivas->hSplitBinRend == NULL ) ? NULL : &st_ivas->hSplitBinRend->splitrend.multiBinPoseData, -#endif st_ivas->hCombinedOrientationData, st_ivas->hTcBuffer->subframe_nbslots[subframeIdx], Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, Cldfb_RealBuffer_subfr, Cldfb_ImagBuffer_subfr ); -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { int16_t pos_idx; @@ -805,7 +793,6 @@ static void ivas_mc_paramupmix_dec_sf( } } } -#endif /* Implement CLDFB synthesis */ for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) @@ -815,13 +802,8 @@ static void ivas_mc_paramupmix_dec_sf( for ( slot_idx = 0; slot_idx < st_ivas->hTcBuffer->subframe_nbslots[subframeIdx]; slot_idx++ ) { -#ifdef SPLIT_REND_WITH_HEAD_ROT RealBuffer[slot_idx] = Cldfb_RealBuffer_Binaural[0][ch][slot_idx]; ImagBuffer[slot_idx] = Cldfb_ImagBuffer_Binaural[0][ch][slot_idx]; -#else - RealBuffer[slot_idx] = Cldfb_RealBuffer_Binaural[ch][slot_idx]; - ImagBuffer[slot_idx] = Cldfb_ImagBuffer_Binaural[ch][slot_idx]; -#endif } cldfbSynthesis( RealBuffer, ImagBuffer, &( output_f[ch][0] ), maxBand * st_ivas->hTcBuffer->subframe_nbslots[subframeIdx], st_ivas->cldfbSynDec[ch] ); diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index 1d23be888d57e925f2bbf796613dedaf36a5de3f..12b1fc71173e7f13a91af162efd0ead1c3cc7518 100644 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -54,11 +54,7 @@ * Local function prototypes *-----------------------------------------------------------------------*/ -#ifdef SPLIT_REND_WITH_HEAD_ROT static ivas_error ivas_mc_dec_reconfig( Decoder_Struct *st_ivas, uint16_t *nSamplesRendered, const PCM_RESOLUTION pcm_resolution, void *data ); -#else -static ivas_error ivas_mc_dec_reconfig( Decoder_Struct *st_ivas, uint16_t *nSamplesRendered, int16_t *data ); -#endif /*--------------------------------------------------------------------------* @@ -666,15 +662,11 @@ void ivas_mct_dec_close( /*! r : MC format mode */ ivas_error ivas_mc_dec_config( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - const int16_t idx, /* i : LS config. index */ - uint16_t *nSamplesRendered, /* o : samples flushed from last frame (JBM) */ -#ifdef SPLIT_REND_WITH_HEAD_ROT + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const int16_t idx, /* i : LS config. index */ + uint16_t *nSamplesRendered, /* o : samples flushed from last frame (JBM) */ const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ void *data /* o : output synthesis signal */ -#else - int16_t *data /* o : output synthesis signal */ -#endif ) { AUDIO_CONFIG signaled_config; @@ -702,11 +694,7 @@ ivas_error ivas_mc_dec_config( { if ( st_ivas->hDecoderConfig->last_ivas_total_brate != st_ivas->hDecoderConfig->ivas_total_brate || st_ivas->transport_config != signaled_config || last_mc_mode != st_ivas->mc_mode ) { -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = ivas_mc_dec_reconfig( st_ivas, nSamplesRendered, pcm_resolution, data ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_mc_dec_reconfig( st_ivas, nSamplesRendered, data ) ) != IVAS_ERR_OK ) -#endif { return error; @@ -728,14 +716,10 @@ ivas_error ivas_mc_dec_config( *-------------------------------------------------------------------------*/ static ivas_error ivas_mc_dec_reconfig( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - uint16_t *nSamplesRendered, /* o : number of samples flushed from the last frame (JBM) */ -#ifdef SPLIT_REND_WITH_HEAD_ROT + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + uint16_t *nSamplesRendered, /* o : number of samples flushed from the last frame (JBM) */ const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ void *data /* o : output synthesis signal */ -#else - int16_t *data /* o : output synthesis signal */ -#endif ) { int16_t nchan_transport_old, nSCE_old, nCPE_old, sba_dirac_stereo_flag_old, nchan_hp20_old; @@ -794,10 +778,8 @@ static ivas_error ivas_mc_dec_reconfig( ivas_output_init( &( st_ivas->hIntSetup ), st_ivas->intern_config ); /* transfer subframe info from DirAC or ParamMC to central tc buffer */ -#ifdef NONBE_FIX_1005_MC_RS_TCBUFFER_UPDATE if ( st_ivas->hTcBuffer->tc_buffer_mode != TC_BUFFER_MODE_BUFFER ) { -#endif if ( last_mc_mode == MC_MODE_PARAMMC ) { st_ivas->hTcBuffer->nb_subframes = st_ivas->hParamMC->nb_subframes; @@ -814,20 +796,14 @@ static ivas_error ivas_mc_dec_reconfig( st_ivas->hTcBuffer->slots_rendered = st_ivas->hSpatParamRendCom->slots_rendered; mvs2s( st_ivas->hSpatParamRendCom->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); } -#ifdef NONBE_FIX_1005_MC_RS_TCBUFFER_UPDATE } -#endif /* JBM: when granularity goes down (e.g. MCT with CREND -> ParamMC with binaural fastconv render what still fits in the new granularity */ tc_granularity_new = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, st_ivas->ivas_format, st_ivas->mc_mode, st_ivas->hDecoderConfig->output_Fs ); if ( tc_granularity_new < st_ivas->hTcBuffer->n_samples_granularity ) { -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = ivas_jbm_dec_flush_renderer( st_ivas, tc_granularity_new, renderer_type_old, intern_config_old, &hIntSetupOld, last_mc_mode, ISM_MODE_NONE, nSamplesRendered, pcm_resolution, data ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_jbm_dec_flush_renderer( st_ivas, tc_granularity_new, renderer_type_old, intern_config_old, &hIntSetupOld, last_mc_mode, ISM_MODE_NONE, nSamplesRendered, data ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -1206,11 +1182,7 @@ static ivas_error ivas_mc_dec_reconfig( output_config = st_ivas->hDecoderConfig->output_config; /* binaural renderers*/ - if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB -#ifdef SPLIT_REND_WITH_HEAD_ROT - || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM -#endif - ) + if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { /* remove unneeded binaural renderers */ if ( st_ivas->hBinRenderer != NULL && ( st_ivas->renderer_type != RENDERER_BINAURAL_FASTCONV && st_ivas->renderer_type != RENDERER_BINAURAL_FASTCONV_ROOM ) ) @@ -1218,18 +1190,10 @@ static ivas_error ivas_mc_dec_reconfig( ivas_binRenderer_close( &st_ivas->hBinRenderer ); } -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( st_ivas->hCrendWrapper != NULL ) && ( st_ivas->hCrendWrapper->hCrend[0] != NULL ) && ( st_ivas->renderer_type != RENDERER_BINAURAL_MIXER_CONV && st_ivas->renderer_type != RENDERER_BINAURAL_MIXER_CONV_ROOM && ( st_ivas->renderer_type != RENDERER_BINAURAL_OBJECTS_TD || st_ivas->hIntSetup.output_config != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) ) -#else - if ( ( st_ivas->hCrendWrapper != NULL ) && ( st_ivas->hCrendWrapper->hCrend != NULL ) && ( st_ivas->renderer_type != RENDERER_BINAURAL_MIXER_CONV && st_ivas->renderer_type != RENDERER_BINAURAL_MIXER_CONV_ROOM && ( st_ivas->renderer_type != RENDERER_BINAURAL_OBJECTS_TD || st_ivas->hIntSetup.output_config != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) ) -#endif { -#ifdef SPLIT_REND_WITH_HEAD_ROT ivas_rend_closeCrend( &( st_ivas->hCrendWrapper ), ( st_ivas->hSplitBinRend == NULL ) ? 1 : st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses ); -#else - ivas_rend_closeCrend( &( st_ivas->hCrendWrapper ) ); -#endif } if ( st_ivas->hBinRendererTd != NULL && ( st_ivas->renderer_type != RENDERER_BINAURAL_OBJECTS_TD ) ) @@ -1241,19 +1205,11 @@ static ivas_error ivas_mc_dec_reconfig( } } -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( st_ivas->hDiracDecBin[0] != NULL ) -#else - if ( st_ivas->hDiracDecBin != NULL ) -#endif { if ( st_ivas->renderer_type != RENDERER_BINAURAL_PARAMETRIC && st_ivas->renderer_type != RENDERER_BINAURAL_PARAMETRIC_ROOM && st_ivas->renderer_type != RENDERER_STEREO_PARAMETRIC ) { -#ifdef SPLIT_REND_WITH_HEAD_ROT ivas_dirac_dec_close_binaural_data( st_ivas->hDiracDecBin ); -#else - ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin ); -#endif } } @@ -1274,46 +1230,25 @@ static ivas_error ivas_mc_dec_reconfig( if ( st_ivas->hIntSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = ivas_rend_initCrendWrapper( &st_ivas->hCrendWrapper, 1 ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_rend_initCrendWrapper( &st_ivas->hCrendWrapper ) ) != IVAS_ERR_OK ) -#endif { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend Wrapper\n" ); } -#ifdef SPLIT_REND_WITH_HEAD_ROT st_ivas->hCrendWrapper->hCrend[0] = NULL; st_ivas->hCrendWrapper->hHrtfCrend = NULL; if ( ( st_ivas->hCrendWrapper->hCrend[0] = (CREND_HANDLE) malloc( sizeof( CREND_DATA ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend\n" ); } -#else - st_ivas->hCrendWrapper->hCrend = NULL; - st_ivas->hCrendWrapper->hHrtfCrend = NULL; - if ( ( st_ivas->hCrendWrapper->hCrend = (CREND_HANDLE) malloc( sizeof( CREND_DATA ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend\n" ); - } -#endif } } else if ( st_ivas->hCrendWrapper == NULL && ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) ) { -#ifdef SPLIT_REND_WITH_HEAD_ROT #ifdef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES if ( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hDecoderConfig->output_config, st_ivas->hRenderConfig, st_ivas->hSetOfHRTF, st_ivas->hHrtfStatistics, st_ivas->hDecoderConfig->output_Fs, st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses ) ) != IVAS_ERR_OK ) #else if ( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hDecoderConfig->output_config, st_ivas->hRenderConfig, st_ivas->hSetOfHRTF, st_ivas->hDecoderConfig->output_Fs, ( st_ivas->hSplitBinRend == NULL ) ? 1 : st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses ) ) != IVAS_ERR_OK ) -#endif -#else -#ifdef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES - if ( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hDecoderConfig->output_config, st_ivas->hRenderConfig, st_ivas->hSetOfHRTF, st_ivas->hHrtfStatistics, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hDecoderConfig->output_config, st_ivas->hRenderConfig, st_ivas->hSetOfHRTF, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) -#endif #endif { return error; diff --git a/lib_dec/ivas_objectRenderer_internal.c b/lib_dec/ivas_objectRenderer_internal.c index 118edba2bd5bbd5a0c329c6ff669a5613ef56a4d..d28bd60af529d6c8d04592b6ffecadeb5a0fd99b 100644 --- a/lib_dec/ivas_objectRenderer_internal.c +++ b/lib_dec/ivas_objectRenderer_internal.c @@ -188,11 +188,7 @@ ivas_error ivas_td_binaural_renderer_sf( return error; } -#ifdef NONBE_FIX_978_MC_TDREND_REVERB if ( st_ivas->hRenderConfig != NULL && st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) -#else - if ( st_ivas->hRenderConfig != NULL && st_ivas->hIntSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) -#endif { if ( ( error = ivas_reverb_process( st_ivas->hReverb, st_ivas->transport_config, 0, tc_local, p_reverb_signal, 0 ) ) != IVAS_ERR_OK ) { @@ -208,11 +204,7 @@ ivas_error ivas_td_binaural_renderer_sf( return error; } -#ifdef NONBE_FIX_978_MC_TDREND_REVERB if ( st_ivas->hRenderConfig != NULL && st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) -#else - if ( st_ivas->hRenderConfig != NULL && st_ivas->hIntSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) -#endif { /* add reverb to rendered signals */ v_add( reverb_signal[0], output_f_local[0], output_f_local[0], output_frame ); @@ -240,7 +232,6 @@ ivas_error ivas_td_binaural_renderer_sf( } -#ifdef SPLIT_REND_WITH_HEAD_ROT /*---------------------------------------------------------------------* * ivas_td_binaural_renderer_sf_splitBinaural() * @@ -379,4 +370,3 @@ ivas_error ivas_td_binaural_renderer_sf_splitBinaural( pop_wmops(); return IVAS_ERR_OK; } -#endif diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c index 924a524dd16dfe30bcb256eac76f24bdd0ac50fd..766635ac4c36a4ea58068be29d13f13d37920e3d 100644 --- a/lib_dec/ivas_omasa_dec.c +++ b/lib_dec/ivas_omasa_dec.c @@ -149,14 +149,10 @@ void ivas_omasa_data_close( *--------------------------------------------------------------------------*/ ivas_error ivas_omasa_dec_config( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - uint16_t *nSamplesRendered, /* o : number of samples flushed from the previous frame (JBM) */ -#ifdef SPLIT_REND_WITH_HEAD_ROT + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + uint16_t *nSamplesRendered, /* o : number of samples flushed from the previous frame (JBM) */ const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ void *data /* o : output synthesis signal */ -#else - int16_t *data /* o : output synthesis signal */ -#endif ) { int16_t k, sce_id, nSCE_old, nchan_hp20_old, numCldfbAnalyses_old, numCldfbSyntheses_old, n_MD; @@ -200,11 +196,7 @@ ivas_error ivas_omasa_dec_config( { st_ivas->hCPE[0]->nchan_out = 1; } -#ifdef SPLIT_REND_WITH_HEAD_ROT else if ( ( error = ivas_masa_dec_reconfigure( st_ivas, nSamplesRendered, pcm_resolution, data ) ) != IVAS_ERR_OK ) -#else - else if ( ( error = ivas_masa_dec_reconfigure( st_ivas, nSamplesRendered, data ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -376,17 +368,9 @@ ivas_error ivas_omasa_dec_config( * TD Decorrelator *-----------------------------------------------------------------*/ -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( st_ivas->hDiracDecBin[0] != NULL ) -#else - if ( st_ivas->hDiracDecBin != NULL ) -#endif { -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = ivas_td_decorr_reconfig_dec( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hDecoderConfig->output_Fs, &( st_ivas->hDiracDecBin[0]->hTdDecorr ), &( st_ivas->hDiracDecBin[0]->useTdDecorr ) ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_td_decorr_reconfig_dec( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hDecoderConfig->output_Fs, &( st_ivas->hDiracDecBin->hTdDecorr ), &( st_ivas->hDiracDecBin->useTdDecorr ) ) ) != IVAS_ERR_OK ) -#endif { return error; @@ -648,11 +632,9 @@ ivas_error ivas_omasa_dirac_td_binaural_jbm( float data_separated_objects[MAX_NUM_OBJECTS][L_FRAME48k]; ivas_error error; float *p_sepobj[MAX_NUM_OBJECTS]; -#ifdef SPLIT_REND_WITH_HEAD_ROT int16_t slot_idx_start; slot_idx_start = st_ivas->hSpatParamRendCom->slots_rendered; -#endif for ( n = 0; n < MAX_NUM_OBJECTS; n++ ) { @@ -665,7 +647,6 @@ ivas_error ivas_omasa_dirac_td_binaural_jbm( /* reset combined orientation access index before calling the td renderer */ ivas_combined_orientation_set_to_start_index( st_ivas->hCombinedOrientationData ); -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { int16_t slot_idx, num_cldfb_bands, nchan_transport_orig, cldfb_slots; @@ -703,7 +684,6 @@ ivas_error ivas_omasa_dirac_td_binaural_jbm( } else { -#endif if ( ( error = ivas_td_binaural_renderer_sf( st_ivas, p_sepobj, *nSamplesRendered ) ) != IVAS_ERR_OK ) { return error; @@ -712,9 +692,7 @@ ivas_error ivas_omasa_dirac_td_binaural_jbm( { v_add( output_f[n], p_sepobj[n], output_f[n], *nSamplesRendered ); } -#ifdef SPLIT_REND_WITH_HEAD_ROT } -#endif return IVAS_ERR_OK; } diff --git a/lib_dec/ivas_osba_dec.c b/lib_dec/ivas_osba_dec.c index 74321e83c98e65edded0302a793e39a48278be0a..0c19a6f0672cb07a70261982ddea24baa810912e 100644 --- a/lib_dec/ivas_osba_dec.c +++ b/lib_dec/ivas_osba_dec.c @@ -137,11 +137,9 @@ ivas_error ivas_osba_dirac_td_binaural_jbm( float output_separated_objects[BINAURAL_CHANNELS][L_FRAME48k]; // VE2SB: TBV float *p_sepobj[BINAURAL_CHANNELS]; int16_t channel_offset; -#ifdef SPLIT_REND_WITH_HEAD_ROT int16_t slot_idx_start; slot_idx_start = st_ivas->hSpatParamRendCom->slots_rendered; -#endif for ( n = 0; n < BINAURAL_CHANNELS; n++ ) { @@ -156,7 +154,6 @@ ivas_error ivas_osba_dirac_td_binaural_jbm( } -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { int16_t slot_idx, num_cldfb_bands, b, nchan_transport_orig; @@ -195,7 +192,6 @@ ivas_error ivas_osba_dirac_td_binaural_jbm( } else { -#endif if ( ( error = ivas_td_binaural_renderer_sf( st_ivas, p_sepobj, *nSamplesRendered ) ) != IVAS_ERR_OK ) { return error; @@ -209,10 +205,7 @@ ivas_error ivas_osba_dirac_td_binaural_jbm( output_f[n][i] = 0.5f * output_f[channel_offset + n][i] + 0.5f * p_sepobj[n][i]; } } - -#ifdef SPLIT_REND_WITH_HEAD_ROT } -#endif return IVAS_ERR_OK; } diff --git a/lib_dec/ivas_output_config.c b/lib_dec/ivas_output_config.c index 957810f74f597b69930a601672a1b4ea85fc0388..dbdb0df1624f6963ea650d78d1d74f7f585af684 100644 --- a/lib_dec/ivas_output_config.c +++ b/lib_dec/ivas_output_config.c @@ -76,21 +76,13 @@ void ivas_renderer_select( st_ivas->hCombinedOrientationData->shd_rot_max_order = -1; } - if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB -#ifdef SPLIT_REND_WITH_HEAD_ROT - || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM -#endif - ) + if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { if ( st_ivas->ivas_format == ISM_FORMAT ) { if ( st_ivas->ism_mode == ISM_MODE_PARAM ) { -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) -#else - if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL ) -#endif { *renderer_type = RENDERER_BINAURAL_PARAMETRIC; } @@ -101,11 +93,7 @@ void ivas_renderer_select( } else /* ISM_MODE_DISC */ { - if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB -#ifdef SPLIT_REND_WITH_HEAD_ROT - || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM -#endif - ) + if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { #ifdef DEBUGGING if ( st_ivas->hDecoderConfig->force_rend == FORCE_CLDFB_RENDERER ) @@ -140,11 +128,7 @@ void ivas_renderer_select( { *internal_config = output_config; -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) -#else - if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL ) -#endif { *renderer_type = RENDERER_BINAURAL_PARAMETRIC; } @@ -157,11 +141,7 @@ void ivas_renderer_select( { *internal_config = IVAS_AUDIO_CONFIG_HOA3; - if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL -#ifdef SPLIT_REND_WITH_HEAD_ROT - || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM -#endif - ) + if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { *renderer_type = RENDERER_BINAURAL_FASTCONV; } @@ -203,11 +183,7 @@ void ivas_renderer_select( { *internal_config = output_config; -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) -#else - if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL ) -#endif { *renderer_type = RENDERER_BINAURAL_PARAMETRIC; } @@ -220,11 +196,7 @@ void ivas_renderer_select( { *internal_config = transport_config; -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) -#else - if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) -#endif { #ifdef DEBUGGING if ( ( ( ( st_ivas->transport_config == IVAS_AUDIO_CONFIG_5_1 || st_ivas->transport_config == IVAS_AUDIO_CONFIG_7_1 ) && ( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation ) ) || ( st_ivas->hDecoderConfig->force_rend == FORCE_TD_RENDERER ) ) && st_ivas->mc_mode == MC_MODE_MCT && st_ivas->hDecoderConfig->force_rend != FORCE_CLDFB_RENDERER ) diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index a50dcf348162c95ffc5b7ad536305533969ee5f3..cff1eef75fbd878bdd7fe194355b7f4acc7879ea 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -101,14 +101,10 @@ void ivas_sba_set_cna_cng_flag( *-------------------------------------------------------------------*/ ivas_error ivas_sba_dec_reconfigure( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - uint16_t *nSamplesFlushed, /* o : number of samples flushed */ -#ifdef SPLIT_REND_WITH_HEAD_ROT + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + uint16_t *nSamplesFlushed, /* o : number of samples flushed */ const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ void *data /* o : output synthesis signal */ -#else - int16_t *data /* o : output synthesis signal */ -#endif ) { int16_t nchan_transport_old, nSCE_old, nCPE_old, nchan_hp20_old; @@ -179,11 +175,7 @@ ivas_error ivas_sba_dec_reconfigure( /* copy the logic from ivas_renderer_select(), because calling this function has too many side effects that would affect the flushing */ if ( ivas_get_sba_num_TCs( ivas_total_brate, sba_order_internal ) <= 2 ) { -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) -#else - if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL ) -#endif { renderer_type_new = RENDERER_BINAURAL_PARAMETRIC; } @@ -194,11 +186,7 @@ ivas_error ivas_sba_dec_reconfigure( } else { - if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL -#ifdef SPLIT_REND_WITH_HEAD_ROT - || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM -#endif - ) + if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { renderer_type_new = RENDERER_BINAURAL_FASTCONV; } @@ -224,11 +212,7 @@ ivas_error ivas_sba_dec_reconfigure( st_ivas->sba_analysis_order = sba_analysis_order_old_flush; st_ivas->hDecoderConfig->ivas_total_brate = last_ivas_total_brate; -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = ivas_jbm_dec_flush_renderer( st_ivas, granularity_new, st_ivas->renderer_type, st_ivas->intern_config, &st_ivas->hIntSetup, st_ivas->mc_mode, ism_mode_old, nSamplesFlushed, pcm_resolution, data ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_jbm_dec_flush_renderer( st_ivas, granularity_new, st_ivas->renderer_type, st_ivas->intern_config, &st_ivas->hIntSetup, st_ivas->mc_mode, ism_mode_old, nSamplesFlushed, data ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -558,21 +542,12 @@ ivas_error ivas_sba_dec_reconfigure( * TD Decorrelator *-----------------------------------------------------------------*/ -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( st_ivas->hDiracDecBin[0] != NULL ) { if ( ( error = ivas_td_decorr_reconfig_dec( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hDecoderConfig->output_Fs, &( st_ivas->hDiracDecBin[0]->hTdDecorr ), &( st_ivas->hDiracDecBin[0]->useTdDecorr ) ) ) != IVAS_ERR_OK ) { return error; } -#else - if ( st_ivas->hDiracDecBin != NULL ) - { - if ( ( error = ivas_td_decorr_reconfig_dec( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hDecoderConfig->output_Fs, &( st_ivas->hDiracDecBin->hTdDecorr ), &( st_ivas->hDiracDecBin->useTdDecorr ) ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif } /*-----------------------------------------------------------------* @@ -702,11 +677,7 @@ void ivas_sba_dec_digest_tc( ivas_spar_dec_digest_tc( st_ivas, st_ivas->nchan_transport, nCldfbSlots, nSamplesForRendering ); } -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( st_ivas->hDiracDecBin[0] != NULL && st_ivas->hDiracDecBin[0]->useTdDecorr ) -#else - if ( st_ivas->hDiracDecBin != NULL && ( st_ivas->hDiracDecBin->useTdDecorr ) ) -#endif { int16_t nSamplesLeftForTD, default_frame; float *decorr_signal[BINAURAL_CHANNELS]; @@ -725,17 +696,9 @@ void ivas_sba_dec_digest_tc( { int16_t nSamplesToDecorr = min( nSamplesLeftForTD, default_frame ); -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( st_ivas->hDiracDecBin[0]->hTdDecorr ) -#else - if ( st_ivas->hDiracDecBin->hTdDecorr ) -#endif { -#ifdef SPLIT_REND_WITH_HEAD_ROT ivas_td_decorr_process( st_ivas->hDiracDecBin[0]->hTdDecorr, p_tc, decorr_signal, nSamplesToDecorr ); -#else - ivas_td_decorr_process( st_ivas->hDiracDecBin->hTdDecorr, p_tc, decorr_signal, nSamplesToDecorr ); -#endif } for ( ch_idx = 0; ch_idx < BINAURAL_CHANNELS; ch_idx++ ) diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c index 7f166cdbbb70cf16ea7d7bd77e7090f49d6bfc2c..738d98172087e889fd802b23f733e69f9a861d1e 100644 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -1251,19 +1251,11 @@ void ivas_spar_dec_set_render_map( } -#ifdef FIX_997_REMOVE_SPAR_DEC_UPMIXER /*-------------------------------------------------------------------* * ivas_spar_dec_set_render_params() * * IVAS SPAR set rendering parameters *-------------------------------------------------------------------*/ -#else -/*-------------------------------------------------------------------* - * ivas_spar_dec_upmixer() - * - * IVAS SPAR upmixer - *-------------------------------------------------------------------*/ -#endif void ivas_spar_dec_set_render_params( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ @@ -1370,134 +1362,6 @@ void ivas_spar_dec_digest_tc( return; } -#ifndef FIX_997_REMOVE_SPAR_DEC_UPMIXER - -/*-------------------------------------------------------------------* - * ivas_spar_dec_upmixer() - * - * - *-------------------------------------------------------------------*/ - -void ivas_spar_dec_upmixer( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - float *output[], /* i/o: input/output audio channels */ - const int16_t nchan_internal, /* i : number of internal channels */ - const int16_t output_frame /* i : output frame length */ -) -{ - SPAR_DEC_HANDLE hSpar; - SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; - int16_t nchan_transport, nchan_out; - int16_t subframe_idx, n, i; - int16_t n_samples_sf; - float *output_f_local[MAX_OUTPUT_CHANNELS]; - float Pcm_tmp[MAX_OUTPUT_CHANNELS][L_FRAME48k]; - float *pPcm_tmp[MAX_OUTPUT_CHANNELS]; - int16_t nchan_internal_total; - int16_t sba_ch_offset; - - hSpar = st_ivas->hSpar; - nchan_transport = hSpar->hMdDec->spar_md_cfg.nchan_transport; - nchan_out = st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe; - n_samples_sf = JBM_CLDFB_SLOTS_IN_SUBFRAME * NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ); - - nchan_internal_total = nchan_internal; - sba_ch_offset = 0; - if ( st_ivas->ivas_format == SBA_ISM_FORMAT && st_ivas->ism_mode == ISM_SBA_MODE_DISC ) - { - nchan_internal_total += st_ivas->nchan_ism; - sba_ch_offset = st_ivas->nchan_ism; - } - - for ( n = 0; n < MAX_OUTPUT_CHANNELS; n++ ) - { - output_f_local[n] = output[n + sba_ch_offset]; - } - - for ( n = 0; n < nchan_internal_total; n++ ) - { - st_ivas->hTcBuffer->tc[n] = output[n]; - } - - /*---------------------------------------------------------------------* - * TD decorrelation - *---------------------------------------------------------------------*/ - - for ( i = 0; i < nchan_internal; i++ ) - { - pPcm_tmp[i] = Pcm_tmp[i]; - } - - if ( hSpar->hMdDec->td_decorr_flag ) - { - if ( hSpar->hTdDecorr ) - { - ivas_td_decorr_process( hSpar->hTdDecorr, output_f_local, pPcm_tmp, output_frame ); - - if ( hSpar->hTdDecorr->num_apd_outputs >= ( nchan_internal - nchan_transport ) ) - { - for ( i = 0; i < nchan_internal - nchan_transport; i++ ) - { - mvr2r( pPcm_tmp[hSpar->hTdDecorr->num_apd_outputs - 1 - i], st_ivas->hTcBuffer->tc[nchan_internal_total - 1 - i], output_frame ); - } - } - else - { - for ( i = 0; i < nchan_internal - nchan_transport; i++ ) - { - set_zero( st_ivas->hTcBuffer->tc[nchan_internal_total - 1 - i], output_frame ); - } - - for ( i = 0; i < hSpar->hTdDecorr->num_apd_outputs; i++ ) - { - mvr2r( pPcm_tmp[hSpar->hTdDecorr->num_apd_outputs - 1 - i], st_ivas->hTcBuffer->tc[nchan_internal_total - 1 - i], output_frame ); - } - } - } - } - - ivas_spar_dec_set_render_params( st_ivas, DEFAULT_JBM_CLDFB_TIMESLOTS ); - - if ( st_ivas->hDirAC != 0 ) - { - ivas_dirac_dec_set_md_map( st_ivas, DEFAULT_JBM_CLDFB_TIMESLOTS ); - } - - for ( subframe_idx = 0; subframe_idx < MAX_PARAM_SPATIAL_SUBFRAMES; subframe_idx++ ) - { - ivas_spar_dec_upmixer_sf( st_ivas, output_f_local, nchan_internal ); - - for ( n = 0; n < nchan_out; n++ ) - { - output_f_local[n] += n_samples_sf; - } - - /* update combined orientation access index */ - ivas_combined_orientation_update_index( st_ivas->hCombinedOrientationData, n_samples_sf ); - } - - for ( n = 0; n < nchan_internal_total; n++ ) - { - st_ivas->hTcBuffer->tc[n] = NULL; - } - - if ( st_ivas->hDirAC != NULL && st_ivas->hSpatParamRendCom != NULL ) - { - hSpatParamRendCom = st_ivas->hSpatParamRendCom; - if ( st_ivas->hDirAC->hConfig->dec_param_estim == 1 ) - { - hSpatParamRendCom->dirac_read_idx = ( hSpatParamRendCom->dirac_read_idx + DEFAULT_JBM_CLDFB_TIMESLOTS ) % hSpatParamRendCom->dirac_md_buffer_length; - } - else - { - hSpatParamRendCom->dirac_read_idx = ( hSpatParamRendCom->dirac_read_idx + DEFAULT_JBM_SUBFRAMES_5MS ) % hSpatParamRendCom->dirac_md_buffer_length; - } - } - - return; -} - -#endif /*-------------------------------------------------------------------* * ivas_spar_dec_upmixer_sf() @@ -1816,11 +1680,7 @@ void ivas_spar_dec_upmixer_sf( } else { - if ( ( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_FOA || !( st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL || st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB -#ifdef SPLIT_REND_WITH_HEAD_ROT - || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM -#endif - ) ) && + if ( ( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_FOA || !( st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL || st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) && !( st_ivas->ivas_format == SBA_ISM_FORMAT && st_ivas->ism_mode == ISM_SBA_MODE_DISC && st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) ) { for ( ts = 0; ts < hSpar->subframe_nbslots[hSpar->subframes_rendered]; ts++ ) diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index 165de91daba577d02ba7f133b7de6a4250afcf89..58b90dfee605de1a31b34086021f3010a0f73a8f 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -812,33 +812,7 @@ typedef struct renderer_struct } ISM_RENDERER_DATA, *ISM_RENDERER_HANDLE; -#ifndef SPLIT_REND_WITH_HEAD_ROT -/* Fastconv binaural data structure */ -typedef struct ivas_binaural_rendering_struct -{ - /* Common variables for all modules */ - IVAS_OUTPUT_SETUP_HANDLE hInputSetup; /* pointer to input spatial format for binaural renderer*/ - EFAP_HANDLE hEFAPdata; /* EFAP structure*/ - float *hoa_dec_mtx; /* pointer to HOA decoder mtx */ - int8_t rotInCldfb; /* Flag to enable rotation within bin Renderer in CLDFB*/ - int16_t max_band; /* band upto which rendering is performed */ - int16_t conv_band; /* band upto which convolution in cldfb domain is performed */ - int16_t timeSlots; /* number of time slots of binaural renderer */ - int16_t nInChannels; /* number input channels */ - int8_t render_lfe; /* Flag to render LFE in binaural rendering*/ - IVAS_FORMAT ivas_format; /* format; corresponds to st_ivas->ivas_format, unless the signal gets transormed to a different domain for rendering */ - - /* Convolution module structure */ - BINRENDERER_CONV_MODULE_HANDLE hBinRenConvModule; - - /* Variables related to reverberator module */ - float earlyPartEneCorrection[CLDFB_NO_CHANNELS_MAX]; - REVERB_STRUCT_HANDLE hReverb; - -} BINAURAL_RENDERER, *BINAURAL_RENDERER_HANDLE; -#endif -#ifdef SPLIT_REND_WITH_HEAD_ROT /*----------------------------------------------------------------------------------* * IVAS decoder specific ISAR wrapper structures *----------------------------------------------------------------------------------*/ @@ -867,7 +841,6 @@ typedef struct int16_t numTdSamplesPerChannelCached; } ISAR_DEC_SPLIT_REND_WRAPPER, *ISAR_DEC_SPLIT_REND_WRAPPER_HANDLE; -#endif /*----------------------------------------------------------------------------------* * MASA decoder structures @@ -1011,9 +984,7 @@ typedef struct decoder_config_structure int16_t force_rend; /* forced TD/CLDFB binaural renderer (for ISM and MC) */ #endif int16_t Opt_tsm; /* indicates whether time scaling modification is activated */ -#ifdef SPLIT_REND_WITH_HEAD_ROT int16_t Opt_Limiter; -#endif IVAS_RENDER_FRAMESIZE render_framesize; int16_t Opt_delay_comp; /* flag indicating delay compensation active */ @@ -1094,11 +1065,7 @@ typedef struct Decoder_Struct BINAURAL_RENDERER_HANDLE hBinRenderer; /* fastconv binaural renderer handle */ BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd; /* Time domain binaural object renderer handle */ TDREND_HRFILT_FiltSet_t *hHrtfTD; /* pointer to HRTF data for TD renderer */ -#ifdef SPLIT_REND_WITH_HEAD_ROT DIRAC_DEC_BIN_HANDLE hDiracDecBin[MAX_HEAD_ROT_POSES]; /* parametric binaural renderer handle */ -#else - DIRAC_DEC_BIN_HANDLE hDiracDecBin; /* parametric binaural renderer handle */ -#endif LSSETUP_CONVERSION_HANDLE hLsSetUpConversion; /* MC LS configuration convertion handle */ EFAP_HANDLE hEFAPdata; /* EFAP structure */ VBAP_HANDLE hVBAPdata; /* VBAP structure */ @@ -1125,10 +1092,8 @@ typedef struct Decoder_Struct int16_t flag_omasa_brate; -#ifdef SPLIT_REND_WITH_HEAD_ROT ISAR_DEC_SPLIT_REND_WRAPPER_HANDLE hSplitBinRend; /* ISAR split binaural rendering handle */ BINAURAL_TD_OBJECT_RENDERER_HANDLE hTdRendHandles[MAX_HEAD_ROT_POSES - 1]; -#endif /* JBM module */ DECODER_TC_BUFFER_HANDLE hTcBuffer; /* JBM structure */ diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 2150caa03a1fac6fd6f48c1e3ecfea35b0530539..ea140b8def1a08f7b1a251c58a3e0ee241e34c8c 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -108,27 +108,17 @@ static ivas_error evs_dec_main( Decoder_Struct *st_ivas, const int16_t nOutSampl static ivas_error input_format_API_to_internal( IVAS_DEC_INPUT_FORMAT input_format, int16_t *bitstream_format_internal, int16_t *sdp_hf_only, const bool is_voip_enabled ); static void init_decoder_config( DECODER_CONFIG_HANDLE hDecoderConfig ); static ivas_error IVAS_DEC_VoIP_reconfigure( IVAS_DEC_HANDLE hIvasDec, const uint16_t nTransportChannels, const uint16_t l_ts ); -#ifdef SPLIT_REND_WITH_HEAD_ROT static ivas_error IVAS_DEC_Setup( IVAS_DEC_HANDLE hIvasDec, uint16_t *nTcBufferGranularity, uint8_t *nTransportChannels, uint8_t *nOutChannels, uint16_t *nSamplesRendered, const IVAS_DEC_PCM_TYPE pcmType, void *data ); -#else -static ivas_error IVAS_DEC_Setup( IVAS_DEC_HANDLE hIvasDec, uint16_t *nTcBufferGranularity, uint8_t *nTransportChannels, uint8_t *nOutChannels, uint16_t *nSamplesRendered, int16_t *data ); -#endif static ivas_error IVAS_DEC_GetTcSamples( IVAS_DEC_HANDLE hIvasDec, float *pcmBuf, int16_t *nOutSamples ); static ivas_error IVAS_DEC_RendererFeedTcSamples( IVAS_DEC_HANDLE hIvasDec, const int16_t nSamplesForRendering, int16_t *nSamplesResidual, float *pcmBuf ); -#ifdef SPLIT_REND_WITH_HEAD_ROT static ivas_error IVAS_DEC_GetRenderedSamples( IVAS_DEC_HANDLE hIvasDec, const uint16_t nSamplesForRendering, uint16_t *nSamplesRendered, uint16_t *nSamplesAvailableNext, const IVAS_DEC_PCM_TYPE pcmType, void *pcmBuf ); -#else -static ivas_error IVAS_DEC_GetRenderedSamples( IVAS_DEC_HANDLE hIvasDec, const uint16_t nSamplesForRendering, uint16_t *nSamplesRendered, uint16_t *nSamplesAvailableNext, int16_t *pcmBuf ); -#endif static ivas_error IVAS_DEC_GetBufferedNumberOfSamples( IVAS_DEC_HANDLE hIvasDec, int16_t *nSamplesBuffered ); -#ifdef SPLIT_REND_WITH_HEAD_ROT static PCM_RESOLUTION pcm_type_API_to_internal( const IVAS_DEC_PCM_TYPE pcmType ); static void *pcm_buffer_offset( void *buffer, const IVAS_DEC_PCM_TYPE pcmType, const int32_t offset ); static ivas_error set_pcm_buffer_to_zero( void *buffer, const IVAS_DEC_PCM_TYPE pcmType, const int16_t nZeroSamples ); static ivas_error isar_set_split_rend_setup( ISAR_DEC_SPLIT_REND_WRAPPER *hSplitBinRend, const ISAR_SPLIT_REND_CONFIG_DATA *hSplitBinConfig, const COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, ISAR_SPLIT_REND_BITS_DATA *splitRendBits ); static ivas_error ivas_create_handle_isar( ISAR_DEC_SPLIT_REND_WRAPPER_HANDLE *hSplitBinRend_out ); static void ivas_destroy_handle_isar( ISAR_DEC_SPLIT_REND_WRAPPER_HANDLE *hSplitBinRend_out ); -#endif static int16_t get_render_frame_size_ms( IVAS_RENDER_FRAMESIZE render_framesize ); @@ -250,7 +240,6 @@ ivas_error IVAS_DEC_Open( return IVAS_ERR_WRONG_PARAMS; } -#ifdef SPLIT_REND_WITH_HEAD_ROT /*-------------------------------------------------------------------------* * isar_set_split_rend_setup() * @@ -270,10 +259,8 @@ static ivas_error isar_set_split_rend_setup( splitRendBits->codec = ISAR_SPLIT_REND_CODEC_DEFAULT; splitRendBits->pose_correction = ISAR_SPLIT_REND_POSE_CORRECTION_MODE_NONE; splitRendBits->codec_frame_size_ms = 0; -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS splitRendBits->isar_frame_size_ms = 0; splitRendBits->lc3plus_highres = 0; -#endif if ( ( hSplitBinRend->hMultiBinCldfbData = (ISAR_DEC_SPLIT_REND_MULTI_BIN_CLDFB_DATA_HANDLE) malloc( sizeof( ISAR_DEC_SPLIT_REND_MULTI_BIN_CLDFB_DATA ) ) ) == NULL ) { @@ -289,7 +276,6 @@ static ivas_error isar_set_split_rend_setup( return IVAS_ERR_OK; } -#endif /*---------------------------------------------------------------------* * init_decoder_config() @@ -312,9 +298,7 @@ static void init_decoder_config( hDecoderConfig->Opt_non_diegetic_pan = 0; hDecoderConfig->non_diegetic_pan_gain = 0; hDecoderConfig->Opt_tsm = 0; -#ifdef SPLIT_REND_WITH_HEAD_ROT hDecoderConfig->Opt_Limiter = 1; -#endif hDecoderConfig->Opt_delay_comp = 0; hDecoderConfig->Opt_ExternalOrientation = 0; hDecoderConfig->Opt_dpid_on = 0; @@ -346,10 +330,8 @@ void IVAS_DEC_Close( ( *phIvasDec )->hVoIP = NULL; } -#ifdef SPLIT_REND_WITH_HEAD_ROT /* destroy Split binaural renderer (ISAR) handle */ ivas_destroy_handle_isar( &( *phIvasDec )->st_ivas->hSplitBinRend ); -#endif if ( ( *phIvasDec )->st_ivas ) { @@ -502,12 +484,10 @@ ivas_error IVAS_DEC_Configure( hDecoderConfig->render_framesize = renderFramesize; } -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { hDecoderConfig->Opt_Headrotation = TRUE; } -#endif /* Set decoder parameters to initial values */ if ( ( error = ivas_init_decoder_front( st_ivas ) ) != IVAS_ERR_OK ) @@ -515,7 +495,6 @@ ivas_error IVAS_DEC_Configure( return error; } -#ifdef SPLIT_REND_WITH_HEAD_ROT /* create ISAR handle */ if ( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { @@ -524,7 +503,6 @@ ivas_error IVAS_DEC_Configure( return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for ISAR handle" ); } } -#endif if ( hIvasDec->mode == IVAS_DEC_MODE_EVS ) { @@ -542,7 +520,6 @@ ivas_error IVAS_DEC_Configure( } -#ifdef SPLIT_REND_WITH_HEAD_ROT /*---------------------------------------------------------------------* * IVAS_DEC_EnableSplitRendering( ) * @@ -573,7 +550,6 @@ ivas_error IVAS_DEC_EnableSplitRendering( return error; } -#endif /*---------------------------------------------------------------------* @@ -904,16 +880,12 @@ ivas_error IVAS_DEC_FeedFrame_Serial( ivas_error IVAS_DEC_GetSamples( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - const int16_t nSamplesAsked, /* i : number of samples wanted by the caller */ -#ifdef SPLIT_REND_WITH_HEAD_ROT + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + const int16_t nSamplesAsked, /* i : number of samples wanted by the caller */ const IVAS_DEC_PCM_TYPE pcmType, /* i : type for the decoded PCM resolution */ void *pcmBuf, /* o : output synthesis signal */ -#else - int16_t *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 */ -#endif - int16_t *nOutSamples, /* o : number of samples per channel written to output buffer */ - bool *needNewFrame /* o :indication that the decoder needs a new frame */ + int16_t *nOutSamples, /* o : number of samples per channel written to output buffer */ + bool *needNewFrame /* o :indication that the decoder needs a new frame */ ) { ivas_error error; @@ -943,7 +915,6 @@ ivas_error IVAS_DEC_GetSamples( return error; } -#ifdef SPLIT_REND_WITH_HEAD_ROT /*----------------------------------------------------------------* * Binaural split rendering setup *----------------------------------------------------------------*/ @@ -952,7 +923,6 @@ ivas_error IVAS_DEC_GetSamples( { isar_set_split_rend_ht_setup( &hIvasDec->st_ivas->hSplitBinRend->splitrend, hIvasDec->st_ivas->hCombinedOrientationData->Quaternions, hIvasDec->st_ivas->hCombinedOrientationData->Rmat ); } -#endif hIvasDec->updateOrientation = false; } @@ -987,11 +957,7 @@ ivas_error IVAS_DEC_GetSamples( { /* setup */ -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = IVAS_DEC_Setup( hIvasDec, &l_ts, &nTransportChannels, &nOutChannels, &nSamplesRendered_loop, pcmType, pcm_buffer_offset( pcmBuf, pcmType, nSamplesRendered * nOutChannels ) ) ) != IVAS_ERR_OK ) -#else - if ( ( error = IVAS_DEC_Setup( hIvasDec, &l_ts, &nTransportChannels, &nOutChannels, &nSamplesRendered_loop, pcmBuf + nSamplesRendered * nOutChannels ) ) != IVAS_ERR_OK ) -#endif { return error; @@ -1058,11 +1024,7 @@ ivas_error IVAS_DEC_GetSamples( /* render IVAS frames directly to the output buffer */ nSamplesToRender = nSamplesAsked - nSamplesRendered; -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = IVAS_DEC_GetRenderedSamples( hIvasDec, nSamplesToRender, &nSamplesRendered_loop, &hIvasDec->nSamplesAvailableNext, pcmType, pcm_buffer_offset( pcmBuf, pcmType, nSamplesRendered * nOutChannels ) ) ) != IVAS_ERR_OK ) -#else - if ( ( error = IVAS_DEC_GetRenderedSamples( hIvasDec, nSamplesToRender, &nSamplesRendered_loop, &hIvasDec->nSamplesAvailableNext, pcmBuf + nSamplesRendered * nOutChannels ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -1087,7 +1049,6 @@ ivas_error IVAS_DEC_GetSamples( } -#ifdef SPLIT_REND_WITH_HEAD_ROT /*---------------------------------------------------------------------* * IVAS_DEC_GetSplitBinauralBitstream( ) * @@ -1243,9 +1204,7 @@ IVAS_DEC_GetSplitBinauralBitstream( Quaternion, st_ivas->hRenderConfig->split_rend_config.splitRendBitRate, st_ivas->hRenderConfig->split_rend_config.codec, -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS st_ivas->hRenderConfig->split_rend_config.isar_frame_size_ms, -#endif st_ivas->hRenderConfig->split_rend_config.codec_frame_size_ms, splitRendBits, Cldfb_RealBuffer_Binaural, @@ -1280,7 +1239,6 @@ IVAS_DEC_GetSplitBinauralBitstream( return error; } -#endif /*---------------------------------------------------------------------* @@ -1290,17 +1248,13 @@ IVAS_DEC_GetSplitBinauralBitstream( *---------------------------------------------------------------------*/ static ivas_error IVAS_DEC_Setup( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - uint16_t *nTcBufferGranularity, /* o : granularity of the TC Buffer */ - uint8_t *nTransportChannels, /* o : number of decoded transport PCM channels */ - uint8_t *nOutChannels, /* o : number of decoded out channels (PCM or CLDFB) */ - uint16_t *nSamplesRendered, /* o : number of samples flushed from the last frame */ -#ifdef SPLIT_REND_WITH_HEAD_ROT + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + uint16_t *nTcBufferGranularity, /* o : granularity of the TC Buffer */ + uint8_t *nTransportChannels, /* o : number of decoded transport PCM channels */ + uint8_t *nOutChannels, /* o : number of decoded out channels (PCM or CLDFB) */ + uint16_t *nSamplesRendered, /* o : number of samples flushed from the last frame */ const IVAS_DEC_PCM_TYPE pcmType, /* i : type for the decoded PCM resolution */ void *data /* o : output synthesis signal */ -#else - int16_t *data /* o : output synthesis signal */ -#endif ) { ivas_error error; @@ -1336,11 +1290,7 @@ static ivas_error IVAS_DEC_Setup( if ( st_ivas->bfi == 0 ) { -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = ivas_dec_setup( st_ivas, nSamplesRendered, pcm_type_API_to_internal( pcmType ), data ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_dec_setup( st_ivas, nSamplesRendered, data ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -1446,13 +1396,8 @@ static ivas_error IVAS_DEC_GetRenderedSamples( const uint16_t nSamplesForRendering, /* i : number of TC samples wanted from the renderer */ uint16_t *nSamplesRendered, /* o : number of samples rendered */ uint16_t *nSamplesAvailableNext, /* o : number of samples still available in the renerer pipeline */ -#ifdef SPLIT_REND_WITH_HEAD_ROT const IVAS_DEC_PCM_TYPE pcmType, - void *pcmBuf -#else - int16_t *pcmBuf -#endif -) + void *pcmBuf ) { Decoder_Struct *st_ivas; ivas_error error; @@ -1465,11 +1410,7 @@ static ivas_error IVAS_DEC_GetRenderedSamples( st_ivas = hIvasDec->st_ivas; /* run the main IVAS decoding routine */ -#ifdef SPLIT_REND_WITH_HEAD_ROT error = ivas_jbm_dec_render( st_ivas, nSamplesForRendering, nSamplesRendered, nSamplesAvailableNext, pcm_type_API_to_internal( pcmType ), pcmBuf ); -#else - error = ivas_jbm_dec_render( st_ivas, nSamplesForRendering, nSamplesRendered, nSamplesAvailableNext, pcmBuf ); -#endif return error; } @@ -1744,15 +1685,11 @@ ivas_error IVAS_DEC_GetMasaMetadata( *---------------------------------------------------------------------*/ 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 */ -#ifdef SPLIT_REND_WITH_HEAD_ROT + 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 int16_t subframe_idx, /* i : subframe index */ const ISAR_SPLIT_REND_ROT_AXIS rot_axis /* i : external control for rotation axis for split rendering */ -#else - const int16_t subframe_idx /* i : subframe index */ -#endif ) { HEAD_TRACK_DATA_HANDLE hHeadTrackData; @@ -1786,9 +1723,7 @@ ivas_error IVAS_DEC_FeedHeadTrackData( hHeadTrackData->Pos[subframe_idx].y = Pos.y; hHeadTrackData->Pos[subframe_idx].z = Pos.z; -#ifdef SPLIT_REND_WITH_HEAD_ROT hHeadTrackData->sr_pose_pred_axis = rot_axis; -#endif hIvasDec->updateOrientation = true; return IVAS_ERR_OK; @@ -2102,24 +2037,18 @@ static ivas_error copyRendererConfigStruct( mvr2r( hRCin->roomAcoustics.pAcoustic_rt60, hRCout->roomAcoustics.pAcoustic_rt60, CLDFB_NO_CHANNELS_MAX ); mvr2r( hRCin->roomAcoustics.pAcoustic_dsr, hRCout->roomAcoustics.pAcoustic_dsr, CLDFB_NO_CHANNELS_MAX ); mvr2r( hRCin->directivity, hRCout->directivity, 3 * MAX_NUM_OBJECTS ); -#ifdef SPLIT_REND_WITH_HEAD_ROT /* TODO: This seems wrong. Why set default instead of copying from hRCin? * Currently seems to work because we only ever copy from a default-initialized handle anyway */ hRCout->split_rend_config.splitRendBitRate = SPLIT_REND_768k; hRCout->split_rend_config.dof = 3; hRCout->split_rend_config.hq_mode = 0; hRCout->split_rend_config.codec_delay_ms = 0; -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS hRCout->split_rend_config.isar_frame_size_ms = 20; -#endif hRCout->split_rend_config.codec_frame_size_ms = 0; /* 0 means "use default for selected codec" */ hRCout->split_rend_config.codec = ISAR_SPLIT_REND_CODEC_DEFAULT; hRCout->split_rend_config.poseCorrectionMode = ISAR_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB; hRCout->split_rend_config.rendererSelection = hRCin->split_rend_config.rendererSelection; -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS hRCout->split_rend_config.lc3plus_highres = hRCin->split_rend_config.lc3plus_highres; -#endif -#endif hRCout->roomAcoustics.use_er = hRCin->roomAcoustics.use_er; hRCout->roomAcoustics.lowComplexity = hRCin->roomAcoustics.lowComplexity; @@ -2176,9 +2105,7 @@ ivas_error IVAS_DEC_FeedRenderConfig( ) { RENDER_CONFIG_HANDLE hRenderConfig; -#ifdef SPLIT_REND_WITH_HEAD_ROT ivas_error error; -#endif if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL || hIvasDec->st_ivas->hRenderConfig == NULL ) { @@ -2219,7 +2146,6 @@ ivas_error IVAS_DEC_FeedRenderConfig( mvr2r( renderConfig.directivity, hRenderConfig->directivity, 3 * MAX_NUM_OBJECTS ); -#ifdef SPLIT_REND_WITH_HEAD_ROT hRenderConfig->split_rend_config = renderConfig.split_rend_config; /* Overwrite any pose correction settings if 0 DOF (no pose correction) was selected */ @@ -2232,7 +2158,6 @@ ivas_error IVAS_DEC_FeedRenderConfig( { return error; } -#endif return IVAS_ERR_OK; } @@ -2267,11 +2192,7 @@ ivas_error IVAS_DEC_GetDelay( st_ivas = hIvasDec->st_ivas; hDecoderConfig = st_ivas->hDecoderConfig; -#ifdef SPLIT_REND_WITH_HEAD_ROT nSamples[1] = NS2SA( hDecoderConfig->output_Fs, get_delay( DEC, hDecoderConfig->output_Fs, st_ivas->ivas_format, st_ivas->cldfbAnaDec[0], hDecoderConfig->output_config ) ); -#else - nSamples[1] = NS2SA( hDecoderConfig->output_Fs, get_delay( DEC, hDecoderConfig->output_Fs, st_ivas->ivas_format, st_ivas->cldfbAnaDec[0] ) ); -#endif nSamples[2] = (int16_t) roundf( (float) st_ivas->binaural_latency_ns * hDecoderConfig->output_Fs / 1000000000.f ); nSamples[0] = nSamples[1] + nSamples[2]; @@ -2544,12 +2465,8 @@ ivas_error IVAS_DEC_TSM_SetQuality( ivas_error IVAS_DEC_VoIP_GetSamples( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ uint16_t nSamplesPerChannel, /* i : number of samples per channel requested to be written to output buffer */ -#ifdef SPLIT_REND_WITH_HEAD_ROT const IVAS_DEC_PCM_TYPE pcmType, void *pcmBuf, -#else - int16_t *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 */ -#endif const uint32_t systemTimestamp_ms /* i : current system timestamp */ #ifdef SUPPORT_JBM_TRACEFILE , @@ -2700,11 +2617,7 @@ ivas_error IVAS_DEC_VoIP_GetSamples( /* codec mode to use not known yet - simply output silence */ /* directly set output zero */ int16_t nSamplesToZero = min( nSamplesPerChannel, hIvasDec->nSamplesAvailableNext ); -#ifdef SPLIT_REND_WITH_HEAD_ROT set_pcm_buffer_to_zero( pcm_buffer_offset( pcmBuf, pcmType, nSamplesRendered * nOutChannels ), pcmType, nSamplesToZero * nOutChannels ); -#else - set_s( pcmBuf + nSamplesRendered * nOutChannels, 0, nSamplesToZero * nOutChannels ); -#endif nSamplesRendered += nSamplesToZero; hIvasDec->nSamplesRendered += nSamplesToZero; hIvasDec->nSamplesAvailableNext -= nSamplesToZero; @@ -2716,11 +2629,7 @@ ivas_error IVAS_DEC_VoIP_GetSamples( nSamplesToRender = nSamplesPerChannel - nSamplesRendered; /* render IVAS frames directly to the output buffer */ -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = IVAS_DEC_GetSamples( hIvasDec, nSamplesToRender, pcmType, pcm_buffer_offset( pcmBuf, pcmType, nSamplesRendered * nOutChannels ), &nSamplesRendered_loop, &tmp ) ) != IVAS_ERR_OK ) -#else - if ( ( error = IVAS_DEC_GetSamples( hIvasDec, nSamplesToRender, pcmBuf + nSamplesRendered * nOutChannels, &nSamplesRendered_loop, &tmp ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -2742,12 +2651,8 @@ ivas_error IVAS_DEC_VoIP_GetSamples( ivas_error IVAS_DEC_Flush( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ const int16_t nSamplesPerChannel, /* i : number of samples per channel requested to be written to output buffer */ -#ifdef SPLIT_REND_WITH_HEAD_ROT const IVAS_DEC_PCM_TYPE pcmType, void *pcmBuf, -#else - int16_t *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 */ -#endif int16_t *nSamplesFlushed /* o : number of samples flushed */ ) { @@ -2760,11 +2665,7 @@ ivas_error IVAS_DEC_Flush( nSamplesToRender = (uint16_t) *nSamplesFlushed; /* render IVAS frames */ -#ifdef SPLIT_REND_WITH_HEAD_ROT error = IVAS_DEC_GetRenderedSamples( hIvasDec, nSamplesToRender, &nSamplesFlushedLocal, &hIvasDec->nSamplesAvailableNext, pcmType, pcmBuf ); -#else - error = IVAS_DEC_GetRenderedSamples( hIvasDec, nSamplesToRender, &nSamplesFlushedLocal, &hIvasDec->nSamplesAvailableNext, pcmBuf ); -#endif return error; } @@ -3031,11 +2932,7 @@ static ivas_error printConfigInfo_dec( get_channel_config( output_config, &config_str[0] ); fprintf( stdout, "Output configuration: %s\n", config_str ); -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) -#else - if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) -#endif { fprintf( stdout, "Render framesize: %dms\n", get_render_frame_size_ms( st_ivas->hDecoderConfig->render_framesize ) ); } @@ -3603,7 +3500,6 @@ static ivas_error IVAS_DEC_VoIP_reconfigure( } -#ifdef SPLIT_REND_WITH_HEAD_ROT /*---------------------------------------------------------------------* * IVAS_DEC_GetSplitRendBitstreamHeader() * @@ -3615,15 +3511,10 @@ IVAS_DEC_GetSplitRendBitstreamHeader( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ ISAR_SPLIT_REND_CODEC *pCodec, /* o: pointer to codec setting */ ISAR_SPLIT_REND_POSE_CORRECTION_MODE *poseCorrection, /* o: pointer to pose correction mode */ -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS - int16_t *pIsar_frame_size_ms, /* o: pointer to isar frame size setting */ -#endif - int16_t *pCodec_frame_size_ms /* o: pointer to codec frame size setting */ -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS + int16_t *pIsar_frame_size_ms, /* o: pointer to isar frame size setting */ + int16_t *pCodec_frame_size_ms /* o: pointer to codec frame size setting */ , - int16_t *pLc3plusHighRes -#endif -) + int16_t *pLc3plusHighRes ) { if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) { @@ -3633,10 +3524,8 @@ IVAS_DEC_GetSplitRendBitstreamHeader( *pCodec = hIvasDec->st_ivas->hRenderConfig->split_rend_config.codec; *pCodec_frame_size_ms = hIvasDec->st_ivas->hRenderConfig->split_rend_config.codec_frame_size_ms; *poseCorrection = hIvasDec->st_ivas->hRenderConfig->split_rend_config.poseCorrectionMode; -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS *pIsar_frame_size_ms = hIvasDec->st_ivas->hRenderConfig->split_rend_config.isar_frame_size_ms; *pLc3plusHighRes = hIvasDec->st_ivas->hRenderConfig->split_rend_config.lc3plus_highres; -#endif return IVAS_ERR_OK; } @@ -3902,4 +3791,3 @@ int16_t IVAS_DEC_is_split_rendering_coded_out( return isSplitCoded; } -#endif diff --git a/lib_dec/lib_dec.h b/lib_dec/lib_dec.h index f9c4e4a0737023ee49bbe1bc2ae3899f1dc4c8fe..3b0e003c8151d86c8d0d05c1624fbe78a62cf4af 100644 --- a/lib_dec/lib_dec.h +++ b/lib_dec/lib_dec.h @@ -74,14 +74,12 @@ typedef enum _IVAS_DEC_FORCED_REND_MODE } IVAS_DEC_FORCED_REND_MODE; #endif -#ifdef SPLIT_REND_WITH_HEAD_ROT typedef enum _IVAS_DEC_PCM_TYPE { IVAS_DEC_PCM_INT16, IVAS_DEC_PCM_FLOAT, IVAS_DEC_PCM_INVALID } IVAS_DEC_PCM_TYPE; -#endif /* bitstream formats that can be consumed */ typedef enum _IVAS_DEC_BS_FORMAT @@ -157,17 +155,12 @@ ivas_error IVAS_DEC_FeedFrame_Serial( ivas_error IVAS_DEC_GetSamples( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ const int16_t nSamplesAsked, /* i : number of samples wanted by the caller */ -#ifdef SPLIT_REND_WITH_HEAD_ROT const IVAS_DEC_PCM_TYPE pcmType, /* i : type for the decoded PCM resolution */ void *pcmBuf, /* o : output synthesis signal */ -#else - int16_t *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 */ -#endif int16_t *nOutSamples, /* o : number of samples per channel written to output buffer */ bool *needNewFrame /* o : indication that the decoder needs a new frame */ ); -#ifdef SPLIT_REND_WITH_HEAD_ROT ivas_error IVAS_DEC_GetSplitBinauralBitstream( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ void *pcmBuf_out, /* o : output synthesis signal for BINAURAL_SPLIT_PCM */ @@ -181,14 +174,10 @@ ivas_error IVAS_DEC_GetSplitRendBitstreamHeader( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ ISAR_SPLIT_REND_CODEC *pCodec, /* o: pointer to codec setting */ ISAR_SPLIT_REND_POSE_CORRECTION_MODE *poseCorrection, /* o: pointer to pose correction mode */ -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS int16_t *pIsar_frame_size_ms, /* o: pointer to isar frame size setting */ -#endif int16_t *pCodec_frame_size_ms /* o: pointer to codec frame size setting */ -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS , int16_t *pLc3plusHighRes /* o: pointer to LC3plus High-Res setting */ -#endif ); /*! r: decoder error code */ @@ -206,7 +195,6 @@ int16_t IVAS_DEC_is_split_rendering_enabled( int16_t IVAS_DEC_is_split_rendering_coded_out( IVAS_DEC_HANDLE hIvasDec /* i/o: IVAS decoder handle */ ); -#endif /*! r: error code */ ivas_error IVAS_DEC_GetObjectMetadata( @@ -228,12 +216,8 @@ 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 */ -#ifdef SPLIT_REND_WITH_HEAD_ROT const int16_t subframe_idx, /* i : subframe index */ const ISAR_SPLIT_REND_ROT_AXIS rot_axis /* i : external control for rotation axis for split rendering */ -#else - const int16_t subframe_idx /* i : subframe index */ -#endif ); /*! r: error code */ @@ -286,12 +270,8 @@ ivas_error IVAS_DEC_TSM_SetQuality( ivas_error IVAS_DEC_VoIP_GetSamples( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ uint16_t nSamplesPerChannel, /* i : number of samples per channel requested to be written to output buffer */ -#ifdef SPLIT_REND_WITH_HEAD_ROT const IVAS_DEC_PCM_TYPE pcmType, void *pcmBuf, -#else - int16_t *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 */ -#endif const uint32_t systemTimestamp_ms /* i : current system timestamp */ #ifdef SUPPORT_JBM_TRACEFILE , JbmTraceFileWriterFn jbmWriterFn, @@ -302,12 +282,8 @@ ivas_error IVAS_DEC_VoIP_GetSamples( ivas_error IVAS_DEC_Flush( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ const int16_t nSamplesPerChannel, /* i : number of samples per channel requested to be written to output buffer */ -#ifdef SPLIT_REND_WITH_HEAD_ROT const IVAS_DEC_PCM_TYPE pcmType, void *pcmBuf, -#else - int16_t *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 */ -#endif int16_t *nSamplesFlushed /* o : number of samples flushed */ ); @@ -320,12 +296,10 @@ ivas_error IVAS_DEC_EnableVoIP( const IVAS_DEC_INPUT_FORMAT inputFormat /* i : format of the input bitstream */ ); -#ifdef SPLIT_REND_WITH_HEAD_ROT /*! r: error code */ ivas_error IVAS_DEC_EnableSplitRendering( IVAS_DEC_HANDLE hIvasDec /* i/o: IVAS decoder handle */ ); -#endif ivas_error IVAS_DEC_SetRenderFramesize( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ diff --git a/lib_enc/ari_hm_enc.c b/lib_enc/ari_hm_enc.c index cbbc1d9763cbcd8c2c328c05b8705ef26f256090..ca8dd994f35e612157c1164ec942bc23018b1941 100644 --- a/lib_enc/ari_hm_enc.c +++ b/lib_enc/ari_hm_enc.c @@ -418,11 +418,7 @@ static void PeakFilter( static float tcx_hm_get_re( const float x[], /* i : absolute spectrum */ const Word16 gain, /* i : HM gain (Q11) */ -#ifdef FIX_1001_ARI_HM_OVERFLOW const int32_t lag, -#else - const int16_t lag, -#endif const int16_t fract_res, const Word16 p[], /* i : harmonic model (Q13) */ const Word32 env[], /* i : envelope (Q16) */ @@ -471,11 +467,7 @@ static float tcx_hm_get_re( static void tcx_hm_quantize_gain( const float x[], /* i : absolute spectrum */ const Word32 env[], /* i : envelope (Q16) */ -#ifdef FIX_1001_ARI_HM_OVERFLOW const int32_t lag, -#else - const int16_t lag, -#endif const int16_t fract_res, Word16 p[], /* i : harmonic model (Q13) */ const int16_t L_frame, /* i : number of spectral lines */ @@ -565,11 +557,7 @@ void tcx_hm_analyse( int16_t *hm_bits /* o : bit consumption */ ) { -#ifdef FIX_1001_ARI_HM_OVERFLOW int32_t lag; -#else - int16_t lag; -#endif int32_t tmpL; int16_t fract_res; float fspec[N_MAX_ARI], RelativeScore; @@ -595,11 +583,7 @@ void tcx_hm_analyse( /* Convert the index to lag */ UnmapIndex( prm_hm[1], L_frame >= 256, LtpPitchLag, ( targetBits - *hm_bits <= kSmallerLagsTargetBitsThreshold ) || ( L_frame < 256 ), &fract_res, &tmpL ); -#ifdef FIX_1001_ARI_HM_OVERFLOW lag = tmpL; -#else - lag = (int16_t) tmpL; -#endif /* Render harmonic model */ tcx_hm_render( lag, fract_res, p ); diff --git a/lib_enc/lib_enc.c b/lib_enc/lib_enc.c index 6497eeffa22ee22936f16fa52f85e8ff7c9f6aeb..9b9a873ea1d4e64aa8777d36c680c1ab51438d47 100644 --- a/lib_enc/lib_enc.c +++ b/lib_enc/lib_enc.c @@ -1057,11 +1057,7 @@ ivas_error IVAS_ENC_GetDelay( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } -#ifdef SPLIT_REND_WITH_HEAD_ROT *delay = NS2SA( hEncoderConfig->input_Fs, get_delay( ENC, hEncoderConfig->input_Fs, hEncoderConfig->ivas_format, NULL, IVAS_AUDIO_CONFIG_INVALID ) ); -#else - *delay = NS2SA( hEncoderConfig->input_Fs, get_delay( ENC, hEncoderConfig->input_Fs, hEncoderConfig->ivas_format, NULL ) ); -#endif *delay *= hEncoderConfig->nchan_inp; diff --git a/lib_isar/isar_MSPred.c b/lib_isar/isar_MSPred.c index d239b2c29fbfb7905dc04ca1723461aa0d71b337..bd6729dd631930b74a66c4ed8878226f60e16f5d 100644 --- a/lib_isar/isar_MSPred.c +++ b/lib_isar/isar_MSPred.c @@ -32,7 +32,6 @@ #include "options.h" #include -#ifdef SPLIT_REND_WITH_HEAD_ROT #include "isar_lcld_prot.h" #include "isar_prot.h" #include "wmc_auto.h" @@ -467,4 +466,3 @@ void writeMSPred( return; } #endif -#endif diff --git a/lib_isar/isar_NoiseGen.c b/lib_isar/isar_NoiseGen.c index 63d91e17000f77f3e58b4cfa0599020654986889..963cbd377ab4288df6b7f3737d85f23b0e83a0ff 100644 --- a/lib_isar/isar_NoiseGen.c +++ b/lib_isar/isar_NoiseGen.c @@ -32,7 +32,6 @@ #include #include "options.h" -#ifdef SPLIT_REND_WITH_HEAD_ROT #include #include "prot.h" #include "isar_lcld_prot.h" @@ -54,4 +53,3 @@ void DeleteNoiseGen( NoiseGen *psNoiseGen ) } extern float GetNoise( NoiseGen *psNoiseGen ); -#endif diff --git a/lib_isar/isar_PerceptualModel.c b/lib_isar/isar_PerceptualModel.c index 18108c7fedfe3cc5de1a393b35c195e763f8c4e4..ce31b001c51cd57fefcb4fa25f086c678077afdf 100644 --- a/lib_isar/isar_PerceptualModel.c +++ b/lib_isar/isar_PerceptualModel.c @@ -32,7 +32,6 @@ #include #include "options.h" -#ifdef SPLIT_REND_WITH_HEAD_ROT #include "isar_lcld_prot.h" #include "prot.h" #include "isar_rom_lcld_tables.h" @@ -249,4 +248,3 @@ void PerceptualModelStereo( return; } -#endif diff --git a/lib_isar/isar_PredDecoder.c b/lib_isar/isar_PredDecoder.c index df7a3ec62514a362cd7bbee3624c1b7a85b5c87f..d107f6dab812edf046b68f0cb2d4aae8db773b09 100644 --- a/lib_isar/isar_PredDecoder.c +++ b/lib_isar/isar_PredDecoder.c @@ -32,7 +32,6 @@ #include #include "options.h" -#ifdef SPLIT_REND_WITH_HEAD_ROT #include #include "prot.h" #include "isar_prot.h" @@ -459,4 +458,3 @@ void ApplyInversePredictors( return; } -#endif diff --git a/lib_isar/isar_PredEncoder.c b/lib_isar/isar_PredEncoder.c index 57dff9dac7e93afc03a25248d45667c46be4e73c..378540d940b8938bbc711397b302802f9a267ef2 100644 --- a/lib_isar/isar_PredEncoder.c +++ b/lib_isar/isar_PredEncoder.c @@ -32,7 +32,6 @@ #include #include "options.h" -#ifdef SPLIT_REND_WITH_HEAD_ROT #include #include "isar_lcld_prot.h" #include "isar_rom_lcld_tables.h" @@ -574,4 +573,3 @@ int32_t WritePredictors( return iBitsWritten; } -#endif diff --git a/lib_isar/isar_RMSEnvGrouping.c b/lib_isar/isar_RMSEnvGrouping.c index b66404dd90abf40ec3a2780b93824b227bd9d64f..e53287c3e0f5620ff807bbc6a2ffda287471c7aa 100644 --- a/lib_isar/isar_RMSEnvGrouping.c +++ b/lib_isar/isar_RMSEnvGrouping.c @@ -32,7 +32,6 @@ #include #include "options.h" -#ifdef SPLIT_REND_WITH_HEAD_ROT #include #include "prot.h" #include "isar_lcld_prot.h" @@ -724,4 +723,3 @@ void ComputeEnvelopeGrouping( return; } -#endif diff --git a/lib_isar/isar_cnst.h b/lib_isar/isar_cnst.h index c81415ff5cfe55122b405d643019d249d11931e3..8f2636bdaa743c7e67cef9236bf2a2f6aa1fd098 100644 --- a/lib_isar/isar_cnst.h +++ b/lib_isar/isar_cnst.h @@ -38,7 +38,6 @@ /* clang-format off */ -#ifdef SPLIT_REND_WITH_HEAD_ROT /*----------------------------------------------------------------------------------* * Split Binaural Rendering Constants @@ -75,12 +74,8 @@ typedef enum #define MAX_SPLIT_REND_MD_BANDS 20 #define MAX_SPLIT_MD_SUBFRAMES 1 #define COMPLEX_MD_BAND_THRESH MAX_SPLIT_REND_MD_BANDS -#ifdef SPLIT_REND_POSE_CORRECTION_UNUSED_BITS #define COMPLEX_MD_BAND_THRESH_LOW 4 #define COMPLEX_MD_BAND_THRESH_HIGH 10 -#else -#define COMPLEX_MD_BAND_THRESH_LOW 5 -#endif #define SPLIT_REND_RO_MD_BAND_THRESH 4 #define ISAR_SPLIT_REND_NUM_QUANT_STRATS 4 @@ -115,9 +110,7 @@ typedef enum #define ISAR_SPLIT_REND_ROT_AXIS_BITS 3 #define ISAR_SPLIT_REND_RO_FLAG_BITS 1 -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS #define IVAS_LC3PLUS_MAX_NUM_DECODERS 2 -#endif /*----------------------------------------------------------------------------------* * Split rendering bitrate constants @@ -129,7 +122,6 @@ typedef enum #define SPLIT_REND_512k 512000 #define SPLIT_REND_768k 768000 -#endif /*SPLIT_REND_WITH_HEAD_ROT */ #endif /*ISAR_CNST_H */ /* clang-format on */ diff --git a/lib_isar/isar_lc3plus_common.c b/lib_isar/isar_lc3plus_common.c index 2e5a31cb6e9af5ea6748a1422d7c83c7781ab5a3..5c56c0b437aff18d7f88ab7711c814c466764780 100644 --- a/lib_isar/isar_lc3plus_common.c +++ b/lib_isar/isar_lc3plus_common.c @@ -35,7 +35,6 @@ #include "ivas_error.h" #include "lc3.h" -#ifdef SPLIT_REND_WITH_HEAD_ROT /*-----------------------------------------------------------------------------------------* * Function ISAR_LC3PLUS_LC3plusErrToIvasErr() * @@ -57,7 +56,6 @@ ivas_error ISAR_LC3PLUS_LC3plusErrToIvasErr( return IVAS_ERR_INTERNAL; } -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS ivas_error IVAS_LC3PLUS_LC3plusRtpErrToIvasErr( const LC3PLUS_RTP_ERR lc3PlusRtpError ) { switch ( lc3PlusRtpError ) @@ -85,5 +83,3 @@ ivas_error IVAS_LC3PLUS_LC3plusRtpErrToIvasErr( const LC3PLUS_RTP_ERR lc3PlusRtp return IVAS_ERR_UNKNOWN; } -#endif -#endif diff --git a/lib_isar/isar_lc3plus_common.h b/lib_isar/isar_lc3plus_common.h index 57060944273cbb46aa0dbfc2ccf684414ae367f9..2638ea8a9cbb34fca0705c0b84e46692e34e9a19 100644 --- a/lib_isar/isar_lc3plus_common.h +++ b/lib_isar/isar_lc3plus_common.h @@ -37,11 +37,8 @@ #include #include "options.h" #include "ivas_error.h" -#ifdef SPLIT_REND_WITH_HEAD_ROT #include "lc3.h" -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS #include "isar_lc3plus_payload.h" -#endif /*! common configuration parameters between encoder and decoder */ typedef struct LC3PLUS_CONFIG @@ -54,19 +51,14 @@ typedef struct LC3PLUS_CONFIG int32_t samplerate; /*! number of channels */ int16_t channels; -#if defined ISAR_BITSTREAM_UPDATE_LC3PLUS || defined ISAR_BITSTREAM_UPDATE_LC3PLUS /*! high resolution mode enabled (1) or disabled (0)*/ int16_t high_res_mode_enabled; -#endif } LC3PLUS_CONFIG; /*! utility function to convert LC3PLUS_Errors to the suitable ivas_error */ ivas_error ISAR_LC3PLUS_LC3plusErrToIvasErr( const LC3PLUS_Error lc3PlusError ); -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS /*! utility function to convert LC3PLUS_Errors to the suitable ivas_error */ ivas_error IVAS_LC3PLUS_LC3plusRtpErrToIvasErr( const LC3PLUS_RTP_ERR lc3PlusRtpError ); -#endif -#endif /* SPLIT_REND_WITH_HEAD_ROT */ #endif /* ISAR_LC3PLUS_COM_H */ diff --git a/lib_isar/isar_lc3plus_dec.c b/lib_isar/isar_lc3plus_dec.c index 15dac2d4162a096dbae87ec963d1157b8e79a947..7d43ed83bb5d4339b9f469ff8f435b678d78bf81 100644 --- a/lib_isar/isar_lc3plus_dec.c +++ b/lib_isar/isar_lc3plus_dec.c @@ -40,29 +40,6 @@ #include "ivas_error_utils.h" #include "wmc_auto.h" -#ifdef SPLIT_REND_WITH_HEAD_ROT - -#ifndef ISAR_BITSTREAM_UPDATE_LC3PLUS -/*------------------------------------------------------------------------- - * isar_LC3PLUS_AllocateSubframeDecodingMatrix() - * - * - *------------------------------------------------------------------------*/ - -static void isar_LC3PLUS_DEC_FreeSubframeDecodingMatrix( - int16_t **subframeChannelMatrix ) -{ - for ( int16_t i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) - { - free( subframeChannelMatrix[i] ); - } - - free( subframeChannelMatrix ); - - return; -} -#endif - /*------------------------------------------------------------------------- * ISAR_LC3PLUS_DEC_Open() @@ -77,37 +54,22 @@ ivas_error ISAR_LC3PLUS_DEC_Open( { LC3PLUS_Error err; int32_t decoder_size; -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS int16_t i; if ( 0 == config.lc3plus_frame_duration_us ) { return IVAS_ERROR( IVAS_ERR_WRONG_PARAMS, "Invalid lc3plus_frame_duration_us (0)\n" ); } -#else - int16_t lc3plusFrameIdx; - int16_t numLC3plusFramesPerIvasFrame; - int16_t i; -#endif if ( ( *handle = malloc( sizeof( struct ISAR_LC3PLUS_DEC_HANDLE ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LC3plus wrapper handle\n" ); } -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS if ( config.channels > IVAS_LC3PLUS_MAX_NUM_DECODERS ) { return IVAS_ERROR( IVAS_ERR_INIT_ERROR, "Maximum number of channels exceeds IVAS_LC3PLUS_MAX_NUM_DECODERS\n" ); } -#else - - if ( 0 == config.lc3plus_frame_duration_us ) - { - return IVAS_ERROR( IVAS_ERR_WRONG_PARAMS, "Invalid lc3plus_frame_duration_us (0)\n" ); - } - numLC3plusFramesPerIvasFrame = (int16_t) ( config.isar_frame_duration_us / config.lc3plus_frame_duration_us ); -#endif ( *handle )->num_decs = 0; @@ -166,11 +128,7 @@ ivas_error ISAR_LC3PLUS_DEC_Open( return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LC3plus decoder\n" ); } -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS err = lc3plus_dec_init( ( *handle )->handles[iCh], config.samplerate, 1, LC3PLUS_PLC_ADVANCED, config.high_res_mode_enabled ); -#else - err = lc3plus_dec_init( ( *handle )->handles[iCh], config.samplerate, 1, LC3PLUS_PLC_ADVANCED, 0 ); -#endif if ( LC3PLUS_OK != err ) { ISAR_LC3PLUS_DEC_Close( handle ); @@ -191,24 +149,10 @@ ivas_error ISAR_LC3PLUS_DEC_Open( return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LC3plus decoder\n" ); } -#ifndef ISAR_BITSTREAM_UPDATE_LC3PLUS - if ( ( ( *handle )->selective_decoding_states[iCh]->frame_actions = malloc( numLC3plusFramesPerIvasFrame * sizeof( SelectiveDecAction ) ) ) == NULL ) - { - ISAR_LC3PLUS_DEC_Close( handle ); - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LC3plus decoder\n" ); - } -#endif ( *handle )->selective_decoding_states[iCh]->has_skipped_a_frame = 0; ( *handle )->selective_decoding_states[iCh]->shall_decode_cached_frame = 0; -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS ( *handle )->selective_decoding_states[iCh]->frame_action = DEC_ACTION_DECODE_AND_USE; -#else - for ( lc3plusFrameIdx = 0; lc3plusFrameIdx < numLC3plusFramesPerIvasFrame; lc3plusFrameIdx++ ) - { - ( *handle )->selective_decoding_states[iCh]->frame_actions[lc3plusFrameIdx] = DEC_ACTION_DECODE_AND_USE; - } -#endif /* allocate and configure per LC3plus decoder bitstream cache */ if ( ( ( *handle )->bitstream_caches[iCh] = malloc( sizeof( ISAR_LC3PLUS_DEC_BITSTREAM_CACHE ) ) ) == NULL ) @@ -216,11 +160,7 @@ ivas_error ISAR_LC3PLUS_DEC_Open( ISAR_LC3PLUS_DEC_Close( handle ); return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LC3plus decoder\n" ); } -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS ( *handle )->bitstream_caches[iCh]->bitstream_cache_capacity = 400 /*LC3plus max non-HR octet count*/; -#else - ( *handle )->bitstream_caches[iCh]->bitstream_cache_capacity = 400 /*LC3plus max non-HR octet count*/ * numLC3plusFramesPerIvasFrame; -#endif if ( ( ( *handle )->bitstream_caches[iCh]->bitstream_cache = malloc( ( *handle )->bitstream_caches[iCh]->bitstream_cache_capacity ) ) == NULL ) { ISAR_LC3PLUS_DEC_Close( handle ); @@ -245,156 +185,6 @@ ivas_error ISAR_LC3PLUS_DEC_Open( return IVAS_ERR_OK; } -#ifndef ISAR_BITSTREAM_UPDATE_LC3PLUS -/*------------------------------------------------------------------------- - * ISAR_LC3PLUS_DEC_AllocateSubframeDecodingMatrix() - * - * - *------------------------------------------------------------------------*/ - -ivas_error ISAR_LC3PLUS_DEC_AllocateSubframeDecodingMatrix( - int16_t ***subframeChannelMatrix, - const uint32_t num_decs ) -{ - int16_t i; - - if ( ( *subframeChannelMatrix = malloc( MAX_PARAM_SPATIAL_SUBFRAMES * sizeof( int16_t * ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "subframeChannelMatrix allocation failed\n" ); - } - - for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) - { - ( *subframeChannelMatrix )[i] = NULL; - } - - for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) - { - if ( ( ( *subframeChannelMatrix )[i] = malloc( num_decs * sizeof( int16_t ) ) ) == NULL ) - { - isar_LC3PLUS_DEC_FreeSubframeDecodingMatrix( *subframeChannelMatrix ); - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "subframeChannelMatrix allocation failed\n" ); - } - } - - return IVAS_ERR_OK; -} - - -/*------------------------------------------------------------------------- - * ISAR_LC3PLUS_DEC_SetSelectiveDecodingMatrix() - * - * - *------------------------------------------------------------------------*/ - -ivas_error ISAR_LC3PLUS_DEC_SetSelectiveDecodingMatrix( - ISAR_LC3PLUS_DEC_HANDLE handle, /* i : LC3plus decoder handle */ - int16_t *subframeChannelMatrix[MAX_PARAM_SPATIAL_SUBFRAMES] ) -{ - int16_t numIvasSubFramesPerLC3frame; - uint32_t decIdx; - int16_t ivasSubframeIdx; - int16_t effectiveIsarSubframeDuration; - int16_t actual_num_spatial_subframes; - - if ( NULL == handle ) - { - return IVAS_ERROR( IVAS_ERR_UNEXPECTED_NULL_POINTER, "ISAR_LC3PLUS_DEC_HANDLE is NULL\n" ); - } - - if ( NULL == subframeChannelMatrix ) - { - return IVAS_ERROR( IVAS_ERR_UNEXPECTED_NULL_POINTER, "subframeChannelMatrix is NULL\n" ); - } - - if ( handle->config.lc3plus_frame_duration_us == 0 || handle->config.isar_frame_duration_us % handle->config.lc3plus_frame_duration_us != 0 ) - { - return IVAS_ERROR( IVAS_ERR_WRONG_PARAMS, "invalid isar_frame_duration_us/lc3plus_frame_duration_us values\n" ); - } - - effectiveIsarSubframeDuration = (int16_t) ( handle->config.isar_frame_duration_us == 20000 ? handle->config.isar_frame_duration_us / MAX_PARAM_SPATIAL_SUBFRAMES : handle->config.isar_frame_duration_us ); - numIvasSubFramesPerLC3frame = (int16_t) handle->config.lc3plus_frame_duration_us / effectiveIsarSubframeDuration; - actual_num_spatial_subframes = (int16_t) handle->config.isar_frame_duration_us / effectiveIsarSubframeDuration; - /* 0.5(0) = 10ms lc3plus, 5ms subframe */ - if ( numIvasSubFramesPerLC3frame != 1 ) - { - return IVAS_ERROR( IVAS_ERR_NOT_IMPLEMENTED, "Selective decoding is only implemented for aligned IVAS-Subframes & LC3plus \n" ); - } - - /* map subframeChannelMatrix to lc3plus skip states */ - /* 1st pass: Flag the required frames */ - for ( decIdx = 0; decIdx < handle->num_decs; decIdx++ ) - { - for ( ivasSubframeIdx = 0; ivasSubframeIdx < actual_num_spatial_subframes; ivasSubframeIdx++ ) - { - if ( 1 == subframeChannelMatrix[ivasSubframeIdx][decIdx] ) - { - /* subframe needed by the user, definitely decode */ - handle->selective_decoding_states[decIdx]->frame_actions[ivasSubframeIdx] = DEC_ACTION_DECODE_AND_USE; - } - else - { - - /* subframe not needed by the user, but might be required to re-initialize a decoder after inactivity */ - if ( - ( ivasSubframeIdx != actual_num_spatial_subframes - 1 ) && 1 == subframeChannelMatrix[ivasSubframeIdx + 1][decIdx] ) - { - /* ... but if the following subframe is required, it needs to be decoded and dropped */ - handle->selective_decoding_states[decIdx]->frame_actions[ivasSubframeIdx] = DEC_ACTION_DECODE_AND_DROP; - } - else - { - handle->selective_decoding_states[decIdx]->frame_actions[ivasSubframeIdx] = DEC_ACTION_SKIP; - } - } - } - } - - /* if a decoder was paused before, it needs to either: - * - Decode the cached frame (if available) and the first required frame OR - * - Decode the previous LC3plus subframe, even if it isn't needed by the user */ - for ( decIdx = 0; decIdx < handle->num_decs; decIdx++ ) - { - if ( handle->selective_decoding_states[decIdx]->has_skipped_a_frame ) - { - /* find the first frame required by the user */ - for ( ivasSubframeIdx = 0; ivasSubframeIdx < actual_num_spatial_subframes; ivasSubframeIdx++ ) - { - if ( DEC_ACTION_DECODE_AND_USE == handle->selective_decoding_states[decIdx]->frame_actions[ivasSubframeIdx] ) - { - /* The first required frame is the first subframe. To flush the decoder, the cached frame must be decoded and dropped */ - if ( 0 == ivasSubframeIdx ) - { - handle->selective_decoding_states[decIdx]->shall_decode_cached_frame = 1; - break; - } - /* The first required frame is not the first frame, so the cache is useless. Instead we decode & drop the previous frame*/ - else - { - handle->selective_decoding_states[decIdx]->frame_actions[ivasSubframeIdx - 1] = DEC_ACTION_DECODE_AND_DROP; - break; - } - } - } - } - } - - /* if a dec gets paused & caching is activated we need to flag the last useful LC3plus frame for caching */ - for ( decIdx = 0; decIdx < handle->num_decs; decIdx++ ) - { - for ( ivasSubframeIdx = 0; ivasSubframeIdx < actual_num_spatial_subframes; ivasSubframeIdx++ ) - { - if ( handle->selective_decoding_states[decIdx]->frame_actions[ivasSubframeIdx] == DEC_ACTION_SKIP && handle->selective_decoding_states[decIdx]->frame_actions[actual_num_spatial_subframes - 1] != DEC_ACTION_DECODE_AND_USE ) - { - handle->selective_decoding_states[decIdx]->frame_actions[actual_num_spatial_subframes - 1] = DEC_ACTION_CACHE; - } - } - } - - return IVAS_ERR_OK; -} -#endif - /*------------------------------------------------------------------------- * ISAR_LC3PLUS_DEC_GetDelay() @@ -464,9 +254,6 @@ void ISAR_LC3PLUS_DEC_Close( if ( NULL != ( *handle )->selective_decoding_states && NULL != ( *handle )->selective_decoding_states[iDec] ) { -#ifndef ISAR_BITSTREAM_UPDATE_LC3PLUS - free( ( *handle )->selective_decoding_states[iDec]->frame_actions ); -#endif free( ( *handle )->selective_decoding_states[iDec] ); } @@ -545,17 +332,10 @@ static ivas_error isar_LC3PLUS_DEC_Decode_or_Conceal_internal( ) { uint32_t iDec; -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS int32_t config_num_media_times; int32_t iMediaTime; int32_t iFtd; LC3PLUS_RTP_PAYLOAD payload; -#else - int32_t iLc3plusFrame; - int32_t lc3framesPerIvasFrame; - int32_t bitstreamOffsetPerCoder; - uint8_t *bitstream_in_iter = bitstream_in; -#endif int32_t ivasSampleIndex; int16_t numSamplesPerLC3plusChannel; ivas_error err; @@ -586,7 +366,6 @@ static ivas_error isar_LC3PLUS_DEC_Decode_or_Conceal_internal( return IVAS_ERROR( IVAS_ERR_NOT_IMPLEMENTED, "isar_frame_duration_us must be equal or multiple of lc3plus_frame_duration_us \n" ); } -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS config_num_media_times = handle->config.isar_frame_duration_us / handle->config.lc3plus_frame_duration_us; if ( !badFrameIndicator ) { @@ -615,25 +394,13 @@ static ivas_error isar_LC3PLUS_DEC_Decode_or_Conceal_internal( return IVAS_ERROR( IVAS_ERR_NOT_IMPLEMENTED, "LC3plus config change (number of media times per frame data block) in bitstream is not supported\n" ); } } -#endif -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS numSamplesPerLC3plusChannel = (int16_t) ( handle->config.samplerate / ( 1000000 / handle->config.isar_frame_duration_us ) / config_num_media_times ); for ( iDec = 0; iDec < handle->num_decs; iDec++ ) { for ( iMediaTime = 0; iMediaTime < config_num_media_times; iMediaTime++ ) { iFtd = iDec + iMediaTime * handle->num_decs; -#else - lc3framesPerIvasFrame = handle->config.isar_frame_duration_us / handle->config.lc3plus_frame_duration_us; - - numSamplesPerLC3plusChannel = (int16_t) ( handle->config.samplerate / ( 1000000 / handle->config.isar_frame_duration_us ) / lc3framesPerIvasFrame ); - bitstreamOffsetPerCoder = bitstream_in_size / handle->num_decs / lc3framesPerIvasFrame; - for ( iDec = 0; iDec < handle->num_decs; iDec++ ) - { - for ( iLc3plusFrame = 0; iLc3plusFrame < lc3framesPerIvasFrame; iLc3plusFrame++ ) - { -#endif if ( handle->selective_decoding_states[iDec]->shall_decode_cached_frame ) { if ( 0 == handle->bitstream_caches[iDec]->bitstream_cache_size ) @@ -656,27 +423,10 @@ static ivas_error isar_LC3PLUS_DEC_Decode_or_Conceal_internal( handle->bitstream_caches[iDec]->bitstream_cache_size = 0; } -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS switch ( handle->selective_decoding_states[iDec]->frame_action ) -#else - switch ( handle->selective_decoding_states[iDec]->frame_actions[iLc3plusFrame] ) -#endif { -#ifndef ISAR_BITSTREAM_UPDATE_LC3PLUS - case DEC_ACTION_DECODE_AND_DROP: - { - err = decode_or_conceal_one_lc3plus_frame( handle->handles[iDec], bitstream_in_iter, bitstreamOffsetPerCoder, &handle->pcm_conversion_buffer, badFrameIndicator ); - if ( err != IVAS_ERR_OK ) - { - return IVAS_ERROR( err, "lc3plus decoding failed\n" ); - } - handle->selective_decoding_states[iDec]->has_skipped_a_frame = 0; - break; - } -#endif case DEC_ACTION_DECODE_AND_USE: { -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS if ( badFrameIndicator ) { err = decode_or_conceal_one_lc3plus_frame( handle->handles[iDec], bitstream_in, bitstream_in_size, &handle->pcm_conversion_buffer, badFrameIndicator ); @@ -703,33 +453,9 @@ static ivas_error isar_LC3PLUS_DEC_Decode_or_Conceal_internal( } handle->selective_decoding_states[iDec]->has_skipped_a_frame = 0; break; -#else - err = decode_or_conceal_one_lc3plus_frame( handle->handles[iDec], bitstream_in_iter, bitstreamOffsetPerCoder, &handle->pcm_conversion_buffer, badFrameIndicator ); - if ( err != IVAS_ERR_OK ) - { - return IVAS_ERROR( err, "lc3plus decoding failed\n" ); - } - - for ( int32_t iSampleInt16 = 0; iSampleInt16 < numSamplesPerLC3plusChannel; iSampleInt16++ ) - { - ivasSampleIndex = iSampleInt16 + iLc3plusFrame * numSamplesPerLC3plusChannel; - pcm_out[iDec][ivasSampleIndex] = (float) handle->pcm_conversion_buffer[iSampleInt16]; - } - handle->selective_decoding_states[iDec]->has_skipped_a_frame = 0; - break; -#endif } -#ifndef ISAR_BITSTREAM_UPDATE_LC3PLUS - case DEC_ACTION_SKIP: - { - /* log that this instance has skipped a frame and must decode twice once reactivated */ - handle->selective_decoding_states[iDec]->has_skipped_a_frame = 1; - break; - } -#endif case DEC_ACTION_CACHE: { -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS if ( handle->bitstream_caches[iDec]->bitstream_cache_capacity < (int32_t) payload.ftds[iFtd].frame_data_length ) { return IVAS_ERROR( IVAS_ERR_INVALID_BUFFER_SIZE, "bitstream_cache_capacity is too low for LC3plus frame size\n" ); @@ -740,41 +466,15 @@ static ivas_error isar_LC3PLUS_DEC_Decode_or_Conceal_internal( /* log that this instance has skipped a frame and must decode twice once reactivated */ handle->selective_decoding_states[iDec]->has_skipped_a_frame = 1; break; -#else - if ( handle->bitstream_caches[iDec]->bitstream_cache_capacity < bitstreamOffsetPerCoder ) - { - return IVAS_ERROR( IVAS_ERR_INVALID_BUFFER_SIZE, "bitstream_cache_capacity is too low for LC3plus frame size\n" ); - } - /* store bit rate of cached frame */ - mvc2c( bitstream_in_iter, handle->bitstream_caches[iDec]->bitstream_cache, (int16_t) bitstreamOffsetPerCoder ); - handle->bitstream_caches[iDec]->bitstream_cache_size = bitstreamOffsetPerCoder; - /* log that this instance has skipped a frame and must decode twice once reactivated */ - handle->selective_decoding_states[iDec]->has_skipped_a_frame = 1; - break; -#endif } case DEC_ACTION_NUM_ENUMS: default: return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "invalid LC3plus decoder state\n" ); } -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS } /* for each media time */ /* reset skipping state, must be set by the user before each decode call*/ handle->selective_decoding_states[iDec]->frame_action = DEC_ACTION_DECODE_AND_USE; } /* for each dec/channel */ -#else - - bitstream_in_iter += bitstreamOffsetPerCoder; - } - - /* reset skipping state, must be set by the user before each decode call*/ - for ( iLc3plusFrame = 0; iLc3plusFrame < lc3framesPerIvasFrame; iLc3plusFrame++ ) - { - handle->selective_decoding_states[iDec]->frame_actions[iLc3plusFrame] = DEC_ACTION_DECODE_AND_USE; - } - } - -#endif return IVAS_ERR_OK; } @@ -841,4 +541,3 @@ ivas_error ISAR_LC3PLUS_DEC_Conceal( return isar_LC3PLUS_DEC_Decode_or_Conceal_internal( handle, bitstream_in, 0, badFrameIndicator, pcm_out ); } -#endif /* SPLIT_REND_WITH_HEAD_ROT */ diff --git a/lib_isar/isar_lc3plus_dec.h b/lib_isar/isar_lc3plus_dec.h index 3949cf766d4f507ee0eb23c64c25eea203273a96..99e7d09eff5d5634e8a771da2bc90234d256de26 100644 --- a/lib_isar/isar_lc3plus_dec.h +++ b/lib_isar/isar_lc3plus_dec.h @@ -35,7 +35,6 @@ #include #include "options.h" -#ifdef SPLIT_REND_WITH_HEAD_ROT #include "lc3.h" #include "ivas_error.h" #include "ivas_cnst.h" @@ -44,13 +43,7 @@ typedef enum { -#ifndef ISAR_BITSTREAM_UPDATE_LC3PLUS - DEC_ACTION_DECODE_AND_DROP = 0, -#endif DEC_ACTION_DECODE_AND_USE, -#ifndef ISAR_BITSTREAM_UPDATE_LC3PLUS - DEC_ACTION_SKIP, -#endif DEC_ACTION_CACHE, DEC_ACTION_NUM_ENUMS } SelectiveDecAction; @@ -60,13 +53,8 @@ typedef struct ISAR_LC3PLUS_DEC_SELECTIVE_DECODING_STATE { /*! indicates that the decoder has skipped one or more frames. This means it must decode two frames to flush algorithmic delay when re-activated */ int16_t has_skipped_a_frame; -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS /*! action to execute for the next frame */ SelectiveDecAction frame_action; -#else - /*! if set to 1, decoder will skip decoding for the next frame */ - SelectiveDecAction *frame_actions; -#endif /*! if set to 1, decoder will decode the cache before decoding any of current frames */ int16_t shall_decode_cached_frame; } ISAR_LC3PLUS_DEC_SELECTIVE_DECODING_STATE; @@ -103,13 +91,6 @@ void ISAR_LC3PLUS_DEC_Close( ISAR_LC3PLUS_DEC_HANDLE *handle /* i/o: pointer to decoder handle */ ); -#ifndef ISAR_BITSTREAM_UPDATE_LC3PLUS -/*! Sets a matrix[MAX_PARAM_SPATIAL_SUBFRAMES][numLC3plusDecoders] where all require subframes must be flagged with 1, frames that are not required with 0 */ -ivas_error ISAR_LC3PLUS_DEC_SetSelectiveDecodingMatrix( - ISAR_LC3PLUS_DEC_HANDLE handle, /* i : decoder handle */ - int16_t *subframeChannelMatrix[MAX_PARAM_SPATIAL_SUBFRAMES] /* i : */ -); -#endif ivas_error ISAR_LC3PLUS_DEC_Decode( ISAR_LC3PLUS_DEC_HANDLE handle, /* i : decoder handle */ @@ -123,13 +104,5 @@ ivas_error ISAR_LC3PLUS_DEC_Conceal( float **pcm_out /* o : concealed samples */ ); -#ifndef ISAR_BITSTREAM_UPDATE_LC3PLUS -ivas_error ISAR_LC3PLUS_DEC_AllocateSubframeDecodingMatrix( - int16_t ***subframeChannelMatrix, - const uint32_t num_decs ); - -void ISAR_LC3PLUS_DEC_FreeSubframeDecodingMatrix( int16_t **subframeChannelMatrix ); -#endif -#endif /* SPLIT_REND_WITH_HEAD_ROT */ #endif /* ISAR_LC3PLUS_DEC_H */ diff --git a/lib_isar/isar_lc3plus_enc.c b/lib_isar/isar_lc3plus_enc.c index 5e32b2c279a57d0fc378110343cdc00380c28ac1..2912a1e514c3e487214a2707cf449d2e7b5ea791 100644 --- a/lib_isar/isar_lc3plus_enc.c +++ b/lib_isar/isar_lc3plus_enc.c @@ -38,11 +38,8 @@ #include "wmc_auto.h" #include "options.h" -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS static const LC3PLUS_RTP_FDL s_fdl_request = LC3PLUS_RTP_FDL_NO_REQ_OR_NO_DATA; -#endif -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS static int32_t limit_per_channel_bitrate( LC3PLUS_CONFIG config, int32_t per_channel_bitrate ) { @@ -79,9 +76,7 @@ static int32_t limit_per_channel_bitrate( LC3PLUS_CONFIG config, assert( false && "unreachable" ); return -1; } -#endif -#ifdef SPLIT_REND_WITH_HEAD_ROT /*-------------------------------------------------------------------* * Function ISAR_LC3PLUS_ENC_Open() * @@ -94,19 +89,9 @@ ivas_error ISAR_LC3PLUS_ENC_Open( ISAR_LC3PLUS_ENC_HANDLE *handle /* o : encoder handle */ ) { -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS int32_t num_lc3plus_media_times_per_ivas_frame; -#ifndef ISAR_BITSTREAM_UPDATE_LC3PLUS - int32_t lc3plus_num_bytes_per_frame; -#endif bool is_last_media_time, is_last_channel; -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS ivas_error ivas_err; -#endif -#endif -#ifndef ISAR_BITSTREAM_UPDATE_LC3PLUS - int32_t bitsPerSecondPerChannel; -#endif int32_t encoder_size; LC3PLUS_Error err; int32_t lfeChans[1]; @@ -118,10 +103,6 @@ ivas_error ISAR_LC3PLUS_ENC_Open( { return IVAS_ERROR( IVAS_ERR_INTERNAL, "Invalid number of channels\n" ); } -#ifndef ISAR_BITSTREAM_UPDATE_LC3PLUS - bitsPerSecondPerChannel = bitsPerSecond / config.channels; -#endif -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS if ( config.lc3plus_frame_duration_us != 2500 && config.lc3plus_frame_duration_us != 5000 && config.lc3plus_frame_duration_us != 10000 ) { return IVAS_ERROR( IVAS_ERR_INTERNAL, "Invalid lc3plus_frame_duration_us\n" ); @@ -130,7 +111,6 @@ ivas_error ISAR_LC3PLUS_ENC_Open( { return IVAS_ERROR( IVAS_ERR_INTERNAL, "Invalid isar_frame_duration_us\n" ); } -#endif encoder_size = lc3plus_enc_get_size( config.samplerate, 1 ); if ( 0 == encoder_size ) { @@ -141,10 +121,8 @@ ivas_error ISAR_LC3PLUS_ENC_Open( { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LC3plus wrapper handle\n" ); } -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS ( *handle )->config = config; ( *handle )->frame_type_descriptors = NULL; -#endif ( *handle )->pcm_conversion_buffer = NULL; ( *handle )->num_encs = 0; @@ -159,7 +137,6 @@ ivas_error ISAR_LC3PLUS_ENC_Open( ( *handle )->handles[i] = NULL; } ( *handle )->num_encs = config.channels; -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS num_lc3plus_media_times_per_ivas_frame = config.isar_frame_duration_us / config.lc3plus_frame_duration_us; ( *handle )->fdl_request = s_fdl_request; ( *handle )->num_ftds = config.channels * num_lc3plus_media_times_per_ivas_frame; @@ -169,7 +146,6 @@ ivas_error ISAR_LC3PLUS_ENC_Open( ISAR_LC3PLUS_ENC_Close( handle ); return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LC3plus frame_type_descriptors\n" ); } -#endif for ( int32_t iCh = 0; iCh < config.channels; iCh++ ) { @@ -179,11 +155,7 @@ ivas_error ISAR_LC3PLUS_ENC_Open( return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LC3plus encoder\n" ); } -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS err = lc3plus_enc_init( ( *handle )->handles[iCh], config.samplerate, 1, config.high_res_mode_enabled, lfeChans ); -#else - err = lc3plus_enc_init( ( *handle )->handles[iCh], config.samplerate, 1, 0, lfeChans ); -#endif if ( err != LC3PLUS_OK ) { ISAR_LC3PLUS_ENC_Close( handle ); @@ -196,14 +168,6 @@ ivas_error ISAR_LC3PLUS_ENC_Open( ISAR_LC3PLUS_ENC_Close( handle ); return IVAS_ERROR( ISAR_LC3PLUS_LC3plusErrToIvasErr( err ), "lc3plus_enc_set_frame_dms failed\n" ); } -#ifndef ISAR_BITSTREAM_UPDATE_LC3PLUS - err = lc3plus_enc_set_bitrate( ( *handle )->handles[iCh], bitsPerSecondPerChannel ); - if ( err != LC3PLUS_OK ) - { - ISAR_LC3PLUS_ENC_Close( handle ); - return IVAS_ERROR( ISAR_LC3PLUS_LC3plusErrToIvasErr( err ), "lc3plus_enc_set_bitrate failed\n" ); - } -#endif } if ( config.isar_frame_duration_us < config.lc3plus_frame_duration_us || config.isar_frame_duration_us % config.lc3plus_frame_duration_us != 0 ) @@ -212,9 +176,6 @@ ivas_error ISAR_LC3PLUS_ENC_Open( return IVAS_ERROR( IVAS_ERR_NOT_IMPLEMENTED, "Current pcm_conversion_buffer sizing requires that lc3plus uses a shorter or equal frame duration than ivas\n" ); } -#ifndef ISAR_BITSTREAM_UPDATE_LC3PLUS - ( *handle )->config = config; -#endif ( *handle )->pcm_conversion_buffer = malloc( sizeof( int16_t ) * config.samplerate * config.lc3plus_frame_duration_us / 1000000 ); if ( NULL == ( *handle )->pcm_conversion_buffer ) { @@ -222,24 +183,13 @@ ivas_error ISAR_LC3PLUS_ENC_Open( return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LC3plus encoder wrapper pcm_conversion_buffer\n" ); } -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS /* update FDI fields */ for ( int32_t iMediaTime = 0; iMediaTime < num_lc3plus_media_times_per_ivas_frame; ++iMediaTime ) { for ( uint32_t iEnc = 0; iEnc < ( *handle )->num_encs; ++iEnc ) { int32_t ftd_index = iEnc + iMediaTime * ( *handle )->num_encs; -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS ( *handle )->frame_type_descriptors[ftd_index].frame_data_length = 0; /* will be set to the correct value in IVAS_LC3PLUS_ENC_SetBitrate */ -#else - lc3plus_num_bytes_per_frame = lc3plus_enc_get_num_bytes( ( *handle )->handles[iEnc] ); - if ( lc3plus_num_bytes_per_frame <= 0 ) - { - ISAR_LC3PLUS_ENC_Close( handle ); - return IVAS_ERROR( IVAS_ERR_INTERNAL, "lc3plus_enc_get_num_bytes reported invalid result failed\n" ); - } - ( *handle )->frame_type_descriptors[ftd_index].frame_data_length = lc3plus_num_bytes_per_frame; -#endif if ( 0 != LC3PLUS_RTP_ftd_bwr_from_samplerate( &( *handle )->frame_type_descriptors[ftd_index].bwr, config.samplerate, config.high_res_mode_enabled ) ) { ISAR_LC3PLUS_ENC_Close( handle ); @@ -276,19 +226,15 @@ ivas_error ISAR_LC3PLUS_ENC_Open( } } -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS ivas_err = IVAS_LC3PLUS_ENC_SetBitrate( *handle, bitsPerSecond ); if ( ivas_err != IVAS_ERR_OK ) { ISAR_LC3PLUS_ENC_Close( handle ); return ivas_err; } -#endif -#endif return IVAS_ERR_OK; } -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS /*-------------------------------------------------------------------* * Function IVAS_LC3PLUS_ENC_SetBitrate() * @@ -331,12 +277,10 @@ ivas_error IVAS_LC3PLUS_ENC_SetBitrate( } minPayloadOverhead = fdrLength + ( numSubframes * LC3PLUS_RTP_FTD_MIN_SIZE ); targetLc3PlusBitratePerChannel = ( availableOctetsPerIsarFrame - minPayloadOverhead ) / handle->config.channels * 8 * lc3plusPacketRate / numLc3plusMediaTimesPerIvasFrame; -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS if ( targetLc3PlusBitratePerChannel <= 0 ) { return IVAS_ERROR( IVAS_ERR_LC3PLUS_INVALID_BITRATE, "available LC3plus bitrate <= 0\n" ); } -#endif targetLc3PlusBitratePerChannel = limit_per_channel_bitrate( handle->config, targetLc3PlusBitratePerChannel ); targetLc3PlusOctetCount = targetLc3PlusBitratePerChannel / 8 / lc3plusPacketRate; /* check resulting octet count. If it requires larger than 1-byte length fields, decrease the bitrate by enough to make room for the additional length field */ @@ -385,7 +329,6 @@ ivas_error IVAS_LC3PLUS_ENC_SetBitrate( } return IVAS_ERR_OK; } -#endif /*-------------------------------------------------------------------* @@ -442,15 +385,11 @@ ivas_error ISAR_LC3PLUS_ENC_GetOutputBitstreamSize( int32_t *bsSize /* o : size of each bitstream frame in bytes */ ) { -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS LC3PLUS_RTP_ERR rtp_err; int32_t num_lc3plus_media_times_per_ivas_frame; int32_t iMediaTime; int32_t ftd_frame_data_length_size, lc3plus_frame_data_length; int32_t ftd_index; -#else - int32_t bitstreamSizeMultiplier; -#endif if ( NULL == handle ) { return IVAS_ERROR( IVAS_ERR_UNEXPECTED_NULL_POINTER, "LC3PLUS_Enc_Wrap_Handle is NULL\n" ); @@ -460,7 +399,6 @@ ivas_error ISAR_LC3PLUS_ENC_GetOutputBitstreamSize( return IVAS_ERROR( IVAS_ERR_UNEXPECTED_NULL_POINTER, "bsSize is NULL\n" ); } -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS if ( 0 == handle->config.lc3plus_frame_duration_us ) { return IVAS_ERROR( IVAS_ERR_INIT_ERROR, "lc3plus_frame_duration_us is 0\n" ); @@ -471,9 +409,7 @@ ivas_error ISAR_LC3PLUS_ENC_GetOutputBitstreamSize( } num_lc3plus_media_times_per_ivas_frame = handle->config.isar_frame_duration_us / handle->config.lc3plus_frame_duration_us; -#endif *bsSize = 0; -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS int32_t fdl_request_length; rtp_err = LC3PLUS_RTP_frame_data_length_get_size( &fdl_request_length, handle->fdl_request ); if ( rtp_err != LC3PLUS_RTP_ERR_NO_ERROR ) @@ -481,14 +417,12 @@ ivas_error ISAR_LC3PLUS_ENC_GetOutputBitstreamSize( return IVAS_ERROR( IVAS_ERR_WRONG_PARAMS, "Invalid LC3plus frame_data_length request\n" ); } *bsSize += fdl_request_length; -#endif for ( uint32_t iEnc = 0; iEnc < handle->num_encs; iEnc++ ) { if ( NULL == handle->handles[iEnc] ) { return IVAS_ERROR( IVAS_ERR_UNEXPECTED_NULL_POINTER, "LC3plus encoder handle is NULL\n" ); } -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS lc3plus_frame_data_length = lc3plus_enc_get_num_bytes( handle->handles[iEnc] ); for ( iMediaTime = 0; iMediaTime < num_lc3plus_media_times_per_ivas_frame; ++iMediaTime ) { @@ -507,18 +441,6 @@ ivas_error ISAR_LC3PLUS_ENC_GetOutputBitstreamSize( *bsSize += ftd_frame_data_length_size; } } -#else - *bsSize += lc3plus_enc_get_num_bytes( handle->handles[iEnc] ); - } - - if ( handle->config.isar_frame_duration_us % handle->config.lc3plus_frame_duration_us != 0 ) - { - return IVAS_ERROR( IVAS_ERR_NOT_IMPLEMENTED, "isar_frame_duration_us must be equal or multiple of lc3plus_frame_duration_us \n" ); - } - bitstreamSizeMultiplier = handle->config.isar_frame_duration_us / handle->config.lc3plus_frame_duration_us; - - *bsSize *= bitstreamSizeMultiplier; -#endif return IVAS_ERR_OK; } @@ -538,12 +460,10 @@ void ISAR_LC3PLUS_ENC_Close( { return; } -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS if ( NULL != ( *handle )->frame_type_descriptors ) { free( ( *handle )->frame_type_descriptors ); } -#endif for ( uint32_t iEnc = 0; iEnc < ( *handle )->num_encs; iEnc++ ) { if ( NULL != ( *handle )->handles[iEnc] ) @@ -573,24 +493,15 @@ void ISAR_LC3PLUS_ENC_Close( *-------------------------------------------------------------------*/ ivas_error ISAR_LC3PLUS_ENC_Encode( - ISAR_LC3PLUS_ENC_HANDLE handle, /* i : LC3plus encoder handle */ - float **pcm_in, /* i : pointer input samples */ -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS + ISAR_LC3PLUS_ENC_HANDLE handle, /* i : LC3plus encoder handle */ + float **pcm_in, /* i : pointer input samples */ void *bitstream_out, /* o : pointer to bitstream frame */ const int32_t bitstream_out_size /* i : size of the bitstream_out buffer in bytes. Must be equal to ISAR_LC3PLUS_ENC_GetOutputBitstreamSize. */ -#else - void *bitstream_out /* o : pointer to bitstream frame */ -#endif ) { -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS int32_t ftdIndex; LC3PLUS_RTP_ERR rtpErr; uint32_t num_media_times; -#else - uint32_t lc3framesPerIvasFrame; - uint8_t *bitstream_out_iter = bitstream_out; -#endif uint32_t numSamplesPerLC3plusChannel; int32_t ivasSampleIndex; int32_t num_bytes = 0; @@ -615,7 +526,6 @@ ivas_error ISAR_LC3PLUS_ENC_Encode( { return IVAS_ERROR( IVAS_ERR_NOT_IMPLEMENTED, "isar_frame_duration_us must be equal or multiple of lc3plus_frame_duration_us \n" ); } -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS num_media_times = handle->config.isar_frame_duration_us / handle->config.lc3plus_frame_duration_us; numSamplesPerLC3plusChannel = handle->config.samplerate / ( 1000000 / handle->config.isar_frame_duration_us ) / num_media_times; @@ -625,39 +535,20 @@ ivas_error ISAR_LC3PLUS_ENC_Encode( { return IVAS_ERROR( IVAS_LC3PLUS_LC3plusRtpErrToIvasErr( rtpErr ), "LC3PLUS_RTP_payload_serialize failed\n" ); } -#else - lc3framesPerIvasFrame = handle->config.isar_frame_duration_us / handle->config.lc3plus_frame_duration_us; - - numSamplesPerLC3plusChannel = handle->config.samplerate / ( 1000000 / handle->config.isar_frame_duration_us ) / lc3framesPerIvasFrame; -#endif for ( uint32_t iEnc = 0; iEnc < handle->num_encs; iEnc++ ) { -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS for ( uint32_t iMediaTime = 0; iMediaTime < num_media_times; iMediaTime++ ) -#else - for ( uint32_t iLc3plusFrame = 0; iLc3plusFrame < lc3framesPerIvasFrame; iLc3plusFrame++ ) -#endif { for ( uint32_t iSampleInt16 = 0; iSampleInt16 < numSamplesPerLC3plusChannel; iSampleInt16++ ) { -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS ivasSampleIndex = iSampleInt16 + iMediaTime * numSamplesPerLC3plusChannel; -#else - ivasSampleIndex = iSampleInt16 + iLc3plusFrame * numSamplesPerLC3plusChannel; -#endif handle->pcm_conversion_buffer[iSampleInt16] = (int16_t) max( INT16_MIN, min( pcm_in[iEnc][ivasSampleIndex], INT16_MAX ) ); } -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS ftdIndex = iMediaTime * handle->num_encs + iEnc; -#endif num_bytes = 0; push_wmops( "lc3plus_enc16" ); -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS err = lc3plus_enc16( handle->handles[iEnc], &handle->pcm_conversion_buffer, handle->frame_type_descriptors[ftdIndex].frame_data, &num_bytes, NULL ); -#else - err = lc3plus_enc16( handle->handles[iEnc], &handle->pcm_conversion_buffer, bitstream_out_iter, &num_bytes, NULL ); -#endif pop_wmops(); if ( err != LC3PLUS_OK ) { @@ -667,15 +558,10 @@ ivas_error ISAR_LC3PLUS_ENC_Encode( { return IVAS_ERROR( IVAS_ERR_INTERNAL, "lc3plus_enc16 did not produce output\n" ); } -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS if ( num_bytes != (int32_t) handle->frame_type_descriptors[ftdIndex].frame_data_length ) { return IVAS_ERROR( IVAS_ERR_INTERNAL, "payload format and lc3plus enc bitrate are not aligned\n" ); } -#else - - bitstream_out_iter += num_bytes; -#endif } } @@ -683,4 +569,3 @@ ivas_error ISAR_LC3PLUS_ENC_Encode( return IVAS_ERR_OK; } -#endif /* SPLIT_REND_WITH_HEAD_ROT */ diff --git a/lib_isar/isar_lc3plus_enc.h b/lib_isar/isar_lc3plus_enc.h index 256542ef53a731726c0ee6f5535df8fe976b3aba..9c80033fd36a9d7fea205bd63bb9497611131167 100644 --- a/lib_isar/isar_lc3plus_enc.h +++ b/lib_isar/isar_lc3plus_enc.h @@ -35,12 +35,9 @@ #include #include "ivas_error.h" -#ifdef SPLIT_REND_WITH_HEAD_ROT #include "lc3.h" #include "isar_lc3plus_common.h" -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS #include "isar_lc3plus_payload.h" -#endif /* encoder wrapper */ typedef struct ISAR_LC3PLUS_ENC_HANDLE @@ -49,29 +46,21 @@ typedef struct ISAR_LC3PLUS_ENC_HANDLE LC3PLUS_Enc **handles; uint32_t num_encs; int16_t *pcm_conversion_buffer; -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS LC3PLUS_RTP_FTD *frame_type_descriptors; int32_t num_ftds; LC3PLUS_RTP_FDL fdl_request; -#endif } * ISAR_LC3PLUS_ENC_HANDLE; ivas_error ISAR_LC3PLUS_ENC_Open( - const LC3PLUS_CONFIG config, /* i : encoder configuration */ -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS + const LC3PLUS_CONFIG config, /* i : encoder configuration */ const uint32_t initialBitsPerSecond, /* i : initial target bit rate */ -#else - const uint32_t bitsPerSecond, /* i : bit rate */ -#endif - ISAR_LC3PLUS_ENC_HANDLE *handle /* o : LC3plus encoder handle */ + ISAR_LC3PLUS_ENC_HANDLE *handle /* o : LC3plus encoder handle */ ); -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS ivas_error IVAS_LC3PLUS_ENC_SetBitrate( ISAR_LC3PLUS_ENC_HANDLE handle, /* o : LC3plus encoder handle */ const uint32_t bitsPerSecond /* i : new target bit rate */ ); -#endif ivas_error ISAR_LC3PLUS_ENC_GetDelay( ISAR_LC3PLUS_ENC_HANDLE handle, /* i : LC3plus encoder handle */ @@ -88,15 +77,10 @@ void ISAR_LC3PLUS_ENC_Close( ); ivas_error ISAR_LC3PLUS_ENC_Encode( - ISAR_LC3PLUS_ENC_HANDLE handle, /* i : LC3plus encoder handle */ - float **pcm_in, /* i : pointer input samples */ -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS + ISAR_LC3PLUS_ENC_HANDLE handle, /* i : LC3plus encoder handle */ + float **pcm_in, /* i : pointer input samples */ void *bitstream_out, /* o : pointer to bitstream frame */ const int32_t bitstream_out_size /* i : size of the bitstream_out buffer in bytes. Must be equal to ISAR_LC3PLUS_ENC_GetOutputBitstreamSize. */ -#else - void *bitstream_out /* o : pointer to bitstream frame */ -#endif ); -#endif #endif /* ISAR_LC3PLUS_ENC_H */ diff --git a/lib_isar/isar_lc3plus_payload.c b/lib_isar/isar_lc3plus_payload.c index cd053978d1ca7a5ffdc914a853e4e829e6be592f..2493aa6a30eb9ca3ab8f493dc1dad4e057666b98 100644 --- a/lib_isar/isar_lc3plus_payload.c +++ b/lib_isar/isar_lc3plus_payload.c @@ -36,8 +36,6 @@ #include "isar_lc3plus_payload.h" #include "options.h" -#ifdef SPLIT_REND_WITH_HEAD_ROT -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS static LC3PLUS_RTP_ERR s_frame_duration_ms_from_fdi( int32_t *frame_duration_us, const LC3PLUS_RTP_FTD_FDI fdi ) { if ( NULL == frame_duration_us ) @@ -818,6 +816,3 @@ LC3PLUS_RTP_ERR LC3PLUS_RTP_ftd_fdi_from_frame_duration_us( LC3PLUS_RTP_FTD_FDI return LC3PLUS_RTP_ERR_INVALID_PARAMETERS; } - -#endif /* ISAR_BITSTREAM_UPDATE_LC3PLUS */ -#endif /* SPLIT_REND_WITH_HEAD_ROT */ diff --git a/lib_isar/isar_lc3plus_payload.h b/lib_isar/isar_lc3plus_payload.h index c225c91591685f0f55f9d906d9719cb89a9fd136..e95128578493f5561fdcb2292aef37f0c202e428 100644 --- a/lib_isar/isar_lc3plus_payload.h +++ b/lib_isar/isar_lc3plus_payload.h @@ -38,8 +38,6 @@ #include "lc3.h" #include "options.h" -#ifdef SPLIT_REND_WITH_HEAD_ROT -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS /* Implementation of the "B.2.6 Table of contents" part of the RTP payload format * for LC3plus as specified in ETSI TS 103 634. */ @@ -211,6 +209,4 @@ LC3PLUS_RTP_ERR LC3PLUS_RTP_payload_deserialize( uint8_t *serialized_buffer, const size_t serialized_buffer_size ); -#endif /* ISAR_BITSTREAM_UPDATE_LC3PLUS */ -#endif /* #ifdef SPLIT_REND_WITH_HEAD_ROT */ #endif /* ISAR_LC3PLUS_PAYLOAD_H */ diff --git a/lib_isar/isar_lcld_decoder.c b/lib_isar/isar_lcld_decoder.c index e15155331c50eb8a83fb807053bd9b9afff6c60e..9d136ebb9515cd0f7e62aa0db739ced212218127 100644 --- a/lib_isar/isar_lcld_decoder.c +++ b/lib_isar/isar_lcld_decoder.c @@ -32,7 +32,6 @@ #include #include "options.h" -#ifdef SPLIT_REND_WITH_HEAD_ROT #include "isar_lcld_prot.h" #include "isar_rom_lcld_tables.h" #include "prot.h" @@ -1708,4 +1707,3 @@ static void ComputeAllocation( return; } -#endif diff --git a/lib_isar/isar_lcld_encoder.c b/lib_isar/isar_lcld_encoder.c index 37bd19dc5ad7fced58b0b3557fcd22c3ccdf6bb5..5b980559be0587ebf62a53c2b86aa32d15162278 100644 --- a/lib_isar/isar_lcld_encoder.c +++ b/lib_isar/isar_lcld_encoder.c @@ -32,7 +32,6 @@ #include #include "options.h" -#ifdef SPLIT_REND_WITH_HEAD_ROT #include #include #include "prot.h" @@ -1890,4 +1889,3 @@ static int32_t ComputeAllocation( return iBitsUsed; } -#endif diff --git a/lib_isar/isar_lcld_prot.h b/lib_isar/isar_lcld_prot.h index eee363ced2b1539e1e2da61303e74af91d29682f..a5664ab0328368a7ad1164ab11584982598745df 100644 --- a/lib_isar/isar_lcld_prot.h +++ b/lib_isar/isar_lcld_prot.h @@ -34,7 +34,6 @@ #define ISAR_LCLD_PROT_H #include "options.h" -#ifdef SPLIT_REND_WITH_HEAD_ROT #include "common_api_types.h" #include "isar_rom_lcld_tables.h" @@ -387,7 +386,6 @@ void ComputeEnvelopeGrouping( ); -#endif /* clang-format on */ #endif /* _LCLD_ENCODER_H_ */ diff --git a/lib_isar/isar_prot.h b/lib_isar/isar_prot.h index 4f1f3e7b951ad690c26f485635df6c746254c4c3..f16d5762dd0118d5d191b0df2701064bbfb6b109 100644 --- a/lib_isar/isar_prot.h +++ b/lib_isar/isar_prot.h @@ -36,7 +36,6 @@ #include "isar_stat.h" -#ifdef SPLIT_REND_WITH_HEAD_ROT #include #include "options.h" @@ -56,12 +55,7 @@ ivas_error split_renderer_open_lc3plus( SPLIT_REND_WRAPPER *hSplitRendWrapper, const ISAR_SPLIT_REND_CONFIG_DATA *pSplitRendConfig, const int32_t OutSampleRate, -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS - const IVAS_RENDER_FRAMESIZE ivas_frame_size -#else - const int16_t num_subframes -#endif -); + const IVAS_RENDER_FRAMESIZE ivas_frame_size ); void isar_splitBinPreRendClose( ISAR_BIN_HR_SPLIT_PRE_REND_HANDLE *hBinHrSplitPreRend ); @@ -74,11 +68,7 @@ void lc3plusTimeAlignCldfbPoseCorr( ivas_error splitRendLc3plusEncodeAndWrite( SPLIT_REND_WRAPPER *hSplitBin, ISAR_SPLIT_REND_BITS_HANDLE pBits, -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS const int32_t available_bits, -#else - const int32_t SplitRendBitRate, -#endif float *in[] ); int32_t ISAR_SPLIT_REND_BITStream_read_int32( @@ -209,15 +199,8 @@ void isar_split_rend_get_quant_params( int16_t bands_pitch[ISAR_SPLIT_REND_NUM_QUANT_STRATS], int16_t pred_real_bands_roll[ISAR_SPLIT_REND_NUM_QUANT_STRATS], int16_t pred_imag_bands_roll[ISAR_SPLIT_REND_NUM_QUANT_STRATS], -#ifdef SPLIT_REND_POSE_CORRECTION_UNUSED_BITS const int16_t ro_flag, -#endif - int16_t *num_quant_strats -#ifndef SPLIT_REND_POSE_CORRECTION_UNUSED_BITS - , - int16_t *num_complex_bands -#endif -); + int16_t *num_quant_strats ); void isar_splitBinPostRendMdDec( ISAR_SPLIT_REND_BITS_HANDLE pBits, @@ -269,9 +252,7 @@ ivas_error isar_renderMultiTDBinToSplitBinaural( SPLIT_REND_WRAPPER *hSplitBin, const IVAS_QUATERNION headPosition, const int32_t SplitRendBitRate, -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS const int16_t isar_frame_size_ms, -#endif const int16_t codec_frame_size_ms, ISAR_SPLIT_REND_BITS_HANDLE pBits, const int16_t max_bands, @@ -288,7 +269,6 @@ void isar_renderSplitGetMultiBinPoseData( MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, const ISAR_SPLIT_REND_ROT_AXIS rot_axis ); -#ifdef SPLIT_REND_POSE_CORRECTION_UNUSED_BITS int16_t isar_renderSplitGetRot_axisNumBits( const int16_t dof ); @@ -300,7 +280,6 @@ int16_t isar_renderSplitGetCodeFromRot_axis( const int16_t dof, const ISAR_SPLIT_REND_ROT_AXIS rot_axis, int16_t *num_bits ); -#endif void isar_init_split_post_rend_handles( ISAR_SPLIT_POST_REND_WRAPPER *hSplitRendWrapper ); @@ -310,12 +289,6 @@ void isar_set_split_rend_ht_setup( IVAS_QUATERNION Quaternions[MAX_PARAM_SPATIAL_SUBFRAMES], float Rmat[MAX_PARAM_SPATIAL_SUBFRAMES][3][3] ); -#ifndef ISAR_BITSTREAM_UPDATE_LC3PLUS -int32_t isar_get_lc3plus_bitrate( - const int32_t SplitRendBitRate, - const ISAR_SPLIT_REND_POSE_CORRECTION_MODE poseCorrectionMode, - const int16_t split_prerender_frame_size_ms ); -#endif ivas_error isar_split_rend_validate_config( const ISAR_SPLIT_REND_CONFIG_DATA *pSplitRendConfig, @@ -325,27 +298,19 @@ int32_t isar_get_lcld_bitrate( const int32_t SplitRendBitRate, const ISAR_SPLIT_REND_POSE_CORRECTION_MODE poseCorrectionMode ); -#ifndef ISAR_BITSTREAM_UPDATE_LC3PLUS -int8_t isar_get_lc3plus_bitrate_id( - const int32_t SplitRendBitRate ); -#endif int32_t isar_get_split_rend_md_target_brate( const int32_t SplitRendBitRate, const int16_t pcm_out_flag ); -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS ivas_error isar_framesize_to_ms( const IVAS_RENDER_FRAMESIZE frame_size, /* i : frame size enum */ int16_t *ms /* o : frame size in ms */ ); -#endif ivas_error isar_split_rend_choose_default_codec( ISAR_SPLIT_REND_CODEC *pCodec, /* i/o: pointer to codec setting */ -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS - int16_t *pIsar_frame_size_ms, /* i/o: pointer to isar frame size setting */ -#endif + int16_t *pIsar_frame_size_ms, /* i/o: pointer to isar frame size setting */ int16_t *pCodec_frame_size_ms, /* i/o: pointer to codec frame size setting */ const int16_t cldfb_in_flag, /* i : flag indicating rendering in TD */ const int16_t pcm_out_flag, /* i : flag to indicate PCM output */ @@ -365,12 +330,6 @@ int16_t wrap_a( const int16_t min_val, const int16_t max_val ); -#ifndef ISAR_BITSTREAM_UPDATE_LC3PLUS -int32_t isar_get_lc3plus_size_from_id( - const int8_t SplitRendBitRateId, - const ISAR_SPLIT_REND_POSE_CORRECTION_MODE poseCorrectionMode, - const int16_t split_prerender_frame_size_ms ); -#endif void isar_renderSplitUpdateNoCorrectionPoseData( const ISAR_SPLIT_REND_CONFIG_DATA *pSplit_rend_config, @@ -386,7 +345,6 @@ ISAR_POST_REND_AudioConfigType isar_getAudioConfigType( void isar_init_split_rend_handles( SPLIT_REND_WRAPPER *hSplitRendWrapper ); -#endif /* clang-format on */ diff --git a/lib_isar/isar_rom_lcld_tables.c b/lib_isar/isar_rom_lcld_tables.c index 043f7b6252f0c13eefdf54ecde6cc4d82b3fc222..414f234ab419d9df9212138335ee142e8cc23c6e 100644 --- a/lib_isar/isar_rom_lcld_tables.c +++ b/lib_isar/isar_rom_lcld_tables.c @@ -32,7 +32,6 @@ #include "isar_rom_lcld_tables.h" #include "options.h" -#ifdef SPLIT_REND_WITH_HEAD_ROT #include "wmc_auto.h" #include "prot.h" #include "isar_lcld_prot.h" @@ -12094,4 +12093,3 @@ const int32_t c_aaiSpreadFunction48[MAX_BANDS_48 * MAX_BANDS_48] = { -121, -114, }; -#endif diff --git a/lib_isar/isar_rom_lcld_tables.h b/lib_isar/isar_rom_lcld_tables.h index 59e047ffa7109c26a00fcc16bb3d86a9a2bdf2be..c398402a436bb36dbbc38450542015a7f35dc7d0 100644 --- a/lib_isar/isar_rom_lcld_tables.h +++ b/lib_isar/isar_rom_lcld_tables.h @@ -36,7 +36,6 @@ #include #include "options.h" -#ifdef SPLIT_REND_WITH_HEAD_ROT #ifndef M_PI #define M_PI 3.14159265358979323846264338327950288f @@ -192,6 +191,5 @@ extern const uint16_t ( *c_apauiHuffEncTabels[2 * ALLOC_TABLE_SIZE] )[2]; extern const uint32_t num_row_aauiLCLDHuff[2 * ALLOC_TABLE_SIZE]; extern const uint32_t c_aaiRMSEnvHuffEnc[64][2]; extern const uint32_t c_aaiRMSEnvHuffDec[13][HUFF_DEC_TABLE_SIZE]; -#endif /*SPLIT_REND_WITH_HEAD_ROT*/ #endif /* ISAR_ROM_LCLD_TABLES_H_ */ diff --git a/lib_isar/isar_rom_post_rend.c b/lib_isar/isar_rom_post_rend.c index 1da467d36c2f290c7621448eefdab73ff7ede2d6..92034813dc5c749a736f1663f0e647a58bc8862b 100644 --- a/lib_isar/isar_rom_post_rend.c +++ b/lib_isar/isar_rom_post_rend.c @@ -41,7 +41,6 @@ /* clang-format off */ -#ifdef SPLIT_REND_WITH_HEAD_ROT /*----------------------------------------------------------------------* * Binuaral split rendering ROM tables *-----------------------------------------------------------------------*/ @@ -176,7 +175,5 @@ const int32_t isar_split_rend_huff_roll_pred_consts[ISAR_SPLIT_REND_ROLL_PRED_QU {14,10,1022},{15,10,1023}, }; -#endif - /* clang-format on */ diff --git a/lib_isar/isar_rom_post_rend.h b/lib_isar/isar_rom_post_rend.h index 83b3e476fbc2a1020726196a1d85c753998b0907..0f111244de887b1306fc127b3e74add88e777a1a 100644 --- a/lib_isar/isar_rom_post_rend.h +++ b/lib_isar/isar_rom_post_rend.h @@ -41,7 +41,6 @@ #include "isar_cnst.h" -#ifdef SPLIT_REND_WITH_HEAD_ROT /*----------------------------------------------------------------------* * Binuaral split rendering ROM tables *-----------------------------------------------------------------------*/ @@ -64,6 +63,5 @@ extern const int32_t isar_split_rend_huff_pred31_consts[ISAR_SPLIT_REND_PRED_31Q extern const int32_t isar_split_rend_huff_roll_pred_consts[ISAR_SPLIT_REND_ROLL_PRED_QUANT_PNTS][3]; extern const int32_t isar_split_rend_huff_p_d_consts[ISAR_SPLIT_REND_D_QUANT_PNTS][3]; extern const int32_t isar_split_rend_huff_p_d_diff_consts[ISAR_SPLIT_REND_D_QUANT_PNTS][3]; -#endif #endif diff --git a/lib_isar/isar_splitRend_lcld_dec.c b/lib_isar/isar_splitRend_lcld_dec.c index 939cdaa1ef6a70e9723d1f1c3f89dc89a82d0d70..4d0f7eee4b356562f4ef2bc8d69f6cd1a5550b9f 100644 --- a/lib_isar/isar_splitRend_lcld_dec.c +++ b/lib_isar/isar_splitRend_lcld_dec.c @@ -32,7 +32,6 @@ #include #include "options.h" -#ifdef SPLIT_REND_WITH_HEAD_ROT #include "isar_prot.h" #include "ivas_prot.h" #include "prot.h" @@ -255,4 +254,3 @@ void isar_splitBinLCLDDecProcess( return; } -#endif diff --git a/lib_isar/isar_splitRend_lcld_enc.c b/lib_isar/isar_splitRend_lcld_enc.c index a3c0ac6bd9d7346dae41b52a70f29cd2362b4b09..518c4226e658762e0f052a39c8486f33e3bf84f0 100644 --- a/lib_isar/isar_splitRend_lcld_enc.c +++ b/lib_isar/isar_splitRend_lcld_enc.c @@ -32,7 +32,6 @@ #include #include "options.h" -#ifdef SPLIT_REND_WITH_HEAD_ROT #include "isar_prot.h" #include "ivas_prot.h" #ifdef DEBUGGING @@ -239,4 +238,3 @@ void isar_splitBinLCLDEncProcess( return; } -#endif diff --git a/lib_isar/isar_splitRendererPLC.c b/lib_isar/isar_splitRendererPLC.c index 5b682602d3b633ef2b6395aab81458ddcffa0361..82803ff398b13533ed21f1c0c7b6c921ac777066 100644 --- a/lib_isar/isar_splitRendererPLC.c +++ b/lib_isar/isar_splitRendererPLC.c @@ -32,7 +32,6 @@ #include #include "options.h" -#ifdef SPLIT_REND_WITH_HEAD_ROT #include #include "ivas_prot.h" #include "prot.h" @@ -539,5 +538,3 @@ void isar_splitBinRendPLC( return; } - -#endif diff --git a/lib_isar/isar_splitRendererPost.c b/lib_isar/isar_splitRendererPost.c index f212e5f304ab3c0d53d97f872cfcc1092e2a132d..8e9ac34dd04ceb25a7688a7df3b0daf876f1ede5 100644 --- a/lib_isar/isar_splitRendererPost.c +++ b/lib_isar/isar_splitRendererPost.c @@ -32,7 +32,6 @@ #include #include "options.h" -#ifdef SPLIT_REND_WITH_HEAD_ROT #include #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG #include @@ -242,19 +241,8 @@ static void isar_split_rend_unquant_md( float quantstep; quantstep = pred_quant_step; -#ifndef SPLIT_REND_POSE_CORRECTION_UNUSED_BITS - for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) - { - for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) - { - hMd->pred_mat_re[ch1][ch2] = hMd->pred_mat_re_idx[ch1][ch2] * quantstep; - hMd->pred_mat_re[ch1][ch2] = hMd->pred_mat_re[ch1][ch2] + fix_pos_rot_mat[ch1][ch2]; - } - } -#endif if ( real_only ) { -#ifdef SPLIT_REND_POSE_CORRECTION_UNUSED_BITS for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) { for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) @@ -263,7 +251,6 @@ static void isar_split_rend_unquant_md( hMd->pred_mat_re[ch1][ch2] = hMd->pred_mat_re[ch1][ch2] + ( ( ch1 == ch2 ) ? 1.0f : 0.0f ); } } -#endif for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) { @@ -275,7 +262,6 @@ static void isar_split_rend_unquant_md( } else { -#ifdef SPLIT_REND_POSE_CORRECTION_UNUSED_BITS for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) { for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) @@ -284,7 +270,6 @@ static void isar_split_rend_unquant_md( hMd->pred_mat_re[ch1][ch2] = hMd->pred_mat_re[ch1][ch2] + fix_pos_rot_mat[ch1][ch2]; } } -#endif for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) { @@ -371,32 +356,6 @@ static void isar_splitBinPostRendMdBase2Dec( { if ( hBinHrSplitPostRend->pose_type[pos_idx] == ANY_YAW ) { -#ifndef SPLIT_REND_POSE_CORRECTION_UNUSED_BITS - for ( b = 0; b < pred_real_bands_yaw; b++ ) - { - hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b]; - for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) - { - for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) - { - code = (int16_t) ISAR_SPLIT_REND_BITStream_read_int32( pBits, pred_code_len ); - hMd->pred_mat_re_idx[ch1][ch2] = code + min_pred_idx; - } - } - } - for ( b = 0; b < pred_imag_bands_yaw; b++ ) - { - hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b]; - for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) - { - for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) - { - code = (int16_t) ISAR_SPLIT_REND_BITStream_read_int32( pBits, pred_code_len ); - hMd->pred_mat_im_idx[ch1][ch2] = code + min_pred_idx; - } - } - } -#else for ( b = 0; b < pred_imag_bands_yaw; b++ ) { hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b]; @@ -429,7 +388,6 @@ static void isar_splitBinPostRendMdBase2Dec( hMd->pred_mat_re_idx[0][1] = 0; hMd->pred_mat_re_idx[1][0] = 0; } -#endif for ( b = 0; b < d_bands_yaw; b++ ) { hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b]; @@ -450,32 +408,6 @@ static void isar_splitBinPostRendMdBase2Dec( } else { -#ifndef SPLIT_REND_POSE_CORRECTION_UNUSED_BITS - for ( b = 0; b < pred_real_bands_roll; b++ ) - { - hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b]; - for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) - { - for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) - { - code = (int16_t) ISAR_SPLIT_REND_BITStream_read_int32( pBits, pred_roll_code_len ); - hMd->pred_mat_re_idx[ch1][ch2] = code + min_pred_roll_idx; - } - } - } - for ( b = 0; b < pred_imag_bands_roll; b++ ) - { - hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b]; - for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) - { - for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) - { - code = (int16_t) ISAR_SPLIT_REND_BITStream_read_int32( pBits, pred_roll_code_len ); - hMd->pred_mat_im_idx[ch1][ch2] = code + min_pred_roll_idx; - } - } - } -#else for ( b = 0; b < pred_imag_bands_roll; b++ ) { hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b]; @@ -508,7 +440,6 @@ static void isar_splitBinPostRendMdBase2Dec( hMd->pred_mat_re_idx[0][1] = 0; hMd->pred_mat_re_idx[1][0] = 0; } -#endif } } } @@ -566,32 +497,6 @@ static void isar_splitBinPostRendMdHuffDec( { if ( hBinHrSplitPostRend->pose_type[pos_idx] == ANY_YAW ) { -#ifndef SPLIT_REND_POSE_CORRECTION_UNUSED_BITS - for ( b = 0; b < pred_real_bands_yaw; b++ ) - { - hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b]; - for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) - { - for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) - { - sym_adj_idx[ch1][ch2] = isar_split_rend_huffman_decode_opt( &pHuff_cfg->pred[pred_cb_idx], pBits, pHuff_cfg->pred_idx_trav[pred_cb_idx] ); - } - } - isar_SplitRenderer_getdiagdiff( sym_adj_idx, hMd->pred_mat_re_idx, 1, min_pred_idx, max_pred_idx ); - } - for ( b = 0; b < pred_imag_bands_yaw; b++ ) - { - hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b]; - for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) - { - for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) - { - sym_adj_idx[ch1][ch2] = isar_split_rend_huffman_decode_opt( &pHuff_cfg->pred[pred_cb_idx], pBits, pHuff_cfg->pred_idx_trav[pred_cb_idx] ); - } - } - isar_SplitRenderer_getdiagdiff( sym_adj_idx, hMd->pred_mat_im_idx, -1, min_pred_idx, max_pred_idx ); - } -#else for ( b = 0; b < pred_imag_bands_yaw; b++ ) { hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b]; @@ -623,7 +528,6 @@ static void isar_splitBinPostRendMdHuffDec( sym_adj_idx[0][1] = 0; isar_SplitRenderer_getdiagdiff( sym_adj_idx, hMd->pred_mat_re_idx, -1, min_pred_idx, max_pred_idx ); } -#endif for ( b = 0; b < d_bands_yaw; b++ ) { hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b]; @@ -642,33 +546,6 @@ static void isar_splitBinPostRendMdHuffDec( } else { -#ifndef SPLIT_REND_POSE_CORRECTION_UNUSED_BITS - for ( b = 0; b < pred_real_bands_roll; b++ ) - { - hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b]; - - for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) - { - for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) - { - sym_adj_idx[ch1][ch2] = isar_split_rend_huffman_decode_opt( &pHuff_cfg->pred_roll, pBits, pHuff_cfg->pred_roll_idx_trav ); - } - } - isar_SplitRenderer_getdiagdiff( sym_adj_idx, hMd->pred_mat_re_idx, 1, min_pred_roll_idx, max_pred_roll_idx ); - } - for ( b = 0; b < pred_imag_bands_roll; b++ ) - { - hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b]; - for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) - { - for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) - { - sym_adj_idx[ch1][ch2] = isar_split_rend_huffman_decode_opt( &pHuff_cfg->pred_roll, pBits, pHuff_cfg->pred_roll_idx_trav ); - } - } - isar_SplitRenderer_getdiagdiff( sym_adj_idx, hMd->pred_mat_im_idx, -1, min_pred_roll_idx, max_pred_roll_idx ); - } -#else for ( b = 0; b < pred_imag_bands_roll; b++ ) { hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b]; @@ -703,7 +580,6 @@ static void isar_splitBinPostRendMdHuffDec( sym_adj_idx[0][1] = 0; isar_SplitRenderer_getdiagdiff( sym_adj_idx, hMd->pred_mat_re_idx, -1, min_pred_roll_idx, max_pred_roll_idx ); } -#endif } } } @@ -732,11 +608,7 @@ void isar_splitBinPostRendMdDec( int16_t pred_real_bands_yaw[ISAR_SPLIT_REND_NUM_QUANT_STRATS], pred_real_bands_roll[ISAR_SPLIT_REND_NUM_QUANT_STRATS]; int16_t pred_imag_bands_yaw[ISAR_SPLIT_REND_NUM_QUANT_STRATS], pred_imag_bands_roll[ISAR_SPLIT_REND_NUM_QUANT_STRATS]; int16_t d_bands_yaw[ISAR_SPLIT_REND_NUM_QUANT_STRATS], bands_pitch[ISAR_SPLIT_REND_NUM_QUANT_STRATS]; -#ifdef SPLIT_REND_POSE_CORRECTION_UNUSED_BITS int16_t num_quant_strats; -#else - int16_t num_complex_bands, num_quant_strats; -#endif int32_t quant_strat_bits, is_huff_coding, quant_strat; int16_t pred_quant_pnts_yaw[ISAR_SPLIT_REND_NUM_QUANT_STRATS]; float pred_1byquantstep_yaw[ISAR_SPLIT_REND_NUM_QUANT_STRATS]; @@ -747,16 +619,13 @@ void isar_splitBinPostRendMdDec( ISAR_BIN_HR_SPLIT_REND_MD_HANDLE hMd; ISAR_SPLIT_REND_CONFIG_DATA split_rend_config; ISAR_SPLIT_REND_ROT_AXIS rot_axis; -#ifdef SPLIT_REND_POSE_CORRECTION_UNUSED_BITS int16_t ro_md_flag, num_bits, axis_code; -#endif hBinHrSplitPostRend->low_Res = 1; split_rend_config.dof = (int16_t) ISAR_SPLIT_REND_BITStream_read_int32( pBits, ISAR_SPLIT_REND_DOF_BITS ); split_rend_config.hq_mode = (int16_t) ISAR_SPLIT_REND_BITStream_read_int32( pBits, ISAR_SPLIT_REND_HQ_MODE_BITS ); -#ifdef SPLIT_REND_POSE_CORRECTION_UNUSED_BITS num_bits = isar_renderSplitGetRot_axisNumBits( split_rend_config.dof ); if ( num_bits > 0 ) { @@ -768,9 +637,6 @@ void isar_splitBinPostRendMdDec( } rot_axis = isar_renderSplitGetRot_axisFromCode( split_rend_config.dof, axis_code ); ro_md_flag = (int16_t) ISAR_SPLIT_REND_BITStream_read_int32( pBits, ISAR_SPLIT_REND_RO_FLAG_BITS ); -#else - rot_axis = (ISAR_SPLIT_REND_ROT_AXIS) ISAR_SPLIT_REND_BITStream_read_int32( pBits, ISAR_SPLIT_REND_ROT_AXIS_BITS ); -#endif isar_renderSplitGetMultiBinPoseData( &split_rend_config, pMultiBinPoseData, rot_axis ); @@ -797,7 +663,6 @@ void isar_splitBinPostRendMdDec( hBinHrSplitPostRend->QuaternionsPre[sf_idx].z = (float) angle; } -#ifdef SPLIT_REND_POSE_CORRECTION_UNUSED_BITS isar_split_rend_get_quant_params( MAX_SPLIT_REND_MD_BANDS, pred_real_bands_yaw, @@ -811,21 +676,6 @@ void isar_splitBinPostRendMdDec( pred_imag_bands_roll, ro_md_flag, &num_quant_strats ); -#else - isar_split_rend_get_quant_params( - MAX_SPLIT_REND_MD_BANDS, - pred_real_bands_yaw, - pred_imag_bands_yaw, - pred_quant_pnts_yaw, - pred_quantstep_yaw, - pred_1byquantstep_yaw, - d_bands_yaw, - bands_pitch, - pred_real_bands_roll, - pred_imag_bands_roll, - &num_quant_strats, - &num_complex_bands ); -#endif quant_strat_bits = (int32_t) ceilf( log2f( num_quant_strats ) ); is_huff_coding = ISAR_SPLIT_REND_BITStream_read_int32( pBits, 1 ); @@ -1907,4 +1757,3 @@ void isar_init_split_post_rend_handles( return; } -#endif diff --git a/lib_isar/isar_splitRendererPre.c b/lib_isar/isar_splitRendererPre.c index 5c2f787a8dc10e1519aa5abad2c9e3d3a0cb2de6..1829618db5fd3c4c184e409964e54cac8f3f825c 100644 --- a/lib_isar/isar_splitRendererPre.c +++ b/lib_isar/isar_splitRendererPre.c @@ -32,7 +32,6 @@ #include #include "options.h" -#ifdef SPLIT_REND_WITH_HEAD_ROT #include #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG #include @@ -482,11 +481,7 @@ static void isar_split_rend_quant_md( { int16_t ch1, ch2; int16_t gd_idx_min; -#ifdef SPLIT_REND_POSE_CORRECTION_UNUSED_BITS float quant_val; -#else - float sign, quant_val; -#endif if ( pose_type == PRED_ONLY || pose_type == PRED_ROLL_ONLY ) { @@ -495,7 +490,6 @@ static void isar_split_rend_quant_md( onebyquantstep = pred_1byquantstep; if ( real_only == 1 ) { -#ifdef SPLIT_REND_POSE_CORRECTION_UNUSED_BITS for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) { hMd->pred_mat_re[ch1][ch1] = hMd->pred_mat_re2[ch1]; @@ -512,23 +506,9 @@ static void isar_split_rend_quant_md( hMd->pred_mat_re_idx[ch1][ch2] = (int16_t) roundf( onebyquantstep * quant_val ); } } -#else - for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) - { - for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) - { - sign = ( hMd->pred_mat_re[ch1][ch2] >= 0.0f ) ? 1.0f : -1.0f; - IVAS_CALCULATE_ABS( hMd->pred_mat_re[ch1][ch2], hMd->pred_mat_im[ch1][ch2], hMd->pred_mat_re[ch1][ch2] ); - hMd->pred_mat_re[ch1][ch2] *= sign; - hMd->pred_mat_im[ch1][ch2] = 0.0f; - } - } -#endif } -#ifdef SPLIT_REND_POSE_CORRECTION_UNUSED_BITS else { -#endif for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) { for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) @@ -538,9 +518,7 @@ static void isar_split_rend_quant_md( hMd->pred_mat_re_idx[ch1][ch2] = (int16_t) roundf( onebyquantstep * quant_val ); } } -#ifdef SPLIT_REND_POSE_CORRECTION_UNUSED_BITS } -#endif if ( real_only == 0 ) { @@ -577,7 +555,6 @@ static void isar_split_rend_quant_md( return; } -#ifdef SPLIT_REND_POSE_CORRECTION_UNUSED_BITS static void get_lr_gains( float cov_in[][BINAURAL_CHANNELS], float cov_out[][BINAURAL_CHANNELS], float gains[BINAURAL_CHANNELS] ) @@ -598,7 +575,6 @@ static void get_lr_gains( float cov_in[][BINAURAL_CHANNELS], } return; } -#endif static void ComputeCoeffs( float cov_ii_re[][BINAURAL_CHANNELS], @@ -622,23 +598,7 @@ static void ComputeCoeffs( if ( pose_type == PITCH_ONLY ) { float gd_tmp[BINAURAL_CHANNELS]; -#ifdef SPLIT_REND_POSE_CORRECTION_UNUSED_BITS get_lr_gains( cov_ii_re, cov_oo_re, gd_tmp ); -#else - for ( i = 0; i < BINAURAL_CHANNELS; i++ ) - { - gd_tmp[i] = cov_ii_re[i][i]; - if ( gd_tmp[i] < EPSILON ) - { - gd_tmp[i] = 1.0f; - } - else - { - gd_tmp[i] = ( cov_oo_re[i][i] ) / gd_tmp[i]; - gd_tmp[i] = sqrtf( gd_tmp[i] ); - } - } -#endif hMd->gd = gd_tmp[0]; hMd->gd2 = gd_tmp[1]; } @@ -647,7 +607,6 @@ static void ComputeCoeffs( if ( real_only ) { float gd_tmp[BINAURAL_CHANNELS]; -#ifdef SPLIT_REND_POSE_CORRECTION_UNUSED_BITS get_lr_gains( cov_ii_re, cov_oo_re, gd_tmp ); for ( i = 0; i < BINAURAL_CHANNELS; i++ ) { @@ -655,31 +614,12 @@ static void ComputeCoeffs( hMd->pred_mat_re2[i] = gd_tmp[i]; set_zero( hMd->pred_mat_im[i], BINAURAL_CHANNELS ); } -#else - for ( i = 0; i < BINAURAL_CHANNELS; i++ ) - { - gd_tmp[i] = cov_ii_re[i][i]; - if ( gd_tmp[i] < EPSILON ) - { - gd_tmp[i] = 1.0f; - } - else - { - gd_tmp[i] = ( cov_oo_re[i][i] ) / gd_tmp[i]; - gd_tmp[i] = sqrtf( gd_tmp[i] ); - } - hMd->pred_mat_re[i][i] = gd_tmp[i]; - set_zero( hMd->pred_mat_im[i], BINAURAL_CHANNELS ); - } -#endif hMd->pred_mat_re[1][0] = 0.0f; hMd->pred_mat_re[0][1] = 0.0f; } else { -#ifdef SPLIT_REND_POSE_CORRECTION_UNUSED_BITS get_lr_gains( cov_ii_re, cov_oo_re, hMd->pred_mat_re2 ); -#endif cov_norm_fact = GetNormFact( cov_ii_re, cov_ii_im, cov_io_re, cov_io_im, cov_oo_re ); /* normalize the covariance */ @@ -799,14 +739,9 @@ static void get_base2_bits( pose_type = hBinHrSplitPreRend->pose_type[pose_idx]; if ( pose_type == ANY_YAW ) { -#ifndef SPLIT_REND_POSE_CORRECTION_UNUSED_BITS - base2bits[q] += pred_yaw_bits[q] * pred_real_bands_yaw[q] * num_subframes * BINAURAL_CHANNELS * BINAURAL_CHANNELS; - base2bits[q] += pred_yaw_bits[q] * pred_imag_bands_yaw[q] * num_subframes * BINAURAL_CHANNELS * BINAURAL_CHANNELS; -#else base2bits[q] += pred_yaw_bits[q] * pred_real_bands_yaw[q] * num_subframes * BINAURAL_CHANNELS; base2bits[q] += pred_yaw_bits[q] * pred_imag_bands_yaw[q] * num_subframes * BINAURAL_CHANNELS; base2bits[q] += pred_yaw_bits[q] * pred_imag_bands_yaw[q] * num_subframes * BINAURAL_CHANNELS * BINAURAL_CHANNELS; -#endif base2bits[q] += d_gain_bits * d_bands_yaw[q] * num_subframes; } else if ( pose_type == PITCH_ONLY ) @@ -816,14 +751,9 @@ static void get_base2_bits( } else { -#ifndef SPLIT_REND_POSE_CORRECTION_UNUSED_BITS - base2bits[q] += pred_roll_bits * pred_real_bands_roll[q] * num_subframes * BINAURAL_CHANNELS * BINAURAL_CHANNELS; - base2bits[q] += pred_roll_bits * pred_imag_bands_roll[q] * num_subframes * BINAURAL_CHANNELS * BINAURAL_CHANNELS; -#else base2bits[q] += pred_roll_bits * pred_real_bands_roll[q] * num_subframes * BINAURAL_CHANNELS; base2bits[q] += pred_roll_bits * pred_imag_bands_roll[q] * num_subframes * BINAURAL_CHANNELS; base2bits[q] += pred_roll_bits * pred_imag_bands_roll[q] * num_subframes * BINAURAL_CHANNELS * BINAURAL_CHANNELS; -#endif } } } @@ -880,33 +810,6 @@ static void isar_SplitRenderer_code_md_base2( { if ( hBinHrSplitPreRend->pose_type[pos_idx] == ANY_YAW ) { -#ifndef SPLIT_REND_POSE_CORRECTION_UNUSED_BITS - for ( b = 0; b < pred_real_bands_yaw; b++ ) - { - hMd = &hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b]; - for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) - { - for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) - { - code = hMd->pred_mat_re_idx[ch1][ch2] - min_pred_idx; - ISAR_SPLIT_REND_BITStream_write_int32( pBits, code, pred_code_len ); - } - } - } - - for ( b = 0; b < pred_imag_bands_yaw; b++ ) - { - hMd = &hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b]; - for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) - { - for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) - { - code = hMd->pred_mat_im_idx[ch1][ch2] - min_pred_idx; - ISAR_SPLIT_REND_BITStream_write_int32( pBits, code, pred_code_len ); - } - } - } -#else for ( b = 0; b < pred_imag_bands_yaw; b++ ) { @@ -939,7 +842,6 @@ static void isar_SplitRenderer_code_md_base2( ISAR_SPLIT_REND_BITStream_write_int32( pBits, code, pred_code_len ); } } -#endif for ( b = 0; b < d_bands_yaw; b++ ) { hMd = &hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b]; @@ -961,33 +863,6 @@ static void isar_SplitRenderer_code_md_base2( } else { -#ifndef SPLIT_REND_POSE_CORRECTION_UNUSED_BITS - for ( b = 0; b < pred_real_bands_roll; b++ ) - { - hMd = &hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b]; - for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) - { - for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) - { - code = hMd->pred_mat_re_idx[ch1][ch2] - min_pred_roll_idx; - ISAR_SPLIT_REND_BITStream_write_int32( pBits, code, pred_roll_code_len ); - } - } - } - - for ( b = 0; b < pred_imag_bands_roll; b++ ) - { - hMd = &hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b]; - for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) - { - for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) - { - code = hMd->pred_mat_im_idx[ch1][ch2] - min_pred_roll_idx; - ISAR_SPLIT_REND_BITStream_write_int32( pBits, code, pred_roll_code_len ); - } - } - } -#else for ( b = 0; b < pred_imag_bands_roll; b++ ) { hMd = &hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b]; @@ -1018,7 +893,6 @@ static void isar_SplitRenderer_code_md_base2( ISAR_SPLIT_REND_BITStream_write_int32( pBits, code, pred_roll_code_len ); } } -#endif } } } @@ -1091,36 +965,6 @@ static void isar_SplitRenderer_code_md_huff( { if ( hBinHrSplitPreRend->pose_type[pos_idx] == ANY_YAW ) { -#ifndef SPLIT_REND_POSE_CORRECTION_UNUSED_BITS - for ( b = 0; b < pred_real_bands_yaw; b++ ) - { - hMd = &hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b]; - isar_SplitRenderer_getdiagdiff( hMd->pred_mat_re_idx, sym_adj_idx, -1, min_pred_idx, max_pred_idx ); - for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) - { - for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) - { - isar_split_rend_huffman_encode( &pHuff_cfg->pred[pred_cb_idx], sym_adj_idx[ch1][ch2], &code, &len ); - ISAR_SPLIT_REND_BITStream_write_int32( pBits, code, len ); - } - } - } - for ( b = 0; b < pred_imag_bands_yaw; b++ ) - { - hMd = &hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b]; - isar_SplitRenderer_getdiagdiff( hMd->pred_mat_im_idx, sym_adj_idx, 1, min_pred_idx, max_pred_idx ); - for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) - { - for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) - { - - isar_split_rend_huffman_encode( &pHuff_cfg->pred[pred_cb_idx], sym_adj_idx[ch1][ch2], &code, &len ); - - ISAR_SPLIT_REND_BITStream_write_int32( pBits, code, len ); - } - } - } -#else for ( b = 0; b < pred_imag_bands_yaw; b++ ) { hMd = &hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b]; @@ -1155,7 +999,6 @@ static void isar_SplitRenderer_code_md_huff( ISAR_SPLIT_REND_BITStream_write_int32( pBits, code, len ); } } -#endif for ( b = 0; b < d_bands_yaw; b++ ) { hMd = &hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b]; @@ -1177,34 +1020,6 @@ static void isar_SplitRenderer_code_md_huff( } else { -#ifndef SPLIT_REND_POSE_CORRECTION_UNUSED_BITS - for ( b = 0; b < pred_real_bands_roll; b++ ) - { - hMd = &hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b]; - isar_SplitRenderer_getdiagdiff( hMd->pred_mat_re_idx, sym_adj_idx, -1, min_pred_roll_idx, max_pred_roll_idx ); - for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) - { - for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) - { - isar_split_rend_huffman_encode( &pHuff_cfg->pred_roll, sym_adj_idx[ch1][ch2], &code, &len ); - ISAR_SPLIT_REND_BITStream_write_int32( pBits, code, len ); - } - } - } - for ( b = 0; b < pred_imag_bands_roll; b++ ) - { - hMd = &hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b]; - isar_SplitRenderer_getdiagdiff( hMd->pred_mat_im_idx, sym_adj_idx, 1, min_pred_roll_idx, max_pred_roll_idx ); - for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ ) - { - for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ ) - { - isar_split_rend_huffman_encode( &pHuff_cfg->pred_roll, sym_adj_idx[ch1][ch2], &code, &len ); - ISAR_SPLIT_REND_BITStream_write_int32( pBits, code, len ); - } - } - } -#else for ( b = 0; b < pred_imag_bands_roll; b++ ) { hMd = &hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b]; @@ -1239,7 +1054,6 @@ static void isar_SplitRenderer_code_md_huff( ISAR_SPLIT_REND_BITStream_write_int32( pBits, code, len ); } } -#endif } } } @@ -1272,16 +1086,10 @@ static void isar_SplitRenderer_quant_code( MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, ISAR_SPLIT_REND_BITS_HANDLE pBits, const int16_t low_res_pre_rend_rot, -#ifdef SPLIT_REND_POSE_CORRECTION_UNUSED_BITS const int16_t ro_md_flag, -#endif const int32_t target_md_bits ) { -#ifdef SPLIT_REND_POSE_CORRECTION_UNUSED_BITS int16_t q, num_subframes, sf_idx, pos_idx, b, num_quant_strats; -#else - int16_t num_complex_bands, q, num_subframes, sf_idx, pos_idx, b, num_quant_strats; -#endif int32_t overhead_bits, quant_strat_bits, huff_bits, start_bit; int16_t pred_real_bands_yaw[ISAR_SPLIT_REND_NUM_QUANT_STRATS], pred_real_bands_roll[ISAR_SPLIT_REND_NUM_QUANT_STRATS]; int16_t pred_imag_bands_yaw[ISAR_SPLIT_REND_NUM_QUANT_STRATS], pred_imag_bands_roll[ISAR_SPLIT_REND_NUM_QUANT_STRATS]; @@ -1291,9 +1099,7 @@ static void isar_SplitRenderer_quant_code( float pred_1byquantstep_yaw[ISAR_SPLIT_REND_NUM_QUANT_STRATS]; float pred_quantstep_yaw[ISAR_SPLIT_REND_NUM_QUANT_STRATS]; ISAR_BIN_HR_SPLIT_REND_MD_HANDLE hMd; -#ifdef SPLIT_REND_POSE_CORRECTION_UNUSED_BITS int16_t rot_axis_code, num_bits; -#endif if ( low_res_pre_rend_rot ) { @@ -1308,16 +1114,12 @@ static void isar_SplitRenderer_quant_code( ISAR_SPLIT_REND_BITStream_write_int32( pBits, pMultiBinPoseData->dof, ISAR_SPLIT_REND_DOF_BITS ); ISAR_SPLIT_REND_BITStream_write_int32( pBits, pMultiBinPoseData->hq_mode, ISAR_SPLIT_REND_HQ_MODE_BITS ); -#ifdef SPLIT_REND_POSE_CORRECTION_UNUSED_BITS rot_axis_code = isar_renderSplitGetCodeFromRot_axis( pMultiBinPoseData->dof, pMultiBinPoseData->rot_axis, &num_bits ); if ( num_bits > 0 ) { ISAR_SPLIT_REND_BITStream_write_int32( pBits, (int32_t) rot_axis_code, num_bits ); } ISAR_SPLIT_REND_BITStream_write_int32( pBits, (int32_t) ro_md_flag, ISAR_SPLIT_REND_RO_FLAG_BITS ); -#else - ISAR_SPLIT_REND_BITStream_write_int32( pBits, (int32_t) pMultiBinPoseData->rot_axis, ISAR_SPLIT_REND_ROT_AXIS_BITS ); -#endif /* code ref pose*/ for ( sf_idx = 0; sf_idx < num_subframes; sf_idx++ ) @@ -1340,15 +1142,9 @@ static void isar_SplitRenderer_quant_code( ISAR_SPLIT_REND_BITStream_write_int32( pBits, angle, ISAR_SPLIT_REND_HEAD_POSE_BITS ); } -#ifdef SPLIT_REND_POSE_CORRECTION_UNUSED_BITS isar_split_rend_get_quant_params( MAX_SPLIT_REND_MD_BANDS, pred_real_bands_yaw, pred_imag_bands_yaw, pred_quant_pnts_yaw, pred_quantstep_yaw, pred_1byquantstep_yaw, d_bands_yaw, bands_pitch, pred_real_bands_roll, pred_imag_bands_roll, ro_md_flag, &num_quant_strats ); -#else - isar_split_rend_get_quant_params( MAX_SPLIT_REND_MD_BANDS, pred_real_bands_yaw, pred_imag_bands_yaw, - pred_quant_pnts_yaw, pred_quantstep_yaw, pred_1byquantstep_yaw, - d_bands_yaw, bands_pitch, pred_real_bands_roll, pred_imag_bands_roll, &num_quant_strats, &num_complex_bands ); -#endif quant_strat_bits = (int32_t) ceilf( log2f( num_quant_strats ) ); overhead_bits = pBits->bits_written - overhead_bits + quant_strat_bits + 1; /* 1 for base2 vs huff */ @@ -1636,11 +1432,7 @@ void isar_rend_CldfbSplitPreRendProcess( isar_SplitRenderer_GetRotMd( hBinHrSplitPreRend, pMultiBinPoseData, Cldfb_In_BinReal, Cldfb_In_BinImag, low_res_pre_rend_rot, ro_md_flag ); -#ifdef SPLIT_REND_POSE_CORRECTION_UNUSED_BITS isar_SplitRenderer_quant_code( hBinHrSplitPreRend, headPosition, pMultiBinPoseData, pBits, low_res_pre_rend_rot, ro_md_flag, target_md_bits ); -#else - isar_SplitRenderer_quant_code( hBinHrSplitPreRend, headPosition, pMultiBinPoseData, pBits, low_res_pre_rend_rot, target_md_bits ); -#endif #ifdef SPLIT_POSE_CORRECTION_DEBUG float tmpCrendBuffer[2][L_FRAME48k], quant_val, step, minv, maxv; @@ -1925,54 +1717,34 @@ ivas_error split_renderer_open_lc3plus( SPLIT_REND_WRAPPER *hSplitRendWrapper, const ISAR_SPLIT_REND_CONFIG_DATA *pSplitRendConfig, const int32_t OutSampleRate, -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS - const IVAS_RENDER_FRAMESIZE isar_frame_size -#else - const int16_t num_subframes -#endif -) + const IVAS_RENDER_FRAMESIZE isar_frame_size ) { ivas_error error; int16_t i, delayBufferLength; LC3PLUS_CONFIG config; -#if defined ISAR_BITSTREAM_UPDATE_LC3PLUS int16_t isar_frame_size_ms; if ( ( error = isar_framesize_to_ms( isar_frame_size, &isar_frame_size_ms ) ) != IVAS_ERR_OK ) { return error; } -#endif -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS /* Check configuration validity */ if ( isar_frame_size_ms < pSplitRendConfig->codec_frame_size_ms ) { return IVAS_ERROR( IVAS_ERR_INVALID_SPLIT_REND_CONFIG, "SR codec frame doesn't fit in one output frame" ); } -#endif config.lc3plus_frame_duration_us = pSplitRendConfig->codec_frame_size_ms * 1000; -#ifndef ISAR_BITSTREAM_UPDATE_LC3PLUS - config.isar_frame_duration_us = ( pSplitRendConfig->dof == 0 ) ? config.lc3plus_frame_duration_us * num_subframes : 20000; -#endif config.samplerate = OutSampleRate; -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS config.isar_frame_duration_us = isar_frame_size_ms * 1000; -#endif -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS config.high_res_mode_enabled = ( pSplitRendConfig->lc3plus_highres != 0 ); -#endif config.channels = BINAURAL_CHANNELS; if ( ( error = ISAR_LC3PLUS_ENC_Open( config, -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS isar_get_lcld_bitrate( pSplitRendConfig->splitRendBitRate, pSplitRendConfig->poseCorrectionMode ), -#else - isar_get_lc3plus_bitrate( pSplitRendConfig->splitRendBitRate, pSplitRendConfig->poseCorrectionMode, (int16_t) ( config.isar_frame_duration_us / 1000 ) ), -#endif &hSplitRendWrapper->hLc3plusEnc ) ) != IVAS_ERR_OK ) { return error; @@ -2029,13 +1801,7 @@ ivas_error split_renderer_open_lc3plus( ivas_error splitRendLc3plusEncodeAndWrite( SPLIT_REND_WRAPPER *hSplitBin, ISAR_SPLIT_REND_BITS_HANDLE pBits, -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS const int32_t available_bits, -#endif -#else - const int32_t SplitRendBitRate, -#endif float *in[] ) { ivas_error error; @@ -2055,28 +1821,19 @@ ivas_error splitRendLc3plusEncodeAndWrite( channel_ptrs[i] = in[i]; } -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS if ( ( error = IVAS_LC3PLUS_ENC_SetBitrate( hSplitBin->hLc3plusEnc, available_bits * FRAMES_PER_SEC ) ) != IVAS_ERR_OK ) { return error; } -#endif if ( ( error = ISAR_LC3PLUS_ENC_GetOutputBitstreamSize( hSplitBin->hLc3plusEnc, &lc3plusBitstreamSize ) ) != IVAS_ERR_OK ) { return error; } -#ifndef ISAR_BITSTREAM_UPDATE_LC3PLUS - ISAR_SPLIT_REND_BITStream_write_int32( pBits, isar_get_lc3plus_bitrate_id( SplitRendBitRate ), 8 ); -#endif /* Write bitstream */ -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS if ( ( error = ISAR_LC3PLUS_ENC_Encode( hSplitBin->hLc3plusEnc, channel_ptrs, &pBits->bits_buf[pBits->bits_written / 8], lc3plusBitstreamSize ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ISAR_LC3PLUS_ENC_Encode( hSplitBin->hLc3plusEnc, channel_ptrs, &pBits->bits_buf[pBits->bits_written / 8] ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -2085,9 +1842,7 @@ ivas_error splitRendLc3plusEncodeAndWrite( pBits->codec = ISAR_SPLIT_REND_CODEC_LC3PLUS; pBits->pose_correction = hSplitBin->multiBinPoseData.poseCorrectionMode; pBits->codec_frame_size_ms = (int16_t) ( hSplitBin->hLc3plusEnc->config.lc3plus_frame_duration_us / 1000 ); -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS pBits->isar_frame_size_ms = (int16_t) ( hSplitBin->hLc3plusEnc->config.isar_frame_duration_us / 1000 ); -#endif return IVAS_ERR_OK; } @@ -2101,9 +1856,7 @@ ivas_error isar_renderMultiTDBinToSplitBinaural( SPLIT_REND_WRAPPER *hSplitBin, const IVAS_QUATERNION headPosition, const int32_t SplitRendBitRate, -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS const int16_t isar_frame_size_ms, -#endif const int16_t codec_frame_size_ms, ISAR_SPLIT_REND_BITS_HANDLE pBits, const int16_t max_bands, @@ -2113,11 +1866,7 @@ ivas_error isar_renderMultiTDBinToSplitBinaural( const int16_t ro_md_flag ) { ivas_error error; -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS int32_t bit_len, available_bits, target_md_bits; -#else - int32_t bit_len, available_bits, target_md_bits, actual_md_bits; -#endif int16_t num_cldfb_bands, ch, slot_idx, pos_idx, num_poses; float Cldfb_In_BinReal[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; float Cldfb_In_BinImag[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; @@ -2154,9 +1903,6 @@ ivas_error isar_renderMultiTDBinToSplitBinaural( } } -#ifndef ISAR_BITSTREAM_UPDATE_LC3PLUS - actual_md_bits = pBits->bits_written; -#endif if ( ( hSplitBin->multiBinPoseData.poseCorrectionMode == ISAR_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB ) || ( !useLc3plus && !pcm_out_flag ) ) { num_slots = ( hSplitBin->multiBinPoseData.poseCorrectionMode == ISAR_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB ) ? CLDFB_NO_COL_MAX : ( hSplitBin->hSplitBinLCLDEnc->iNumBlocks * hSplitBin->hSplitBinLCLDEnc->iNumIterations ); @@ -2197,9 +1943,6 @@ ivas_error isar_renderMultiTDBinToSplitBinaural( { target_md_bits = isar_get_split_rend_md_target_brate( SplitRendBitRate, pcm_out_flag ) * L_FRAME48k / 48000; -#ifndef ISAR_BITSTREAM_UPDATE_LC3PLUS - actual_md_bits = pBits->bits_written; -#endif isar_rend_CldfbSplitPreRendProcess( hSplitBin->hBinHrSplitPreRend, headPosition, &hSplitBin->multiBinPoseData, Cldfb_In_BinReal, Cldfb_In_BinImag, pBits, target_md_bits, low_res_pre_rend_rot, ro_md_flag ); } @@ -2212,32 +1955,16 @@ ivas_error isar_renderMultiTDBinToSplitBinaural( if ( !useLc3plus ) { available_bits = ( SplitRendBitRate * hSplitBin->hSplitBinLCLDEnc->iNumBlocks * hSplitBin->hSplitBinLCLDEnc->iNumIterations ) / ( 16 * FRAMES_PER_SEC ); -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS available_bits -= pBits->bits_written; -#else - actual_md_bits = pBits->bits_written - actual_md_bits; - available_bits -= actual_md_bits; -#endif pBits->codec_frame_size_ms = codec_frame_size_ms; -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS pBits->isar_frame_size_ms = isar_frame_size_ms; -#endif isar_splitBinLCLDEncProcess( hSplitBin->hSplitBinLCLDEnc, Cldfb_In_BinReal, Cldfb_In_BinImag, available_bits, pBits ); } else { -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS available_bits = ( SplitRendBitRate / FRAMES_PER_SEC ) - pBits->bits_written; if ( ( error = splitRendLc3plusEncodeAndWrite( hSplitBin, pBits, available_bits, in ) ) != IVAS_ERR_OK ) -#else - available_bits = ( SplitRendBitRate / FRAMES_PER_SEC ) - pBits->bits_written; - if ( ( error = splitRendLc3plusEncodeAndWrite( hSplitBin, pBits, in ) ) != IVAS_ERR_OK ) -#endif -#else - if ( ( error = splitRendLc3plusEncodeAndWrite( hSplitBin, pBits, SplitRendBitRate, in ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -2337,4 +2064,3 @@ void lc3plusTimeAlignCldfbPoseCorr( return; } -#endif diff --git a/lib_isar/isar_splitRenderer_utils.c b/lib_isar/isar_splitRenderer_utils.c index a1910bf9f67f94b00b18f0e30dcafdf9bea97e31..a7c8033a8abe6f43d4af8cc107b99e1f2eec6331 100644 --- a/lib_isar/isar_splitRenderer_utils.c +++ b/lib_isar/isar_splitRenderer_utils.c @@ -32,7 +32,6 @@ #include #include "options.h" -#ifdef SPLIT_REND_WITH_HEAD_ROT #include #include "ivas_prot.h" #include "isar_rom_post_rend.h" @@ -564,131 +563,6 @@ int32_t isar_get_lcld_bitrate( } -#ifndef ISAR_BITSTREAM_UPDATE_LC3PLUS -/*------------------------------------------------------------------------- - * Function isar_get_lc3plus_bitrate() - * - * - *------------------------------------------------------------------------*/ - -int32_t isar_get_lc3plus_bitrate( - const int32_t SplitRendBitRate, - ISAR_SPLIT_REND_POSE_CORRECTION_MODE poseCorrectionMode, - const int16_t split_prerender_frame_size_ms ) -{ - if ( poseCorrectionMode == ISAR_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB ) - { - int32_t inBandMdBps = (int32_t) ( 8 * 1000 / split_prerender_frame_size_ms ); - return isar_get_lcld_bitrate( SplitRendBitRate, poseCorrectionMode ) - inBandMdBps; - } - - if ( poseCorrectionMode == ISAR_SPLIT_REND_POSE_CORRECTION_MODE_NONE ) - { - return SplitRendBitRate; - } - - /* Should not be reached */ - assert( 0 ); - return -1; -} - - -/*------------------------------------------------------------------------- - * Function isar_get_lc3plus_bitrate_id() - * - * - *------------------------------------------------------------------------*/ - -int8_t isar_get_lc3plus_bitrate_id( - const int32_t SplitRendBitRate ) -{ - switch ( SplitRendBitRate ) - { - case SPLIT_REND_768k: - { - return 4; - } - case SPLIT_REND_512k: - { - return 3; - } - case SPLIT_REND_384k: - { - return 2; - } - case SPLIT_REND_320k: - { - return 1; - } - case SPLIT_REND_256k: - { - return 0; - } - default: - { - break; - } - } - - return -1; -} - - -/*------------------------------------------------------------------------- - * Function isar_get_lc3plus_size_from_id() - * - * - *------------------------------------------------------------------------*/ - -int32_t isar_get_lc3plus_size_from_id( - const int8_t SplitRendBitRateId, - const ISAR_SPLIT_REND_POSE_CORRECTION_MODE poseCorrectionMode, - const int16_t split_prerender_frame_size_ms ) -{ - int32_t bitrate; - - switch ( SplitRendBitRateId ) - { - case 4: - { - bitrate = SPLIT_REND_768k; - break; - } - case 3: - { - bitrate = SPLIT_REND_512k; - break; - } - case 2: - { - bitrate = SPLIT_REND_384k; - break; - } - case 1: - { - bitrate = SPLIT_REND_320k; - break; - } - case 0: - { - bitrate = SPLIT_REND_256k; - break; - } - default: - { - bitrate = -1; - break; - } - } - - bitrate = isar_get_lc3plus_bitrate( bitrate, poseCorrectionMode, split_prerender_frame_size_ms ); - - /* Return size in bytes */ - return (int32_t) ( bitrate * split_prerender_frame_size_ms / 1000 / 8 ); -} -#endif - - /*------------------------------------------------------------------------- * Function isar_split_rend_validate_config() * @@ -751,19 +625,9 @@ ivas_error isar_split_rend_validate_config( break; case SPLIT_REND_384k: case SPLIT_REND_512k: -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS case SPLIT_REND_768k: -#endif /* Always valid */ break; -#ifndef ISAR_BITSTREAM_UPDATE_LC3PLUS - case SPLIT_REND_768k: - if ( pSplitRendConfig->dof == 0 && pSplitRendConfig->codec == ISAR_SPLIT_REND_CODEC_LC3PLUS ) - { - return IVAS_ERROR( IVAS_ERR_INVALID_SPLIT_REND_CONFIG, "Bitrate is too high for LC3plus with 0 DOF" ); - } - break; -#endif default: return IVAS_ERR_LC3PLUS_INVALID_BITRATE; } @@ -772,45 +636,24 @@ ivas_error isar_split_rend_validate_config( { if ( pSplitRendConfig->dof == 1 ) { -#ifdef SPLIT_REND_POSE_CORRECTION_UNUSED_BITS if ( pSplitRendConfig->splitRendBitRate < 34000 ) { return IVAS_ERROR( IVAS_ERR_INVALID_SPLIT_REND_CONFIG, "1DOF metadata needs atleast 34 kbps" ); } -#else - if ( pSplitRendConfig->splitRendBitRate < 50000 ) - { - return IVAS_ERROR( IVAS_ERR_INVALID_SPLIT_REND_CONFIG, "1DOF metadata needs atleast 50 kbps" ); - } -#endif } else if ( pSplitRendConfig->dof == 2 ) { -#ifdef SPLIT_REND_POSE_CORRECTION_UNUSED_BITS if ( pSplitRendConfig->splitRendBitRate < 50000 ) { return IVAS_ERROR( IVAS_ERR_INVALID_SPLIT_REND_CONFIG, "2DOF metadata needs atleast 50 kbps" ); } -#else - if ( pSplitRendConfig->splitRendBitRate < 66000 ) - { - return IVAS_ERROR( IVAS_ERR_INVALID_SPLIT_REND_CONFIG, "2DOF metadata needs atleast 66 kbps" ); - } -#endif } else if ( pSplitRendConfig->dof == 3 ) { -#ifdef SPLIT_REND_POSE_CORRECTION_UNUSED_BITS if ( pSplitRendConfig->splitRendBitRate < 82000 ) { return IVAS_ERROR( IVAS_ERR_INVALID_SPLIT_REND_CONFIG, "3DOF metadata needs atleast 82 kbps" ); } -#else - if ( pSplitRendConfig->splitRendBitRate < 128000 ) - { - return IVAS_ERROR( IVAS_ERR_INVALID_SPLIT_REND_CONFIG, "3DOF metadata needs atleast 128 kbps" ); - } -#endif } } @@ -835,23 +678,12 @@ void isar_split_rend_get_quant_params( int16_t bands_pitch[ISAR_SPLIT_REND_NUM_QUANT_STRATS], int16_t pred_real_bands_roll[ISAR_SPLIT_REND_NUM_QUANT_STRATS], int16_t pred_imag_bands_roll[ISAR_SPLIT_REND_NUM_QUANT_STRATS], -#ifdef SPLIT_REND_POSE_CORRECTION_UNUSED_BITS const int16_t ro_flag, -#endif - int16_t *num_quant_strats -#ifndef SPLIT_REND_POSE_CORRECTION_UNUSED_BITS - , - int16_t *num_complex_bands -#endif -) + int16_t *num_quant_strats ) { int16_t q; *num_quant_strats = ISAR_SPLIT_REND_NUM_QUANT_STRATS; -#ifndef SPLIT_REND_POSE_CORRECTION_UNUSED_BITS - *num_complex_bands = COMPLEX_MD_BAND_THRESH_LOW; - assert( *num_complex_bands <= num_md_bands ); -#endif pred_quant_pnts_yaw[0] = ISAR_SPLIT_REND_PRED_63QUANT_PNTS; pred_quantstep_yaw[0] = ISAR_SPLIT_REND_PRED63_Q_STEP; @@ -869,17 +701,6 @@ void isar_split_rend_get_quant_params( pred_real_bands_roll[q] = num_md_bands; } -#ifndef SPLIT_REND_POSE_CORRECTION_UNUSED_BITS - pred_imag_bands_yaw[0] = num_md_bands; - pred_imag_bands_roll[0] = num_md_bands; - pred_imag_bands_yaw[1] = num_md_bands; - pred_imag_bands_roll[1] = num_md_bands; - for ( q = 2; q < *num_quant_strats; q++ ) - { - pred_imag_bands_yaw[q] = ( q < ( *num_quant_strats - 1 ) ) ? num_md_bands : *num_complex_bands; - pred_imag_bands_roll[q] = *num_complex_bands; - } -#else if ( ro_flag ) { for ( q = 0; q < *num_quant_strats; q++ ) @@ -901,7 +722,6 @@ void isar_split_rend_get_quant_params( { pred_imag_bands_roll[q] = SPLIT_REND_RO_MD_BAND_THRESH; } -#endif for ( q = 0; q < *num_quant_strats; q++ ) { @@ -912,7 +732,6 @@ void isar_split_rend_get_quant_params( return; } -#ifdef SPLIT_REND_POSE_CORRECTION_UNUSED_BITS /*------------------------------------------------------------------------- * Function isar_renderSplitGetRot_axisNumBits() * @@ -1004,7 +823,6 @@ int16_t isar_renderSplitGetCodeFromRot_axis( return code; } -#endif /*------------------------------------------------------------------------- * Function isar_renderSplitGetMultiBinPoseData() @@ -1070,19 +888,12 @@ void isar_renderSplitGetMultiBinPoseData( switch ( rot_axis ) { case DEFAULT_AXIS: -#ifndef SPLIT_REND_POSE_CORRECTION_UNUSED_BITS - case YAW: - case PITCH: -#endif case YAW_PITCH: { num_yaw_poses = SPLIT_REND_MAX_YAW_ONLY_POSES; num_pitch_poses = SPLIT_REND_MAX_PITCH_ONLY_POSES; break; } -#ifndef SPLIT_REND_POSE_CORRECTION_UNUSED_BITS - case ROLL: -#endif case YAW_ROLL: { num_yaw_poses = SPLIT_REND_MAX_YAW_ONLY_POSES; @@ -1194,7 +1005,6 @@ void isar_init_multi_bin_pose_data( return; } -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS ivas_error isar_framesize_to_ms( const IVAS_RENDER_FRAMESIZE frame_size, /* i : frame size enum */ int16_t *ms /* o : frame size in ms */ @@ -1217,7 +1027,6 @@ ivas_error isar_framesize_to_ms( return IVAS_ERR_OK; } -#endif /*------------------------------------------------------------------------- @@ -1228,9 +1037,7 @@ ivas_error isar_framesize_to_ms( ivas_error isar_split_rend_choose_default_codec( ISAR_SPLIT_REND_CODEC *pCodec, /* i/o: pointer to codec setting */ -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS - int16_t *pIsar_frame_size_ms, /* i/o: pointer to isar frame size setting */ -#endif + int16_t *pIsar_frame_size_ms, /* i/o: pointer to isar frame size setting */ int16_t *pCodec_frame_size_ms, /* i/o: pointer to codec frame size setting */ const int16_t cldfb_in_flag, /* i : flag indicating rendering in TD */ const int16_t pcm_out_flag, /* i : flag to indicate PCM output */ @@ -1264,12 +1071,10 @@ ivas_error isar_split_rend_choose_default_codec( return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Unknown split codec value" ); } } -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS if ( *pIsar_frame_size_ms == 0 ) /* isar frame size hasn't been set yet - use default for current configuration */ { *pIsar_frame_size_ms = 20; } -#endif return IVAS_ERR_OK; } @@ -1285,5 +1090,3 @@ int32_t get_bit( { return ( state & ( 1 << bit_id ) ); } - -#endif diff --git a/lib_isar/isar_stat.h b/lib_isar/isar_stat.h index 65376ea191f05b5ebb78e4843df84680e14c5edf..fde90e33fdd0e7f1bd447c156c00d6523e640549 100644 --- a/lib_isar/isar_stat.h +++ b/lib_isar/isar_stat.h @@ -38,7 +38,6 @@ #include "options.h" #include "stat_com.h" #include "ivas_stat_com.h" -#ifdef SPLIT_REND_WITH_HEAD_ROT #include "isar_lcld_prot.h" #include "isar_lc3plus_enc.h" #include "isar_lc3plus_dec.h" @@ -113,9 +112,7 @@ typedef struct isar_binaural_head_rot_split_rendering_md_struct { float pred_mat_re[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; float pred_mat_im[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; -#ifdef SPLIT_REND_POSE_CORRECTION_UNUSED_BITS float pred_mat_re2[BINAURAL_CHANNELS]; -#endif float gd; float gd2; int16_t pred_mat_re_idx[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; @@ -254,6 +251,5 @@ typedef struct int32_t lc3plusDelaySamples; } SPLIT_REND_WRAPPER; -#endif #endif /* ISAR_STAT_H */ diff --git a/lib_isar/lib_isar_post_rend.c b/lib_isar/lib_isar_post_rend.c index 80b17c499ec9fa974a55636e31158eb4f44a86e4..ab1693640abe006fc95582d899138793088a6c50 100644 --- a/lib_isar/lib_isar_post_rend.c +++ b/lib_isar/lib_isar_post_rend.c @@ -38,14 +38,6 @@ #include "prot.h" #include "ivas_prot.h" -#ifndef SPLIT_REND_WITH_HEAD_ROT - -int32_t ISAR_POST_REND_void_func( void ) -{ - return 0; -} - -#else #include "ivas_prot_rend.h" #include @@ -80,18 +72,9 @@ typedef struct { const int32_t *pOutSampleRate; const AUDIO_CONFIG *pOutConfig; -#ifndef ISAR_BITSTREAM_UPDATE_LC3PLUS - const LSSETUP_CUSTOM_STRUCT *pCustomLsOut; - const EFAP_WRAPPER *pEfapOutWrapper; -#endif const ISAR_POST_REND_HeadRotData *pHeadRotData; -#ifndef ISAR_BITSTREAM_UPDATE_LC3PLUS - const RENDER_CONFIG_HANDLE *hhRendererConfig; -#endif const int16_t *pSplitRendBFI; -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS const ISAR_SPLIT_REND_CONFIG_DATA *pSplitRenderConfig; -#endif } rendering_context; /* Common base for input structs */ @@ -218,10 +201,8 @@ static void convertBitsBufferToInternalBitsBuff( hBits->codec = outBits.config.codec; hBits->pose_correction = outBits.config.poseCorrection; hBits->codec_frame_size_ms = outBits.config.codec_frame_size_ms; -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS hBits->isar_frame_size_ms = outBits.config.isar_frame_size_ms; hBits->lc3plus_highres = outBits.config.lc3plusHighRes; -#endif return; } @@ -237,10 +218,8 @@ static void convertInternalBitsBuffToBitsBuffer( hOutBits->config.codec = bits.codec; hOutBits->config.poseCorrection = bits.pose_correction; hOutBits->config.codec_frame_size_ms = bits.codec_frame_size_ms; -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS hOutBits->config.isar_frame_size_ms = bits.isar_frame_size_ms; hOutBits->config.lc3plusHighRes = bits.lc3plus_highres; -#endif return; } @@ -470,9 +449,7 @@ static rendering_context getRendCtx( ctx.pOutSampleRate = &hIvasRend->sampleRateOut; ctx.pHeadRotData = &hIvasRend->headRotData; ctx.pSplitRendBFI = &hIvasRend->splitRendBFI; -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS ctx.pSplitRenderConfig = &hIvasRend->splitRenderConfig; -#endif return ctx; } @@ -495,12 +472,7 @@ static ivas_error getRendInputNumChannels( static ivas_error updateSplitPostRendPanGains( input_split_post_rend *inputSplitPostRend, const AUDIO_CONFIG outConfig, - ISAR_SPLIT_REND_CONFIG_DATA *hRendCfg -#ifndef ISAR_BITSTREAM_UPDATE_LC3PLUS - , - int16_t num_subframes -#endif -) + ISAR_SPLIT_REND_CONFIG_DATA *hRendCfg ) { ivas_error error; rendering_context rendCtx; @@ -512,30 +484,9 @@ static ivas_error updateSplitPostRendPanGains( rendCtx = inputSplitPostRend->base.ctx; isar_renderSplitGetMultiBinPoseData( hRendCfg, &inputSplitPostRend->splitPostRendWrapper.multiBinPoseData, rendCtx.pHeadRotData->sr_pose_pred_axis ); -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS config.high_res_mode_enabled = ( hRendCfg->lc3plus_highres != 0 ); -#endif config.lc3plus_frame_duration_us = hRendCfg->codec_frame_size_ms * 1000; -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS config.isar_frame_duration_us = hRendCfg->isar_frame_size_ms * 1000; -#else - if ( num_subframes != MAX_PARAM_SPATIAL_SUBFRAMES ) - { - if ( hRendCfg->codec == ISAR_SPLIT_REND_CODEC_LC3PLUS ) - { - config.isar_frame_duration_us = ( hRendCfg->poseCorrectionMode == ISAR_SPLIT_REND_POSE_CORRECTION_MODE_NONE ) ? config.lc3plus_frame_duration_us * num_subframes : 20000; - } - else - { - config.isar_frame_duration_us = ( hRendCfg->poseCorrectionMode == ISAR_SPLIT_REND_POSE_CORRECTION_MODE_NONE ) ? config.lc3plus_frame_duration_us : 20000; - } - iNumLCLDIterationsPerFrame = 1; - } - else - { - config.isar_frame_duration_us = 20000; - } -#endif if ( hRendCfg->codec_frame_size_ms > 0 ) { @@ -581,12 +532,7 @@ static ivas_error setRendInputActiveSplitPostRend( void *input, const AUDIO_CONFIG inConfig, const IVAS_REND_InputId id, - ISAR_SPLIT_REND_CONFIG_DATA *hRendCfg -#ifndef ISAR_BITSTREAM_UPDATE_LC3PLUS - , - const int16_t num_subframes -#endif -) + ISAR_SPLIT_REND_CONFIG_DATA *hRendCfg ) { ivas_error error; rendering_context rendCtx; @@ -605,12 +551,7 @@ static ivas_error setRendInputActiveSplitPostRend( initRendInputBase( &inputSplitPostRend->base, inConfig, id, rendCtx, inputSplitPostRend->bufferData, MAX_CLDFB_BIN_BUFFER_LENGTH ); inputSplitPostRend->numCachedSamples = 0; - if ( ( error = updateSplitPostRendPanGains( inputSplitPostRend, outConfig, hRendCfg -#ifndef ISAR_BITSTREAM_UPDATE_LC3PLUS - , - num_subframes -#endif - ) ) != IVAS_ERR_OK ) + if ( ( error = updateSplitPostRendPanGains( inputSplitPostRend, outConfig, hRendCfg ) ) != IVAS_ERR_OK ) { return error; } @@ -945,12 +886,7 @@ ivas_error ISAR_POST_REND_AddInput( int32_t maxNumInputsOfType; void *inputsArray; int32_t inputStructSize; - ivas_error ( *activateInput )( void *, AUDIO_CONFIG, IVAS_REND_InputId, ISAR_SPLIT_REND_CONFIG_DATA * -#ifndef ISAR_BITSTREAM_UPDATE_LC3PLUS - , - int16_t -#endif - ); + ivas_error ( *activateInput )( void *, AUDIO_CONFIG, IVAS_REND_InputId, ISAR_SPLIT_REND_CONFIG_DATA * ); int32_t inputIndex; /* Validate function arguments */ @@ -978,12 +914,7 @@ ivas_error ISAR_POST_REND_AddInput( } *inputId = makeInputId( inConfig, inputIndex ); - if ( ( error = activateInput( (uint8_t *) inputsArray + inputStructSize * inputIndex, inConfig, *inputId, &hIvasRend->splitRenderConfig -#ifndef ISAR_BITSTREAM_UPDATE_LC3PLUS - , - hIvasRend->num_subframes -#endif - ) ) != IVAS_ERR_OK ) + if ( ( error = activateInput( (uint8_t *) inputsArray + inputStructSize * inputIndex, inConfig, *inputId, &hIvasRend->splitRenderConfig ) ) != IVAS_ERR_OK ) { return error; } @@ -1184,9 +1115,7 @@ ivas_error ISAR_POST_REND_InitConfig( hIvasRend->splitRenderConfig.hq_mode = 0; hIvasRend->splitRenderConfig.codec_delay_ms = 0; hIvasRend->splitRenderConfig.codec_frame_size_ms = 0; /* 0 means "use default for selected codec" */ -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS hIvasRend->splitRenderConfig.isar_frame_size_ms = 0; /* 0 means "use default for selected codec" */ -#endif hIvasRend->splitRenderConfig.codec = ISAR_SPLIT_REND_CODEC_DEFAULT; hIvasRend->splitRenderConfig.poseCorrectionMode = ISAR_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB; hIvasRend->splitRenderConfig.rendererSelection = ISAR_SPLIT_REND_RENDERER_SELECTION_DEFAULT; @@ -1221,9 +1150,7 @@ int16_t ISAR_POST_REND_GetRenderConfig( splitRenderConfig->hq_mode = 0; splitRenderConfig->codec_delay_ms = 0; splitRenderConfig->codec_frame_size_ms = 0; /* 0 means "use default for selected codec" */ -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS splitRenderConfig->isar_frame_size_ms = 0; /* 0 means "use default for selected codec" */ -#endif splitRenderConfig->codec = ISAR_SPLIT_REND_CODEC_DEFAULT; splitRenderConfig->poseCorrectionMode = ISAR_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB; splitRenderConfig->rendererSelection = hRCin.rendererSelection; @@ -1340,18 +1267,11 @@ static ivas_error splitBinLc3plusDecode( ISAR_SPLIT_POST_REND_WRAPPER *hSplitBin, ISAR_SPLIT_REND_BITS_HANDLE bits, float outputBuffer[BINAURAL_CHANNELS][L_FRAME48k], -#ifndef ISAR_BITSTREAM_UPDATE_LC3PLUS - ISAR_SPLIT_REND_POSE_CORRECTION_MODE pose_correction, -#endif const int16_t SplitRendBFI ) { ivas_error error; float *channel_ptrs[MAX_HEAD_ROT_POSES * 2]; -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS int32_t lc3plusBitstreamSize; -#else - int32_t lc3plusBitrateId, lc3plusBitstreamSize; -#endif push_wmops( "splitBinLc3plusDecode" ); assert( hSplitBin->hLc3plusDec != NULL ); @@ -1368,15 +1288,9 @@ static ivas_error splitBinLc3plusDecode( { ++bits->bits_read; } -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS /* Size is in bytes */ assert( ( bits->bits_written - bits->bits_read ) % 8 == 0 ); lc3plusBitstreamSize = ( bits->bits_written - bits->bits_read ) / 8; -#else - /* Read LC3plus bitstream size info */ - lc3plusBitrateId = ISAR_SPLIT_REND_BITStream_read_int32( bits, 8 ); - lc3plusBitstreamSize = isar_get_lc3plus_size_from_id( (int8_t) lc3plusBitrateId, pose_correction, (int16_t) ( hSplitBin->hLc3plusDec->config.isar_frame_duration_us / 1000 ) ); -#endif if ( ( error = ISAR_LC3PLUS_DEC_Decode( hSplitBin->hLc3plusDec, &bits->bits_buf[bits->bits_read / 8], lc3plusBitstreamSize, channel_ptrs ) ) != IVAS_ERR_OK ) { @@ -1419,9 +1333,6 @@ static ivas_error renderSplitBinauralWithPostRot( int16_t outBufNumSamplesPerChannel, outBufNumColPerChannel; int16_t numSamplesPerChannelCacheSize, numColPerChannelCacheSize; float *readPtr, *writePtr; -#ifndef ISAR_BITSTREAM_UPDATE_LC3PLUS - uint32_t ivas_frame_duration_us; -#endif int16_t iNumBlocksPerFrame, iNumLCLDIterationsPerFrame; const ISAR_POST_REND_HeadRotData *pHeadRotData; @@ -1429,24 +1340,15 @@ static ivas_error renderSplitBinauralWithPostRot( push_wmops( "renderSplitBinauralWithPostRot" ); error = IVAS_ERR_OK; -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS if ( outAudio.config.numSamplesPerChannel / *splitBinInput->base.ctx.pOutSampleRate > splitBinInput->hBits->config.isar_frame_size_ms ) { return IVAS_ERR_INTERNAL_FATAL; } -#endif pHeadRotData = splitBinInput->base.ctx.pHeadRotData; hSplitBin = &splitBinInput->splitPostRendWrapper; convertBitsBufferToInternalBitsBuff( *splitBinInput->hBits, &bits ); -#ifndef ISAR_BITSTREAM_UPDATE_LC3PLUS - ivas_frame_duration_us = 20000; - if ( splitBinInput->splitPostRendWrapper.hLc3plusDec != NULL ) - { - ivas_frame_duration_us = splitBinInput->splitPostRendWrapper.hLc3plusDec->config.isar_frame_duration_us; - } -#endif iNumLCLDIterationsPerFrame = 1; iNumBlocksPerFrame = CLDFB_NO_COL_MAX; @@ -1491,13 +1393,7 @@ static ivas_error renderSplitBinauralWithPostRot( { isPostRendInputCldfb = 1; } -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS numSamplesPerChannelCacheSize = (int16_t) ( *splitBinInput->base.ctx.pOutSampleRate * bits.isar_frame_size_ms / 1000 ) - outBufNumSamplesPerChannel; -#else - preRendFrameSize_ms = (int16_t) ( ivas_frame_duration_us ) / 1000; - - numSamplesPerChannelCacheSize = (int16_t) ( *splitBinInput->base.ctx.pOutSampleRate * ( preRendFrameSize_ms - bits.codec_frame_size_ms ) / 1000 ); -#endif outBufNumColPerChannel = MAX_PARAM_SPATIAL_SUBFRAMES; numColPerChannelCacheSize = ( iNumBlocksPerFrame * iNumLCLDIterationsPerFrame ) - outBufNumColPerChannel; @@ -1541,9 +1437,6 @@ static ivas_error renderSplitBinauralWithPostRot( else { if ( ( error = splitBinLc3plusDecode( hSplitBin, &bits, tmpCrendBuffer, -#ifndef ISAR_BITSTREAM_UPDATE_LC3PLUS - bits.pose_correction, -#endif SplitRendBFI ) ) != IVAS_ERR_OK ) { return error; @@ -1597,11 +1490,7 @@ static ivas_error renderSplitBinauralWithPostRot( copyBufferTo2dArray( splitBinInput->base.inputBuffer, tmpCrendBuffer ); if ( splitBinInput->numCachedSamples == 0 ) { -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS preRendFrameSize_ms = splitBinInput->base.ctx.pSplitRenderConfig->isar_frame_size_ms; -#else - preRendFrameSize_ms = (int16_t) ( ivas_frame_duration_us ) / 1000; -#endif numSamplesPerChannelCacheSize = (int16_t) ( *splitBinInput->base.ctx.pOutSampleRate * preRendFrameSize_ms / 1000 ); numSamplesPerChannelCacheSize -= outAudio.config.numSamplesPerChannel; splitBinInput->numCachedSamples = numSamplesPerChannelCacheSize; @@ -1859,11 +1748,9 @@ ivas_error ISAR_REND_SetSplitRendBitstreamHeader( const ISAR_SPLIT_REND_CODEC codec, /* o: codec setting */ const ISAR_SPLIT_REND_POSE_CORRECTION_MODE poseCorrection, /* o: pose correction mode */ const int16_t codec_frame_size_ms /* i: codec frame size setting */ -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS , const int16_t isar_frame_size_ms, /* i: isar codec frame size setting */ const int16_t lc3plus_highres /* i: LC3plus Hig-Res setting. Ignored if codec is not LC3plus */ -#endif ) { if ( hIvasRend == NULL ) @@ -1871,14 +1758,10 @@ ivas_error ISAR_REND_SetSplitRendBitstreamHeader( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } hIvasRend->splitRenderConfig.codec = codec; -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS hIvasRend->splitRenderConfig.isar_frame_size_ms = isar_frame_size_ms; -#endif hIvasRend->splitRenderConfig.codec_frame_size_ms = codec_frame_size_ms; hIvasRend->splitRenderConfig.poseCorrectionMode = poseCorrection; -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS hIvasRend->splitRenderConfig.lc3plus_highres = lc3plus_highres; -#endif return IVAS_ERR_OK; } @@ -1906,6 +1789,3 @@ int32_t ISAR_POST_REND_GetCntFramesLimited( return hIvasRend->hLimiter->cnt_frames_limited; } #endif - - -#endif diff --git a/lib_isar/lib_isar_post_rend.h b/lib_isar/lib_isar_post_rend.h index 992b23704c586d9cad3711ef8b6ac0f61ec02510..ce701d577cbb020797b65158ba94fbe8405588af 100644 --- a/lib_isar/lib_isar_post_rend.h +++ b/lib_isar/lib_isar_post_rend.h @@ -37,12 +37,6 @@ #include "common_api_types.h" -#ifndef SPLIT_REND_WITH_HEAD_ROT - -int32_t ISAR_POST_REND_void_func( void ); - -#else - /*---------------------------------------------------------------------* * Renderer constants *---------------------------------------------------------------------*/ @@ -62,10 +56,8 @@ typedef struct ISAR_SPLIT_REND_CODEC codec; ISAR_SPLIT_REND_POSE_CORRECTION_MODE poseCorrection; int16_t codec_frame_size_ms; -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS int16_t isar_frame_size_ms; int16_t lc3plusHighRes; -#endif } ISAR_POST_REND_BitstreamBufferConfig; typedef struct @@ -207,11 +199,9 @@ ivas_error ISAR_REND_SetSplitRendBitstreamHeader( const ISAR_SPLIT_REND_CODEC codec, /* o: codec setting */ const ISAR_SPLIT_REND_POSE_CORRECTION_MODE poseCorrection, /* o: pose correction mode */ const int16_t codec_frame_size_ms /* i: codec frame size setting */ -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS , const int16_t isar_frame_size_ms, /* i: isar frame size setting */ const int16_t lc3plus_highres /* i: LC3plus Hig-Res setting. Ignored if codec is not LC3plus */ -#endif ); #ifdef DEBUGGING @@ -224,7 +214,6 @@ int32_t ISAR_POST_REND_GetCntFramesLimited( ); #endif -#endif /* SPLIT_REND_WITH_HEAD_ROT */ /* clang-format on */ diff --git a/lib_isar/lib_isar_pre_rend.c b/lib_isar/lib_isar_pre_rend.c index 01baba8ba70387851c348584c157940829d67144..85a70b847b498de372ff09caf2ab69331abe7238 100644 --- a/lib_isar/lib_isar_pre_rend.c +++ b/lib_isar/lib_isar_pre_rend.c @@ -46,14 +46,6 @@ #include "wmc_auto.h" -#ifndef SPLIT_REND_WITH_HEAD_ROT -int32_t ISAR_PRE_REND_void_func( void ) -{ - return 0; -} - -#else - /*-------------------------------------------------------------------* * Local constants *-------------------------------------------------------------------*/ @@ -82,11 +74,7 @@ ivas_error ISAR_PRE_REND_open( const int32_t output_Fs, /* i: output sampling rate */ const int16_t cldfb_in_flag, /* i: Flag to indicate CLDFB or time doamin input */ const int16_t pcm_out_flag, /* i: Flag to indicate PCM output */ -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS const IVAS_RENDER_FRAMESIZE ivas_frame_size, /* i: IVAS frame size */ -#else - const int16_t num_subframes, /* i: number of subframes */ -#endif const int16_t mixed_td_cldfb_flag /* i: Flag to indicate combined TD and CLDFB input */ ) { @@ -96,18 +84,10 @@ ivas_error ISAR_PRE_REND_open( int16_t cldfb_in_flag_local = cldfb_in_flag; if ( ( error = isar_split_rend_choose_default_codec( &( pSplitRendConfig->codec ), -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS &pSplitRendConfig->isar_frame_size_ms, -#endif &pSplitRendConfig->codec_frame_size_ms, cldfb_in_flag_local, - pcm_out_flag, (int16_t) -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS - ivas_frame_size -#else - num_subframes -#endif - ) ) != IVAS_ERR_OK ) + pcm_out_flag, (int16_t) ivas_frame_size ) ) != IVAS_ERR_OK ) { return error; } @@ -193,12 +173,7 @@ ivas_error ISAR_PRE_REND_open( if ( pSplitRendConfig->codec == ISAR_SPLIT_REND_CODEC_LC3PLUS ) { if ( ( error = split_renderer_open_lc3plus( hSplitBinRend, pSplitRendConfig, output_Fs, -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS - ivas_frame_size -#else - num_subframes -#endif - ) ) != IVAS_ERR_OK ) + ivas_frame_size ) ) != IVAS_ERR_OK ) { return error; } @@ -323,9 +298,7 @@ ivas_error ISAR_PRE_REND_MultiBinToSplitBinaural( const IVAS_QUATERNION headPosition, /* i: head rotation QUATERNION */ const int32_t SplitRendBitRate, /* i: Split renderer bitrate */ ISAR_SPLIT_REND_CODEC splitCodec, /* i/o: Split renderer codec */ -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS const int16_t isar_frame_size_ms, /* i: ISAR framesize */ -#endif int16_t codec_frame_size_ms, /* i/o: ISAR transport codec framesize */ ISAR_SPLIT_REND_BITS_HANDLE pBits, /* i/o: ISAR bits struct handle */ float Cldfb_In_BinReal[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i/o: CLDFB real buffer */ @@ -339,11 +312,7 @@ ivas_error ISAR_PRE_REND_MultiBinToSplitBinaural( ) { ivas_error error; -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS int32_t bit_len, target_md_bits, available_bits; -#else - int32_t bit_len, target_md_bits, actual_md_bits, available_bits; -#endif error = IVAS_ERR_OK; push_wmops( "isar_pre_rend_MultiBinToSplitBinaural" ); @@ -361,9 +330,7 @@ ivas_error ISAR_PRE_REND_MultiBinToSplitBinaural( error = isar_renderMultiTDBinToSplitBinaural( hSplitBin, headPosition, SplitRendBitRate, -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS isar_frame_size_ms, -#endif codec_frame_size_ms, pBits, max_bands, @@ -382,16 +349,10 @@ ivas_error ISAR_PRE_REND_MultiBinToSplitBinaural( lc3plusTimeAlignCldfbPoseCorr( hSplitBin, Cldfb_In_BinReal, Cldfb_In_BinImag ); } -#ifndef ISAR_BITSTREAM_UPDATE_LC3PLUS - actual_md_bits = pBits->bits_written; -#endif if ( hSplitBin->multiBinPoseData.poseCorrectionMode == ISAR_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB ) { target_md_bits = isar_get_split_rend_md_target_brate( SplitRendBitRate, pcm_out_flag ) * L_FRAME48k / 48000; -#ifndef ISAR_BITSTREAM_UPDATE_LC3PLUS - actual_md_bits = pBits->bits_written; -#endif isar_rend_CldfbSplitPreRendProcess( hSplitBin->hBinHrSplitPreRend, headPosition, &hSplitBin->multiBinPoseData, Cldfb_In_BinReal, Cldfb_In_BinImag, pBits, target_md_bits, low_res_pre_rend_rot, ro_md_flag ); } @@ -404,12 +365,7 @@ ivas_error ISAR_PRE_REND_MultiBinToSplitBinaural( if ( splitCodec == ISAR_SPLIT_REND_CODEC_LCLD ) { available_bits = ( SplitRendBitRate * hSplitBin->hSplitBinLCLDEnc->iNumBlocks * hSplitBin->hSplitBinLCLDEnc->iNumIterations ) / ( 16 * FRAMES_PER_SEC ); -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS available_bits -= pBits->bits_written; -#else - actual_md_bits = pBits->bits_written - actual_md_bits; - available_bits -= actual_md_bits; -#endif pBits->codec_frame_size_ms = codec_frame_size_ms; isar_splitBinLCLDEncProcess( hSplitBin->hSplitBinLCLDEnc, Cldfb_In_BinReal, Cldfb_In_BinImag, available_bits, pBits ); } @@ -433,12 +389,8 @@ ivas_error ISAR_PRE_REND_MultiBinToSplitBinaural( cldfbSynthesis( Cldfb_In_BinReal_p, Cldfb_In_BinImag_p, output[ch], hSplitBin->hCldfbHandles->cldfbSyn[0]->no_channels * num_slots, hSplitBin->hCldfbHandles->cldfbSyn[ch] ); } -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS available_bits = ( SplitRendBitRate / FRAMES_PER_SEC ) - pBits->bits_written; if ( ( error = splitRendLc3plusEncodeAndWrite( hSplitBin, pBits, available_bits, output ) ) != IVAS_ERR_OK ) -#else - if ( ( error = splitRendLc3plusEncodeAndWrite( hSplitBin, pBits, SplitRendBitRate, output ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -493,5 +445,3 @@ ivas_error ISAR_PRE_REND_MultiBinToSplitBinaural( return error; } - -#endif diff --git a/lib_isar/lib_isar_pre_rend.h b/lib_isar/lib_isar_pre_rend.h index a8cfdaf61c586060cadeeca0ca115017fe92db41..201b46cd0ffc60607d29017f862a775342b32096 100644 --- a/lib_isar/lib_isar_pre_rend.h +++ b/lib_isar/lib_isar_pre_rend.h @@ -36,11 +36,6 @@ #include "isar_stat.h" #include "isar_prot.h" -#ifndef SPLIT_REND_WITH_HEAD_ROT - -int32_t ISAR_PRE_REND_void_func( void ); - -#else ivas_error ISAR_PRE_REND_open( SPLIT_REND_WRAPPER *hSplitBinRend, /* i/o: Split renderer pre-renerer handle */ @@ -48,11 +43,7 @@ ivas_error ISAR_PRE_REND_open( const int32_t output_Fs, /* i: output sampling rate */ const int16_t cldfb_in_flag, /* i: Flag to indicate CLDFB or time doamin input */ const int16_t pcm_out_flag, /* i: Flag to indicate PCM output */ -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS const IVAS_RENDER_FRAMESIZE ivas_frame_size, /* i: IVAS frame size */ -#else - const int16_t num_subframes, /* i: number of subframes */ -#endif const int16_t mixed_td_cldfb_flag /* i: Flag to indicate combined TD and CLDFB input */ ); @@ -72,9 +63,7 @@ ivas_error ISAR_PRE_REND_MultiBinToSplitBinaural( const IVAS_QUATERNION headPosition, /* i: head rotation QUATERNION */ const int32_t SplitRendBitRate, /* i: Split renderer bitrate */ ISAR_SPLIT_REND_CODEC splitCodec, /* i/o: Split renderer codec */ -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS const int16_t isar_frame_size_ms, /* i: ISAR framesize */ -#endif int16_t codec_frame_size_ms, /* i/o: ISAR transport codec framesize */ ISAR_SPLIT_REND_BITS_HANDLE pBits, /* i/o: ISAR bits struct handle */ float Cldfb_In_BinReal[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i/o: CLDFB real buffer */ @@ -87,5 +76,4 @@ ivas_error ISAR_PRE_REND_MultiBinToSplitBinaural( const int16_t ro_md_flag /* i: Flag to indicate real only metadata for yaw */ ); -#endif #endif /* LIB_ISAR_PRE_REND_H */ diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c index 88dcebf71b776b98eaf63cd6c7e065b6d6f1ccf3..62bc41fc36c065f1dc8e463a23c700c07b00e35d 100644 --- a/lib_rend/ivas_crend.c +++ b/lib_rend/ivas_crend.c @@ -190,11 +190,7 @@ static ivas_error ivas_rend_initCrend( return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Encountered unsupported input config in Crend" ); } - if ( outConfig != IVAS_AUDIO_CONFIG_BINAURAL && outConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR && outConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB -#ifdef SPLIT_REND_WITH_HEAD_ROT - && outConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED && outConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM -#endif - ) + if ( outConfig != IVAS_AUDIO_CONFIG_BINAURAL && outConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR && outConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB && outConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED && outConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Encountered unsupported output type in Crend" ); } @@ -1263,19 +1259,12 @@ static ivas_error ivas_er_init_handle( *------------------------------------------------------------------------*/ ivas_error ivas_rend_initCrendWrapper( -#ifdef SPLIT_REND_WITH_HEAD_ROT CREND_WRAPPER_HANDLE *pCrend, - const int16_t num_poses -#else - CREND_WRAPPER_HANDLE *pCrend -#endif -) + const int16_t num_poses ) { int16_t i; CREND_HANDLE hCrend; -#ifdef SPLIT_REND_WITH_HEAD_ROT int16_t pos_idx; -#endif if ( pCrend == NULL ) { @@ -1290,9 +1279,7 @@ ivas_error ivas_rend_initCrendWrapper( ( *pCrend )->binaural_latency_ns = 0; ( *pCrend )->hHrtfCrend = NULL; -#ifdef SPLIT_REND_WITH_HEAD_ROT for ( pos_idx = 0; pos_idx < num_poses; pos_idx++ ) -#endif { hCrend = NULL; if ( ( hCrend = (CREND_HANDLE) malloc( sizeof( CREND_DATA ) ) ) == NULL ) @@ -1331,18 +1318,13 @@ ivas_error ivas_rend_initCrendWrapper( hCrend->m_fPitch = 0; hCrend->m_fRoll = 0; -#ifdef SPLIT_REND_WITH_HEAD_ROT ( *pCrend )->hCrend[pos_idx] = hCrend; -#else - ( *pCrend )->hCrend = hCrend; -#endif } return IVAS_ERR_OK; } -#ifdef SPLIT_REND_WITH_HEAD_ROT /*------------------------------------------------------------------------- * ivas_rend_openMultiBinCrend() * @@ -1359,14 +1341,10 @@ ivas_rend_openMultiBinCrend( { ivas_error error; -#ifdef SPLIT_REND_WITH_HEAD_ROT #ifdef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES if ( ( error = ivas_rend_openCrend( pCrend, inConfig, outConfig, NULL /*hRendCfg*/, NULL, NULL /* hHrtfStatistics */, output_Fs, pMultiBinPoseData->num_poses ) ) != IVAS_ERR_OK ) #else if ( ( error = ivas_rend_openCrend( pCrend, inConfig, outConfig, NULL /*hRendCfg*/, NULL, output_Fs, pMultiBinPoseData->num_poses ) ) != IVAS_ERR_OK ) -#endif -#else - if ( ( error = ivas_rend_openCrend( pCrend, inConfig, outConfig, NULL /*hRendCfg*/, NULL, output_Fs ) ) != IVAS_ERR_OK ) #endif { return error; @@ -1374,7 +1352,6 @@ ivas_rend_openMultiBinCrend( return error; } -#endif /*------------------------------------------------------------------------- @@ -1392,13 +1369,8 @@ ivas_error ivas_rend_openCrend( #ifdef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES HRTFS_STATISTICS_HANDLE hHrtfStatistics, #endif -#ifdef SPLIT_REND_WITH_HEAD_ROT const int32_t output_Fs, - const int16_t num_poses -#else - const int32_t output_Fs -#endif -) + const int16_t num_poses ) { int16_t i, subframe_length; int32_t max_total_ir_len; @@ -1409,11 +1381,7 @@ ivas_error ivas_rend_openCrend( error = IVAS_ERR_OK; -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = ivas_rend_initCrendWrapper( pCrend, num_poses ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_rend_initCrendWrapper( pCrend ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -1428,15 +1396,9 @@ ivas_error ivas_rend_openCrend( } } -#ifdef SPLIT_REND_WITH_HEAD_ROT for ( pos_idx = 0; pos_idx < num_poses; pos_idx++ ) -#endif { -#ifdef SPLIT_REND_WITH_HEAD_ROT hCrend = ( *pCrend )->hCrend[pos_idx]; -#else - hCrend = ( *pCrend )->hCrend; -#endif hHrtf = ( *pCrend )->hHrtfCrend; if ( hHrtf != NULL ) @@ -1615,11 +1577,7 @@ ivas_error ivas_rend_openCrend( ( *pCrend )->binaural_latency_ns = (int32_t) ( ( *pCrend )->hHrtfCrend->latency_s * 1000000000.f ); } -#ifdef SPLIT_REND_WITH_HEAD_ROT ( *pCrend )->hCrend[pos_idx] = hCrend; -#else - ( *pCrend )->hCrend = hCrend; -#endif } return IVAS_ERR_OK; @@ -1633,18 +1591,11 @@ ivas_error ivas_rend_openCrend( *------------------------------------------------------------------------*/ void ivas_rend_closeCrend( -#ifdef SPLIT_REND_WITH_HEAD_ROT CREND_WRAPPER_HANDLE *pCrend, - const int16_t num_poses -#else - CREND_WRAPPER_HANDLE *pCrend -#endif -) + const int16_t num_poses ) { int16_t i; -#ifdef SPLIT_REND_WITH_HEAD_ROT int16_t pos_idx; -#endif CREND_HANDLE hCrend; if ( pCrend == NULL || *pCrend == NULL ) @@ -1657,15 +1608,9 @@ void ivas_rend_closeCrend( ivas_hrtf_close( &( *pCrend )->hHrtfCrend ); } -#ifdef SPLIT_REND_WITH_HEAD_ROT for ( pos_idx = 0; pos_idx < num_poses; pos_idx++ ) -#endif { -#ifdef SPLIT_REND_WITH_HEAD_ROT hCrend = ( *pCrend )->hCrend[pos_idx]; -#else - hCrend = ( *pCrend )->hCrend; -#endif if ( hCrend != NULL ) { for ( i = 0; i < MAX_INTERN_CHANNELS; i++ ) @@ -1762,11 +1707,7 @@ void ivas_rend_closeCrend( free( hCrend ); hCrend = NULL; -#ifdef SPLIT_REND_WITH_HEAD_ROT ( *pCrend )->hCrend[pos_idx] = hCrend; -#else - ( *pCrend )->hCrend = hCrend; -#endif } } @@ -1777,7 +1718,6 @@ void ivas_rend_closeCrend( } -#ifdef SPLIT_REND_WITH_HEAD_ROT /*------------------------------------------------------------------------- * ivas_rend_closeCldfbRend() * @@ -1799,7 +1739,6 @@ void ivas_rend_closeCldfbRend( return; } -#endif /*-----------------------------------------------------------------------------------------* @@ -1815,13 +1754,8 @@ static ivas_error ivas_rend_crendConvolver( float *pcm_in[], float *pcm_out[], const int32_t output_Fs, -#ifdef SPLIT_REND_WITH_HEAD_ROT const int16_t i_ts, - const int16_t pos_idx -#else - const int16_t i_ts -#endif -) + const int16_t pos_idx ) { int16_t i, j, k, m; int16_t subframe_length, idx_in; @@ -1839,11 +1773,7 @@ static ivas_error ivas_rend_crendConvolver( CREND_HANDLE hCrend; ivas_error error; -#ifdef SPLIT_REND_WITH_HEAD_ROT hCrend = pCrend->hCrend[pos_idx]; -#else - hCrend = pCrend->hCrend; -#endif if ( ( error = getAudioConfigNumChannels( inConfig, &nchan_in ) ) != IVAS_ERR_OK ) { @@ -2055,11 +1985,8 @@ ivas_error ivas_rend_crendProcessSubframe( float *output[], /* i/o: input/output audio channels */ const int16_t n_samples_to_render, /* i : output frame length per channel */ const int32_t output_Fs /* i : output sampling rate */ -#ifdef SPLIT_REND_WITH_HEAD_ROT , - const int16_t pos_idx -#endif -) + const int16_t pos_idx ) { int16_t subframe_idx, subframe_len; int16_t nchan_out, nchan_in, ch, first_sf, last_sf, slot_size, slots_to_render; @@ -2071,11 +1998,7 @@ ivas_error ivas_rend_crendProcessSubframe( int8_t combinedOrientationEnabled; CREND_HANDLE hCrend; -#ifdef SPLIT_REND_WITH_HEAD_ROT hCrend = pCrend->hCrend[pos_idx]; -#else - hCrend = pCrend->hCrend; -#endif combinedOrientationEnabled = 0; if ( hCombinedOrientationData != NULL ) @@ -2170,17 +2093,11 @@ ivas_error ivas_rend_crendProcessSubframe( if ( ( inConfigType == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) || ( inConfigType == IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS ) ) { -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = ivas_rend_crendConvolver( pCrend, inConfig, outConfig, tc_local, p_pcm_tmp, output_Fs, 0, pos_idx ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_rend_crendConvolver( pCrend, inConfig, outConfig, tc_local, p_pcm_tmp, output_Fs, 0 ) ) != IVAS_ERR_OK ) - -#endif { return error; } -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( pCrend->hCrend[0]->hReverb != NULL ) { if ( ( error = ivas_reverb_process( pCrend->hCrend[pos_idx]->hReverb, inConfig, 1, tc_local, p_pcm_tmp, 0 ) ) != IVAS_ERR_OK ) @@ -2188,15 +2105,6 @@ ivas_error ivas_rend_crendProcessSubframe( return error; } } -#else - if ( pCrend->hCrend->hReverb != NULL ) - { - if ( ( error = ivas_reverb_process( pCrend->hCrend->hReverb, inConfig, 1, tc_local, p_pcm_tmp, 0 ) ) != IVAS_ERR_OK ) - { - return error; - } - } -#endif for ( ch = 0; ch < nchan_in; ch++ ) { @@ -2238,7 +2146,6 @@ ivas_error ivas_rend_crendProcessSubframe( } -#ifdef SPLIT_REND_WITH_HEAD_ROT /*-----------------------------------------------------------------------------------------* * Function ivas_rend_crend_ProcessSplitBin() * @@ -2540,4 +2447,3 @@ ivas_error ivas_rend_crendProcessSubframesSplitBin( return IVAS_ERR_OK; } -#endif diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index d7e9a582d05ace4ed32cf56c1f0473c96d7e7740..459bcc31026e7acce880efd30e388d7d912ba9b7 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -98,21 +98,13 @@ static void ivas_dirac_dec_binaural_internal( Decoder_Struct *st_ivas, COMBINED_ static void ivas_dirac_dec_decorrelate_slot( DIRAC_DEC_BIN_HANDLE hDiracDecBin, const int16_t num_freq_bands, const int16_t slot, float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float decRe[][CLDFB_NO_CHANNELS_MAX], float decIm[][CLDFB_NO_CHANNELS_MAX] ); -#ifdef SPLIT_REND_WITH_HEAD_ROT static void ivas_dirac_dec_binaural_formulate_input_covariance_matrices( DIRAC_DEC_BIN_HANDLE hDiracDecBin, const SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, const PARAMBIN_REND_CONFIG_HANDLE hConfig, float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], const int16_t subframe, float *subFrameTotalEne, float *IIReneLimiter ); static void ivas_dirac_dec_binaural_formulate_target_covariance_matrices( DIRAC_DEC_BIN_HANDLE hDiracDecBin, const SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, const PARAMBIN_REND_CONFIG_HANDLE hConfig, float Rmat[3][3], const int16_t subframe, const int16_t isHeadtracked, const float *subFrameTotalEne, const float *IIReneLimiter, const MASA_ISM_DATA_HANDLE hMasaIsmData ); -#else -static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matrices( DIRAC_DEC_BIN_HANDLE hDiracDecBin, SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, PARAMBIN_REND_CONFIG_HANDLE hConfig, float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float Rmat[3][3], const int16_t subframe, const int16_t isHeadtracked, const MASA_ISM_DATA_HANDLE hMasaIsmData ); -#endif static void ivas_dirac_dec_binaural_determine_processing_matrices( DIRAC_DEC_BIN_HANDLE hDiracDecBin, SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, PARAMBIN_REND_CONFIG_HANDLE hConfig, const int16_t max_band_decorr, float Rmat[3][3], const int16_t subframe, const int16_t isHeadtracked, const int16_t nchanSeparateChannels, const MASA_ISM_DATA_HANDLE hMasaIsmData ); -#ifdef SPLIT_REND_WITH_HEAD_ROT static void ivas_dirac_dec_binaural_process_output( DIRAC_DEC_BIN_HANDLE hDiracDecBin, SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, HANDLE_CLDFB_FILTER_BANK cldfbSynDec[MAX_OUTPUT_CHANNELS], float *output_f[], float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], const int16_t max_band_decorr, const int16_t numInChannels, const int16_t processReverb, const int16_t subframe, float outRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float outIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float reverbRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float reverbIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float decorrRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float decorrIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], const uint8_t recompute ); -#else -static void ivas_dirac_dec_binaural_process_output( DIRAC_DEC_BIN_HANDLE hDiracDecBin, SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, HANDLE_CLDFB_FILTER_BANK cldfbSynDec[MAX_OUTPUT_CHANNELS], float *output_f[], float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], const int16_t max_band_decorr, const int16_t numInChannels, const int16_t processReverb, const int16_t subframe ); -#endif static void adaptTransportSignalsHeadtracked( COMBINED_ORIENTATION_HANDLE hHeadTrackData, float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], const int16_t nBins, const int16_t nSlots, float Rmat[3][3] ); @@ -136,11 +128,7 @@ static void matrixMul( float Are[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float Ai static void matrixTransp2Mul( float Are[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float Aim[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float Bre[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float Bim[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float outRe[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float outIm[BINAURAL_CHANNELS][BINAURAL_CHANNELS] ); -#ifdef SPLIT_REND_WITH_HEAD_ROT static void ivas_masa_ext_rend_parambin_internal( MASA_EXT_REND_HANDLE hMasaExtRend, COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, float *output_f[], const int16_t subframe, const SPLIT_REND_WRAPPER *hSplitRendWrapper, float Cldfb_Out_Real[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float Cldfb_Out_Imag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX] ); -#else -static void ivas_masa_ext_rend_parambin_internal( MASA_EXT_REND_HANDLE hMasaExtRend, COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, float *output_f[], const int16_t subframe ); -#endif /*------------------------------------------------------------------------- * ivas_dirac_dec_init_binaural_data() @@ -165,7 +153,6 @@ ivas_error ivas_dirac_dec_init_binaural_data( float binCenterFreq, tmpFloat; ivas_error error; float frequency_axis[CLDFB_NO_CHANNELS_MAX]; -#ifdef SPLIT_REND_WITH_HEAD_ROT int16_t num_poses, pos_idx; num_poses = 1; @@ -177,9 +164,6 @@ ivas_error ivas_dirac_dec_init_binaural_data( for ( pos_idx = 0; pos_idx < num_poses; pos_idx++ ) { hDiracDecBin = st_ivas->hDiracDecBin[pos_idx]; -#else - hDiracDecBin = st_ivas->hDiracDecBin; -#endif if ( hDiracDecBin == NULL ) { @@ -249,7 +233,7 @@ ivas_error ivas_dirac_dec_init_binaural_data( #ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF mvr2r( ( *phHrtfParambin )->parametricEarlyPartEneCorrection, hDiracDecBin->earlyPartEneCorrection, nBins ); #else - mvr2r( hHrtfParambin->parametricEarlyPartEneCorrection, hDiracDecBin->earlyPartEneCorrection, nBins ); + mvr2r( hHrtfParambin->parametricEarlyPartEneCorrection, hDiracDecBin->earlyPartEneCorrection, nBins ); #endif /* reconfiguration needed when Reverb. parameters are changed -> close and open the handle again */ @@ -259,11 +243,7 @@ ivas_error ivas_dirac_dec_init_binaural_data( ivas_binaural_reverb_close( &( hDiracDecBin->hReverb ) ); } - if ( hDiracDecBin->hReverb == NULL -#ifdef SPLIT_REND_WITH_HEAD_ROT - && pos_idx == 0 -#endif - ) /* open reverb only for the main direction */ + if ( hDiracDecBin->hReverb == NULL && pos_idx == 0 ) /* open reverb only for the main direction */ { #ifdef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES #ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF @@ -272,8 +252,8 @@ ivas_error ivas_dirac_dec_init_binaural_data( if ( ( error = ivas_binaural_reverb_init( &hDiracDecBin->hReverb, st_ivas->hHrtfStatistics, nBins, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, &( st_ivas->hRenderConfig->roomAcoustics ), output_Fs, st_ivas->hHrtfParambin->parametricReverberationTimes, st_ivas->hHrtfParambin->parametricReverberationEneCorrections ) ) != IVAS_ERR_OK ) #endif #else - /* Todo Philips: Room acoustics should be passed here once the underlying part works. Probably enough to pick it from st_ivas but you know best. */ - if ( ( error = ivas_binaural_reverb_open_parambin( &hDiracDecBin->hReverb, nBins, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, NULL, output_Fs, st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) + /* Todo Philips: Room acoustics should be passed here once the underlying part works. Probably enough to pick it from st_ivas but you know best. */ + if ( ( error = ivas_binaural_reverb_open_parambin( &hDiracDecBin->hReverb, nBins, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, NULL, output_Fs, st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) #endif { return error; @@ -303,10 +283,8 @@ ivas_error ivas_dirac_dec_init_binaural_data( ivas_dirac_dec_decorr_close( &hDiracDecBin->h_freq_domain_decorr_ap_params, &hDiracDecBin->h_freq_domain_decorr_ap_state ); } -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( pos_idx == 0 ) /* open decorrelator only for the main direction */ { -#endif if ( ( error = ivas_td_decorr_reconfig_dec( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hDecoderConfig->output_Fs, &( hDiracDecBin->hTdDecorr ), &( hDiracDecBin->useTdDecorr ) ) ) != IVAS_ERR_OK ) { return error; @@ -328,13 +306,11 @@ ivas_error ivas_dirac_dec_init_binaural_data( return error; } } -#ifdef SPLIT_REND_WITH_HEAD_ROT } else { hDiracDecBin->useTdDecorr = st_ivas->hDiracDecBin[0]->useTdDecorr; /* copy the flag, but the implementation re-uses the decorrelated signal */ } -#endif hDiracDecBin->reqularizationFactor = configure_reqularization_factor( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate ); @@ -342,12 +318,8 @@ ivas_error ivas_dirac_dec_init_binaural_data( hDiracDecBin->phHrtfParambin = phHrtfParambin; #endif -#ifdef SPLIT_REND_WITH_HEAD_ROT st_ivas->hDiracDecBin[pos_idx] = hDiracDecBin; } -#else - st_ivas->hDiracDecBin = hDiracDecBin; -#endif /* allocate transport channels */ if ( st_ivas->hTcBuffer == NULL ) @@ -386,16 +358,13 @@ void ivas_dirac_dec_close_binaural_data( DIRAC_DEC_BIN_HANDLE *hBinaural /* i/o: decoder DirAC binaural data handle */ ) { -#ifdef SPLIT_REND_WITH_HEAD_ROT int16_t pos_idx; -#endif if ( hBinaural == NULL || *hBinaural == NULL ) { return; } -#ifdef SPLIT_REND_WITH_HEAD_ROT for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES; pos_idx++ ) { if ( hBinaural[pos_idx] != NULL ) @@ -416,21 +385,6 @@ void ivas_dirac_dec_close_binaural_data( hBinaural[pos_idx] = NULL; } } -#else - if ( ( *hBinaural )->hReverb != NULL ) - { - ivas_binaural_reverb_close( &( ( *hBinaural )->hReverb ) ); - } - - ivas_td_decorr_dec_close( &( ( *hBinaural )->hTdDecorr ) ); - if ( ( *hBinaural )->h_freq_domain_decorr_ap_params != NULL ) - { - ivas_dirac_dec_decorr_close( &( *hBinaural )->h_freq_domain_decorr_ap_params, &( *hBinaural )->h_freq_domain_decorr_ap_state ); - } - - free( *hBinaural ); - *hBinaural = NULL; -#endif return; } @@ -621,7 +575,6 @@ static void ivas_dirac_dec_binaural_internal( DIFFUSE_DISTRIBUTION_DATA diffuseDistData; int16_t nBins, offsetSamples; int16_t i, j; -#ifdef SPLIT_REND_WITH_HEAD_ROT int16_t pos_idx; MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData; float tmp_Cldfb_out_re[BINAURAL_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; @@ -635,9 +588,6 @@ static void ivas_dirac_dec_binaural_internal( float IIReneLimiter[CLDFB_NO_CHANNELS_MAX]; hDiracDecBin = st_ivas->hDiracDecBin[0]; -#else - hDiracDecBin = st_ivas->hDiracDecBin; -#endif assert( hDiracDecBin ); hSpatParamRendCom = st_ivas->hSpatParamRendCom; nBins = hSpatParamRendCom->num_freq_bands; @@ -805,20 +755,13 @@ static void ivas_dirac_dec_binaural_internal( if ( nchan_transport == 2 ) { -#ifdef SPLIT_REND_WITH_HEAD_ROT /* in case of split rendering, determine the prototype rotation based on the main direction and use the same prototypes for the offset directions */ -#endif adaptTransportSignalsHeadtracked( hCombinedOrientationData, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, nBins, hSpatParamRendCom->subframe_nbslots[subframe], Rmat ); ivas_dirac_dec_binaural_check_and_switch_transports_headtracked( hCombinedOrientationData, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, nBins, hSpatParamRendCom->subframe_nbslots[subframe], Rmat ); } } -#ifndef SPLIT_REND_WITH_HEAD_ROT - ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matrices( hDiracDecBin, hSpatParamRendCom, &config_data, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, Rmat, subframe, - hCombinedOrientationData && hCombinedOrientationData->enableCombinedOrientation[hCombinedOrientationData->subframe_idx] > 0, st_ivas->hMasaIsmData ); - -#endif if ( config_data.ivas_format == ISM_FORMAT ) { max_band_decorr = 0; @@ -833,13 +776,11 @@ static void ivas_dirac_dec_binaural_internal( } -#ifdef SPLIT_REND_WITH_HEAD_ROT ivas_dirac_dec_binaural_formulate_input_covariance_matrices( hDiracDecBin, hSpatParamRendCom, &config_data, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, subframe, subFrameTotalEne, IIReneLimiter ); ivas_dirac_dec_binaural_formulate_target_covariance_matrices( hDiracDecBin, hSpatParamRendCom, &config_data, Rmat, subframe, hCombinedOrientationData && hCombinedOrientationData->enableCombinedOrientation[hCombinedOrientationData->subframe_idx] > 0, subFrameTotalEne, IIReneLimiter, st_ivas->hMasaIsmData ); -#endif nchanSeparateChannels = 0; if ( config_data.separateCenterChannelRendering || ( st_ivas->ivas_format == MASA_ISM_FORMAT && ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) ) ) @@ -854,18 +795,13 @@ static void ivas_dirac_dec_binaural_internal( ivas_dirac_dec_binaural_determine_processing_matrices( hDiracDecBin, hSpatParamRendCom, &config_data, max_band_decorr, Rmat, subframe, hCombinedOrientationData && hCombinedOrientationData->enableCombinedOrientation[hCombinedOrientationData->subframe_idx] > 0, nchanSeparateChannels, st_ivas->hMasaIsmData ); -#ifdef SPLIT_REND_WITH_HEAD_ROT pMultiBinPoseData = NULL; if ( st_ivas->hSplitBinRend != NULL ) { pMultiBinPoseData = &st_ivas->hSplitBinRend->splitrend.multiBinPoseData; } -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) -#else - if ( pMultiBinPoseData != NULL && pMultiBinPoseData->num_poses > 1 ) -#endif { ivas_dirac_dec_binaural_process_output( hDiracDecBin, hSpatParamRendCom, st_ivas->cldfbSynDec, output_f, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, max_band_decorr, numInChannels, config_data.processReverb, subframe, tmp_Cldfb_out_re, tmp_Cldfb_out_im, @@ -886,13 +822,9 @@ static void ivas_dirac_dec_binaural_internal( max_band_decorr, numInChannels, config_data.processReverb, subframe, NULL, NULL, reverbRe, reverbIm, decorrRe, decorrIm, 1 ); } -#else - ivas_dirac_dec_binaural_process_output( hDiracDecBin, hSpatParamRendCom, st_ivas->cldfbSynDec, output_f, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, max_band_decorr, numInChannels, config_data.processReverb, subframe ); -#endif hDiracDecBin->hDiffuseDist = NULL; -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( pMultiBinPoseData != NULL && pMultiBinPoseData->num_poses > 1 ) { /* quaternion-based rotation from ivas_binRenderer_internal.c:ivas_binRenderer(), but using absolute rotation instead of delta rotations */ @@ -959,626 +891,89 @@ static void ivas_dirac_dec_binaural_internal( } /* update this counter only after the last rendering of split directions */ -#endif hSpatParamRendCom->slots_rendered += hSpatParamRendCom->subframe_nbslots[subframe]; - hSpatParamRendCom->subframes_rendered++; - - return; -} - - -static void ivas_dirac_dec_decorrelate_slot( - DIRAC_DEC_BIN_HANDLE hDiracDecBin, - const int16_t num_freq_bands, - const int16_t slot, - float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], - float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], - float decRe[][CLDFB_NO_CHANNELS_MAX], - float decIm[][CLDFB_NO_CHANNELS_MAX] ) -{ - int16_t offset, ch, bin; - float onset_filter[BINAURAL_CHANNELS * CLDFB_NO_CHANNELS_MAX]; /* 2 ch, 60 bins */ - float decorrelatedFrameInterleaved[2 * BINAURAL_CHANNELS * CLDFB_NO_CHANNELS_MAX]; /* 2 ch, real + imag, 60 bins */ - float protoFrameF[2 * BINAURAL_CHANNELS * CLDFB_NO_CHANNELS_MAX]; /* 2 ch, real + imag, 60 bins */ - const int16_t protoIndexDir[BINAURAL_CHANNELS] = { 0, 1 }; - - /* Decorrelation needs interleaved data. Copy left and right signals to proto_frame_f */ - for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) - { - offset = num_freq_bands * BINAURAL_CHANNELS * ch; - for ( bin = 0; bin < num_freq_bands; bin++ ) - { - protoFrameF[( bin * BINAURAL_CHANNELS ) + offset] = inRe[ch][slot][bin]; - protoFrameF[( bin * BINAURAL_CHANNELS ) + offset + 1] = inIm[ch][slot][bin]; - } - } - - /* Decorrelate proto signal to decorrelatedFrameInterleaved */ - ivas_dirac_dec_decorr_process( num_freq_bands, - BINAURAL_CHANNELS, - BINAURAL_CHANNELS, - DIRAC_SYNTHESIS_PSD_LS, - BINAURAL_CHANNELS, - protoFrameF, - BINAURAL_CHANNELS, - protoIndexDir, - decorrelatedFrameInterleaved, - onset_filter, - hDiracDecBin->h_freq_domain_decorr_ap_params, - hDiracDecBin->h_freq_domain_decorr_ap_state ); - - /* De-interleave decorrelated signals*/ - for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) - { - offset = num_freq_bands * BINAURAL_CHANNELS * ch; - for ( bin = 0; bin < num_freq_bands; bin++ ) - { - decRe[ch][bin] = decorrelatedFrameInterleaved[( bin * BINAURAL_CHANNELS ) + offset]; - decIm[ch][bin] = decorrelatedFrameInterleaved[( bin * BINAURAL_CHANNELS ) + offset + 1]; - } - } - - return; -} - - -#ifdef SPLIT_REND_WITH_HEAD_ROT -static void ivas_dirac_dec_binaural_formulate_input_covariance_matrices( - DIRAC_DEC_BIN_HANDLE hDiracDecBin, - const SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, - const PARAMBIN_REND_CONFIG_HANDLE hConfig, - float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], - float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], - const int16_t subframe, - float *subFrameTotalEne, - float *IIReneLimiter ) -{ - int16_t ch, slot, bin; - int16_t nBins; - float IIReneLimiterFactor; - float qualityBasedSmFactor; - float lowBitRateEQ[CLDFB_NO_CHANNELS_MAX]; - uint8_t applyLowBitRateEQ; - IVAS_FORMAT ivas_format; - int32_t ivas_total_brate; - int16_t nchan_transport; - - ivas_format = hConfig->ivas_format; - ivas_total_brate = hConfig->ivas_total_brate; - nchan_transport = hConfig->nchan_transport; - qualityBasedSmFactor = hConfig->qualityBasedSmFactor; - qualityBasedSmFactor *= qualityBasedSmFactor; - nBins = hSpatParamRendCom->num_freq_bands; /* Actually bins */ - - set_zero( hDiracDecBin->ChCrossRe, nBins ); - set_zero( hDiracDecBin->ChCrossIm, nBins ); - for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) - { - set_zero( hDiracDecBin->ChEne[ch], nBins ); - } - - /* Determine EQ for low bit rates (13.2 and 16.4 kbps) */ - applyLowBitRateEQ = 0; - if ( ( ivas_format == MASA_FORMAT || ivas_format == MC_FORMAT ) && ivas_total_brate < MASA_STEREO_MIN_BITRATE ) - { - applyLowBitRateEQ = 1; - if ( ivas_total_brate == IVAS_16k4 ) - { - for ( bin = 0; bin < LOW_BIT_RATE_BINAURAL_EQ_BINS; bin++ ) - { - lowBitRateEQ[bin + LOW_BIT_RATE_BINAURAL_EQ_OFFSET] = lowBitRateBinauralEQ[bin] * 0.5f + 0.5f; - } - } - else - { - for ( bin = 0; bin < LOW_BIT_RATE_BINAURAL_EQ_BINS; bin++ ) - { - lowBitRateEQ[bin + LOW_BIT_RATE_BINAURAL_EQ_OFFSET] = lowBitRateBinauralEQ[bin]; - } - } - } - - /* Formulate input and target covariance matrices for this subframe */ - set_zero( subFrameTotalEne, CLDFB_NO_CHANNELS_MAX ); - - /* Calculate input covariance matrix */ - for ( slot = 0; slot < hSpatParamRendCom->subframe_nbslots[subframe]; slot++ ) - { - for ( bin = 0; bin < nBins; bin++ ) - { - for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) - { - float instEne; - - instEne = ( inRe[ch][slot][bin] * inRe[ch][slot][bin] ); - instEne += ( inIm[ch][slot][bin] * inIm[ch][slot][bin] ); - hDiracDecBin->ChEne[ch][bin] += instEne; - subFrameTotalEne[bin] += instEne; - } - hDiracDecBin->ChCrossRe[bin] += inRe[0][slot][bin] * inRe[1][slot][bin]; - hDiracDecBin->ChCrossRe[bin] += inIm[0][slot][bin] * inIm[1][slot][bin]; - hDiracDecBin->ChCrossIm[bin] += inRe[0][slot][bin] * inIm[1][slot][bin]; - hDiracDecBin->ChCrossIm[bin] -= inIm[0][slot][bin] * inRe[1][slot][bin]; - } - } - - /* Apply EQ at low bit rates */ - if ( applyLowBitRateEQ ) - { - int16_t lastEqBin = LOW_BIT_RATE_BINAURAL_EQ_OFFSET + LOW_BIT_RATE_BINAURAL_EQ_BINS - 1; - - for ( bin = LOW_BIT_RATE_BINAURAL_EQ_OFFSET; bin < lastEqBin; bin++ ) - { - subFrameTotalEne[bin] *= lowBitRateEQ[bin]; - } - for ( ; bin < nBins; bin++ ) - { - subFrameTotalEne[bin] *= lowBitRateEQ[lastEqBin]; - } - } - - if ( ( ivas_format == SBA_FORMAT || ivas_format == SBA_ISM_FORMAT ) && nchan_transport == 2 ) - { - float tempRe, tempIm; - float subFrameSumEne[CLDFB_NO_CHANNELS_MAX]; - - v_multc( subFrameTotalEne, SBA_CARDI_TARGET_ENERGY_GAIN, subFrameTotalEne, nBins ); - - set_zero( subFrameSumEne, CLDFB_NO_CHANNELS_MAX ); - for ( slot = 0; slot < hSpatParamRendCom->subframe_nbslots[subframe]; slot++ ) - { - for ( bin = 0; bin < nBins; bin++ ) - { - tempRe = inRe[0][slot][bin] + inRe[1][slot][bin]; - tempIm = inIm[0][slot][bin] + inIm[1][slot][bin]; - subFrameSumEne[bin] += tempRe * tempRe + tempIm * tempIm; - } - } - - for ( bin = 0; bin < nBins; bin++ ) - { - subFrameTotalEne[bin] = max( subFrameTotalEne[bin], subFrameSumEne[bin] ); - } - } - - /* Temporal IIR-type smoothing of covariance matrices. Also apply encoding quality based smoothing factor. */ - if ( ivas_format == MASA_FORMAT && ivas_total_brate < MASA_STEREO_MIN_BITRATE ) - { - IIReneLimiterFactor = 16.0f + ( 1.0f - qualityBasedSmFactor ); - } - else - { - IIReneLimiterFactor = 8.0f + ( 1.0f - qualityBasedSmFactor ); - } - for ( bin = 0; bin < nBins; bin++ ) - { - float eneRatio; - - /* Temporally smooth cov mtx estimates for resulting mixing matrix stability. The design principle is that - * the energy history (IIR) must not be more than double of the current frame energy. This provides more - * robust performance at energy offsets when compared to typical IIR averaging. */ - eneRatio = ( hDiracDecBin->ChEne[0][bin] + hDiracDecBin->ChEne[1][bin] ) / fmaxf( 1e-12f, ( hDiracDecBin->ChEnePrev[0][bin] + hDiracDecBin->ChEnePrev[1][bin] ) ); - IIReneLimiter[bin] = fminf( 1.0f, eneRatio * IIReneLimiterFactor ); - - hDiracDecBin->ChCrossRe[bin] *= qualityBasedSmFactor; - hDiracDecBin->ChCrossIm[bin] *= qualityBasedSmFactor; - for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) - { - hDiracDecBin->ChEne[ch][bin] *= qualityBasedSmFactor; - } - - hDiracDecBin->ChCrossRe[bin] += IIReneLimiter[bin] * hDiracDecBin->ChCrossRePrev[bin]; - hDiracDecBin->ChCrossIm[bin] += IIReneLimiter[bin] * hDiracDecBin->ChCrossImPrev[bin]; - - for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) - { - hDiracDecBin->ChEne[ch][bin] += IIReneLimiter[bin] * hDiracDecBin->ChEnePrev[ch][bin]; - } - - /* Store energy values and coefficients for next round */ - hDiracDecBin->ChCrossRePrev[bin] = hDiracDecBin->ChCrossRe[bin]; - hDiracDecBin->ChCrossImPrev[bin] = hDiracDecBin->ChCrossIm[bin]; - for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) - { - hDiracDecBin->ChEnePrev[ch][bin] = hDiracDecBin->ChEne[ch][bin]; - } - } - - return; -} - -static void ivas_dirac_dec_binaural_formulate_target_covariance_matrices( - DIRAC_DEC_BIN_HANDLE hDiracDecBin, - const SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, - const PARAMBIN_REND_CONFIG_HANDLE hConfig, - float Rmat[3][3], - const int16_t subframe, - const int16_t isHeadtracked, - const float *subFrameTotalEne, - const float *IIReneLimiter, - const MASA_ISM_DATA_HANDLE hMasaIsmData ) -{ - int16_t ch, bin; - int16_t separateCenterChannelRendering; - int16_t nBins, idx; - float frameMeanDiffusenessEneWeight[CLDFB_NO_CHANNELS_MAX]; - float qualityBasedSmFactor; - int16_t dirac_read_idx; - PARAMBIN_HRTF_GAIN_CACHE gainCache[MAX_GAIN_CACHE_SIZE]; - IVAS_FORMAT ivas_format; - MC_MODE mc_mode; - int16_t gainCacheBaseIndex; - - separateCenterChannelRendering = hConfig->separateCenterChannelRendering; - ivas_format = hConfig->ivas_format; - mc_mode = hConfig->mc_mode; - qualityBasedSmFactor = hConfig->qualityBasedSmFactor; - qualityBasedSmFactor *= qualityBasedSmFactor; - nBins = hSpatParamRendCom->num_freq_bands; /* Actually bins */ - - set_zero( hDiracDecBin->ChCrossReOut, nBins ); - set_zero( hDiracDecBin->ChCrossImOut, nBins ); - for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) - { - set_zero( hDiracDecBin->ChEneOut[ch], nBins ); - } - set_zero( hDiracDecBin->frameMeanDiffuseness, nBins ); - - set_zero( frameMeanDiffusenessEneWeight, CLDFB_NO_CHANNELS_MAX ); - - for ( idx = 0; idx < MAX_GAIN_CACHE_SIZE; idx++ ) - { - gainCache[idx].azi = -1000; /* Use -1000 as value for uninitialized cache. */ - } - - dirac_read_idx = hSpatParamRendCom->render_to_md_map[subframe]; - - /* Determine target covariance matrix containing target binaural properties */ - for ( bin = 0; bin < nBins; bin++ ) - { - float diffuseness = 1.0f; /* ratio1 and ratio2 are subtracted from diffuseness further below */ - float diffusenessValForDecorrelationReduction = 1.0f; - float diffEneValForDecorrelationReduction; - float surCoh = 0.0f, spreadCoh = 0.0f; /* Default values if spreadSurroundCoherenceApplied == false */ - float diffEne, dirEne, meanEnePerCh; - int16_t dirIndex; - - /* When BINAURAL_ROOM is not indicated, hBinaural->earlyPartEneCorrection[bin] values are all 1.0f. - * When BINAURAL_ROOM is indicated, the binaural audio output is based on combined use of the - * HRTF data set and a BRIR-based data set. The HRTF data set is spectrally corrected to match - * the early spectrum of the BRIR data, using the spectral correction data in - * hBinaural->earlyPartEneCorrection[bin], based on the BRIR set. */ - meanEnePerCh = hDiracDecBin->earlyPartEneCorrection[bin] * subFrameTotalEne[bin] / 2.0f; - - /* Determine direct part target covariance matrix (for 1 or 2 directions) */ - for ( dirIndex = 0; dirIndex < hSpatParamRendCom->numSimultaneousDirections; dirIndex++ ) - { - int16_t aziDeg, eleDeg; - float lRealp, lImagp, rRealp, rImagp; - float lRealpTmp, lImagpTmp, rRealpTmp, rImagpTmp; - float hrtfEne[BINAURAL_CHANNELS], hrtfCrossRe, hrtfCrossIm, ratio; - uint8_t isIsmDirection = 0; - - if ( dirIndex == 0 ) /* For first of the two simultaneous directions */ - { - aziDeg = hSpatParamRendCom->azimuth[dirac_read_idx][bin]; - eleDeg = hSpatParamRendCom->elevation[dirac_read_idx][bin]; - ratio = hSpatParamRendCom->energy_ratio1[dirac_read_idx][bin]; - spreadCoh = hSpatParamRendCom->spreadCoherence[dirac_read_idx][bin]; - gainCacheBaseIndex = 0; - } - else if ( ivas_format != MASA_ISM_FORMAT || ( ivas_format == MASA_ISM_FORMAT && dirIndex < hSpatParamRendCom->numParametricDirections ) ) /* For second of the two simultaneous directions */ - { - if ( ( ratio = hSpatParamRendCom->energy_ratio2[dirac_read_idx][bin] ) < 0.001 ) - { - /* This touches only MASA path where second direction always has smaller ratio and - * for non-2dir it is zero. As the whole direction contribution is multiplied with - * the ratio, a very small ratio does not contribute any energy to output. Thus, - * it is better to save complexity. */ - continue; - } - aziDeg = hSpatParamRendCom->azimuth2[dirac_read_idx][bin]; - eleDeg = hSpatParamRendCom->elevation2[dirac_read_idx][bin]; - spreadCoh = hSpatParamRendCom->spreadCoherence2[dirac_read_idx][bin]; - gainCacheBaseIndex = 3; - } - else /* For object directions of MASA_ISM_FORMAT */ - { - isIsmDirection = 1; - uint16_t ismDirIndex; - ismDirIndex = dirIndex - hSpatParamRendCom->numParametricDirections; - assert( hMasaIsmData != NULL && "hMasaIsmData should not be NULL if we use it" ); - if ( hMasaIsmData->ism_is_edited[ismDirIndex] ) - { - aziDeg = hMasaIsmData->azimuth_ism_edited[ismDirIndex]; - eleDeg = hMasaIsmData->elevation_ism_edited[ismDirIndex]; - } - else - { - aziDeg = hMasaIsmData->azimuth_ism[ismDirIndex][dirac_read_idx]; - eleDeg = hMasaIsmData->elevation_ism[ismDirIndex][dirac_read_idx]; - } - ratio = hMasaIsmData->energy_ratio_ism[ismDirIndex][dirac_read_idx][bin]; - spreadCoh = 0.0f; - gainCacheBaseIndex = 6 + ismDirIndex; - } - - diffuseness -= ratio; /* diffuseness = 1 - ratio1 - ratio2 */ - - if ( diffuseness < 0.0f ) - { - diffuseness = 0.0f; - } - if ( isIsmDirection ) - { - /* Objects cause lesser decorrelation reduction, to avoid removing all decorrelation when only objects are present */ - diffusenessValForDecorrelationReduction -= ratio * 0.5f; - } - else - { - diffusenessValForDecorrelationReduction -= ratio; - } - - if ( separateCenterChannelRendering ) - { - /* In masa + mono rendering mode, the center directions originate from phantom sources, so the - * spread coherence is increased */ - float aziRad, eleRad, doaVectorX, spatialAngleDeg, altSpreadCoh; - - aziRad = (float) aziDeg * PI_OVER_180; - eleRad = (float) eleDeg * PI_OVER_180; - doaVectorX = cosf( aziRad ) * cosf( eleRad ); - spatialAngleDeg = acosf( doaVectorX ) * _180_OVER_PI; - altSpreadCoh = 1.0f - ( spatialAngleDeg / 30.0f ); - spreadCoh = max( spreadCoh, altSpreadCoh ); - } - -#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF - getDirectPartGains( bin, aziDeg, eleDeg, &lRealp, &lImagp, &rRealp, &rImagp, hDiracDecBin->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache[gainCacheBaseIndex], isHeadtracked, *hDiracDecBin->phHrtfParambin ); -#else - getDirectPartGains( bin, aziDeg, eleDeg, &lRealp, &lImagp, &rRealp, &rImagp, hDiracDecBin->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache[gainCacheBaseIndex], isHeadtracked ); -#endif - - if ( hDiracDecBin->renderStereoOutputInsteadOfBinaural ) - { - /* Synthesizing spread coherence is not needed for stereo loudspeaker output, - * as directional sound is reproduced with two loudspeakers in any case */ - spreadCoh = 0.0f; - } - - if ( spreadCoh > 0.0f ) - { - float centerMul, sidesMul; - float hrtfEneCenter, hrtfEneSides, hrtfEneRealized, eneCorrectionFactor; - float w1, w2, w3, eq; - - hrtfEneCenter = ( lRealp * lRealp ) + ( lImagp * lImagp ) + ( rRealp * rRealp ) + ( rImagp * rImagp ); - - /* Spread coherence is synthesized as coherent sources at 30 degree horizontal spacing. - * The following formulas determine the gains for these sources. - * spreadCoh = 0: Only panning - * spreadCoh = 0.5: Three sources coherent panning (e.g. 30 0 -30 deg azi) - * spreadCoh = 1.0: Two sources coherent panning with gap (as above, but center is silent) */ - if ( spreadCoh < 0.5f ) - { - /* 0.0f < spreadCoh < 0.5f */ - sidesMul = 0.5774f * spreadCoh * 2.0f; /* sqrt(1/3) = 0.5774f */ - centerMul = 1.0f - ( spreadCoh * 2.0f ) + sidesMul; - } - else - { - /* 0.5f <= spreadCoh < 1.0f */ - centerMul = 2.0f - ( 2.0f * spreadCoh ); - sidesMul = inv_sqrt( centerMul + 2.0f ); - centerMul *= sidesMul; - } - - /* Apply the gain for the center source of the three coherent sources */ - lRealp *= centerMul; - lImagp *= centerMul; - rRealp *= centerMul; - rImagp *= centerMul; - - /* Apply the gain for the left source of the three coherent sources */ -#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF - getDirectPartGains( bin, aziDeg + 30, eleDeg, &lRealpTmp, &lImagpTmp, &rRealpTmp, &rImagpTmp, hDiracDecBin->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache[gainCacheBaseIndex + 1], isHeadtracked, *hDiracDecBin->phHrtfParambin ); -#else - getDirectPartGains( bin, aziDeg + 30, eleDeg, &lRealpTmp, &lImagpTmp, &rRealpTmp, &rImagpTmp, hDiracDecBin->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache[gainCacheBaseIndex + 1], isHeadtracked ); -#endif - - hrtfEneSides = ( lRealpTmp * lRealpTmp ) + ( lImagpTmp * lImagpTmp ) + ( rRealpTmp * rRealpTmp ) + ( rImagpTmp * rImagpTmp ); - lRealp += sidesMul * lRealpTmp; - lImagp += sidesMul * lImagpTmp; - rRealp += sidesMul * rRealpTmp; - rImagp += sidesMul * rImagpTmp; - - /* Apply the gain for the right source of the three coherent sources. - * -30 degrees to 330 wrapping due to internal functions. */ -#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF - getDirectPartGains( bin, aziDeg + 330, eleDeg, &lRealpTmp, &lImagpTmp, &rRealpTmp, &rImagpTmp, hDiracDecBin->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache[gainCacheBaseIndex + 2], isHeadtracked, *hDiracDecBin->phHrtfParambin ); -#else - getDirectPartGains( bin, aziDeg + 330, eleDeg, &lRealpTmp, &lImagpTmp, &rRealpTmp, &rImagpTmp, hDiracDecBin->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache[gainCacheBaseIndex + 2], isHeadtracked ); -#endif - hrtfEneSides += ( lRealpTmp * lRealpTmp ) + ( lImagpTmp * lImagpTmp ) + ( rRealpTmp * rRealpTmp ) + ( rImagpTmp * rImagpTmp ); - lRealp += sidesMul * lRealpTmp; - lImagp += sidesMul * lImagpTmp; - rRealp += sidesMul * rRealpTmp; - rImagp += sidesMul * rImagpTmp; - - /* Formulate an eneCorrectionFactor that compensates for the coherent summation of the HRTFs */ - hrtfEneRealized = ( lRealp * lRealp ) + ( lImagp * lImagp ) + ( rRealp * rRealp ) + ( rImagp * rImagp ); - eneCorrectionFactor = ( ( hrtfEneSides * sidesMul * sidesMul ) + - ( hrtfEneCenter * centerMul * centerMul ) ) / - max( 1e-12f, hrtfEneRealized ); - - /* Weighting factors to determine appropriate target spectrum for spread coherent sound */ - if ( spreadCoh < 0.5 ) - { - w1 = 1.0f - 2.0f * spreadCoh; - w2 = 2.0f * spreadCoh; - w3 = 0.0f; - } - else - { - w1 = 0.0f; - w2 = 2.0f - 2.0f * spreadCoh; - w3 = 2.0f * spreadCoh - 1.0f; - } - - if ( ( ivas_format == MC_FORMAT && mc_mode == MC_MODE_MCMASA ) ) - { - idx = min( bin, MASA_NUM_DEFINED_SUR_SPR_COH_ENE_BINS - 1 ); - - /* Apply the target spectrum to the eneCorrectionFactor */ - if ( separateCenterChannelRendering ) /* spreadCoh mostly originates from phantom sources in separate channel rendering mode */ - { - eneCorrectionFactor *= w1 * 1.0f + ( w2 + w3 ) * spreadCohEne1[idx]; - } - else - { - eneCorrectionFactor *= w1 * 1.0f + w2 * spreadCohEne05[idx] + w3 * spreadCohEne1[idx]; - } - } - - /* Equalize the spread coherent combined HRTFs */ - eq = min( 4.0f, sqrtf( eneCorrectionFactor ) ); - lRealp *= eq; - lImagp *= eq; - rRealp *= eq; - rImagp *= eq; - } - - hrtfEne[0] = ( lRealp * lRealp ) + ( lImagp * lImagp ); - hrtfEne[1] = ( rRealp * rRealp ) + ( rImagp * rImagp ); - hrtfCrossRe = ( lRealp * rRealp ) + ( lImagp * rImagp ); - hrtfCrossIm = ( -lImagp * rRealp ) + ( lRealp * rImagp ); - - /* Add direct part (1 or 2) covariance matrix */ - dirEne = ratio * meanEnePerCh; - hDiracDecBin->ChEneOut[0][bin] += dirEne * hrtfEne[0]; /* Dir ene part*/ - hDiracDecBin->ChEneOut[1][bin] += dirEne * hrtfEne[1]; - hDiracDecBin->ChCrossReOut[bin] += dirEne * hrtfCrossRe; /* Dir cross re */ - hDiracDecBin->ChCrossImOut[bin] += dirEne * hrtfCrossIm; /* Dir cross im */ - } - - /* Add diffuse / ambient part covariance matrix */ - diffuseness = max( 0.0f, diffuseness ); - diffEne = diffuseness * meanEnePerCh; - surCoh = hSpatParamRendCom->surroundingCoherence[dirac_read_idx][bin]; - - diffusenessValForDecorrelationReduction = max( 0.0f, diffusenessValForDecorrelationReduction ); - diffEneValForDecorrelationReduction = diffusenessValForDecorrelationReduction * meanEnePerCh; - - if ( ( ivas_format == MC_FORMAT && mc_mode == MC_MODE_MCMASA ) ) - { - if ( !hDiracDecBin->renderStereoOutputInsteadOfBinaural ) - { - float spectrumModVal; - - idx = min( bin, MASA_NUM_DEFINED_SUR_SPR_COH_ENE_BINS - 1 ); - /* Apply target spectrum that emphasizes low frequencies when the sound is surround coherent */ - spectrumModVal = ( 1.0f - surCoh ) + surCoh * surCohEne[idx]; - diffEne *= spectrumModVal; - - /* Modify also the value for decorrelation reduction */ - diffEneValForDecorrelationReduction *= spectrumModVal; - } - } - hDiracDecBin->ChEneOut[0][bin] += diffEne; /* Diff ene part*/ - hDiracDecBin->ChEneOut[1][bin] += diffEne; - - if ( hDiracDecBin->renderStereoOutputInsteadOfBinaural ) - { - /* When rendering stereo, ambience (except for surround coherent sound) has zero ICC. */ - hDiracDecBin->ChCrossReOut[bin] += surCoh * diffEne; - } - else /* When rendering binaural, ambience has frequency dependent ICC. */ - { - if ( ( ivas_format == SBA_FORMAT || ivas_format == SBA_ISM_FORMAT ) && bin < BINAURAL_COHERENCE_DIFFERENCE_BINS ) - { - float diffuseFieldCoherence; - diffuseFieldCoherence = hDiracDecBin->hDiffuseDist->diffuseRatioX[bin] * hDiracDecBin->diffuseFieldCoherenceX[bin] + hDiracDecBin->hDiffuseDist->diffuseRatioY[bin] * hDiracDecBin->diffuseFieldCoherenceY[bin] + hDiracDecBin->hDiffuseDist->diffuseRatioZ[bin] * hDiracDecBin->diffuseFieldCoherenceZ[bin]; - hDiracDecBin->ChCrossReOut[bin] += ( ( 1.0f - surCoh ) * diffuseFieldCoherence + surCoh ) * diffEne; - } - else - { - hDiracDecBin->ChCrossReOut[bin] += ( ( 1.0f - surCoh ) * hDiracDecBin->diffuseFieldCoherence[bin] + surCoh ) * diffEne; - } - } - - /* Store parameters for formulating average diffuseness over frame */ - hDiracDecBin->frameMeanDiffuseness[bin] += diffEneValForDecorrelationReduction; - frameMeanDiffusenessEneWeight[bin] += meanEnePerCh; - } - - /* Formulate average diffuseness over frame */ - for ( bin = 0; bin < nBins; bin++ ) - { - hDiracDecBin->frameMeanDiffuseness[bin] /= fmaxf( 1e-12f, frameMeanDiffusenessEneWeight[bin] ); - } + hSpatParamRendCom->subframes_rendered++; - for ( bin = 0; bin < nBins; bin++ ) - { - hDiracDecBin->ChCrossReOut[bin] *= qualityBasedSmFactor; - hDiracDecBin->ChCrossImOut[bin] *= qualityBasedSmFactor; + return; +} - for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) - { - hDiracDecBin->ChEneOut[ch][bin] *= qualityBasedSmFactor; - } - hDiracDecBin->ChCrossReOut[bin] += IIReneLimiter[bin] * hDiracDecBin->ChCrossReOutPrev[bin]; - hDiracDecBin->ChCrossImOut[bin] += IIReneLimiter[bin] * hDiracDecBin->ChCrossImOutPrev[bin]; +static void ivas_dirac_dec_decorrelate_slot( + DIRAC_DEC_BIN_HANDLE hDiracDecBin, + const int16_t num_freq_bands, + const int16_t slot, + float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], + float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], + float decRe[][CLDFB_NO_CHANNELS_MAX], + float decIm[][CLDFB_NO_CHANNELS_MAX] ) +{ + int16_t offset, ch, bin; + float onset_filter[BINAURAL_CHANNELS * CLDFB_NO_CHANNELS_MAX]; /* 2 ch, 60 bins */ + float decorrelatedFrameInterleaved[2 * BINAURAL_CHANNELS * CLDFB_NO_CHANNELS_MAX]; /* 2 ch, real + imag, 60 bins */ + float protoFrameF[2 * BINAURAL_CHANNELS * CLDFB_NO_CHANNELS_MAX]; /* 2 ch, real + imag, 60 bins */ + const int16_t protoIndexDir[BINAURAL_CHANNELS] = { 0, 1 }; - for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + /* Decorrelation needs interleaved data. Copy left and right signals to proto_frame_f */ + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + offset = num_freq_bands * BINAURAL_CHANNELS * ch; + for ( bin = 0; bin < num_freq_bands; bin++ ) { - hDiracDecBin->ChEneOut[ch][bin] += IIReneLimiter[bin] * hDiracDecBin->ChEneOutPrev[ch][bin]; + protoFrameF[( bin * BINAURAL_CHANNELS ) + offset] = inRe[ch][slot][bin]; + protoFrameF[( bin * BINAURAL_CHANNELS ) + offset + 1] = inIm[ch][slot][bin]; } + } - /* Store energy values and coefficients for next round */ - hDiracDecBin->ChCrossReOutPrev[bin] = hDiracDecBin->ChCrossReOut[bin]; - hDiracDecBin->ChCrossImOutPrev[bin] = hDiracDecBin->ChCrossImOut[bin]; + /* Decorrelate proto signal to decorrelatedFrameInterleaved */ + ivas_dirac_dec_decorr_process( num_freq_bands, + BINAURAL_CHANNELS, + BINAURAL_CHANNELS, + DIRAC_SYNTHESIS_PSD_LS, + BINAURAL_CHANNELS, + protoFrameF, + BINAURAL_CHANNELS, + protoIndexDir, + decorrelatedFrameInterleaved, + onset_filter, + hDiracDecBin->h_freq_domain_decorr_ap_params, + hDiracDecBin->h_freq_domain_decorr_ap_state ); - for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + /* De-interleave decorrelated signals*/ + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + offset = num_freq_bands * BINAURAL_CHANNELS * ch; + for ( bin = 0; bin < num_freq_bands; bin++ ) { - hDiracDecBin->ChEneOutPrev[ch][bin] = hDiracDecBin->ChEneOut[ch][bin]; + decRe[ch][bin] = decorrelatedFrameInterleaved[( bin * BINAURAL_CHANNELS ) + offset]; + decIm[ch][bin] = decorrelatedFrameInterleaved[( bin * BINAURAL_CHANNELS ) + offset + 1]; } } return; } -#else -static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matrices( + + +static void ivas_dirac_dec_binaural_formulate_input_covariance_matrices( DIRAC_DEC_BIN_HANDLE hDiracDecBin, - SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, - PARAMBIN_REND_CONFIG_HANDLE hConfig, + const SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, + const PARAMBIN_REND_CONFIG_HANDLE hConfig, float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], - float Rmat[3][3], const int16_t subframe, - const int16_t isHeadtracked, - const MASA_ISM_DATA_HANDLE hMasaIsmData ) + float *subFrameTotalEne, + float *IIReneLimiter ) { int16_t ch, slot, bin; - int16_t separateCenterChannelRendering; - int16_t nBins, idx; - float frameMeanDiffusenessEneWeight[CLDFB_NO_CHANNELS_MAX]; + int16_t nBins; float IIReneLimiterFactor; float qualityBasedSmFactor; float lowBitRateEQ[CLDFB_NO_CHANNELS_MAX]; uint8_t applyLowBitRateEQ; - int16_t dirac_read_idx; - float subFrameTotalEne[CLDFB_NO_CHANNELS_MAX]; - PARAMBIN_HRTF_GAIN_CACHE gainCache[MAX_GAIN_CACHE_SIZE]; IVAS_FORMAT ivas_format; - MC_MODE mc_mode; int32_t ivas_total_brate; int16_t nchan_transport; - int16_t gainCacheBaseIndex; - separateCenterChannelRendering = hConfig->separateCenterChannelRendering; ivas_format = hConfig->ivas_format; - mc_mode = hConfig->mc_mode; ivas_total_brate = hConfig->ivas_total_brate; nchan_transport = hConfig->nchan_transport; qualityBasedSmFactor = hConfig->qualityBasedSmFactor; @@ -1587,20 +982,9 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric set_zero( hDiracDecBin->ChCrossRe, nBins ); set_zero( hDiracDecBin->ChCrossIm, nBins ); - set_zero( hDiracDecBin->ChCrossReOut, nBins ); - set_zero( hDiracDecBin->ChCrossImOut, nBins ); for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { set_zero( hDiracDecBin->ChEne[ch], nBins ); - set_zero( hDiracDecBin->ChEneOut[ch], nBins ); - } - set_zero( hDiracDecBin->frameMeanDiffuseness, nBins ); - - set_zero( frameMeanDiffusenessEneWeight, CLDFB_NO_CHANNELS_MAX ); - - for ( idx = 0; idx < MAX_GAIN_CACHE_SIZE; idx++ ) - { - gainCache[idx].azi = -1000; /* Use -1000 as value for uninitialized cache. */ } /* Determine EQ for low bit rates (13.2 and 16.4 kbps) */ @@ -1626,7 +1010,6 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric /* Formulate input and target covariance matrices for this subframe */ set_zero( subFrameTotalEne, CLDFB_NO_CHANNELS_MAX ); - dirac_read_idx = hSpatParamRendCom->render_to_md_map[subframe]; /* Calculate input covariance matrix */ for ( slot = 0; slot < hSpatParamRendCom->subframe_nbslots[subframe]; slot++ ) @@ -1681,12 +1064,105 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric subFrameSumEne[bin] += tempRe * tempRe + tempIm * tempIm; } } + for ( bin = 0; bin < nBins; bin++ ) { subFrameTotalEne[bin] = max( subFrameTotalEne[bin], subFrameSumEne[bin] ); } } + /* Temporal IIR-type smoothing of covariance matrices. Also apply encoding quality based smoothing factor. */ + if ( ivas_format == MASA_FORMAT && ivas_total_brate < MASA_STEREO_MIN_BITRATE ) + { + IIReneLimiterFactor = 16.0f + ( 1.0f - qualityBasedSmFactor ); + } + else + { + IIReneLimiterFactor = 8.0f + ( 1.0f - qualityBasedSmFactor ); + } + for ( bin = 0; bin < nBins; bin++ ) + { + float eneRatio; + + /* Temporally smooth cov mtx estimates for resulting mixing matrix stability. The design principle is that + * the energy history (IIR) must not be more than double of the current frame energy. This provides more + * robust performance at energy offsets when compared to typical IIR averaging. */ + eneRatio = ( hDiracDecBin->ChEne[0][bin] + hDiracDecBin->ChEne[1][bin] ) / fmaxf( 1e-12f, ( hDiracDecBin->ChEnePrev[0][bin] + hDiracDecBin->ChEnePrev[1][bin] ) ); + IIReneLimiter[bin] = fminf( 1.0f, eneRatio * IIReneLimiterFactor ); + + hDiracDecBin->ChCrossRe[bin] *= qualityBasedSmFactor; + hDiracDecBin->ChCrossIm[bin] *= qualityBasedSmFactor; + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + hDiracDecBin->ChEne[ch][bin] *= qualityBasedSmFactor; + } + + hDiracDecBin->ChCrossRe[bin] += IIReneLimiter[bin] * hDiracDecBin->ChCrossRePrev[bin]; + hDiracDecBin->ChCrossIm[bin] += IIReneLimiter[bin] * hDiracDecBin->ChCrossImPrev[bin]; + + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + hDiracDecBin->ChEne[ch][bin] += IIReneLimiter[bin] * hDiracDecBin->ChEnePrev[ch][bin]; + } + + /* Store energy values and coefficients for next round */ + hDiracDecBin->ChCrossRePrev[bin] = hDiracDecBin->ChCrossRe[bin]; + hDiracDecBin->ChCrossImPrev[bin] = hDiracDecBin->ChCrossIm[bin]; + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + hDiracDecBin->ChEnePrev[ch][bin] = hDiracDecBin->ChEne[ch][bin]; + } + } + + return; +} + +static void ivas_dirac_dec_binaural_formulate_target_covariance_matrices( + DIRAC_DEC_BIN_HANDLE hDiracDecBin, + const SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, + const PARAMBIN_REND_CONFIG_HANDLE hConfig, + float Rmat[3][3], + const int16_t subframe, + const int16_t isHeadtracked, + const float *subFrameTotalEne, + const float *IIReneLimiter, + const MASA_ISM_DATA_HANDLE hMasaIsmData ) +{ + int16_t ch, bin; + int16_t separateCenterChannelRendering; + int16_t nBins, idx; + float frameMeanDiffusenessEneWeight[CLDFB_NO_CHANNELS_MAX]; + float qualityBasedSmFactor; + int16_t dirac_read_idx; + PARAMBIN_HRTF_GAIN_CACHE gainCache[MAX_GAIN_CACHE_SIZE]; + IVAS_FORMAT ivas_format; + MC_MODE mc_mode; + int16_t gainCacheBaseIndex; + + separateCenterChannelRendering = hConfig->separateCenterChannelRendering; + ivas_format = hConfig->ivas_format; + mc_mode = hConfig->mc_mode; + qualityBasedSmFactor = hConfig->qualityBasedSmFactor; + qualityBasedSmFactor *= qualityBasedSmFactor; + nBins = hSpatParamRendCom->num_freq_bands; /* Actually bins */ + + set_zero( hDiracDecBin->ChCrossReOut, nBins ); + set_zero( hDiracDecBin->ChCrossImOut, nBins ); + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + set_zero( hDiracDecBin->ChEneOut[ch], nBins ); + } + set_zero( hDiracDecBin->frameMeanDiffuseness, nBins ); + + set_zero( frameMeanDiffusenessEneWeight, CLDFB_NO_CHANNELS_MAX ); + + for ( idx = 0; idx < MAX_GAIN_CACHE_SIZE; idx++ ) + { + gainCache[idx].azi = -1000; /* Use -1000 as value for uninitialized cache. */ + } + + dirac_read_idx = hSpatParamRendCom->render_to_md_map[subframe]; + /* Determine target covariance matrix containing target binaural properties */ for ( bin = 0; bin < nBins; bin++ ) { @@ -1787,7 +1263,11 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric spreadCoh = max( spreadCoh, altSpreadCoh ); } +#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF + getDirectPartGains( bin, aziDeg, eleDeg, &lRealp, &lImagp, &rRealp, &rImagp, hDiracDecBin->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache[gainCacheBaseIndex], isHeadtracked, *hDiracDecBin->phHrtfParambin ); +#else getDirectPartGains( bin, aziDeg, eleDeg, &lRealp, &lImagp, &rRealp, &rImagp, hDiracDecBin->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache[gainCacheBaseIndex], isHeadtracked ); +#endif if ( hDiracDecBin->renderStereoOutputInsteadOfBinaural ) { @@ -1830,7 +1310,11 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric rImagp *= centerMul; /* Apply the gain for the left source of the three coherent sources */ +#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF + getDirectPartGains( bin, aziDeg + 30, eleDeg, &lRealpTmp, &lImagpTmp, &rRealpTmp, &rImagpTmp, hDiracDecBin->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache[gainCacheBaseIndex + 1], isHeadtracked, *hDiracDecBin->phHrtfParambin ); +#else getDirectPartGains( bin, aziDeg + 30, eleDeg, &lRealpTmp, &lImagpTmp, &rRealpTmp, &rImagpTmp, hDiracDecBin->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache[gainCacheBaseIndex + 1], isHeadtracked ); +#endif hrtfEneSides = ( lRealpTmp * lRealpTmp ) + ( lImagpTmp * lImagpTmp ) + ( rRealpTmp * rRealpTmp ) + ( rImagpTmp * rImagpTmp ); lRealp += sidesMul * lRealpTmp; @@ -1840,7 +1324,11 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric /* Apply the gain for the right source of the three coherent sources. * -30 degrees to 330 wrapping due to internal functions. */ +#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF + getDirectPartGains( bin, aziDeg + 330, eleDeg, &lRealpTmp, &lImagpTmp, &rRealpTmp, &rImagpTmp, hDiracDecBin->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache[gainCacheBaseIndex + 2], isHeadtracked, *hDiracDecBin->phHrtfParambin ); +#else getDirectPartGains( bin, aziDeg + 330, eleDeg, &lRealpTmp, &lImagpTmp, &rRealpTmp, &rImagpTmp, hDiracDecBin->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache[gainCacheBaseIndex + 2], isHeadtracked ); +#endif hrtfEneSides += ( lRealpTmp * lRealpTmp ) + ( lImagpTmp * lImagpTmp ) + ( rRealpTmp * rRealpTmp ) + ( rImagpTmp * rImagpTmp ); lRealp += sidesMul * lRealpTmp; lImagp += sidesMul * lImagpTmp; @@ -1959,63 +1447,36 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric hDiracDecBin->frameMeanDiffuseness[bin] /= fmaxf( 1e-12f, frameMeanDiffusenessEneWeight[bin] ); } - /* Temporal IIR-type smoothing of covariance matrices. Also apply encoding quality based smoothing factor. */ - if ( ivas_format == MASA_FORMAT && ivas_total_brate < MASA_STEREO_MIN_BITRATE ) - { - IIReneLimiterFactor = 16.0f + ( 1.0f - qualityBasedSmFactor ); - } - else - { - IIReneLimiterFactor = 8.0f + ( 1.0f - qualityBasedSmFactor ); - } for ( bin = 0; bin < nBins; bin++ ) { - float eneRatio, IIReneLimiter; - - /* Temporally smooth cov mtx estimates for resulting mixing matrix stability. The design principle is that - * the energy history (IIR) must not be more than double of the current frame energy. This provides more - * robust performance at energy offsets when compared to typical IIR averaging. */ - eneRatio = ( hDiracDecBin->ChEne[0][bin] + hDiracDecBin->ChEne[1][bin] ) / fmaxf( 1e-12f, ( hDiracDecBin->ChEnePrev[0][bin] + hDiracDecBin->ChEnePrev[1][bin] ) ); - IIReneLimiter = fminf( 1.0f, eneRatio * IIReneLimiterFactor ); - - hDiracDecBin->ChCrossRe[bin] *= qualityBasedSmFactor; - hDiracDecBin->ChCrossIm[bin] *= qualityBasedSmFactor; hDiracDecBin->ChCrossReOut[bin] *= qualityBasedSmFactor; hDiracDecBin->ChCrossImOut[bin] *= qualityBasedSmFactor; for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { - hDiracDecBin->ChEne[ch][bin] *= qualityBasedSmFactor; hDiracDecBin->ChEneOut[ch][bin] *= qualityBasedSmFactor; } - hDiracDecBin->ChCrossRe[bin] += IIReneLimiter * hDiracDecBin->ChCrossRePrev[bin]; - hDiracDecBin->ChCrossIm[bin] += IIReneLimiter * hDiracDecBin->ChCrossImPrev[bin]; - hDiracDecBin->ChCrossReOut[bin] += IIReneLimiter * hDiracDecBin->ChCrossReOutPrev[bin]; - hDiracDecBin->ChCrossImOut[bin] += IIReneLimiter * hDiracDecBin->ChCrossImOutPrev[bin]; + hDiracDecBin->ChCrossReOut[bin] += IIReneLimiter[bin] * hDiracDecBin->ChCrossReOutPrev[bin]; + hDiracDecBin->ChCrossImOut[bin] += IIReneLimiter[bin] * hDiracDecBin->ChCrossImOutPrev[bin]; for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { - hDiracDecBin->ChEne[ch][bin] += IIReneLimiter * hDiracDecBin->ChEnePrev[ch][bin]; - hDiracDecBin->ChEneOut[ch][bin] += IIReneLimiter * hDiracDecBin->ChEneOutPrev[ch][bin]; + hDiracDecBin->ChEneOut[ch][bin] += IIReneLimiter[bin] * hDiracDecBin->ChEneOutPrev[ch][bin]; } /* Store energy values and coefficients for next round */ - hDiracDecBin->ChCrossRePrev[bin] = hDiracDecBin->ChCrossRe[bin]; - hDiracDecBin->ChCrossImPrev[bin] = hDiracDecBin->ChCrossIm[bin]; hDiracDecBin->ChCrossReOutPrev[bin] = hDiracDecBin->ChCrossReOut[bin]; hDiracDecBin->ChCrossImOutPrev[bin] = hDiracDecBin->ChCrossImOut[bin]; for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { - hDiracDecBin->ChEnePrev[ch][bin] = hDiracDecBin->ChEne[ch][bin]; hDiracDecBin->ChEneOutPrev[ch][bin] = hDiracDecBin->ChEneOut[ch][bin]; } } return; } -#endif static void ivas_dirac_dec_binaural_determine_processing_matrices( DIRAC_DEC_BIN_HANDLE hDiracDecBin, @@ -2261,27 +1722,19 @@ static void ivas_dirac_dec_binaural_process_output( const int16_t max_band_decorr, const int16_t numInChannels, const int16_t processReverb, - const int16_t subframe -#ifdef SPLIT_REND_WITH_HEAD_ROT - , + const int16_t subframe, float outRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float outIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float reverbRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float reverbIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float decorrRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float decorrIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], - const uint8_t recompute -#endif -) + const uint8_t recompute ) { int16_t slot, bin, chA, chB; int16_t nBins; float outSlotRe[CLDFB_NO_CHANNELS_MAX], outSlotIm[CLDFB_NO_CHANNELS_MAX]; float decSlotRe[BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX], decSlotIm[BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX]; -#ifndef SPLIT_REND_WITH_HEAD_ROT - float reverbRe[BINAURAL_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; - float reverbIm[BINAURAL_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; -#endif float interpVal; float *decSlotRePointer; float *decSlotImPointer; @@ -2295,14 +1748,10 @@ static void ivas_dirac_dec_binaural_process_output( if ( processReverb ) { /* Process second / room effect part of binaural output when needed */ -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( recompute == 1 ) { -#endif ivas_binaural_reverb_processSubframe( hDiracDecBin->hReverb, numInChannels, nSlots, inRe, inIm, reverbRe, reverbIm ); -#ifdef SPLIT_REND_WITH_HEAD_ROT } -#endif } interpVal = 0.0f; @@ -2311,12 +1760,9 @@ static void ivas_dirac_dec_binaural_process_output( interpVal += 1.0f / (float) nSlots; if ( !hDiracDecBin->useTdDecorr && max_band_decorr > 0 ) { -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( recompute == 1 ) { -#endif ivas_dirac_dec_decorrelate_slot( hDiracDecBin, nBins, slot, inRe, inIm, decSlotRe, decSlotIm ); -#ifdef SPLIT_REND_WITH_HEAD_ROT for ( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) { mvr2r( decSlotRe[chA], decorrRe[chA][slot], CLDFB_NO_CHANNELS_MAX ); @@ -2331,7 +1777,6 @@ static void ivas_dirac_dec_binaural_process_output( mvr2r( decorrIm[chA][slot], decSlotIm[chA], CLDFB_NO_CHANNELS_MAX ); } } -#endif } for ( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) @@ -2409,7 +1854,6 @@ static void ivas_dirac_dec_binaural_process_output( outSlotRePr = &( outSlotRe[0] ); outSlotImPr = &( outSlotIm[0] ); -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( outRe != NULL && outIm != NULL ) { /* provide the data outside in CLDFB domain => mainly for split rendering */ @@ -2421,10 +1865,6 @@ static void ivas_dirac_dec_binaural_process_output( /* Inverse filter bank */ cldfbSynthesis( &outSlotRePr, &outSlotImPr, &( output_f[chA][nBins * slot + offsetSamples] ), nBins, cldfbSynDec[chA] ); } -#else - /* Inverse filter bank */ - cldfbSynthesis( &outSlotRePr, &outSlotImPr, &( output_f[chA][nBins * slot + offsetSamples] ), nBins, cldfbSynDec[chA] ); -#endif } } @@ -3460,15 +2900,10 @@ static void ivas_masa_ext_rend_parambin_internal( MASA_EXT_REND_HANDLE hMasaExtRend, COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, float *output_f[], -#ifdef SPLIT_REND_WITH_HEAD_ROT const int16_t subframe, const SPLIT_REND_WRAPPER *hSplitRendWrapper, float Cldfb_Out_Real[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], - float Cldfb_Out_Imag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX] -#else - const int16_t subframe -#endif -) + float Cldfb_Out_Imag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX] ) { DIRAC_DEC_BIN_HANDLE hDiracDecBin; SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; @@ -3482,7 +2917,6 @@ static void ivas_masa_ext_rend_parambin_internal( int16_t i, j; int16_t nchan_transport; -#ifdef SPLIT_REND_WITH_HEAD_ROT int16_t pos_idx; const MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData; float tmp_Cldfb_out_re[BINAURAL_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; @@ -3497,9 +2931,6 @@ static void ivas_masa_ext_rend_parambin_internal( float IIReneLimiter[CLDFB_NO_CHANNELS_MAX]; hDiracDecBin = hMasaExtRend->hDiracDecBin[0]; -#else - hDiracDecBin = hMasaExtRend->hDiracDecBin; -#endif assert( hDiracDecBin ); hSpatParamRendCom = hMasaExtRend->hSpatParamRendCom; nBins = hSpatParamRendCom->num_freq_bands; @@ -3570,9 +3001,7 @@ static void ivas_masa_ext_rend_parambin_internal( if ( nchan_transport == 2 ) { -#ifdef SPLIT_REND_WITH_HEAD_ROT /* in case of split rendering, determine the prototype rotation based on the main direction and use the same prototypes for the offset directions */ -#endif adaptTransportSignalsHeadtracked( hCombinedOrientationData, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, nBins, hSpatParamRendCom->subframe_nbslots[subframe], Rmat ); ivas_dirac_dec_binaural_check_and_switch_transports_headtracked( hCombinedOrientationData, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, nBins, hSpatParamRendCom->subframe_nbslots[subframe], Rmat ); @@ -3580,28 +3009,20 @@ static void ivas_masa_ext_rend_parambin_internal( } -#ifndef SPLIT_REND_WITH_HEAD_ROT - ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matrices( hDiracDecBin, hSpatParamRendCom, &config_data, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, Rmat, subframe, - hCombinedOrientationData && hCombinedOrientationData->enableCombinedOrientation[hCombinedOrientationData->subframe_idx] > 0, NULL ); -#endif - /* Always using CLDFB decorrelation in MASA EXT renderer */ max_band_decorr = hDiracDecBin->h_freq_domain_decorr_ap_params->max_band_decorr; -#ifdef SPLIT_REND_WITH_HEAD_ROT ivas_dirac_dec_binaural_formulate_input_covariance_matrices( hDiracDecBin, hSpatParamRendCom, &config_data, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, subframe, subFrameTotalEne, IIReneLimiter ); ivas_dirac_dec_binaural_formulate_target_covariance_matrices( hDiracDecBin, hSpatParamRendCom, &config_data, Rmat, subframe, hCombinedOrientationData && hCombinedOrientationData->enableCombinedOrientation[hCombinedOrientationData->subframe_idx] > 0, subFrameTotalEne, IIReneLimiter, NULL ); -#endif ivas_dirac_dec_binaural_determine_processing_matrices( hDiracDecBin, hSpatParamRendCom, &config_data, max_band_decorr, Rmat, subframe, hCombinedOrientationData && hCombinedOrientationData->enableCombinedOrientation[hCombinedOrientationData->subframe_idx] > 0, 0, NULL ); -#ifdef SPLIT_REND_WITH_HEAD_ROT pMultiBinPoseData = NULL; if ( hSplitRendWrapper != NULL ) { @@ -3626,13 +3047,9 @@ static void ivas_masa_ext_rend_parambin_internal( max_band_decorr, numInChannels, config_data.processReverb, subframe, NULL, NULL, reverbRe, reverbIm, decorrRe, decorrIm, 1 ); } -#else - ivas_dirac_dec_binaural_process_output( hDiracDecBin, hSpatParamRendCom, hMasaExtRend->cldfbSynRend, output_f, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, max_band_decorr, numInChannels, config_data.processReverb, subframe ); -#endif hDiracDecBin->hDiffuseDist = NULL; -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( pMultiBinPoseData != NULL && pMultiBinPoseData->num_poses > 1 ) { /* quaternion-based rotation from ivas_binRenderer_internal.c:ivas_binRenderer(), but using absolute rotation instead of delta rotations */ @@ -3695,7 +3112,6 @@ static void ivas_masa_ext_rend_parambin_internal( } /* update this counter only after the last rendering of split directions */ -#endif hSpatParamRendCom->slots_rendered += hSpatParamRendCom->subframe_nbslots[subframe]; hSpatParamRendCom->subframes_rendered++; @@ -3704,17 +3120,13 @@ static void ivas_masa_ext_rend_parambin_internal( void ivas_masa_ext_rend_parambin_render( - MASA_EXT_REND_HANDLE hMasaExtRend, /* i/o: MASA ext rend structure */ - COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, /* i : combined orientation handle */ - float *output_f[], /* i/o: synthesized core-coder transport channels/DirAC output */ -#ifdef SPLIT_REND_WITH_HEAD_ROT + MASA_EXT_REND_HANDLE hMasaExtRend, /* i/o: MASA ext rend structure */ + COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, /* i : combined orientation handle */ + float *output_f[], /* i/o: synthesized core-coder transport channels/DirAC output */ const int16_t num_subframes, /* i : number of subframes to render */ const SPLIT_REND_WRAPPER *hSplitRendWrapper, /* i : split rendering orientation data */ float Cldfb_Out_Real[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* o : rendered orientations for split rend. real part of cldfb */ float Cldfb_Out_Imag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX] /* o : rendered orientations for split rend. imag part of cldfb */ -#else - const int16_t num_subframes /* i : number of subframes to render */ -#endif ) { int16_t subframe; @@ -3736,11 +3148,7 @@ void ivas_masa_ext_rend_parambin_render( int16_t n_samples_sf = hSpatParamRendCom->slot_size * CLDFB_SLOTS_PER_SUBFRAME; hSpatParamRendCom->slots_rendered = 0; -#ifdef SPLIT_REND_WITH_HEAD_ROT ivas_masa_ext_rend_parambin_internal( hMasaExtRend, hCombinedOrientationData, p_output, hSpatParamRendCom->dirac_read_idx, hSplitRendWrapper, Cldfb_Out_Real, Cldfb_Out_Imag ); -#else - ivas_masa_ext_rend_parambin_internal( hMasaExtRend, hCombinedOrientationData, p_output, hSpatParamRendCom->dirac_read_idx ); -#endif for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { diff --git a/lib_rend/ivas_output_init.c b/lib_rend/ivas_output_init.c index 4f77c20b78b7cda3b52a87244dac26e64f19eca5..24e61972285267c97d7f6cf2cb6b05dc90c373ab 100644 --- a/lib_rend/ivas_output_init.c +++ b/lib_rend/ivas_output_init.c @@ -93,10 +93,8 @@ int16_t audioCfg2channels( nchan_out = 8; break; case IVAS_AUDIO_CONFIG_BINAURAL: -#ifdef SPLIT_REND_WITH_HEAD_ROT case IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED: case IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM: -#endif case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR: case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB: nchan_out = 2; @@ -224,10 +222,8 @@ void ivas_output_init( hOutSetup->is_planar_setup = 0; break; case IVAS_AUDIO_CONFIG_BINAURAL: -#ifdef SPLIT_REND_WITH_HEAD_ROT case IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED: case IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM: -#endif case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR: case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB: case IVAS_AUDIO_CONFIG_ISM1: @@ -328,11 +324,7 @@ int16_t ivas_get_nchan_buffers_dec( { nchan_out_buff = max( nchan_out_buff, st_ivas->hOutSetup.nchan_out_woLFE + st_ivas->hOutSetup.num_lfe ); } -#ifdef SPLIT_REND_WITH_HEAD_ROT else if ( output_config == IVAS_AUDIO_CONFIG_STEREO || output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) -#else - else if ( output_config == IVAS_AUDIO_CONFIG_STEREO || output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) -#endif { nchan_out_buff = 2 * CPE_CHANNELS; } @@ -411,12 +403,10 @@ int16_t ivas_get_nchan_buffers_dec( } } -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { nchan_out_buff = max( nchan_out_buff, st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses * BINAURAL_CHANNELS ); } -#endif return nchan_out_buff; } diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index 49203db068df58458a397d38bba715026c8b214d..e734543acd1535bf37199d310ad46328becceec9 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -203,14 +203,10 @@ void ivas_masa_ext_rend_parambin_render( MASA_EXT_REND_HANDLE hMasaExtRend, /* i/o: MASA ext rend structure */ COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, /* i : combined orientation handle */ float *output_f[], /* i/o: synthesized core-coder transport channels/DirAC output */ -#ifdef SPLIT_REND_WITH_HEAD_ROT const int16_t num_subframes, /* i : number of subframes to render */ const SPLIT_REND_WRAPPER *hSplitRendWrapper, /* i : split rendering orientation data */ float Cldfb_Out_Real[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* o : rendered orientations for split rend. real part of cldfb */ float Cldfb_Out_Imag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX] /* o : rendered orientations for split rend. imag part of cldfb */ -#else - const int16_t num_subframes /* i : number of subframes to render */ -#endif ); ivas_error ivas_dirac_dec_init_binaural_data( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ @@ -879,21 +875,13 @@ ivas_error ivas_rend_openCrend( #ifdef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES HRTFS_STATISTICS_HANDLE hHrtfStatistics, #endif -#ifdef SPLIT_REND_WITH_HEAD_ROT const int32_t output_Fs, const int16_t num_poses -#else - const int32_t output_Fs -#endif ); void ivas_rend_closeCrend( -#ifdef SPLIT_REND_WITH_HEAD_ROT CREND_WRAPPER_HANDLE *pCrend , const int16_t num_poses -#else - CREND_WRAPPER_HANDLE *pCrend -#endif ); ivas_error ivas_hrtf_init( @@ -901,12 +889,8 @@ ivas_error ivas_hrtf_init( ); ivas_error ivas_rend_initCrendWrapper( -#ifdef SPLIT_REND_WITH_HEAD_ROT CREND_WRAPPER_HANDLE *pCrend, const int16_t num_poses -#else - CREND_WRAPPER_HANDLE *pCrend -#endif ); @@ -923,10 +907,8 @@ ivas_error ivas_rend_crendProcessSubframe( float *output[], /* i/o: input/output audio channels */ const int16_t n_samples_to_render, /* i : output frame length per channel */ const int32_t output_Fs /* i : output sampling rate */ -#ifdef SPLIT_REND_WITH_HEAD_ROT , const int16_t pos_idx -#endif ); @@ -1279,14 +1261,12 @@ void QuatToRotMat( float Rmat[3][3] /* o : real-space rotation matrix for this rotation */ ); -#ifdef SPLIT_REND_WITH_HEAD_ROT void Quat2EulerDegree( const IVAS_QUATERNION quat, /* i : quaternion describing the rotation */ float *yaw, /* o : yaw */ float *pitch, /* o : pitch */ float *roll /* o : roll */ ); -#endif void rotateAziEle( float azi_in, /* i : output elevation */ @@ -1575,7 +1555,6 @@ void masaPrerendClose( ); -#ifdef SPLIT_REND_WITH_HEAD_ROT /*----------------------------------------------------------------------------------* * Split rendering *----------------------------------------------------------------------------------*/ @@ -1653,7 +1632,6 @@ void ivas_rend_closeCldfbRend( CLDFB_REND_WRAPPER *pCldfbRend ); -#endif /* clang-format on */ diff --git a/lib_rend/ivas_render_config.c b/lib_rend/ivas_render_config.c index 5226c0dcbd5801454acbccbdc53f8a37e03b213b..081c0940da6b09fc87abae5d129beb56f327970e 100644 --- a/lib_rend/ivas_render_config.c +++ b/lib_rend/ivas_render_config.c @@ -131,22 +131,16 @@ ivas_error ivas_render_config_init_from_rom( ( *hRenderConfig )->directivity[i * 3 + 1] = 360.0f; /* Back cone */ ( *hRenderConfig )->directivity[i * 3 + 2] = 1.0f; /* Back attenuation */ } -#ifdef SPLIT_REND_WITH_HEAD_ROT ( *hRenderConfig )->split_rend_config.splitRendBitRate = SPLIT_REND_768k; ( *hRenderConfig )->split_rend_config.dof = 3; ( *hRenderConfig )->split_rend_config.hq_mode = 0; ( *hRenderConfig )->split_rend_config.codec_delay_ms = 0; -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS ( *hRenderConfig )->split_rend_config.isar_frame_size_ms = 20; -#endif ( *hRenderConfig )->split_rend_config.codec_frame_size_ms = 0; /* 0 means "use default for selected codec" */ ( *hRenderConfig )->split_rend_config.codec = ISAR_SPLIT_REND_CODEC_DEFAULT; ( *hRenderConfig )->split_rend_config.poseCorrectionMode = ISAR_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB; ( *hRenderConfig )->split_rend_config.rendererSelection = ISAR_SPLIT_REND_RENDERER_SELECTION_DEFAULT; -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS ( *hRenderConfig )->split_rend_config.lc3plus_highres = 0; -#endif -#endif return IVAS_ERR_OK; } diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c index 74ae4fc6826fbeddb923163d142d2330c97a0b22..a829db866d320e3962212bd72b190f6e5b763e1d 100644 --- a/lib_rend/ivas_rotation.c +++ b/lib_rend/ivas_rotation.c @@ -52,9 +52,7 @@ static ivas_error combine_external_and_head_orientations( IVAS_QUATERNION *headRotQuaternions, IVAS_VECTOR3 *listenerPos, -#ifdef SPLIT_REND_WITH_HEAD_ROT ISAR_SPLIT_REND_ROT_AXIS sr_pose_pred_axis, /* i : split rend pose prediction axis*/ -#endif EXTERNAL_ORIENTATION_HANDLE hExtOrientationData, COMBINED_ORIENTATION_HANDLE hCombinedOrientationData ); @@ -106,9 +104,7 @@ ivas_error ivas_headTrack_open( ( *hHeadTrackData )->Rmat_prev[i][i] = 1.0f; } -#ifdef SPLIT_REND_WITH_HEAD_ROT ( *hHeadTrackData )->sr_pose_pred_axis = DEFAULT_AXIS; -#endif set_zero( ( *hHeadTrackData )->chEneIIR[0], MASA_FREQUENCY_BANDS ); set_zero( ( *hHeadTrackData )->chEneIIR[1], MASA_FREQUENCY_BANDS ); @@ -158,7 +154,6 @@ void QuatToRotMat( float Rmat[3][3] /* o : real-space rotation matrix for this rotation */ ) { -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( quat.w == -3.0 ) { IVAS_QUATERNION quat_local; @@ -167,7 +162,6 @@ void QuatToRotMat( } else { -#endif Rmat[0][0] = quat.w * quat.w + quat.x * quat.x - quat.y * quat.y - quat.z * quat.z; Rmat[0][1] = 2.0f * ( quat.x * quat.y - quat.w * quat.z ); Rmat[0][2] = 2.0f * ( quat.x * quat.z + quat.w * quat.y ); @@ -179,9 +173,7 @@ void QuatToRotMat( Rmat[2][0] = 2.0f * ( quat.x * quat.z - quat.w * quat.y ); Rmat[2][1] = 2.0f * ( quat.y * quat.z + quat.w * quat.x ); Rmat[2][2] = quat.w * quat.w - quat.x * quat.x - quat.y * quat.y + quat.z * quat.z; -#ifdef SPLIT_REND_WITH_HEAD_ROT } -#endif return; } @@ -294,11 +286,7 @@ void rotateFrame_shd( } /* calculate ambisonics rotation matrices for the previous and current frames */ -#ifdef SPLIT_REND_WITH_HEAD_ROT SHrotmatgen( SHrotmat_prev, hCombinedOrientationData->Rmat_prev[0], shd_rot_max_order ); -#else - SHrotmatgen( SHrotmat_prev, hCombinedOrientationData->Rmat_prev, shd_rot_max_order ); -#endif SHrotmatgen( SHrotmat, hCombinedOrientationData->Rmat[hCombinedOrientationData->subframe_idx], shd_rot_max_order ); @@ -355,11 +343,7 @@ void rotateFrame_shd( { mvr2r( hCombinedOrientationData->Rmat[hCombinedOrientationData->subframe_idx][i], -#ifdef SPLIT_REND_WITH_HEAD_ROT hCombinedOrientationData->Rmat_prev[0][i], -#else - hCombinedOrientationData->Rmat_prev[i], -#endif 3 ); } @@ -425,11 +409,7 @@ void rotateFrame_sd( ch_in_woLFE = ( ch_in >= index_lfe ) ? ch_in - 1 : ch_in; /* gains for previous subframe rotation */ -#ifdef SPLIT_REND_WITH_HEAD_ROT rotateAziEle( hTransSetup.ls_azimuth[ch_in_woLFE], hTransSetup.ls_elevation[ch_in_woLFE], &azimuth, &elevation, hCombinedOrientationData->Rmat_prev[0], hTransSetup.is_planar_setup ); -#else - rotateAziEle( hTransSetup.ls_azimuth[ch_in_woLFE], hTransSetup.ls_elevation[ch_in_woLFE], &azimuth, &elevation, hCombinedOrientationData->Rmat_prev, hTransSetup.is_planar_setup ); -#endif if ( hEFAPdata != NULL && ( hTransSetup.ls_azimuth[ch_in_woLFE] != azimuth || hTransSetup.ls_elevation[ch_in_woLFE] != elevation ) ) { @@ -490,11 +470,7 @@ void rotateFrame_sd( { mvr2r( hCombinedOrientationData->Rmat[hCombinedOrientationData->subframe_idx][i], -#ifdef SPLIT_REND_WITH_HEAD_ROT hCombinedOrientationData->Rmat_prev[0][i], -#else - hCombinedOrientationData->Rmat_prev[i], -#endif 3 ); } @@ -786,9 +762,7 @@ ivas_error ivas_combined_orientation_open( int16_t j; IVAS_QUATERNION identity; IVAS_VECTOR3 origo; -#ifdef SPLIT_REND_WITH_HEAD_ROT int16_t pos_idx; -#endif identity.w = 1.0f; identity.x = identity.y = identity.z = 0.0f; @@ -804,18 +778,7 @@ ivas_error ivas_combined_orientation_open( ( *hCombinedOrientationData )->num_subframes = num_subframes; ( *hCombinedOrientationData )->interpolationCoefficient = 1.0f; ( *hCombinedOrientationData )->interpolationIncrement = 1.0f; -#ifndef FIX_1008_EXTORIENT_TARGET_INTERPOLATION - if ( num_subframes == 1 ) - { - ( *hCombinedOrientationData )->maximumFramesToTargetOrientation = 2000; - } - else - { -#endif - ( *hCombinedOrientationData )->maximumFramesToTargetOrientation = 500; -#ifndef FIX_1008_EXTORIENT_TARGET_INTERPOLATION - } -#endif + ( *hCombinedOrientationData )->maximumFramesToTargetOrientation = 500; ( *hCombinedOrientationData )->lrSwitchedNext = 0; ( *hCombinedOrientationData )->lrSwitchedCurrent = 0; ( *hCombinedOrientationData )->lrSwitchInterpVal = 0.0f; @@ -837,7 +800,6 @@ ivas_error ivas_combined_orientation_open( } } -#ifdef SPLIT_REND_WITH_HEAD_ROT for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES; pos_idx++ ) { for ( j = 0; j < 3; j++ ) @@ -848,13 +810,6 @@ ivas_error ivas_combined_orientation_open( } ( *hCombinedOrientationData )->sr_pose_pred_axis = DEFAULT_AXIS; ( *hCombinedOrientationData )->sr_low_res_flag = 0; -#else - for ( j = 0; j < 3; j++ ) - { - set_zero( ( *hCombinedOrientationData )->Rmat_prev[j], 3 ); - ( *hCombinedOrientationData )->Rmat_prev[j][j] = 1.0f; - } -#endif ( *hCombinedOrientationData )->Quaternion_prev_extOrientation = identity; ( *hCombinedOrientationData )->Quaternion_frozen_ext = identity; @@ -911,9 +866,7 @@ ivas_error combine_external_and_head_orientations_dec( COMBINED_ORIENTATION_HANDLE hCombinedOrientationData /* i/o: combined orientation handle */ ) { -#ifdef SPLIT_REND_WITH_HEAD_ROT ISAR_SPLIT_REND_ROT_AXIS sr_pose_pred_axis; -#endif IVAS_QUATERNION *pHeadRotQuaternion = NULL; IVAS_VECTOR3 *listenerPos = NULL; @@ -921,21 +874,15 @@ ivas_error combine_external_and_head_orientations_dec( { pHeadRotQuaternion = hHeadTrackData->Quaternions; listenerPos = hHeadTrackData->Pos; -#ifdef SPLIT_REND_WITH_HEAD_ROT sr_pose_pred_axis = hHeadTrackData->sr_pose_pred_axis; -#endif } -#ifdef SPLIT_REND_WITH_HEAD_ROT else { sr_pose_pred_axis = DEFAULT_AXIS; } -#endif return combine_external_and_head_orientations( pHeadRotQuaternion, listenerPos, -#ifdef SPLIT_REND_WITH_HEAD_ROT sr_pose_pred_axis, -#endif hExtOrientationData, hCombinedOrientationData ); } @@ -952,16 +899,12 @@ ivas_error combine_external_and_head_orientations_rend( COMBINED_ORIENTATION_HANDLE hCombinedOrientationData /* i/o: combined orientation handle */ ) { -#ifdef SPLIT_REND_WITH_HEAD_ROT ISAR_SPLIT_REND_ROT_AXIS sr_pose_pred_axis; -#endif IVAS_QUATERNION *headRotQuaternions = NULL; IVAS_VECTOR3 *listenerPos = NULL; int16_t i; -#ifdef SPLIT_REND_WITH_HEAD_ROT sr_pose_pred_axis = DEFAULT_AXIS; -#endif if ( hHeadTrackData != NULL ) { if ( hHeadTrackData->headRotEnabled ) @@ -969,9 +912,7 @@ ivas_error combine_external_and_head_orientations_rend( headRotQuaternions = hHeadTrackData->headPositions; listenerPos = hHeadTrackData->Pos; } -#ifdef SPLIT_REND_WITH_HEAD_ROT sr_pose_pred_axis = hHeadTrackData->sr_pose_pred_axis; -#endif } else if ( hExtOrientationData != NULL ) { @@ -986,9 +927,7 @@ ivas_error combine_external_and_head_orientations_rend( } return combine_external_and_head_orientations( headRotQuaternions, listenerPos, -#ifdef SPLIT_REND_WITH_HEAD_ROT sr_pose_pred_axis, -#endif hExtOrientationData, hCombinedOrientationData ); } @@ -1001,11 +940,9 @@ ivas_error combine_external_and_head_orientations_rend( *------------------------------------------------------------------------*/ ivas_error combine_external_and_head_orientations( - IVAS_QUATERNION *headRotQuaternions, /* i : quaternions for head rotation */ - IVAS_VECTOR3 *listenerPos, /* i : listener position */ -#ifdef SPLIT_REND_WITH_HEAD_ROT - ISAR_SPLIT_REND_ROT_AXIS sr_pose_pred_axis, /* i : split rend pose prediction axis */ -#endif + IVAS_QUATERNION *headRotQuaternions, /* i : quaternions for head rotation */ + IVAS_VECTOR3 *listenerPos, /* i : listener position */ + ISAR_SPLIT_REND_ROT_AXIS sr_pose_pred_axis, /* i : split rend pose prediction axis */ EXTERNAL_ORIENTATION_HANDLE hExtOrientationData, /* i : external orientation handle */ COMBINED_ORIENTATION_HANDLE hCombinedOrientationData /* i/o: combined orientation handle */ ) @@ -1241,9 +1178,7 @@ ivas_error combine_external_and_head_orientations( } } -#ifdef SPLIT_REND_WITH_HEAD_ROT hCombinedOrientationData->sr_pose_pred_axis = sr_pose_pred_axis; -#endif hCombinedOrientationData->subframe_idx = 0; hCombinedOrientationData->cur_subframe_samples_rendered = 0; hCombinedOrientationData->subframe_idx_start = 0; @@ -1464,11 +1399,7 @@ static float SHrot_w( if ( m == 0 ) { -#ifdef SPLIT_REND_WITH_HEAD_ROT assert( 0 && "ERROR should not be called\n" ); -#else - printf( "ERROR should not be called\n" ); -#endif return 0.0f; } else @@ -1615,11 +1546,7 @@ void ivas_combined_orientation_update_index( { if ( hCombinedOrientationData != NULL ) { - if ( hCombinedOrientationData->num_subframes == 1 -#ifdef SPLIT_REND_WITH_HEAD_ROT - || hCombinedOrientationData->sr_low_res_flag -#endif - ) + if ( hCombinedOrientationData->num_subframes == 1 || hCombinedOrientationData->sr_low_res_flag ) { /* only one orientation available anyway or split rendering with low resolution*/ hCombinedOrientationData->subframe_idx = 0; @@ -1670,11 +1597,7 @@ void ivas_combined_orientation_update_start_index( { if ( hCombinedOrientationData != NULL ) { -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( hCombinedOrientationData->num_subframes == 1 || hCombinedOrientationData->sr_low_res_flag ) -#else - if ( hCombinedOrientationData->num_subframes == 1 ) -#endif { /* only one orientation available anyway or split rendering with low resolution*/ hCombinedOrientationData->subframe_idx = 0; diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index 41ece382ee75e5e4c1bab1df6b6b2ce2bb2747ef..794103d66a6162a67f80a94b84bf88169d3f05a1 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -563,13 +563,8 @@ typedef struct ivas_binaural_rendering_conv_module_struct float ***filterTapsRightReal; float ***filterTapsRightImag; -#ifdef SPLIT_REND_WITH_HEAD_ROT float ****filterStatesLeftReal; float ****filterStatesLeftImag; -#else - float ***filterStatesLeftReal; - float ***filterStatesLeftImag; -#endif int16_t numTapsArray[BINAURAL_CONVBANDS]; int16_t numTaps; @@ -667,9 +662,7 @@ typedef struct IVAS_QUATERNION headPositions[MAX_PARAM_SPATIAL_SUBFRAMES]; IVAS_VECTOR3 Pos[MAX_PARAM_SPATIAL_SUBFRAMES]; float crossfade[L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES]; -#ifdef SPLIT_REND_WITH_HEAD_ROT ISAR_SPLIT_REND_ROT_AXIS sr_pose_pred_axis; -#endif ivas_orient_trk_state_t *hOrientationTracker; } IVAS_REND_HeadRotData; @@ -691,9 +684,7 @@ typedef struct ivas_binaural_head_track_struct int16_t shd_rot_max_order; ivas_orient_trk_state_t *OrientationTracker; -#ifdef SPLIT_REND_WITH_HEAD_ROT ISAR_SPLIT_REND_ROT_AXIS sr_pose_pred_axis; -#endif } HEAD_TRACK_DATA, *HEAD_TRACK_DATA_HANDLE; @@ -731,19 +722,13 @@ typedef struct ivas_combined_orientation_struct IVAS_QUATERNION Quaternions_ext_interpolation_start; IVAS_QUATERNION Quaternions_ext_interpolation_target; float Rmat[MAX_PARAM_SPATIAL_SUBFRAMES][3][3]; -#ifdef SPLIT_REND_WITH_HEAD_ROT float Rmat_prev[MAX_HEAD_ROT_POSES][3][3]; -#else - float Rmat_prev[3][3]; -#endif float chEneIIR[2][MASA_FREQUENCY_BANDS]; /* independent of the format. MASA bands are suitable for the task and readily available in ROM. */ float procChEneIIR[2][MASA_FREQUENCY_BANDS]; int16_t shd_rot_max_order; IVAS_VECTOR3 listenerPos[MAX_PARAM_SPATIAL_SUBFRAMES]; -#ifdef SPLIT_REND_WITH_HEAD_ROT ISAR_SPLIT_REND_ROT_AXIS sr_pose_pred_axis; int16_t sr_low_res_flag; -#endif IVAS_QUATERNION Quaternion_frozen_ext; IVAS_QUATERNION Quaternion_frozen_head; int8_t isExtOrientationFrozen; @@ -1248,17 +1233,12 @@ typedef struct ivas_crend_state_t typedef struct ivas_binaural_crend_wrapper_struct { int32_t binaural_latency_ns; -#ifdef SPLIT_REND_WITH_HEAD_ROT CREND_HANDLE hCrend[MAX_HEAD_ROT_POSES]; -#else - CREND_HANDLE hCrend; -#endif HRTFS_HANDLE hHrtfCrend; } CREND_WRAPPER, *CREND_WRAPPER_HANDLE; -#ifdef SPLIT_REND_WITH_HEAD_ROT /* Fastconv binaural data structure */ typedef struct ivas_binaural_rendering_struct { @@ -1284,7 +1264,6 @@ typedef struct ivas_binaural_rendering_struct int16_t numPoses; } BINAURAL_RENDERER, *BINAURAL_RENDERER_HANDLE; -#endif /*------------------------------------------------------------------------------------------* * HRTF structures - hrtfs from binary files @@ -1367,7 +1346,6 @@ typedef struct ivas_hrtfs_statistics_struct } HRTFS_STATISTICS, *HRTFS_STATISTICS_HANDLE; #endif -#ifdef SPLIT_REND_WITH_HEAD_ROT /*----------------------------------------------------------------------------------* * Binaural split rendering structures *----------------------------------------------------------------------------------*/ @@ -1508,8 +1486,6 @@ typedef struct ivas_binaural_head_rot_split_rendering_lcld_dec_struct } BIN_HR_SPLIT_LCLD_DEC, *BIN_HR_SPLIT_LCLD_DEC_HANDLE; -#endif - /*----------------------------------------------------------------------------------* * Limiter structure @@ -1584,7 +1560,6 @@ typedef struct ivas_LS_setup_custom } LSSETUP_CUSTOM_STRUCT, *LSSETUP_CUSTOM_HANDLE; -#ifdef SPLIT_REND_WITH_HEAD_ROT /*----------------------------------------------------------------------------------* * CLDFB renderer wrapper @@ -1598,7 +1573,6 @@ typedef struct } CLDFB_REND_WRAPPER; -#endif /* Channel types in a channel-based config */ typedef enum @@ -1620,11 +1594,7 @@ typedef struct ivas_masa_external_rendering_struct RENDERER_TYPE renderer_type; DIRAC_REND_HANDLE hDirACRend; SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; -#ifdef SPLIT_REND_WITH_HEAD_ROT DIRAC_DEC_BIN_HANDLE hDiracDecBin[MAX_HEAD_ROT_POSES]; -#else - DIRAC_DEC_BIN_HANDLE hDiracDecBin; -#endif REVERB_STRUCT_HANDLE hReverb; HRTFS_PARAMBIN_HANDLE *hHrtfParambin; diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 08a2e3286b50f0d9dee297607099fa9c5e35f110..666bea3169ef12e2cf94d472ee5b7386665f0e84 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -86,11 +86,9 @@ typedef struct const LSSETUP_CUSTOM_STRUCT *pCustomLsOut; const EFAP_WRAPPER *pEfapOutWrapper; const IVAS_REND_HeadRotData *pHeadRotData; -#ifdef SPLIT_REND_WITH_HEAD_ROT const RENDER_CONFIG_HANDLE *hhRendererConfig; const int16_t *pSplitRendBFI; const SPLIT_REND_WRAPPER *pSplitRendWrapper; -#endif const COMBINED_ORIENTATION_HANDLE *pCombinedOrientationData; } rendering_context; @@ -116,9 +114,7 @@ typedef struct rotation_matrix rot_mat_prev; pan_vector prev_pan_gains; int8_t firstFrameRendered; -#ifdef SPLIT_REND_WITH_HEAD_ROT TDREND_WRAPPER splitTdRendWrappers[MAX_HEAD_ROT_POSES - 1]; /* Additional TD Rend instances used for split rendering */ -#endif float *bufferData; int16_t nonDiegeticPan; float nonDiegeticPanGain; @@ -149,15 +145,9 @@ typedef struct EFAP_WRAPPER efapInWrapper; TDREND_WRAPPER tdRendWrapper; CREND_WRAPPER_HANDLE crendWrapper; -#ifdef SPLIT_REND_WITH_HEAD_ROT TDREND_WRAPPER splitTdRendWrappers[MAX_HEAD_ROT_POSES - 1]; /* Additional TD Rend instances used for split rendering */ -#endif REVERB_HANDLE hReverb; -#ifdef SPLIT_REND_WITH_HEAD_ROT rotation_gains rot_gains_prev[MAX_HEAD_ROT_POSES]; -#else - rotation_gains rot_gains_prev; -#endif int16_t nonDiegeticPan; float nonDiegeticPanGain; lfe_routing lfeRouting; @@ -171,15 +161,9 @@ typedef struct { input_base base; pan_matrix hoaDecMtx; -#ifdef SPLIT_REND_WITH_HEAD_ROT CLDFB_REND_WRAPPER cldfbRendWrapper; -#endif CREND_WRAPPER_HANDLE crendWrapper; -#ifdef SPLIT_REND_WITH_HEAD_ROT rotation_gains rot_gains_prev[MAX_HEAD_ROT_POSES]; -#else - rotation_gains rot_gains_prev; -#endif float *bufferData; DIRAC_ANA_HANDLE hDirAC; } input_sba; @@ -223,15 +207,11 @@ struct IVAS_REND AUDIO_CONFIG outputConfig; EFAP_WRAPPER efapOutWrapper; IVAS_LSSETUP_CUSTOM_STRUCT customLsOut; -#ifdef SPLIT_REND_WITH_HEAD_ROT SPLIT_REND_WRAPPER splitRendWrapper; IVAS_REND_AudioBuffer splitRendEncBuffer; -#endif IVAS_REND_HeadRotData headRotData; -#ifdef SPLIT_REND_WITH_HEAD_ROT int16_t splitRendBFI; -#endif EXTERNAL_ORIENTATION_HANDLE hExternalOrientationData; COMBINED_ORIENTATION_HANDLE hCombinedOrientationData; @@ -255,7 +235,6 @@ static ivas_error initMasaExtRenderer( input_masa *inputMasa, const AUDIO_CONFIG #endif static void freeMasaExtRenderer( MASA_EXT_REND_HANDLE *hMasaExtRendOut ); -#ifdef SPLIT_REND_WITH_HEAD_ROT static ivas_error renderSbaToMultiBinauralCldfb( input_sba *sbaInput, float Cldfb_Out_Real[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], @@ -267,7 +246,6 @@ static ivas_error renderSbaToMultiBinaural( input_sba *sbaInput, const AUDIO_CONFIG outConfig, float out[][L_FRAME48k] ); -#endif /*-------------------------------------------------------------------* * Local functions @@ -340,7 +318,6 @@ static float *getSmplPtr( return buffer.data + chnlIdx * buffer.config.numSamplesPerChannel + smplIdx; } -#ifdef SPLIT_REND_WITH_HEAD_ROT static void convertBitsBufferToInternalBitsBuff( const IVAS_REND_BitstreamBuffer outBits, ISAR_SPLIT_REND_BITS_HANDLE hBits ) @@ -434,7 +411,6 @@ static void accumulateCLDFBArrayToBuffer( return; } -#endif static void copyBufferTo2dArray( const IVAS_REND_AudioBuffer buffer, @@ -444,9 +420,7 @@ static void copyBufferTo2dArray( uint32_t chnlIdx; const float *readPtr; -#ifdef SPLIT_REND_WITH_HEAD_ROT assert( ( buffer.config.is_cldfb == 0 ) && "for CLDFB input call copyBufferToCLDFBarray()" ); -#endif readPtr = buffer.data; for ( chnlIdx = 0; chnlIdx < (uint32_t) buffer.config.numChannels; ++chnlIdx ) @@ -462,10 +436,7 @@ static void copyBufferTo2dArray( static void accumulate2dArrayToBuffer( float array[][L_FRAME48k], -#ifdef SPLIT_REND_WITH_HEAD_ROT - const -#endif - IVAS_REND_AudioBuffer *buffer ) + const IVAS_REND_AudioBuffer *buffer ) { int16_t smplIdx, chnlIdx; float *writePtr; @@ -559,10 +530,8 @@ static ivas_error validateOutputAudioConfig( case IVAS_AUDIO_CONFIG_HOA2: case IVAS_AUDIO_CONFIG_HOA3: case IVAS_AUDIO_CONFIG_BINAURAL: -#ifdef SPLIT_REND_WITH_HEAD_ROT case IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED: case IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM: -#endif case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR: case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB: case IVAS_AUDIO_CONFIG_MASA1: @@ -642,14 +611,12 @@ static ivas_error validateOutputSampleRate( /* If no binaural rendering, any sampling rate is supported */ return IVAS_ERR_OK; } -#ifdef SPLIT_REND_WITH_HEAD_ROT else if ( ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || outConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) && sampleRate != 48000 ) { return IVAS_ERROR( IVAS_ERR_INVALID_SAMPLING_RATE, "Error: Only 48kHz output sampling rate is supported for split rendering." ); } else { -#endif /* Otherwise rendering to binaural, support the same set as IVAS decoder */ switch ( sampleRate ) @@ -662,9 +629,7 @@ static ivas_error validateOutputSampleRate( } return IVAS_ERR_INVALID_SAMPLING_RATE; -#ifdef SPLIT_REND_WITH_HEAD_ROT } -#endif } @@ -687,10 +652,8 @@ ivas_error getAudioConfigNumChannels( break; case IVAS_AUDIO_CONFIG_STEREO: case IVAS_AUDIO_CONFIG_BINAURAL: -#ifdef SPLIT_REND_WITH_HEAD_ROT case IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED: case IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM: -#endif case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR: case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB: case IVAS_AUDIO_CONFIG_MASA2: @@ -1144,9 +1107,7 @@ static ivas_error initHeadRotation( hIvasRend->headRotData.headPositions[i] = quaternionInit(); } -#ifdef SPLIT_REND_WITH_HEAD_ROT hIvasRend->headRotData.sr_pose_pred_axis = DEFAULT_AXIS; -#endif if ( ( hIvasRend->headRotData.hOrientationTracker = (ivas_orient_trk_state_t *) malloc( sizeof( ivas_orient_trk_state_t ) ) ) == NULL ) { @@ -1271,11 +1232,9 @@ static rendering_context getRendCtx( ctx.pCustomLsOut = &hIvasRend->customLsOut; ctx.pEfapOutWrapper = &hIvasRend->efapOutWrapper; ctx.pHeadRotData = &hIvasRend->headRotData; -#ifdef SPLIT_REND_WITH_HEAD_ROT ctx.hhRendererConfig = &hIvasRend->hRendererConfig; ctx.pSplitRendBFI = &hIvasRend->splitRendBFI; ctx.pSplitRendWrapper = &hIvasRend->splitRendWrapper; -#endif ctx.pCombinedOrientationData = &hIvasRend->hCombinedOrientationData; return ctx; @@ -1321,11 +1280,7 @@ static ivas_error initIsmMasaRendering( ivas_td_binaural_close( &inputIsm->tdRendWrapper.hBinRendererTd ); } -#ifdef SPLIT_REND_WITH_HEAD_ROT ivas_rend_closeCrend( &inputIsm->crendWrapper, inputIsm->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses ); -#else - ivas_rend_closeCrend( &inputIsm->crendWrapper ); -#endif ivas_reverb_close( &inputIsm->hReverb ); @@ -1349,9 +1304,7 @@ static ivas_error setRendInputActiveIsm( rendering_context rendCtx; AUDIO_CONFIG outConfig; input_ism *inputIsm; -#ifdef SPLIT_REND_WITH_HEAD_ROT int16_t i; -#endif inputIsm = (input_ism *) input; rendCtx = inputIsm->base.ctx; @@ -1378,34 +1331,18 @@ static ivas_error setRendInputActiveIsm( initRotMatrix( inputIsm->rot_mat_prev ); set_zero( inputIsm->prev_pan_gains, MAX_OUTPUT_CHANNELS ); -#ifdef SPLIT_REND_WITH_HEAD_ROT for ( i = 0; i < (int16_t) ( sizeof( inputIsm->splitTdRendWrappers ) / sizeof( *inputIsm->splitTdRendWrappers ) ); ++i ) { inputIsm->splitTdRendWrappers[i].hHrtfTD = &hrtfs->hHrtfTD; } -#endif inputIsm->hOMasa = NULL; error = IVAS_ERR_OK; inputIsm->tdRendWrapper.hHrtfTD = &hrtfs->hHrtfTD; -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL || outConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || outConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) -#else - if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) -#endif { -#ifndef SPLIT_REND_WITH_HEAD_ROT -#ifdef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES - if ( ( error = ivas_rend_openCrend( &inputIsm->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, hrtfs->hSetOfHRTF, hrtfs->hHrtfStatistics, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_rend_openCrend( &inputIsm->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, hrtfs->hSetOfHRTF, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) -#endif - { - return error; - } -#else if ( ( error = ivas_td_binaural_open_ext( &inputIsm->tdRendWrapper, inConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) { return error; @@ -1422,7 +1359,6 @@ static ivas_error setRendInputActiveIsm( /* Assert same delay as main TD renderer */ assert( inputIsm->splitTdRendWrappers[i].binaural_latency_ns == inputIsm->tdRendWrapper.binaural_latency_ns ); } -#endif } else if ( outConfig == IVAS_AUDIO_CONFIG_MASA1 || outConfig == IVAS_AUDIO_CONFIG_MASA2 ) { @@ -1433,24 +1369,6 @@ static ivas_error setRendInputActiveIsm( } else { -#ifndef SPLIT_REND_WITH_HEAD_ROT - if ( ( error = ivas_td_binaural_open_ext( &inputIsm->tdRendWrapper, inConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) - { - return error; - } - - if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) - { -#ifdef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES - if ( ( error = ivas_reverb_open( &( inputIsm->hReverb ), hrtfs->hHrtfStatistics, hRendCfg, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_reverb_open( &( inputIsm->hReverb ), outConfig, NULL, inputIsm->tdRendWrapper.hBinRendererTd->HrFiltSet_p->lr_energy_and_iac, hRendCfg, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) -#endif - { - return error; - } - } -#else if ( ( error = ivas_td_binaural_open_ext( &inputIsm->tdRendWrapper, inConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) { return error; @@ -1478,7 +1396,6 @@ static ivas_error setRendInputActiveIsm( return error; } } -#endif } return IVAS_ERR_OK; @@ -1489,9 +1406,7 @@ static void clearInputIsm( input_ism *inputIsm ) { rendering_context rendCtx; -#ifdef SPLIT_REND_WITH_HEAD_ROT int16_t i; -#endif rendCtx = inputIsm->base.ctx; @@ -1499,11 +1414,7 @@ static void clearInputIsm( initRendInputBase( &inputIsm->base, IVAS_AUDIO_CONFIG_INVALID, 0, rendCtx, NULL, 0 ); /* Free input's internal handles */ -#ifdef SPLIT_REND_WITH_HEAD_ROT ivas_rend_closeCrend( &inputIsm->crendWrapper, inputIsm->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses ); -#else - ivas_rend_closeCrend( &inputIsm->crendWrapper ); -#endif ivas_reverb_close( &inputIsm->hReverb ); @@ -1512,12 +1423,10 @@ static void clearInputIsm( ivas_td_binaural_close( &inputIsm->tdRendWrapper.hBinRendererTd ); } -#ifdef SPLIT_REND_WITH_HEAD_ROT for ( i = 0; i < (int16_t) ( sizeof( inputIsm->splitTdRendWrappers ) / sizeof( *inputIsm->splitTdRendWrappers ) ); ++i ) { ivas_td_binaural_close( &inputIsm->splitTdRendWrappers[i].hBinRendererTd ); } -#endif ivas_omasa_ana_close( &( inputIsm->hOMasa ) ); @@ -2111,10 +2020,8 @@ static ivas_error updateMcPanGains( switch ( outConfig ) { case IVAS_AUDIO_CONFIG_BINAURAL: -#ifdef SPLIT_REND_WITH_HEAD_ROT case IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED: case IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM: -#endif break; /* Do nothing */ case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR: case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB: @@ -2166,9 +2073,7 @@ static ivas_error initMcBinauralRendering( uint8_t reconfigureFlag ) { ivas_error error; -#ifdef SPLIT_REND_WITH_HEAD_ROT int16_t i; -#endif int32_t binauralDelayNs; int32_t outSampleRate; int8_t useTDRend; @@ -2195,7 +2100,6 @@ static ivas_error initMcBinauralRendering( ivas_td_binaural_close( &inputMc->tdRendWrapper.hBinRendererTd ); } -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( !reconfigureFlag || !useTDRend ) { for ( i = 0; i < MAX_HEAD_ROT_POSES - 1; ++i ) @@ -2206,16 +2110,11 @@ static ivas_error initMcBinauralRendering( } } } -#endif /* if we need to use TD renderer and CREND was open, close it */ if ( useTDRend ) { -#ifdef SPLIT_REND_WITH_HEAD_ROT ivas_rend_closeCrend( &inputMc->crendWrapper, inputMc->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses ); -#else - ivas_rend_closeCrend( &inputMc->crendWrapper ); -#endif } if ( !reconfigureFlag || ( !useTDRend && outConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB && inputMc->hReverb != NULL ) ) @@ -2240,7 +2139,6 @@ static ivas_error initMcBinauralRendering( return error; } -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || outConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { /* Open TD renderer wrappers */ @@ -2256,7 +2154,6 @@ static ivas_error initMcBinauralRendering( } } -#endif if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB && inputMc->hReverb == NULL ) { #ifdef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES @@ -2272,7 +2169,6 @@ static ivas_error initMcBinauralRendering( else if ( !useTDRend && inputMc->crendWrapper == NULL ) { /* open CREND */ -#ifdef SPLIT_REND_WITH_HEAD_ROT #ifdef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES if ( ( error = ivas_rend_openCrend( &inputMc->crendWrapper, ( inConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM ) ? IVAS_AUDIO_CONFIG_7_1_4 : inConfig, outConfig, hRendCfg, hMixconv, hHrtfStatistics, outSampleRate, ( ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) || ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ) ? inputMc->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses : 1 ) ) != IVAS_ERR_OK ) @@ -2280,15 +2176,6 @@ static ivas_error initMcBinauralRendering( if ( ( error = ivas_rend_openCrend( &inputMc->crendWrapper, ( inConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM ) ? IVAS_AUDIO_CONFIG_7_1_4 : inConfig, outConfig, hRendCfg, hMixconv, outSampleRate, ( ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) || ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ) ? inputMc->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses : 1 ) ) != IVAS_ERR_OK ) -#endif -#else -#ifdef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES - if ( ( error = ivas_rend_openCrend( &inputMc->crendWrapper, ( inConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM ) ? IVAS_AUDIO_CONFIG_7_1_4 : inConfig, outConfig, hRendCfg, hMixconv, hHrtfStatistics, outSampleRate ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_rend_openCrend( &inputMc->crendWrapper, ( inConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM ) ? IVAS_AUDIO_CONFIG_7_1_4 : inConfig, outConfig, hRendCfg, - hMixconv, - outSampleRate ) ) != IVAS_ERR_OK ) -#endif #endif { return error; @@ -2329,11 +2216,7 @@ static ivas_error initMcMasaRendering( ivas_td_binaural_close( &inputMc->tdRendWrapper.hBinRendererTd ); } -#ifdef SPLIT_REND_WITH_HEAD_ROT ivas_rend_closeCrend( &inputMc->crendWrapper, inputMc->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses ); -#else - ivas_rend_closeCrend( &inputMc->crendWrapper ); -#endif ivas_reverb_close( &inputMc->hReverb ); @@ -2417,16 +2300,12 @@ static ivas_error setRendInputActiveMc( RENDER_CONFIG_DATA *hRendCfg, hrtf_handles *hrtfs ) { -#ifdef SPLIT_REND_WITH_HEAD_ROT int16_t i; -#endif ivas_error error; rendering_context rendCtx; AUDIO_CONFIG outConfig; input_mc *inputMc; -#ifdef SPLIT_REND_WITH_HEAD_ROT int16_t pos_idx; -#endif inputMc = (input_mc *) input; rendCtx = inputMc->base.ctx; @@ -2459,19 +2338,14 @@ static ivas_error setRendInputActiveMc( inputMc->hReverb = NULL; inputMc->hMcMasa = NULL; -#ifdef SPLIT_REND_WITH_HEAD_ROT for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES; pos_idx++ ) { initRotGains( inputMc->rot_gains_prev[pos_idx] ); } -#else - initRotGains( inputMc->rot_gains_prev ); -#endif inputMc->lfeRouting = defaultLfeRouting( inConfig, inputMc->customLsInput, outConfig, *inputMc->base.ctx.pCustomLsOut ); set_zero( inputMc->lfeDelayBuffer, MAX_BIN_DELAY_SAMPLES ); inputMc->binauralDelaySmp = 0; -#ifdef SPLIT_REND_WITH_HEAD_ROT for ( i = 0; i < (int16_t) ( sizeof( inputMc->splitTdRendWrappers ) / sizeof( *inputMc->splitTdRendWrappers ) ); ++i ) { if ( hrtfs->hHrtfTD ) @@ -2482,9 +2356,6 @@ static ivas_error setRendInputActiveMc( } if ( getAudioConfigType( outConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL ) -#else - if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL || outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) -#endif { #ifdef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES if ( ( error = initMcBinauralRendering( inputMc, inConfig, outConfig, hRendCfg, hrtfs->hSetOfHRTF, hrtfs->hHrtfStatistics, FALSE ) ) != IVAS_ERR_OK ) @@ -2519,9 +2390,7 @@ static ivas_error setRendInputActiveMc( static void clearInputMc( input_mc *inputMc ) { -#ifdef SPLIT_REND_WITH_HEAD_ROT int16_t i; -#endif rendering_context rendCtx; rendCtx = inputMc->base.ctx; @@ -2536,11 +2405,7 @@ static void clearInputMc( efap_free_data( &inputMc->efapInWrapper.hEfap ); } -#ifdef SPLIT_REND_WITH_HEAD_ROT ivas_rend_closeCrend( &inputMc->crendWrapper, inputMc->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses ); -#else - ivas_rend_closeCrend( &inputMc->crendWrapper ); -#endif ivas_reverb_close( &inputMc->hReverb ); @@ -2549,7 +2414,6 @@ static void clearInputMc( ivas_td_binaural_close( &inputMc->tdRendWrapper.hBinRendererTd ); } -#ifdef SPLIT_REND_WITH_HEAD_ROT for ( i = 0; i < (int16_t) ( sizeof( inputMc->splitTdRendWrappers ) / sizeof( *inputMc->splitTdRendWrappers ) ); ++i ) { if ( inputMc->splitTdRendWrappers[i].hBinRendererTd != NULL ) @@ -2557,7 +2421,6 @@ static void clearInputMc( ivas_td_binaural_close( &inputMc->splitTdRendWrappers[i].hBinRendererTd ); } } -#endif ivas_mcmasa_ana_close( &( inputMc->hMcMasa ) ); @@ -2687,7 +2550,6 @@ static ivas_error updateSbaPanGains( case IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL: switch ( outConfig ) { -#ifdef SPLIT_REND_WITH_HEAD_ROT case IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED: case IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM: { @@ -2710,10 +2572,8 @@ static ivas_error updateSbaPanGains( } break; } -#endif case IVAS_AUDIO_CONFIG_BINAURAL: { -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( hRendCfg->split_rend_config.rendererSelection == ISAR_SPLIT_REND_RENDERER_SELECTION_FASTCONV ) { if ( ( error = ivas_rend_openCldfbRend( &inputSba->cldfbRendWrapper, inConfig, outConfig, &rendCtx.pSplitRendWrapper->multiBinPoseData, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) @@ -2722,20 +2582,11 @@ static ivas_error updateSbaPanGains( } } else -#endif { -#ifdef SPLIT_REND_WITH_HEAD_ROT #ifdef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES if ( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, inConfig, outConfig, hRendCfg, hMixconv, hHrtfStatistics, *rendCtx.pOutSampleRate, rendCtx.pSplitRendWrapper->multiBinPoseData.num_poses ) ) != IVAS_ERR_OK ) #else if ( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, inConfig, outConfig, hRendCfg, hMixconv, *rendCtx.pOutSampleRate, rendCtx.pSplitRendWrapper->multiBinPoseData.num_poses ) ) != IVAS_ERR_OK ) -#endif -#else -#ifdef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES - if ( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, inConfig, outConfig, hRendCfg, hMixconv, hHrtfStatistics, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, inConfig, outConfig, hRendCfg, hMixconv, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) -#endif #endif { return error; @@ -2749,18 +2600,10 @@ static ivas_error updateSbaPanGains( { return error; } -#ifdef SPLIT_REND_WITH_HEAD_ROT #ifdef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES if ( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, hMixconv, hHrtfStatistics, *rendCtx.pOutSampleRate, rendCtx.pSplitRendWrapper->multiBinPoseData.num_poses ) ) != IVAS_ERR_OK ) #else if ( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, hMixconv, *rendCtx.pOutSampleRate, rendCtx.pSplitRendWrapper->multiBinPoseData.num_poses ) ) != IVAS_ERR_OK ) -#endif -#else -#ifdef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES - if ( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, hMixconv, hHrtfStatistics, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, hMixconv, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) -#endif #endif { return error; @@ -2793,11 +2636,7 @@ static ivas_error initSbaMasaRendering( { ivas_error error; -#ifdef SPLIT_REND_WITH_HEAD_ROT ivas_rend_closeCrend( &inputSba->crendWrapper, inputSba->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses ); -#else - ivas_rend_closeCrend( &inputSba->crendWrapper ); -#endif if ( ( error = ivas_dirac_ana_open( &inputSba->hDirAC, inSampleRate ) ) != IVAS_ERR_OK ) { @@ -2821,9 +2660,7 @@ static ivas_error setRendInputActiveSba( rendering_context rendCtx; AUDIO_CONFIG outConfig; input_sba *inputSba; -#ifdef SPLIT_REND_WITH_HEAD_ROT int16_t pos_idx; -#endif inputSba = (input_sba *) input; rendCtx = inputSba->base.ctx; @@ -2834,35 +2671,21 @@ static ivas_error setRendInputActiveSba( return IVAS_ERR_IO_CONFIG_PAIR_NOT_SUPPORTED; } -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = allocateInputBaseBufferData( &inputSba->bufferData, MAX_CLDFB_BUFFER_LENGTH ) ) != IVAS_ERR_OK ) -#else - if ( ( error = allocateInputBaseBufferData( &inputSba->bufferData, MAX_BUFFER_LENGTH ) ) != IVAS_ERR_OK ) -#endif { return error; } -#ifdef SPLIT_REND_WITH_HEAD_ROT initRendInputBase( &inputSba->base, inConfig, id, rendCtx, inputSba->bufferData, MAX_CLDFB_BUFFER_LENGTH ); -#else - initRendInputBase( &inputSba->base, inConfig, id, rendCtx, inputSba->bufferData, MAX_BUFFER_LENGTH ); -#endif setZeroPanMatrix( inputSba->hoaDecMtx ); -#ifdef SPLIT_REND_WITH_HEAD_ROT inputSba->crendWrapper = NULL; for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES; pos_idx++ ) { initRotGains( inputSba->rot_gains_prev[pos_idx] ); } inputSba->cldfbRendWrapper.hHrtfFastConv = hrtfs->hHrtfFastConv; -#else - inputSba->crendWrapper = NULL; - inputSba->hDirAC = NULL; - initRotGains( inputSba->rot_gains_prev ); -#endif if ( outConfig == IVAS_AUDIO_CONFIG_MASA1 || outConfig == IVAS_AUDIO_CONFIG_MASA2 ) { @@ -2897,16 +2720,12 @@ static void clearInputSba( initRendInputBase( &inputSba->base, IVAS_AUDIO_CONFIG_INVALID, 0, rendCtx, NULL, 0 ); /* Free input's internal handles */ -#ifdef SPLIT_REND_WITH_HEAD_ROT ivas_rend_closeCrend( &inputSba->crendWrapper, rendCtx.pSplitRendWrapper->multiBinPoseData.num_poses ); if ( inputSba->cldfbRendWrapper.hCldfbRend != NULL ) { ivas_rend_closeCldfbRend( &inputSba->cldfbRendWrapper ); } -#else - ivas_rend_closeCrend( &inputSba->crendWrapper ); -#endif ivas_dirac_ana_close( &( inputSba->hDirAC ) ); @@ -3015,9 +2834,7 @@ ivas_error IVAS_REND_Open( const int16_t num_subframes ) { int16_t i; -#ifdef SPLIT_REND_WITH_HEAD_ROT int16_t j; -#endif IVAS_REND_HANDLE hIvasRend; ivas_error error; int16_t numOutChannels; @@ -3092,10 +2909,8 @@ ivas_error IVAS_REND_Open( } /* Initialize inputs */ -#ifdef SPLIT_REND_WITH_HEAD_ROT isar_init_split_rend_handles( &hIvasRend->splitRendWrapper ); hIvasRend->splitRendEncBuffer.data = NULL; -#endif for ( i = 0; i < RENDERER_MAX_ISM_INPUTS; ++i ) { @@ -3104,13 +2919,11 @@ ivas_error IVAS_REND_Open( hIvasRend->inputsIsm[i].crendWrapper = NULL; hIvasRend->inputsIsm[i].hReverb = NULL; hIvasRend->inputsIsm[i].tdRendWrapper.hBinRendererTd = NULL; -#ifdef SPLIT_REND_WITH_HEAD_ROT for ( j = 0; j < (int16_t) ( sizeof( hIvasRend->inputsIsm[i].splitTdRendWrappers ) / sizeof( *hIvasRend->inputsIsm[i].splitTdRendWrappers ) ); ++j ) { hIvasRend->inputsIsm[i].splitTdRendWrappers[j].hBinRendererTd = NULL; hIvasRend->inputsIsm[i].splitTdRendWrappers[j].hHrtfTD = NULL; } -#endif hIvasRend->inputsIsm[i].bufferData = NULL; hIvasRend->inputsIsm[i].nonDiegeticPan = nonDiegeticPan; hIvasRend->inputsIsm[i].nonDiegeticPanGain = nonDiegeticPanGain; @@ -3130,13 +2943,11 @@ ivas_error IVAS_REND_Open( hIvasRend->inputsMc[i].nonDiegeticPan = nonDiegeticPan; hIvasRend->inputsMc[i].nonDiegeticPanGain = nonDiegeticPanGain; hIvasRend->inputsMc[i].hMcMasa = NULL; -#ifdef SPLIT_REND_WITH_HEAD_ROT for ( j = 0; j < (int16_t) ( sizeof( hIvasRend->inputsMc[i].splitTdRendWrappers ) / sizeof( *hIvasRend->inputsMc[i].splitTdRendWrappers ) ); ++j ) { hIvasRend->inputsMc[i].splitTdRendWrappers[j].hBinRendererTd = NULL; hIvasRend->inputsMc[i].splitTdRendWrappers[j].hHrtfTD = NULL; } -#endif } for ( i = 0; i < RENDERER_MAX_SBA_INPUTS; ++i ) @@ -3144,10 +2955,8 @@ ivas_error IVAS_REND_Open( initRendInputBase( &hIvasRend->inputsSba[i].base, IVAS_AUDIO_CONFIG_INVALID, 0, getRendCtx( hIvasRend ), NULL, 0 ); hIvasRend->inputsSba[i].crendWrapper = NULL; -#ifdef SPLIT_REND_WITH_HEAD_ROT hIvasRend->inputsSba[i].cldfbRendWrapper.hCldfbRend = NULL; hIvasRend->inputsSba[i].cldfbRendWrapper.hHrtfFastConv = NULL; -#endif hIvasRend->inputsSba[i].bufferData = NULL; hIvasRend->inputsSba[i].hDirAC = NULL; } @@ -3578,7 +3387,6 @@ static ivas_error findFreeInputSlot( } -#ifdef SPLIT_REND_WITH_HEAD_ROT static int16_t getCldfbRendFlag( IVAS_REND_HANDLE hIvasRend, /* i : Renderer handle */ const IVAS_REND_AudioConfigType new_configType ) @@ -3680,8 +3488,6 @@ static ivas_error ivas_pre_rend_init( return IVAS_ERR_OK; } -#endif - /*-------------------------------------------------------------------* * IVAS_REND_AddInput() @@ -3708,7 +3514,6 @@ ivas_error IVAS_REND_AddInput( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) && hIvasRend->splitRendEncBuffer.data == NULL && hIvasRend->hRendererConfig != NULL ) { int16_t cldfb_in_flag; @@ -3719,7 +3524,6 @@ ivas_error IVAS_REND_AddInput( return error; } } -#endif switch ( getAudioConfigType( inConfig ) ) { @@ -3817,11 +3621,7 @@ ivas_error IVAS_REND_ConfigureCustomInputLoudspeakerLayout( return error; } -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( getAudioConfigType( hIvasRend->outputConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL ) -#else - if ( hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL || hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) -#endif { if ( ( error = initMcBinauralRendering( inputMc, inputMc->base.inConfig, @@ -4140,7 +3940,6 @@ ivas_error IVAS_REND_GetDelay( { if ( hIvasRend->inputsSba[i].base.inConfig != IVAS_AUDIO_CONFIG_INVALID ) { -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( hIvasRend->splitRendWrapper.hBinHrSplitPreRend != NULL ) { if ( hIvasRend->hRendererConfig->split_rend_config.rendererSelection == ISAR_SPLIT_REND_RENDERER_SELECTION_FASTCONV ) @@ -4160,7 +3959,6 @@ ivas_error IVAS_REND_GetDelay( max_latency_ns = max( max_latency_ns, latency_ns ); } else -#endif { latency_ns = ( hIvasRend->inputsSba[i].crendWrapper != NULL ) ? hIvasRend->inputsSba[i].crendWrapper->binaural_latency_ns : 0; max_latency_ns = max( max_latency_ns, latency_ns ); @@ -4198,9 +3996,7 @@ ivas_error IVAS_REND_FeedInputAudio( ivas_error error; input_base *inputBase; int16_t numInputChannels; -#ifdef SPLIT_REND_WITH_HEAD_ROT int16_t cldfb2tdSampleFact; -#endif /* Validate function arguments */ if ( hIvasRend == NULL || inputAudio.data == NULL ) @@ -4208,14 +4004,10 @@ ivas_error IVAS_REND_FeedInputAudio( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } -#ifdef SPLIT_REND_WITH_HEAD_ROT cldfb2tdSampleFact = ( inputAudio.config.is_cldfb ) ? 2 : 1; if ( inputAudio.config.numSamplesPerChannel <= 0 || ( MAX_BUFFER_LENGTH_PER_CHANNEL < inputAudio.config.numSamplesPerChannel && inputAudio.config.is_cldfb == 0 ) || ( ( MAX_BUFFER_LENGTH_PER_CHANNEL * cldfb2tdSampleFact ) < inputAudio.config.numSamplesPerChannel && inputAudio.config.is_cldfb == 1 ) ) -#else - if ( inputAudio.config.numSamplesPerChannel <= 0 || MAX_BUFFER_LENGTH_PER_CHANNEL < inputAudio.config.numSamplesPerChannel ) -#endif { return IVAS_ERROR( IVAS_ERR_INVALID_BUFFER_SIZE, "Buffer size outside of supported range" ); } @@ -4225,15 +4017,10 @@ ivas_error IVAS_REND_FeedInputAudio( return IVAS_ERR_WRONG_NUM_CHANNELS; } -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( getAudioConfigType( hIvasRend->outputConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL && hIvasRend->outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED && hIvasRend->outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM && ( inputAudio.config.numSamplesPerChannel * 1000 / cldfb2tdSampleFact ) != ( BINAURAL_RENDERING_FRAME_SIZE_MS * hIvasRend->num_subframes ) * hIvasRend->sampleRateOut ) -#else - if ( getAudioConfigType( hIvasRend->outputConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL && - inputAudio.config.numSamplesPerChannel * 1000 != ( BINAURAL_RENDERING_FRAME_SIZE_MS * hIvasRend->num_subframes ) * hIvasRend->sampleRateOut ) -#endif { return IVAS_ERROR( IVAS_ERR_INVALID_BUFFER_SIZE, "Binaural rendering requires specific frame size" ); } @@ -4262,11 +4049,7 @@ ivas_error IVAS_REND_FeedInputAudio( mvr2r( inputAudio.data, inputBase->inputBuffer.data, inputAudio.config.numSamplesPerChannel * inputAudio.config.numChannels ); -#ifdef SPLIT_REND_WITH_HEAD_ROT inputBase->numNewSamplesPerChannel = inputAudio.config.numSamplesPerChannel / cldfb2tdSampleFact; -#else - inputBase->numNewSamplesPerChannel = inputAudio.config.numSamplesPerChannel; -#endif return IVAS_ERR_OK; } @@ -4468,22 +4251,16 @@ int16_t IVAS_REND_GetRenderConfig( mvr2r( hRCin->roomAcoustics.pAcoustic_rt60, hRCout->roomAcoustics.pAcoustic_rt60, CLDFB_NO_CHANNELS_MAX ); mvr2r( hRCin->roomAcoustics.pAcoustic_dsr, hRCout->roomAcoustics.pAcoustic_dsr, CLDFB_NO_CHANNELS_MAX ); -#ifdef SPLIT_REND_WITH_HEAD_ROT hRCout->split_rend_config.splitRendBitRate = SPLIT_REND_768k; hRCout->split_rend_config.dof = 3; hRCout->split_rend_config.hq_mode = 0; hRCout->split_rend_config.codec_delay_ms = 0; -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS hRCout->split_rend_config.isar_frame_size_ms = 20; -#endif hRCout->split_rend_config.codec_frame_size_ms = 0; /* 0 means "use default for selected codec" */ hRCout->split_rend_config.codec = ISAR_SPLIT_REND_CODEC_DEFAULT; hRCout->split_rend_config.poseCorrectionMode = ISAR_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB; hRCout->split_rend_config.rendererSelection = hRCin->split_rend_config.rendererSelection; -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS hRCout->split_rend_config.lc3plus_highres = 0; -#endif -#endif hRCout->roomAcoustics.use_er = hRCin->roomAcoustics.use_er; hRCout->roomAcoustics.lowComplexity = hRCin->roomAcoustics.lowComplexity; @@ -4504,9 +4281,7 @@ int16_t IVAS_REND_FeedRenderConfig( ) { RENDER_CONFIG_HANDLE hRenderConfig; -#ifdef SPLIT_REND_WITH_HEAD_ROT ivas_error error; -#endif if ( hIvasRend == NULL || hIvasRend->hRendererConfig == NULL ) { @@ -4537,7 +4312,6 @@ int16_t IVAS_REND_FeedRenderConfig( mvr2r( renderConfig.roomAcoustics.AbsCoeff, hRenderConfig->roomAcoustics.AbsCoeff, IVAS_ROOM_ABS_COEFF ); } -#ifdef SPLIT_REND_WITH_HEAD_ROT hRenderConfig->split_rend_config = renderConfig.split_rend_config; /* Overwrite any pose correction settings if 0 DOF (no pose correction) was selected */ if ( hRenderConfig->split_rend_config.dof == 0 ) @@ -4565,7 +4339,6 @@ int16_t IVAS_REND_FeedRenderConfig( return error; } } -#endif return IVAS_ERR_OK; } @@ -4578,13 +4351,11 @@ int16_t IVAS_REND_FeedRenderConfig( *-------------------------------------------------------------------*/ ivas_error IVAS_REND_SetHeadRotation( - IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ - const IVAS_QUATERNION headRot, /* i : head orientations for next rendering call */ - const IVAS_VECTOR3 Pos, /* i : listener positions for next rendering call */ -#ifdef SPLIT_REND_WITH_HEAD_ROT + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + const IVAS_QUATERNION headRot, /* i : head orientations for next rendering call */ + const IVAS_VECTOR3 Pos, /* i : listener positions for next rendering call */ const ISAR_SPLIT_REND_ROT_AXIS rot_axis, /* i : external control for rotation axis for split rendering */ -#endif - const int16_t sf_idx /* i : subframe index */ + const int16_t sf_idx /* i : subframe index */ ) { int16_t i; @@ -4642,9 +4413,7 @@ ivas_error IVAS_REND_SetHeadRotation( hIvasRend->headRotData.Pos[sf_idx] = Pos; -#ifdef SPLIT_REND_WITH_HEAD_ROT hIvasRend->headRotData.sr_pose_pred_axis = rot_axis; -#endif return IVAS_ERR_OK; } @@ -4700,7 +4469,6 @@ ivas_error IVAS_REND_DisableHeadRotation( } -#ifdef SPLIT_REND_WITH_HEAD_ROT /*-------------------------------------------------------------------* * IVAS_REND_SetSplitRendBFI() * @@ -4715,7 +4483,6 @@ ivas_error IVAS_REND_SetSplitRendBFI( return IVAS_ERR_OK; } -#endif /*-------------------------------------------------------------------* @@ -5312,7 +5079,6 @@ static ivas_error renderIsmToBinaural( return IVAS_ERR_OK; } -#ifdef SPLIT_REND_WITH_HEAD_ROT static int16_t getNumSubframesInBuffer( const IVAS_REND_AudioBuffer *buffer, const int32_t sampleRate ) @@ -5327,7 +5093,6 @@ static int16_t getNumSubframesInBuffer( return (int16_t) ( buffer->config.numSamplesPerChannel / ( sampleRate / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES * cldfb2tdSampleFact ) ); } -#endif static ivas_error renderIsmToBinauralRoom( input_ism *ismInput, @@ -5475,14 +5240,8 @@ static ivas_error renderIsmToBinauralRoom( /* render 7_1_4 with BRIRs */ -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = ivas_rend_crendProcessSubframe( ismInput->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR, NULL, NULL, NULL, NULL, NULL, p_tmpRendBuffer, p_tmpRendBuffer, ismInput->base.inputBuffer.config.numSamplesPerChannel, *ismInput->base.ctx.pOutSampleRate, 0 ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_rend_crendProcessSubframe( ismInput->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR, NULL, NULL, - NULL, NULL, NULL, p_tmpRendBuffer, p_tmpRendBuffer, ismInput->base.inputBuffer.config.numSamplesPerChannel, *ismInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) - -#endif { return error; } @@ -5663,7 +5422,6 @@ static ivas_error renderIsmToSba( } -#ifdef SPLIT_REND_WITH_HEAD_ROT static ivas_error renderIsmToSplitBinaural( input_ism *ismInput, const IVAS_REND_AudioBuffer outAudio ) @@ -5763,7 +5521,6 @@ static ivas_error renderIsmToSplitBinaural( /* Encoding to split rendering bitstream done at a higher level */ return IVAS_ERR_OK; } -#endif static void renderIsmToMasa( @@ -5826,12 +5583,10 @@ static ivas_error renderInputIsm( case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR: error = renderIsmToBinauralRoom( ismInput, outAudio ); break; -#ifdef SPLIT_REND_WITH_HEAD_ROT case IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED: case IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM: error = renderIsmToSplitBinaural( ismInput, outAudio ); break; -#endif case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB: error = renderIsmToBinauralReverb( ismInput, outAudio ); break; @@ -5886,15 +5641,11 @@ static ivas_error renderActiveInputsIsm( static ivas_error renderLfeToBinaural( const input_mc *mcInput, -#ifdef SPLIT_REND_WITH_HEAD_ROT const AUDIO_CONFIG outConfig, -#endif IVAS_REND_AudioBuffer outAudio ) { int16_t lfe_idx; -#ifdef SPLIT_REND_WITH_HEAD_ROT int16_t pose_idx, num_poses; -#endif float gain; int16_t ear_idx; float tmpLfeBuffer[MAX_BUFFER_LENGTH_PER_CHANNEL]; @@ -5902,11 +5653,7 @@ static ivas_error renderLfeToBinaural( const float *lfeInput; float *writePtr; -#ifdef SPLIT_REND_WITH_HEAD_ROT assert( ( getAudioConfigType( outConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL ) && "Must be binaural output" ); -#else - assert( ( outAudio.config.numChannels == 2 ) && "Must be binaural output" ); -#endif push_wmops( "renderLfeToBinaural" ); @@ -5944,7 +5691,6 @@ static ivas_error renderLfeToBinaural( /* Save remaining LFE samples of current frame for next frame */ mvr2r( lfeInput + num_cpy_smpl_cur_frame, mcInput->lfeDelayBuffer, num_cpy_smpl_prev_frame ); -#ifdef SPLIT_REND_WITH_HEAD_ROT /* Copy LFE to left and right binaural channels for all poses */ if ( mcInput->base.ctx.pSplitRendWrapper != NULL ) { @@ -5963,14 +5709,6 @@ static ivas_error renderLfeToBinaural( v_add( writePtr, tmpLfeBuffer, writePtr, frame_size ); } } -#else /* SPLIT_REND_WITH_HEAD_ROT */ - /* Copy LFE to left and right ears */ - for ( ear_idx = 0; ear_idx < BINAURAL_CHANNELS; ++ear_idx ) - { - writePtr = getSmplPtr( outAudio, ear_idx, 0 ); - v_add( writePtr, tmpLfeBuffer, writePtr, frame_size ); - } -#endif /* SPLIT_REND_WITH_HEAD_ROT */ pop_wmops(); @@ -6034,11 +5772,7 @@ static ivas_error renderMcToBinaural( tmpRotBuffer.data = malloc( tmpRotBuffer.config.numSamplesPerChannel * tmpRotBuffer.config.numChannels * sizeof( float ) ); set_zero( tmpRotBuffer.data, tmpRotBuffer.config.numSamplesPerChannel * tmpRotBuffer.config.numChannels ); -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = rotateFrameMc( mcInput->base.inputBuffer, mcInput->base.inConfig, &mcInput->customLsInput, mcInput->base.ctx.pHeadRotData, mcInput->base.ctx.pCombinedOrientationData, mcInput->rot_gains_prev[0], mcInput->efapInWrapper.hEfap, tmpRotBuffer ) ) != IVAS_ERR_OK ) -#else - if ( ( error = rotateFrameMc( mcInput->base.inputBuffer, mcInput->base.inConfig, &mcInput->customLsInput, mcInput->base.ctx.pHeadRotData, mcInput->base.ctx.pCombinedOrientationData, mcInput->rot_gains_prev, mcInput->efapInWrapper.hEfap, tmpRotBuffer ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -6052,13 +5786,8 @@ static ivas_error renderMcToBinaural( } /* call CREND */ -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = ivas_rend_crendProcessSubframe( mcInput->crendWrapper, mcInput->base.inConfig, outConfig, NULL, NULL, NULL, NULL, NULL, p_tmpRendBuffer, p_tmpRendBuffer, mcInput->base.inputBuffer.config.numSamplesPerChannel, *mcInput->base.ctx.pOutSampleRate, 0 ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_rend_crendProcessSubframe( mcInput->crendWrapper, mcInput->base.inConfig, outConfig, NULL, NULL, - NULL, NULL, NULL, p_tmpRendBuffer, p_tmpRendBuffer, mcInput->base.inputBuffer.config.numSamplesPerChannel, *mcInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -6066,11 +5795,7 @@ static ivas_error renderMcToBinaural( accumulate2dArrayToBuffer( tmpRendBuffer, &outAudio ); -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = renderLfeToBinaural( mcInput, outConfig, outAudio ) ) != IVAS_ERR_OK ) -#else - if ( ( error = renderLfeToBinaural( mcInput, outAudio ) ) != IVAS_ERR_OK ) -#endif { return error; @@ -6138,11 +5863,7 @@ static ivas_error renderMcToBinauralRoom( set_zero( tmpRotBuffer.data, tmpRotBuffer.config.numSamplesPerChannel * tmpRotBuffer.config.numChannels ); if ( ( error = rotateFrameMc( mcInput->base.inputBuffer, mcInput->base.inConfig, &mcInput->customLsInput, mcInput->base.ctx.pHeadRotData, mcInput->base.ctx.pCombinedOrientationData, -#ifdef SPLIT_REND_WITH_HEAD_ROT mcInput->rot_gains_prev[0], -#else - mcInput->rot_gains_prev, -#endif mcInput->efapInWrapper.hEfap, tmpRotBuffer ) ) != IVAS_ERR_OK ) { return error; @@ -6157,13 +5878,8 @@ static ivas_error renderMcToBinauralRoom( } /* call CREND */ -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = ivas_rend_crendProcessSubframe( mcInput->crendWrapper, mcInput->base.inConfig, outConfig, NULL, NULL, NULL, NULL, NULL, p_tmpRendBuffer, p_tmpRendBuffer, mcInput->base.inputBuffer.config.numSamplesPerChannel, *mcInput->base.ctx.pOutSampleRate, 0 ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_rend_crendProcessSubframe( mcInput->crendWrapper, mcInput->base.inConfig, outConfig, NULL, NULL, - NULL, NULL, NULL, p_tmpRendBuffer, p_tmpRendBuffer, mcInput->base.inputBuffer.config.numSamplesPerChannel, *mcInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -6171,11 +5887,7 @@ static ivas_error renderMcToBinauralRoom( accumulate2dArrayToBuffer( tmpRendBuffer, &outAudio ); -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = renderLfeToBinaural( mcInput, outConfig, outAudio ) ) != IVAS_ERR_OK ) -#else - if ( ( error = renderLfeToBinaural( mcInput, outAudio ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -6232,11 +5944,7 @@ static ivas_error renderMcCustomLsToBinauralRoom( set_zero( tmpRotBuffer.data, tmpRotBuffer.config.numSamplesPerChannel * tmpRotBuffer.config.numChannels ); if ( ( error = rotateFrameMc( mcInput->base.inputBuffer, mcInput->base.inConfig, &mcInput->customLsInput, mcInput->base.ctx.pHeadRotData, mcInput->base.ctx.pCombinedOrientationData, -#ifdef SPLIT_REND_WITH_HEAD_ROT mcInput->rot_gains_prev[0], -#else - mcInput->rot_gains_prev, -#endif mcInput->efapInWrapper.hEfap, tmpRotBuffer ) ) != IVAS_ERR_OK ) { return error; @@ -6263,24 +5971,15 @@ static ivas_error renderMcCustomLsToBinauralRoom( copyBufferTo2dArray( tmpMcBuffer, tmpCrendBuffer ); /* call CREND */ -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = ivas_rend_crendProcessSubframe( mcInput->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, NULL, NULL, NULL, NULL, NULL, p_tmpCrendBuffer, p_tmpCrendBuffer, mcInput->base.inputBuffer.config.numSamplesPerChannel, *mcInput->base.ctx.pOutSampleRate, 0 ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_rend_crendProcessSubframe( mcInput->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, NULL, NULL, - NULL, NULL, NULL, p_tmpCrendBuffer, p_tmpCrendBuffer, mcInput->base.inputBuffer.config.numSamplesPerChannel, *mcInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) -#endif { return error; } accumulate2dArrayToBuffer( tmpCrendBuffer, &outAudio ); -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = renderLfeToBinaural( mcInput, outConfig, outAudio ) ) != IVAS_ERR_OK ) -#else - if ( ( error = renderLfeToBinaural( mcInput, outAudio ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -6354,7 +6053,6 @@ static void renderMcToMasa( } -#ifdef SPLIT_REND_WITH_HEAD_ROT static ivas_error renderMcToSplitBinaural( input_mc *mcInput, const AUDIO_CONFIG outConfig, @@ -6512,7 +6210,6 @@ static ivas_error renderMcToSplitBinaural( pop_wmops(); return IVAS_ERR_OK; } -#endif static ivas_error renderInputMc( @@ -6564,12 +6261,10 @@ static ivas_error renderInputMc( error = renderMcToBinauralRoom( mcInput, outConfig, outAudio ); } break; -#ifdef SPLIT_REND_WITH_HEAD_ROT case IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED: case IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM: error = renderMcToSplitBinaural( mcInput, outConfig, outAudio ); break; -#endif default: return IVAS_ERR_INVALID_OUTPUT_FORMAT; } @@ -6650,7 +6345,6 @@ static void renderSbaToSba( return; } -#ifdef SPLIT_REND_WITH_HEAD_ROT static ivas_error renderSbaToMultiBinaural( input_sba *sbaInput, const AUDIO_CONFIG outConfig, @@ -6809,7 +6503,6 @@ static ivas_error renderSbaToSplitBinaural( pop_wmops(); return error; } -#endif static ivas_error renderSbaToBinaural( input_sba *sbaInput, @@ -6826,7 +6519,6 @@ static ivas_error renderSbaToBinaural( int16_t subframe_idx; push_wmops( "renderSbaToBinaural" ); -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( sbaInput->base.ctx.hhRendererConfig[0]->split_rend_config.rendererSelection == ISAR_SPLIT_REND_RENDERER_SELECTION_FASTCONV ) { float Cldfb_RealBuffer_Binaural[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; @@ -6841,7 +6533,6 @@ static ivas_error renderSbaToBinaural( accumulateCLDFBArrayToBuffer( Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, &outAudio ); } else -#endif { for ( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) { @@ -6871,13 +6562,8 @@ static ivas_error renderSbaToBinaural( /* copy input for in-place rotation */ mvr2r( sbaInput->base.inputBuffer.data, tmpRotBuffer.data, tmpRotBuffer.config.numChannels * tmpRotBuffer.config.numSamplesPerChannel ); -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = rotateFrameSba( sbaInput->base.inputBuffer, sbaInput->base.inConfig, sbaInput->base.ctx.pHeadRotData, sbaInput->base.ctx.pCombinedOrientationData, sbaInput->rot_gains_prev[0], tmpRotBuffer ) ) != IVAS_ERR_OK ) -#else - if ( ( error = rotateFrameSba( sbaInput->base.inputBuffer, sbaInput->base.inConfig, sbaInput->base.ctx.pHeadRotData, - sbaInput->base.ctx.pCombinedOrientationData, sbaInput->rot_gains_prev, tmpRotBuffer ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -6891,13 +6577,8 @@ static ivas_error renderSbaToBinaural( } /* call CREND */ -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = ivas_rend_crendProcessSubframe( sbaInput->crendWrapper, sbaInput->base.inConfig, outConfig, NULL, NULL, NULL, NULL, NULL, p_tmpCrendBuffer, p_tmpCrendBuffer, sbaInput->base.inputBuffer.config.numSamplesPerChannel, *sbaInput->base.ctx.pOutSampleRate, 0 ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_rend_crendProcessSubframe( sbaInput->crendWrapper, sbaInput->base.inConfig, outConfig, NULL, NULL, - NULL, NULL, NULL, p_tmpCrendBuffer, p_tmpCrendBuffer, sbaInput->base.inputBuffer.config.numSamplesPerChannel, *sbaInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -6960,11 +6641,7 @@ static ivas_error renderSbaToBinauralRoom( if ( ( error = rotateFrameSba( sbaInput->base.inputBuffer, sbaInput->base.inConfig, sbaInput->base.ctx.pHeadRotData, sbaInput->base.ctx.pCombinedOrientationData, -#ifdef SPLIT_REND_WITH_HEAD_ROT sbaInput->rot_gains_prev[0], -#else - sbaInput->rot_gains_prev, -#endif tmpRotBuffer ) ) != IVAS_ERR_OK ) { return error; @@ -6992,13 +6669,8 @@ static ivas_error renderSbaToBinauralRoom( copyBufferTo2dArray( tmpMcBuffer, tmpCrendBuffer ); /* call CREND */ -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = ivas_rend_crendProcessSubframe( sbaInput->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, NULL, NULL, NULL, NULL, NULL, p_tmpCrendBuffer, p_tmpCrendBuffer, sbaInput->base.inputBuffer.config.numSamplesPerChannel, *sbaInput->base.ctx.pOutSampleRate, 0 ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_rend_crendProcessSubframe( sbaInput->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, NULL, NULL, - NULL, NULL, NULL, p_tmpCrendBuffer, p_tmpCrendBuffer, sbaInput->base.inputBuffer.config.numSamplesPerChannel, *sbaInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -7039,20 +6711,14 @@ static ivas_error renderInputSba( { ivas_error error; IVAS_REND_AudioBuffer inAudio; -#ifdef SPLIT_REND_WITH_HEAD_ROT int16_t cldfb2tdSampleFact; -#endif error = IVAS_ERR_OK; inAudio = sbaInput->base.inputBuffer; -#ifdef SPLIT_REND_WITH_HEAD_ROT cldfb2tdSampleFact = outAudio.config.is_cldfb ? 2 : 1; if ( ( sbaInput->base.numNewSamplesPerChannel * cldfb2tdSampleFact != outAudio.config.numSamplesPerChannel ) && ( outConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) && ( outConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) -#else - if ( sbaInput->base.numNewSamplesPerChannel != outAudio.config.numSamplesPerChannel ) -#endif { return IVAS_ERROR( IVAS_ERR_INVALID_BUFFER_SIZE, "Mismatch between the number of input samples vs number of requested output samples - currently not allowed" ); } @@ -7075,12 +6741,10 @@ static ivas_error renderInputSba( case IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL: switch ( outConfig ) { -#ifdef SPLIT_REND_WITH_HEAD_ROT case IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED: case IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM: error = renderSbaToSplitBinaural( sbaInput, outConfig, outAudio ); break; -#endif case IVAS_AUDIO_CONFIG_BINAURAL: error = renderSbaToBinaural( sbaInput, outConfig, outAudio ); break; @@ -7310,11 +6974,9 @@ static ivas_error renderInputMasa( int16_t maxBin; float *tmpBuffer[MAX_OUTPUT_CHANNELS]; float tmpBuffer_buff[MAX_OUTPUT_CHANNELS][L_FRAME48k]; -#ifdef SPLIT_REND_WITH_HEAD_ROT int16_t cldfb2tdSampleFact; float Cldfb_RealBuffer_Binaural[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; float Cldfb_ImagBuffer_Binaural[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; -#endif if ( !masaInput->metadataHasBeenFed ) { @@ -7322,13 +6984,9 @@ static ivas_error renderInputMasa( } inAudio = masaInput->base.inputBuffer; -#ifdef SPLIT_REND_WITH_HEAD_ROT cldfb2tdSampleFact = outAudio.config.is_cldfb ? 2 : 1; if ( ( masaInput->base.numNewSamplesPerChannel * cldfb2tdSampleFact != outAudio.config.numSamplesPerChannel ) && ( outConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) && ( outConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) -#else - if ( masaInput->base.numNewSamplesPerChannel != outAudio.config.numSamplesPerChannel ) -#endif { return IVAS_ERROR( IVAS_ERR_INVALID_BUFFER_SIZE, "Mismatch between the number of input samples vs number of requested output samples - currently not allowed" ); } @@ -7360,7 +7018,6 @@ static ivas_error renderInputMasa( num_subframes = (int16_t) ( masaInput->base.inputBuffer.config.numSamplesPerChannel / ( *masaInput->base.ctx.pOutSampleRate / ( IVAS_NUM_FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES ) ) ); -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM || outConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) { /* split rendering. use the combined of the first subframe in all subframes */ @@ -7388,7 +7045,6 @@ static ivas_error renderInputMasa( else { /* non-split path */ -#endif switch ( masaInput->hMasaExtRend->renderer_type ) { case RENDERER_DIRAC: @@ -7399,11 +7055,7 @@ static ivas_error renderInputMasa( case RENDERER_BINAURAL_PARAMETRIC: case RENDERER_BINAURAL_PARAMETRIC_ROOM: copyMasaMetadataToDiracRenderer( &masaInput->masaMetadata, masaInput->hMasaExtRend->hSpatParamRendCom, maxBin ); -#ifdef SPLIT_REND_WITH_HEAD_ROT ivas_masa_ext_rend_parambin_render( masaInput->hMasaExtRend, *masaInput->base.ctx.pCombinedOrientationData, tmpBuffer, num_subframes, NULL, NULL, NULL ); -#else - ivas_masa_ext_rend_parambin_render( masaInput->hMasaExtRend, *masaInput->base.ctx.pCombinedOrientationData, tmpBuffer, num_subframes ); -#endif break; case RENDERER_DISABLE: break; /* This happens for 1TC MASA to MONO where we just copy input transport to output */ @@ -7412,9 +7064,7 @@ static ivas_error renderInputMasa( } accumulate2dArrayToBuffer( tmpBuffer_buff, &outAudio ); -#ifdef SPLIT_REND_WITH_HEAD_ROT } -#endif } return IVAS_ERR_OK; @@ -7625,20 +7275,14 @@ ivas_error IVAS_REND_SetIsmMetadataDelay( static ivas_error getSamplesInternal( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ -#ifdef SPLIT_REND_WITH_HEAD_ROT IVAS_REND_AudioBuffer outAudio /* i/o: buffer for output audio */, IVAS_REND_BitstreamBuffer *hBits /*i/o: buffer for input/output bitstream. Needed in split rendering mode*/ -#else - IVAS_REND_AudioBuffer outAudio /* i/o: buffer for output audio */ -#endif ) { ivas_error error; int16_t numOutChannels; -#ifdef SPLIT_REND_WITH_HEAD_ROT int16_t cldfb2tdSampleFact; IVAS_REND_AudioBuffer outAudioOrig; -#endif /* Validate function arguments */ if ( hIvasRend == NULL || outAudio.data == NULL ) @@ -7646,14 +7290,10 @@ static ivas_error getSamplesInternal( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } -#ifdef SPLIT_REND_WITH_HEAD_ROT cldfb2tdSampleFact = ( outAudio.config.is_cldfb ) ? 2 : 1; if ( outAudio.config.numSamplesPerChannel <= 0 || ( MAX_BUFFER_LENGTH_PER_CHANNEL < outAudio.config.numSamplesPerChannel && outAudio.config.is_cldfb == 0 ) || ( ( MAX_BUFFER_LENGTH_PER_CHANNEL * cldfb2tdSampleFact ) < outAudio.config.numSamplesPerChannel && outAudio.config.is_cldfb == 1 ) ) -#else - if ( outAudio.config.numSamplesPerChannel <= 0 || MAX_BUFFER_LENGTH_PER_CHANNEL < outAudio.config.numSamplesPerChannel ) -#endif { return IVAS_ERR_INVALID_BUFFER_SIZE; } @@ -7663,15 +7303,10 @@ static ivas_error getSamplesInternal( return IVAS_ERR_WRONG_NUM_CHANNELS; } -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( getAudioConfigType( hIvasRend->outputConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL && hIvasRend->outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED && hIvasRend->outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM && ( outAudio.config.numSamplesPerChannel * 1000 / cldfb2tdSampleFact ) != ( hIvasRend->num_subframes * BINAURAL_RENDERING_FRAME_SIZE_MS ) * hIvasRend->sampleRateOut ) -#else - if ( getAudioConfigType( hIvasRend->outputConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL && - outAudio.config.numSamplesPerChannel * 1000 != ( hIvasRend->num_subframes * BINAURAL_RENDERING_FRAME_SIZE_MS ) * hIvasRend->sampleRateOut ) -#endif { return IVAS_ERROR( IVAS_ERR_INVALID_BUFFER_SIZE, "Binaural rendering requires specific frame size" ); } @@ -7712,11 +7347,7 @@ static ivas_error getSamplesInternal( return error; } -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( numOutChannels != outAudio.config.numChannels && hIvasRend->outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED && hIvasRend->outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) -#else - if ( numOutChannels != outAudio.config.numChannels ) -#endif { return IVAS_ERR_WRONG_NUM_CHANNELS; } @@ -7724,7 +7355,6 @@ static ivas_error getSamplesInternal( /* Clear original output buffer */ set_zero( outAudio.data, outAudio.config.numChannels * outAudio.config.numSamplesPerChannel ); -#ifdef SPLIT_REND_WITH_HEAD_ROT outAudioOrig = outAudio; /* Use internal buffer if outputting split rendering bitstream */ if ( ( hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || @@ -7739,7 +7369,6 @@ static ivas_error getSamplesInternal( /* Clear output buffer for split rendering bitstream */ set_zero( outAudio.data, outAudio.config.numChannels * outAudio.config.numSamplesPerChannel ); } -#endif if ( ( error = renderActiveInputsIsm( hIvasRend, outAudio ) ) != IVAS_ERR_OK ) { @@ -7761,15 +7390,6 @@ static ivas_error getSamplesInternal( return error; } -#ifndef SPLIT_REND_WITH_HEAD_ROT -#ifndef DISABLE_LIMITER -#ifdef DEBUGGING - hIvasRend->numClipping += -#endif - limitRendererOutput( hIvasRend->hLimiter, outAudio.data, outAudio.config.numSamplesPerChannel, IVAS_LIMITER_THRESHOLD ); -#endif -#endif -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { ISAR_SPLIT_REND_BITS_DATA bits; @@ -7813,9 +7433,7 @@ static ivas_error getSamplesInternal( hIvasRend->headRotData.headPositions[0], hIvasRend->hRendererConfig->split_rend_config.splitRendBitRate, hIvasRend->hRendererConfig->split_rend_config.codec, -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS hIvasRend->hRendererConfig->split_rend_config.isar_frame_size_ms, -#endif hIvasRend->hRendererConfig->split_rend_config.codec_frame_size_ms, &bits, Cldfb_RealBuffer_Binaural, @@ -7840,9 +7458,7 @@ static ivas_error getSamplesInternal( accumulate2dArrayToBuffer( tmpBinaural_buff, &outAudio ); } } -#endif -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( outAudio.config.is_cldfb == 0 ) { #ifndef DISABLE_LIMITER @@ -7852,7 +7468,6 @@ static ivas_error getSamplesInternal( limitRendererOutput( hIvasRend->hLimiter, outAudio.data, outAudio.config.numSamplesPerChannel, IVAS_LIMITER_THRESHOLD ); #endif } -#endif /* update global cominbed orientation start index */ ivas_combined_orientation_update_start_index( hIvasRend->hCombinedOrientationData, outAudio.config.numSamplesPerChannel ); @@ -7873,15 +7488,10 @@ ivas_error IVAS_REND_GetSamples( ) { -#ifdef SPLIT_REND_WITH_HEAD_ROT return getSamplesInternal( hIvasRend, outAudio, NULL ); -#else - return getSamplesInternal( hIvasRend, outAudio ); -#endif } -#ifdef SPLIT_REND_WITH_HEAD_ROT /*-------------------------------------------------------------------* * IVAS_REND_GetSplitBinauralBitstream() * @@ -7919,10 +7529,8 @@ ivas_error IVAS_REND_GetSplitRendBitstreamHeader( ISAR_SPLIT_REND_CODEC *pCodec, /* o: pointer to codec setting */ ISAR_SPLIT_REND_POSE_CORRECTION_MODE *poseCorrection, /* o: pointer to pose correction mode */ int16_t *pCodec_frame_size_ms /* o: pointer to codec frame size setting */ -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS , int16_t *pIsar_frame_size_ms /* o: pointer to isar frame size setting */ -#endif ) { if ( hIvasRend == NULL || hIvasRend->hRendererConfig == NULL ) @@ -7931,15 +7539,11 @@ ivas_error IVAS_REND_GetSplitRendBitstreamHeader( } *pCodec = hIvasRend->hRendererConfig->split_rend_config.codec; *pCodec_frame_size_ms = hIvasRend->hRendererConfig->split_rend_config.codec_frame_size_ms; -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS *pIsar_frame_size_ms = hIvasRend->hRendererConfig->split_rend_config.isar_frame_size_ms; -#endif *poseCorrection = hIvasRend->hRendererConfig->split_rend_config.poseCorrectionMode; return IVAS_ERR_OK; } -#endif - /*-------------------------------------------------------------------* * IVAS_REND_Close() @@ -7989,10 +7593,8 @@ void IVAS_REND_Close( ivas_limiter_close( &hIvasRend->hLimiter ); -#ifdef SPLIT_REND_WITH_HEAD_ROT /* Split binaural rendering */ ISAR_PRE_REND_close( &hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer ); -#endif closeHeadRotation( hIvasRend ); @@ -8018,7 +7620,6 @@ void IVAS_REND_Close( } -#ifdef SPLIT_REND_WITH_HEAD_ROT /*-------------------------------------------------------------------* * IVAS_REND_openCldfb() * @@ -8135,7 +7736,6 @@ void IVAS_REND_cldfbSynthesis_wrapper( return; } -#endif #ifdef DEBUGGING @@ -8658,9 +8258,7 @@ static ivas_error ivas_masa_ext_rend_parambin_init( float binCenterFreq, tmpFloat; ivas_error error; float frequency_axis[CLDFB_NO_CHANNELS_MAX]; -#ifdef SPLIT_REND_WITH_HEAD_ROT int16_t pos_idx; -#endif error = IVAS_ERR_OK; @@ -8675,13 +8273,9 @@ static ivas_error ivas_masa_ext_rend_parambin_init( nBins = inputMasa->hMasaExtRend->hSpatParamRendCom->num_freq_bands; renderer_type = inputMasa->hMasaExtRend->renderer_type; -#ifdef SPLIT_REND_WITH_HEAD_ROT for ( pos_idx = 0; pos_idx < inputMasa->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses; pos_idx++ ) { hDiracDecBin = inputMasa->hMasaExtRend->hDiracDecBin[pos_idx]; -#else - hDiracDecBin = inputMasa->hMasaExtRend->hDiracDecBin; -#endif /* Init assumes that no reconfiguration is required in external renderer. Instead, free and rebuild whole rendering. */ if ( ( hDiracDecBin = (DIRAC_DEC_BIN_HANDLE) malloc( sizeof( DIRAC_DEC_BIN_DATA ) ) ) == NULL ) @@ -8741,14 +8335,10 @@ static ivas_error ivas_masa_ext_rend_parambin_init( #ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF mvr2r( ( *phHrtfParambin )->parametricEarlyPartEneCorrection, hDiracDecBin->earlyPartEneCorrection, nBins ); #else - mvr2r( hHrtfParambin->parametricEarlyPartEneCorrection, hDiracDecBin->earlyPartEneCorrection, nBins ); + mvr2r( hHrtfParambin->parametricEarlyPartEneCorrection, hDiracDecBin->earlyPartEneCorrection, nBins ); #endif -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( hDiracDecBin->hReverb == NULL && pos_idx == 0 ) /* open reverb only for the main direction */ -#else - if ( hDiracDecBin->hReverb == NULL ) -#endif { #ifdef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES #ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF @@ -8757,8 +8347,8 @@ static ivas_error ivas_masa_ext_rend_parambin_init( if ( ( error = ivas_binaural_reverb_init( &hDiracDecBin->hReverb, hHrtfStatistics, nBins, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, &( hRendCfg->roomAcoustics ), output_Fs, hHrtfParambin->parametricReverberationTimes, hHrtfParambin->parametricReverberationEneCorrections ) ) != IVAS_ERR_OK ) #endif #else - /* Todo Philips: Room acoustics should be passed here once the underlying part works. In this case, it probably should come from render context or somewhere else suitable. */ - if ( ( error = ivas_binaural_reverb_open_parambin( &hDiracDecBin->hReverb, nBins, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, NULL, output_Fs, hHrtfParambin ) ) != IVAS_ERR_OK ) + /* Todo Philips: Room acoustics should be passed here once the underlying part works. In this case, it probably should come from render context or somewhere else suitable. */ + if ( ( error = ivas_binaural_reverb_open_parambin( &hDiracDecBin->hReverb, nBins, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, NULL, output_Fs, hHrtfParambin ) ) != IVAS_ERR_OK ) #endif { return error; @@ -8776,10 +8366,8 @@ static ivas_error ivas_masa_ext_rend_parambin_init( assert( false ); } -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( pos_idx == 0 ) /* open decorrelator only for the main direction */ { -#endif /* Always open frequency domain decorrelator */ ivas_dirac_dec_get_frequency_axis( frequency_axis, output_Fs, nBins ); if ( ( error = ivas_dirac_dec_decorr_open( &( hDiracDecBin->h_freq_domain_decorr_ap_params ), @@ -8794,9 +8382,7 @@ static ivas_error ivas_masa_ext_rend_parambin_init( { return error; } -#ifdef SPLIT_REND_WITH_HEAD_ROT } -#endif /* External renderer uses constant regularization factor */ hDiracDecBin->reqularizationFactor = 0.4f; @@ -8804,12 +8390,8 @@ static ivas_error ivas_masa_ext_rend_parambin_init( hDiracDecBin->phHrtfParambin = phHrtfParambin; #endif -#ifdef SPLIT_REND_WITH_HEAD_ROT inputMasa->hMasaExtRend->hDiracDecBin[pos_idx] = hDiracDecBin; } -#else - inputMasa->hMasaExtRend->hDiracDecBin = hDiracDecBin; -#endif return error; } @@ -8839,14 +8421,10 @@ static ivas_error initMasaExtRenderer( hMasaExtRend->renderer_type = RENDERER_DISABLE; hMasaExtRend->hDirACRend = NULL; hMasaExtRend->hSpatParamRendCom = NULL; -#ifdef SPLIT_REND_WITH_HEAD_ROT for ( i = 0; i < MAX_HEAD_ROT_POSES; i++ ) { hMasaExtRend->hDiracDecBin[i] = NULL; } -#else - hMasaExtRend->hDiracDecBin = NULL; -#endif hMasaExtRend->hReverb = NULL; hMasaExtRend->hHrtfParambin = &hrtfs->hHrtfParambin; hMasaExtRend->hVBAPdata = NULL; @@ -8893,10 +8471,8 @@ static ivas_error initMasaExtRenderer( break; case IVAS_AUDIO_CONFIG_BINAURAL: -#ifdef SPLIT_REND_WITH_HEAD_ROT case IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM: case IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED: -#endif hMasaExtRend->renderer_type = RENDERER_BINAURAL_PARAMETRIC; break; @@ -9013,7 +8589,6 @@ static void freeMasaExtRenderer( ivas_spat_hSpatParamRendCom_close( &hMasaExtRend->hSpatParamRendCom ); } -#ifdef SPLIT_REND_WITH_HEAD_ROT for ( i = 0; i < MAX_HEAD_ROT_POSES; i++ ) { if ( hMasaExtRend->hDiracDecBin[i] != NULL ) @@ -9022,12 +8597,6 @@ static void freeMasaExtRenderer( } } -#else - if ( hMasaExtRend->hDiracDecBin != NULL ) - { - ivas_dirac_dec_close_binaural_data( &hMasaExtRend->hDiracDecBin ); - } -#endif if ( hMasaExtRend->hReverb != NULL ) { diff --git a/lib_rend/lib_rend.h b/lib_rend/lib_rend.h index 5cf173c37e2db75a3f24d80332c7df9969ebe715..918e19b1ba2920582b3ae071b32b0f2f1dd10b0e 100644 --- a/lib_rend/lib_rend.h +++ b/lib_rend/lib_rend.h @@ -53,7 +53,6 @@ typedef float IVAS_REND_LfePanMtx[RENDERER_MAX_INPUT_LFE_CHANNELS][IVAS_MAX_OUTPUT_CHANNELS]; -#ifdef SPLIT_REND_WITH_HEAD_ROT typedef struct { int32_t bufLenInBytes; @@ -62,17 +61,14 @@ typedef struct ISAR_SPLIT_REND_CODEC codec; ISAR_SPLIT_REND_POSE_CORRECTION_MODE poseCorrection; int16_t codec_frame_size_ms; -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS int16_t isar_frame_size_ms; int16_t lc3plus_highres; -#endif } IVAS_REND_BitstreamBufferConfig; typedef struct { IVAS_REND_BitstreamBufferConfig config; uint8_t *bits; } IVAS_REND_BitstreamBuffer; -#endif typedef struct { @@ -254,7 +250,6 @@ int16_t IVAS_REND_FeedRenderConfig( const IVAS_RENDER_CONFIG_DATA renderConfig /* i : Render configuration struct */ ); -#ifdef SPLIT_REND_WITH_HEAD_ROT ivas_error IVAS_REND_FeedSplitBinauralBitstream( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ const IVAS_REND_InputId inputId, /* i : ID of the input */ @@ -278,20 +273,15 @@ ivas_error IVAS_REND_GetSplitRendBitstreamHeader( ISAR_SPLIT_REND_CODEC *pCodec, /* o: pointer to codec setting */ ISAR_SPLIT_REND_POSE_CORRECTION_MODE *poseCorrection, /* o: pointer to pose correction mode */ int16_t *pCodec_frame_size_ms /* o: pointer to codec frame size setting */ -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS , int16_t *pIsar_frame_size_ms /* o: pointer to isar frame size setting */ -#endif ); -#endif ivas_error IVAS_REND_SetHeadRotation( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ const IVAS_QUATERNION headRot, /* i : head orientations for next rendering call */ const IVAS_VECTOR3 Pos, /* i : listener positions for next rendering call */ -#ifdef SPLIT_REND_WITH_HEAD_ROT const ISAR_SPLIT_REND_ROT_AXIS rot_axis, /* i : external control for rotation axis for split rendering*/ -#endif const int16_t sf_idx /* i : subframe index */ ); @@ -326,11 +316,9 @@ ivas_error IVAS_REND_SetReferenceVector( const IVAS_VECTOR3 refPos /* i : Reference position */ ); -#ifdef SPLIT_REND_WITH_HEAD_ROT ivas_error IVAS_REND_SetSplitRendBFI( IVAS_REND_HANDLE hIvasRend, const int16_t bfi); -#endif ivas_error IVAS_REND_SetExternalOrientation( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ @@ -391,7 +379,6 @@ void IVAS_REND_Close( ); -#ifdef SPLIT_REND_WITH_HEAD_ROT /* Split binaural rendering functions */ ivas_error IVAS_REND_openCldfb( @@ -422,7 +409,6 @@ void IVAS_REND_cldfbSynthesis_wrapper( const int16_t samplesToProcess, /* i : number of processed samples */ IVAS_CLDFB_FILTER_BANK_HANDLE h_cldfb /* i : filter bank state */ ); -#endif #ifdef DEBUGGING int32_t IVAS_REND_GetNoCLipping( diff --git a/lib_util/render_config_reader.c b/lib_util/render_config_reader.c index 64f195b1e580ff50645c05d9f8abc2c6abb40a4d..c05b3735470c52fbcdd2b8dfce267be209b08433 100644 --- a/lib_util/render_config_reader.c +++ b/lib_util/render_config_reader.c @@ -1068,11 +1068,7 @@ static void strip_spaces( while ( pStr[read_idx] ) { -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( !isspace( (int32_t) pStr[read_idx] ) && !iscntrl( (int32_t) pStr[read_idx] ) ) -#else - if ( !isspace( pStr[read_idx] ) && !iscntrl( pStr[read_idx] ) ) -#endif { pStr[write_idx++] = pStr[read_idx]; } @@ -1849,10 +1845,8 @@ ivas_error RenderConfigReader_read( uint32_t fgHasMethod, fgHasNBands, fgHasFreqs, fgHasDefaultGrid, fgHasStartFreq, fgHasFreqHop; uint32_t aeHasFgIdx, aeHasPredelay, aeHasRt60, aeHasDsr; uint32_t aeHasERsize, aeHasERabs; -#ifdef SPLIT_REND_WITH_HEAD_ROT bool dofProvided = false; bool poseCorrProvided = false; -#endif uint32_t nDP; uint32_t accDPIdx; @@ -2456,7 +2450,6 @@ ivas_error RenderConfigReader_read( free( pValue ); acIdx++; } -#ifdef SPLIT_REND_WITH_HEAD_ROT else if ( strcmp( chapter, "SPLITREND" ) == 0 && strlen( pParams ) != 0 ) { params_idx = 0; @@ -2573,7 +2566,6 @@ ivas_error RenderConfigReader_read( errorHandler( pValue, ERROR_VALUE_INVALID ); } } -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS else if ( strcmp( item, "LC3PLUS_HIGHRES" ) == 0 ) { if ( !sscanf( pValue, "%hd", &hRenderConfig->split_rend_config.lc3plus_highres ) ) @@ -2581,7 +2573,6 @@ ivas_error RenderConfigReader_read( errorHandler( item, ERROR_VALUE_INVALID ); } } -#endif #ifdef DEBUGGING else { @@ -2591,7 +2582,6 @@ ivas_error RenderConfigReader_read( } free( pValue ); } -#endif else if ( strcmp( chapter, "DIRECTIVITYSETTING" ) == 0 && strlen( pParams ) != 0 ) { diff --git a/lib_util/split_rend_bfi_file_reader.c b/lib_util/split_rend_bfi_file_reader.c index 3fc63331783c21e734e2d1a68cea680fd346e85c..91cb44d422a2ee8e8b433d89f10b49713a660112 100644 --- a/lib_util/split_rend_bfi_file_reader.c +++ b/lib_util/split_rend_bfi_file_reader.c @@ -33,7 +33,6 @@ #include #include "options.h" #include "split_rend_bfi_file_reader.h" -#ifdef SPLIT_REND_WITH_HEAD_ROT #include #include "prot.h" @@ -159,4 +158,3 @@ const char *SplitRendBFIFileReader_getFilePath( return SplitRendBFIReader->file_path; } -#endif /* SPLIT_REND_WITH_HEAD_ROT */ diff --git a/lib_util/split_rend_bfi_file_reader.h b/lib_util/split_rend_bfi_file_reader.h index 679c424a1563cc4fd8de76651ef439565a03269c..0956b6b3ddcecc0b8fd58f0f13a26b15b8e4c5a0 100644 --- a/lib_util/split_rend_bfi_file_reader.h +++ b/lib_util/split_rend_bfi_file_reader.h @@ -34,7 +34,6 @@ #define IVAS_SR_BFI_FILE_READER_H #include "common_api_types.h" -#ifdef SPLIT_REND_WITH_HEAD_ROT typedef struct SplitRendBFIFileReader SplitRendBFIFileReader; @@ -56,5 +55,4 @@ const char *SplitRendBFIFileReader_getFilePath( ); -#endif /* SPLIT_REND_WITH_HEAD_ROT */ #endif /* IVAS_SR_BFI_FILE_READER_H */ diff --git a/lib_util/split_render_file_read_write.c b/lib_util/split_render_file_read_write.c index e52f9fe86ddb867237859198ff127699a7036fe7..0c3e23edd6edf91e631c8f0b88384a7cb0ba7e2e 100644 --- a/lib_util/split_render_file_read_write.c +++ b/lib_util/split_render_file_read_write.c @@ -33,7 +33,6 @@ #include #include "options.h" #include "split_render_file_read_write.h" -#ifdef SPLIT_REND_WITH_HEAD_ROT #include #include "prot.h" @@ -66,14 +65,10 @@ ivas_error split_rend_reader_open( char *filename, ISAR_SPLIT_REND_CODEC *codec, ISAR_SPLIT_REND_POSE_CORRECTION_MODE *poseCorrection, - int16_t *codec_frame_size_ms -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS - , + int16_t *codec_frame_size_ms, int16_t *isar_frame_size_ms, int32_t *sampling_rate, - int16_t *lc3plus_highres -#endif -) + int16_t *lc3plus_highres ) { SplitFileReadWrite *hSplitRendFileReadWrite; size_t header_len, h; @@ -125,7 +120,6 @@ ivas_error split_rend_reader_open( { return IVAS_ERR_FAILED_FILE_READ; } -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS /* read isar bitstream frame size signalling */ if ( fread( isar_frame_size_ms, sizeof( *isar_frame_size_ms ), 1, hSplitRendFileReadWrite->file ) != 1 ) { @@ -141,7 +135,6 @@ ivas_error split_rend_reader_open( { return IVAS_ERR_FAILED_FILE_READ; } -#endif *hhSplitRendFileReadWrite = hSplitRendFileReadWrite; @@ -162,14 +155,10 @@ ivas_error split_rend_writer_open( const int32_t delayTimeScale, ISAR_SPLIT_REND_CODEC codec, ISAR_SPLIT_REND_POSE_CORRECTION_MODE poseCorrection, - int16_t codec_frame_size_ms -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS - , + int16_t codec_frame_size_ms, const int16_t isar_frame_size_ms, const int32_t sampling_rate, - const int16_t lc3plus_highres -#endif -) + const int16_t lc3plus_highres ) { SplitFileReadWrite *hSplitRendFileReadWrite; size_t header_len, h; @@ -220,7 +209,6 @@ ivas_error split_rend_writer_open( { return IVAS_ERR_FAILED_FILE_WRITE; } -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS /* Write isar bit stream frame size signalling */ if ( fwrite( &isar_frame_size_ms, sizeof( isar_frame_size_ms ), 1, hSplitRendFileReadWrite->file ) != 1 ) { @@ -236,7 +224,6 @@ ivas_error split_rend_writer_open( { return IVAS_ERR_FAILED_FILE_WRITE; } -#endif *hhSplitRendFileReadWrite = hSplitRendFileReadWrite; @@ -428,4 +415,3 @@ ivas_error split_rend_read_pre_rend_delay_ns( return IVAS_ERR_OK; } -#endif /* SPLIT_REND_WITH_HEAD_ROT */ diff --git a/lib_util/split_render_file_read_write.h b/lib_util/split_render_file_read_write.h index bdda7e59893446ef9501f87464f1463474c119a9..2895dd42687f37c421d3c97734bea2a0c32c8d7e 100644 --- a/lib_util/split_render_file_read_write.h +++ b/lib_util/split_render_file_read_write.h @@ -34,7 +34,6 @@ #define SPLIT_RENDER_FILE_READ_WRITE_H #include "common_api_types.h" -#ifdef SPLIT_REND_WITH_HEAD_ROT typedef struct SplitFileReadWrite SplitFileReadWrite; @@ -44,14 +43,10 @@ ivas_error split_rend_reader_open( char *filename, ISAR_SPLIT_REND_CODEC *codec, ISAR_SPLIT_REND_POSE_CORRECTION_MODE *poseCorrection, - int16_t *codec_frame_size_ms -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS - , + int16_t *codec_frame_size_ms, int16_t *isar_frame_size_ms, int32_t *sampling_rate, - int16_t *lc3plus_highres -#endif -); + int16_t *lc3plus_highres ); /* Allocates and initializes a a split renderer writer instance */ @@ -62,14 +57,10 @@ ivas_error split_rend_writer_open( const int32_t delayTimeScale, ISAR_SPLIT_REND_CODEC codec, ISAR_SPLIT_REND_POSE_CORRECTION_MODE poseCorrection, - int16_t codec_frame_size_ms -#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS - , + int16_t codec_frame_size_ms, const int16_t isar_frame_size_ms, const int32_t sampling_rate, - const int16_t lc3plus_highres -#endif -); + const int16_t lc3plus_highres ); /* Closes the split renderer reader/writer and deallocates memory */ @@ -95,5 +86,4 @@ ivas_error split_rend_read_pre_rend_delay_ns( SplitFileReadWrite *hSplitRendFileReadWrite, uint32_t *delay_ns ); -#endif /* SPLIT_REND_WITH_HEAD_ROT */ #endif /* SPLIT_RENDER_FILE_READ_WRITE_H */