diff --git a/apps/decoder.c b/apps/decoder.c index 9a20474542dd7c9c05aec360909f544ebb6c735a..320b309096dea1c54ea2b08482a9dff047e8a862 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -80,7 +80,6 @@ static * Local structure for storing cmdln arguments *------------------------------------------------------------------------------------------*/ -#ifdef FIX_1053_REVERB_RECONFIGURATION typedef struct { uint16_t *pID; @@ -89,7 +88,6 @@ typedef struct uint16_t selected; uint16_t frameCounter; } AcousticEnvironmentSequence; -#endif typedef struct @@ -122,11 +120,7 @@ typedef struct bool customLsOutputEnabled; char *customLsSetupFilename; int16_t orientation_tracking; -#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION bool non_diegetic_pan_enabled; -#else - int16_t Opt_non_diegetic_pan; -#endif float non_diegetic_pan_gain; Word16 non_diegetic_pan_gain_fx; /* Q15 */ bool renderConfigEnabled; @@ -135,16 +129,8 @@ typedef struct IVAS_DEC_COMPLEXITY_LEVEL complexityLevel; bool tsmEnabled; IVAS_RENDER_FRAMESIZE renderFramesize; -#ifdef FIX_1053_REVERB_RECONFIGURATION AcousticEnvironmentSequence aeSequence; -#else - uint16_t acousticEnvironmentId; -#endif -#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION bool dpidEnabled; -#else - int16_t Opt_dpid_on; -#endif uint16_t directivityPatternId[IVAS_MAX_NUM_OBJECTS]; } DecArguments; @@ -266,11 +252,7 @@ int main( if ( arg.hrtfReaderEnabled ) { /* sanity check */ -#ifdef NONBE_1293_SR_HRTF 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 ) -#else - if ( arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) -#endif { arg.hrtfReaderEnabled = false; fprintf( stderr, "\nError: HRTF binary file cannot be used in this output configuration.\n\n" ); @@ -385,51 +367,15 @@ int main( } } -#ifndef FIX_1158_FASTCONV_REVERB_HRTF - /*------------------------------------------------------------------------------------------* - * Open renderer configuration reader file - *------------------------------------------------------------------------------------------*/ - - if ( arg.renderConfigEnabled ) - { - /* sanity check */ -#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION - if ( arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM && arg.non_diegetic_pan_enabled == false ) -#else - if ( arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM && - arg.Opt_non_diegetic_pan == 0 ) -#endif - { - fprintf( stderr, "\nError: Renderer configuration file cannot be used in this output configuration.\n\n" ); - goto cleanup; - } - - if ( ( error = RenderConfigReader_open( arg.renderConfigFilename, &renderConfigReader ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nError: Can't open Renderer configuration file %s \n\n", arg.renderConfigFilename ); - goto cleanup; - } - } -#endif /*------------------------------------------------------------------------------------------* * Configure the decoder *------------------------------------------------------------------------------------------*/ asked_frame_size = arg.renderFramesize; -#ifdef FIX_1053_REVERB_RECONFIGURATION uint16_t aeID = arg.aeSequence.count > 0 ? arg.aeSequence.pID[0] : 65535; -#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputConfig, arg.tsmEnabled, arg.renderFramesize, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled, arg.non_diegetic_pan_enabled, arg.non_diegetic_pan_gain_fx, arg.dpidEnabled, aeID, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK ) -#else - if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputConfig, arg.tsmEnabled, arg.renderFramesize, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled, arg.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain_fx, - arg.Opt_dpid_on, aeID, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK ) -#endif -#else - if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputConfig, arg.tsmEnabled, arg.renderFramesize, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled, arg.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain_fx, - arg.Opt_dpid_on, arg.acousticEnvironmentId, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK ) -#endif { fprintf( stderr, "\nConfigure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; @@ -480,7 +426,6 @@ int main( } } -#ifdef FIX_VOIP_FUNCTIONS /*-----------------------------------------------------------------* * Print config information *-----------------------------------------------------------------*/ @@ -490,9 +435,6 @@ int main( fprintf( stderr, "\nIVAS_DEC_PrintConfig failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } -#else - IVAS_DEC_PrintConfig( hIvasDec, 1, arg.voipMode ); -#endif /*-------------------------------------------------------------------* * Load renderer configuration from file @@ -505,11 +447,7 @@ int main( /* sanity check */ if ( arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM && -#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION arg.non_diegetic_pan_enabled == false ) -#else - arg.Opt_non_diegetic_pan == 0 ) -#endif { fprintf( stderr, "\nExternal Renderer Config is supported only when binaural output configurations is used as output OR when Split rendering mode is enabled. Exiting. \n" ); goto cleanup; @@ -521,13 +459,11 @@ int main( goto cleanup; } -#ifdef FIX_1158_FASTCONV_REVERB_HRTF if ( ( error = RenderConfigReader_open( arg.renderConfigFilename, &renderConfigReader ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError: Can't open Renderer configuration file %s \n\n", arg.renderConfigFilename ); goto cleanup; } -#endif if ( RenderConfigReader_read( renderConfigReader, arg.renderConfigFilename, &renderConfig ) != IVAS_ERR_OK ) { @@ -535,30 +471,16 @@ int main( goto cleanup; } -#ifdef CONF_DISTATT if ( ( error = RenderConfigReader_getDirectivity( renderConfigReader, arg.directivityPatternId, renderConfig.directivity_fx ) ) != IVAS_ERR_OK ) -#else - if ( ( error = RenderConfigReader_getDirectivity( renderConfigReader, arg.directivityPatternId, renderConfig.directivity ) ) != IVAS_ERR_OK ) -#endif { 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; } -#ifndef CONF_DISTATT - FOR( Word16 i = 0; i < 4; i++ ) - { - renderConfig.directivity_fx[i * 3] = (Word16) ( renderConfig.directivity[i * 3] * ( 1u << 6 ) ); - renderConfig.directivity_fx[i * 3 + 1] = (Word16) ( renderConfig.directivity[i * 3 + 1] * ( 1u << 6 ) ); - renderConfig.directivity_fx[i * 3 + 2] = (Word16) ( renderConfig.directivity[i * 3 + 2] * ( ( 1u << 15 ) - 1 ) ); - } -#endif -#ifdef CONF_DISTATT if ( ( error = RenderConfigReader_getDistanceAttenuation( renderConfigReader, renderConfig.distAtt_fx ) ) != IVAS_ERR_OK ) { fprintf( stderr, "Failed to get Distance Attenuation \n\n" ); goto cleanup; } -#endif if ( ( arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { if ( asked_frame_size != IVAS_RENDER_FRAMESIZE_20MS && @@ -586,11 +508,7 @@ int main( if ( arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { -#ifdef FIX_1053_REVERB_RECONFIGURATION if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, aeID, &renderConfig.roomAcoustics ) ) == IVAS_ERR_OK ) -#else - if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, arg.acousticEnvironmentId, &renderConfig.roomAcoustics ) ) == IVAS_ERR_OK ) -#endif { if ( RenderConfigReader_checkValues( &renderConfig ) != IVAS_ERR_OK ) { @@ -600,16 +518,9 @@ int main( } else { -#ifdef FIX_1053_REVERB_RECONFIGURATION fprintf( stderr, "Failed to get acoustic environment with ID: %d\n\n", aeID ); -#else - fprintf( stderr, "Failed to get acoustic environment with ID: %d\n\n", arg.acousticEnvironmentId ); -#endif goto cleanup; } -#ifndef FIX_587_DEFAULT_REVERB - renderConfig.roomAcoustics.override = true; -#endif } /* ISAR frame size is set from command line, not renderer config file. @@ -805,13 +716,11 @@ cleanup: free( pcmBuf ); -#ifdef FIX_1053_REVERB_RECONFIGURATION if ( arg.aeSequence.count > 0 ) { free( arg.aeSequence.pID ); free( arg.aeSequence.pValidity ); } -#endif if ( arg.hrtfReaderEnabled ) { @@ -993,32 +902,20 @@ static bool parseCmdlIVAS_dec( arg->renderConfigEnabled = false; arg->renderConfigFilename = NULL; -#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION arg->dpidEnabled = false; -#else - arg->Opt_dpid_on = 0; -#endif arg->outputMdFilename = NULL; arg->inputFormat = IVAS_DEC_INPUT_FORMAT_G192; -#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION arg->non_diegetic_pan_enabled = false; -#else - arg->Opt_non_diegetic_pan = 0; -#endif arg->non_diegetic_pan_gain = 0.f; arg->tsmEnabled = false; arg->renderFramesize = IVAS_RENDER_FRAMESIZE_20MS; -#ifdef FIX_1053_REVERB_RECONFIGURATION arg->aeSequence.count = 0; arg->aeSequence.pID = NULL; arg->aeSequence.pValidity = NULL; arg->aeSequence.selected = 0; arg->aeSequence.frameCounter = 0; -#else - arg->acousticEnvironmentId = 65535; -#endif for ( i = 0; i < IVAS_MAX_NUM_OBJECTS; ++i ) { arg->directivityPatternId[i] = 65535; @@ -1273,11 +1170,7 @@ static bool parseCmdlIVAS_dec( else if ( strcmp( argv_to_upper, "-NON_DIEGETIC_PAN" ) == 0 ) { i++; -#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION arg->non_diegetic_pan_enabled = true; -#else - arg->Opt_non_diegetic_pan = 1; -#endif strncpy( argv_to_upper, argv[i], sizeof( argv_to_upper ) - 1 ); argv_to_upper[sizeof( argv_to_upper ) - 1] = '\0'; to_upper( argv_to_upper ); @@ -1344,7 +1237,6 @@ static bool parseCmdlIVAS_dec( if ( !is_digits_only( argv[i] ) ) { -#ifdef FIX_1053_REVERB_RECONFIGURATION uint16_t k; char *s = argv[i]; char *token = argv[i]; @@ -1404,13 +1296,7 @@ static bool parseCmdlIVAS_dec( usage_dec(); return false; } -#else - fprintf( stdout, "Error: Invalid acoustic environment ID specified: %s\n\n", argv[i] ); - usage_dec(); - return false; -#endif } -#ifdef FIX_1053_REVERB_RECONFIGURATION else { /* A single acoustic environment */ @@ -1425,19 +1311,12 @@ static bool parseCmdlIVAS_dec( arg->aeSequence.pID[0] = (int16_t) atoi( argv[i++] ); arg->aeSequence.pValidity[0] = 0; } -#else - arg->acousticEnvironmentId = (int16_t) atoi( argv[i++] ); -#endif } else if ( strcmp( argv_to_upper, "-DPID" ) == 0 ) { int16_t id, tmp; -#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION arg->dpidEnabled = true; -#else - arg->Opt_dpid_on = 1; -#endif ++i; tmp = 0; while ( is_number( argv[i + tmp] ) && tmp < IVAS_MAX_NUM_OBJECTS ) @@ -1518,11 +1397,7 @@ static bool parseCmdlIVAS_dec( } i++; -#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION if ( arg->non_diegetic_pan_enabled && arg->outputConfig != IVAS_AUDIO_CONFIG_STEREO ) -#else - if ( ( arg->Opt_non_diegetic_pan ) && ( arg->outputConfig != IVAS_AUDIO_CONFIG_STEREO ) ) -#endif { fprintf( stderr, "Error: non-diegetic panning is supported in stereo only\n\n" ); usage_dec(); @@ -1540,11 +1415,7 @@ static bool parseCmdlIVAS_dec( arg->outputConfig = IVAS_AUDIO_CONFIG_MONO; arg->decMode = IVAS_DEC_MODE_EVS; -#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION if ( arg->non_diegetic_pan_enabled ) -#else - if ( ( arg->Opt_non_diegetic_pan ) ) -#endif { arg->outputConfig = IVAS_AUDIO_CONFIG_STEREO; } @@ -1665,15 +1536,11 @@ static void usage_dec( void ) fprintf( stdout, " output configuration. ID1, ID2, ID3, ID4 specify the directivity pattern IDs used for\n" ); fprintf( stdout, " ISMs 1,2,3 and 4 respectively. This options needs to be accompanied by a render_config file,\n" ); fprintf( stdout, " otherwise a default directivity pattern is used.\n" ); -#ifdef FIX_1053_REVERB_RECONFIGURATION fprintf( stdout, "-aeid ID : Acoustic environment ID (number > 0) or\n" ); fprintf( stdout, " a sequence thereof in the format [ID1:duration1,ID2:duration2...]\n" ); fprintf( stdout, " without braces and spaces, with ':' character separating ID from duration and ',' separating\n" ); fprintf( stdout, " ID and duration pairs, where duration is specified in frames\n" ); fprintf( stdout, " for BINAURAL_ROOM_REVERB output configuration.\n" ); -#else - fprintf( stdout, "-aeid ID : Acoustic environment ID (number >= 0) for BINAURAL_ROOM_REVERB output configuration\n" ); -#endif fprintf( stdout, "-level level : Complexity level, level = (1, 2, 3), will be defined after characterisation. \n" ); fprintf( stdout, " Currently, all values default to level 3 (full functionality).\n" ); fprintf( stdout, "-q : Quiet mode, no frame counter\n" ); @@ -1925,12 +1792,8 @@ static ivas_error initOnFirstGoodFrame( for ( int16_t j = 0; j < numInitialBadFrames; ++j ) { -#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT float delayMs = (float) ( pFullDelayNumSamples[0] ) / (float) ( *delayTimeScale ); if ( ( error = MasaFileWriter_writeFrame( *ppMasaWriter, hMasaExtOutMeta, &delayMs ) ) != IVAS_ERR_OK ) -#else - if ( ( error = MasaFileWriter_writeFrame( *ppMasaWriter, hMasaExtOutMeta ) ) != IVAS_ERR_OK ) -#endif { fprintf( stderr, "\nError writing MASA metadata to file: %s\n", MasaFileWriter_getFilePath( *ppMasaWriter ) ); return error; @@ -2006,7 +1869,6 @@ static ivas_error decodeG192( int16_t vec_pos_update, vec_pos_len; SplitFileReadWrite *splitRendWriter = NULL; int16_t isSplitRend, isSplitCoded; -#ifdef FIX_1053_REVERB_RECONFIGURATION IVAS_RENDER_CONFIG_DATA renderConfig; RenderConfigReader *renderConfigReader = NULL; @@ -2042,7 +1904,6 @@ static ivas_error decodeG192( goto cleanup; } } -#endif for ( i = 0; i < IVAS_MAX_NUM_OBJECTS; ++i ) { @@ -2209,7 +2070,6 @@ static ivas_error decodeG192( { if ( needNewFrame ) { -#ifdef FIX_1053_REVERB_RECONFIGURATION if ( arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB && renderConfigReader != NULL && arg.aeSequence.count > 0 && arg.aeSequence.pValidity[arg.aeSequence.selected] != 0 ) { @@ -2240,7 +2100,6 @@ static ivas_error decodeG192( } } } -#endif if ( ( error = BS_Reader_ReadFrame_short( hBsReader, bit_stream, &num_bits, &bfi ) ) != IVAS_ERR_OK ) { if ( error == IVAS_ERR_END_OF_FILE ) @@ -2383,7 +2242,6 @@ static ivas_error decodeG192( if ( bsFormat == IVAS_DEC_BS_MASA || bsFormat == IVAS_DEC_BS_MASA_ISM ) { IVAS_MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta; -#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT int16_t fullDelayNumSamples[3]; float delayMs; @@ -2392,19 +2250,14 @@ static ivas_error decodeG192( { fprintf( stderr, "\nUnable to get delay of decoder: %s\n", ivas_error_to_string( error ) ); } -#endif if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &hMasaExtOutMeta, 0 ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in IVAS_DEC_GetMasaMetadata: %s\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } -#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT delayMs = (float) ( fullDelayNumSamples[0] ) / (float) ( delayTimeScale ); if ( ( error = MasaFileWriter_writeFrame( masaWriter, hMasaExtOutMeta, &delayMs ) ) != IVAS_ERR_OK ) -#else - if ( ( error = MasaFileWriter_writeFrame( masaWriter, hMasaExtOutMeta ) ) != IVAS_ERR_OK ) -#endif { fprintf( stderr, "\nError writing MASA metadata to file: %s\n", MasaFileWriter_getFilePath( masaWriter ) ); goto cleanup; @@ -2530,7 +2383,6 @@ static ivas_error decodeG192( if ( bsFormat == IVAS_DEC_BS_MASA || bsFormat == IVAS_DEC_BS_MASA_ISM ) { IVAS_MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta; -#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT int16_t fullDelayNumSamples[3]; float delayMs; @@ -2538,19 +2390,14 @@ static ivas_error decodeG192( { fprintf( stderr, "\nUnable to get delay of decoder: %s\n", ivas_error_to_string( error ) ); } -#endif if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &hMasaExtOutMeta, 0 ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in IVAS_DEC_GetMasaMetadata: %s\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } -#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT delayMs = (float) ( fullDelayNumSamples[0] ) / (float) ( delayTimeScale ); if ( ( error = MasaFileWriter_writeFrame( masaWriter, hMasaExtOutMeta, &delayMs ) ) != IVAS_ERR_OK ) -#else - if ( ( error = MasaFileWriter_writeFrame( masaWriter, hMasaExtOutMeta ) ) != IVAS_ERR_OK ) -#endif { fprintf( stderr, "\nError writing MASA metadata to file: %s\n", MasaFileWriter_getFilePath( masaWriter ) ); goto cleanup; @@ -2628,9 +2475,7 @@ static ivas_error decodeG192( cleanup: -#ifdef FIX_1053_REVERB_RECONFIGURATION RenderConfigReader_close( &renderConfigReader ); -#endif split_rend_reader_writer_close( &splitRendWriter ); AudioFileWriter_close( &afWriter ); @@ -3098,7 +2943,6 @@ static ivas_error decodeVoIP( if ( bsFormat == IVAS_DEC_BS_MASA || bsFormat == IVAS_DEC_BS_MASA_ISM ) { IVAS_MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta; -#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT int16_t fullDelayNumSamples[3]; float delayMs; @@ -3107,19 +2951,14 @@ static ivas_error decodeVoIP( { fprintf( stderr, "\nUnable to get delay of decoder: %s\n", ivas_error_to_string( error ) ); } -#endif if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &hMasaExtOutMeta, 1 ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in IVAS_DEC_GetMasaMetadata: %s\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } -#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT delayMs = (float) ( fullDelayNumSamples[0] ) / (float) ( delayTimeScale ); if ( ( error = MasaFileWriter_writeFrame( masaWriter, hMasaExtOutMeta, &delayMs ) ) != IVAS_ERR_OK ) -#else - if ( ( error = MasaFileWriter_writeFrame( masaWriter, hMasaExtOutMeta ) ) != IVAS_ERR_OK ) -#endif { fprintf( stderr, "\nError writing MASA metadata to file: %s\n", MasaFileWriter_getFilePath( masaWriter ) ); goto cleanup; @@ -3197,7 +3036,6 @@ static ivas_error decodeVoIP( if ( bsFormat == IVAS_DEC_BS_MASA || bsFormat == IVAS_DEC_BS_MASA_ISM ) { IVAS_MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta; -#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT int16_t fullDelayNumSamples[3]; float delayMs; @@ -3206,19 +3044,14 @@ static ivas_error decodeVoIP( { fprintf( stderr, "\nUnable to get delay of decoder: %s\n", ivas_error_to_string( error ) ); } -#endif if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &hMasaExtOutMeta, 0 ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in IVAS_DEC_GetMasaMetadata: %s\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } -#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT delayMs = (float) ( fullDelayNumSamples[0] ) / (float) ( delayTimeScale ); if ( ( error = MasaFileWriter_writeFrame( masaWriter, hMasaExtOutMeta, &delayMs ) ) != IVAS_ERR_OK ) -#else - if ( ( error = MasaFileWriter_writeFrame( masaWriter, hMasaExtOutMeta ) ) != IVAS_ERR_OK ) -#endif { fprintf( stderr, "\nError writing MASA metadata to file: %s\n", MasaFileWriter_getFilePath( masaWriter ) ); goto cleanup; diff --git a/apps/renderer.c b/apps/renderer.c index df73dbadeca402a8b0655d6aba1cf4fd7c36f93d..be10447a06bb799c90f52a2a1a8489bb49eb71c6 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -144,7 +144,6 @@ typedef struct IVAS_CUSTOM_LS_DATA outSetupCustom; } OutputConfig; -#ifdef FIX_1053_REVERB_RECONFIGURATION typedef struct { uint16_t *pID; @@ -153,7 +152,6 @@ typedef struct uint16_t selected; uint16_t frameCounter; } AcousticEnvironmentSequence; -#endif typedef struct { @@ -174,10 +172,8 @@ typedef struct char customHrtfFilePath[RENDERER_MAX_CLI_ARG_LENGTH]; char renderConfigFilePath[RENDERER_MAX_CLI_ARG_LENGTH]; int8_t orientation_tracking; -#ifdef FIX_1135_EXT_RENDERER_HANDLES int16_t Opt_Headrotation; int16_t Opt_ExternalOrientation; -#endif int16_t nonDiegeticPan; float nonDiegeticPanGain; IVAS_REND_COMPLEXITY_LEVEL complexityLevel; @@ -194,11 +190,7 @@ typedef struct float syncMdDelay; IVAS_RENDER_FRAMESIZE render_framesize; uint16_t directivityPatternId[RENDERER_MAX_ISM_INPUTS]; -#ifdef FIX_1053_REVERB_RECONFIGURATION AcousticEnvironmentSequence aeSequence; -#else - uint16_t acousticEnvironmentId; -#endif } CmdlnArgs; typedef enum @@ -393,11 +385,7 @@ static const CmdLnParser_Option cliOptions[] = { .id = CmdLnOptionId_acousticEnvironmentId, .match = "acoustic_environment_id", .matchShort = "aeid", -#ifdef FIX_1053_REVERB_RECONFIGURATION .description = "Acoustic environment ID( number > 0 ) or a sequence thereof in the format [ID1:duration1,ID2:duration2...] without braces and spaces, with ':' character separating ID from duration and ',' separating ID and duration pairs, where duration is specified in frames for BINAURAL_ROOM_REVERB output configuration.", -#else - .description = "Acoustic environment ID (number >= 0) for BINAURAL_ROOM_REVERB output configuration", -#endif }, }; @@ -794,9 +782,7 @@ int main( int16_t zeroPadToWrite = 0; int32_t delayTimeScale = 0; int16_t i, numChannels; -#ifdef FIX_1053_REVERB_RECONFIGURATION uint16_t aeID; -#endif ivas_error error = IVAS_ERR_OK; #ifdef WMOPS @@ -984,11 +970,7 @@ int main( Word32 nonDiegeticPanGain_fx = ( args.nonDiegeticPanGain == 1.0f ) ? ONE_IN_Q31 : ( args.nonDiegeticPanGain == -1.0f ) ? L_negate( ONE_IN_Q31 ) : (Word32) ( args.nonDiegeticPanGain * ( 1LL << Q31 ) ); -#ifdef FIX_1135_EXT_RENDERER_HANDLES IF( ( error = IVAS_REND_Open( &hIvasRend, args.sampleRate, args.outConfig.audioConfig, !isEmptyString( args.customHrtfFilePath ), args.nonDiegeticPan, nonDiegeticPanGain_fx, args.Opt_Headrotation, args.Opt_ExternalOrientation, (int16_t) args.render_framesize ) ) != IVAS_ERR_OK ) -#else - IF( ( error = IVAS_REND_Open( &hIvasRend, args.sampleRate, args.outConfig.audioConfig, !isEmptyString( args.customHrtfFilePath ), args.nonDiegeticPan, nonDiegeticPanGain_fx, (int16_t) args.render_framesize ) ) != IVAS_ERR_OK ) -#endif { fprintf( stderr, "\nError opening renderer handle: %s\n", ivas_error_to_string( error ) ); goto cleanup; @@ -1176,7 +1158,6 @@ int main( fprintf( stderr, "\nFailed to read renderer configuration from file %s\n", args.renderConfigFilePath ); goto cleanup; } -#ifdef NONBE_FIX_1337_MISSING_DIRECTIVITY_DISTATT_EXTREND if ( ( error = RenderConfigReader_getDirectivity( renderConfigReader, args.directivityPatternId, renderConfig.directivity_fx ) ) != IVAS_ERR_OK ) { fprintf( stderr, "Failed to get directivity patterns for one or more of IDs: %d %d %d %d\n\n", args.directivityPatternId[0], args.directivityPatternId[1], args.directivityPatternId[2], args.directivityPatternId[3] ); @@ -1187,15 +1168,10 @@ int main( fprintf( stderr, "Failed to get Distance Attenuation \n\n" ); goto cleanup; } -#endif if ( args.outConfig.audioConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { -#ifdef FIX_1053_REVERB_RECONFIGURATION aeID = args.aeSequence.count > 0 ? args.aeSequence.pID[0] : 65535; if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, aeID, &renderConfig.roomAcoustics ) ) == IVAS_ERR_OK ) -#else - if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, args.acousticEnvironmentId, &renderConfig.roomAcoustics ) ) == IVAS_ERR_OK ) -#endif { if ( RenderConfigReader_checkValues( &renderConfig ) != IVAS_ERR_OK ) { @@ -1205,16 +1181,9 @@ int main( } else { -#ifdef FIX_1053_REVERB_RECONFIGURATION fprintf( stderr, "Failed to get acoustic environment with ID: %d\n\n", aeID ); -#else - fprintf( stderr, "\nFailed to get acoustic environment with ID: %d\n\n", args.acousticEnvironmentId ); -#endif goto cleanup; } -#ifndef FIX_587_DEFAULT_REVERB - renderConfig.roomAcoustics.override = 1; -#endif } /* ISAR frame size is set from command line, not renderer config file. @@ -1634,7 +1603,6 @@ int main( num_in_channels = inBuffer.config.numChannels; const bool isCurrentFrameMultipleOf20ms = frame % ( 4 / args.render_framesize ) == 0; -#ifdef FIX_1053_REVERB_RECONFIGURATION if ( args.outConfig.audioConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB && renderConfigReader != NULL && args.aeSequence.count > 0 && args.aeSequence.pValidity[args.aeSequence.selected] != 0 ) { @@ -1667,7 +1635,6 @@ int main( } } } -#endif numSamplesRead = 0; @@ -2057,11 +2024,7 @@ int main( } } } -#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT if ( ( error = MasaFileWriter_writeFrame( masaWriter, hMetaOutput, NULL ) ) != IVAS_ERR_OK ) /* NULL -> use default metadata delay settings */ -#else - if ( ( error = MasaFileWriter_writeFrame( masaWriter, hMetaOutput ) ) != IVAS_ERR_OK ) -#endif { fprintf( stderr, "\nError writing MASA metadata to file: %s\n", MasaFileWriter_getFilePath( masaWriter ) ); } @@ -2135,13 +2098,11 @@ cleanup: free( bitsBufferData ); } -#ifdef FIX_1053_REVERB_RECONFIGURATION if ( args.aeSequence.count > 0 ) { free( args.aeSequence.pID ); free( args.aeSequence.pValidity ); } -#endif for ( i = 0; i < RENDERER_MAX_MASA_INPUTS; ++i ) { @@ -2609,7 +2570,6 @@ static bool parseLfePositionConfig( return true; } -#ifdef FIX_1053_REVERB_RECONFIGURATION static bool parseAcousticEnvironmentIds( const char *value, AcousticEnvironmentSequence *aeSequence ) @@ -2694,7 +2654,6 @@ static bool parseAcousticEnvironmentIds( return true; } -#endif static bool checkRequiredArgs( @@ -2779,10 +2738,8 @@ static CmdlnArgs defaultArgs( clearString( args.renderConfigFilePath ); clearString( args.externalOrientationFilePath ); -#ifdef FIX_1135_EXT_RENDERER_HANDLES args.Opt_Headrotation = 0; args.Opt_ExternalOrientation = 0; -#endif args.orientation_tracking = IVAS_HEAD_ORIENT_TRK_NONE; @@ -2809,15 +2766,11 @@ static CmdlnArgs defaultArgs( args.directivityPatternId[i] = 65535; } -#ifdef FIX_1053_REVERB_RECONFIGURATION args.aeSequence.count = 0; args.aeSequence.pID = NULL; args.aeSequence.pValidity = NULL; args.aeSequence.selected = 0; args.aeSequence.frameCounter = 0; -#else - args.acousticEnvironmentId = 65535; -#endif return args; } @@ -2877,9 +2830,7 @@ static void parseOption( break; case CmdLnOptionId_trajFile: assert( numOptionValues == 1 ); -#ifdef FIX_1135_EXT_RENDERER_HANDLES args->Opt_Headrotation = 1; -#endif strncpy( args->headRotationFilePath, optionValues[0], RENDERER_MAX_CLI_ARG_LENGTH - 1 ); break; case CmdLnOptionId_outputMetadata: @@ -2900,9 +2851,7 @@ static void parseOption( break; case CmdLnOptionId_exteriorOrientationFile: assert( numOptionValues == 1 ); -#ifdef FIX_1135_EXT_RENDERER_HANDLES args->Opt_ExternalOrientation = 1; -#endif strncpy( args->externalOrientationFilePath, optionValues[0], RENDERER_MAX_CLI_ARG_LENGTH - 1 ); break; case CmdLnOptionId_customHrtfFile: @@ -2993,19 +2942,10 @@ static void parseOption( break; case CmdLnOptionId_acousticEnvironmentId: assert( numOptionValues == 1 ); -#ifdef FIX_1053_REVERB_RECONFIGURATION if ( !parseAcousticEnvironmentIds( optionValues[0], &args->aeSequence ) ) { fprintf( stderr, "Invalid acoustic environment ID specified: %s\n", optionValues[0] ); } -#else - if ( !is_digits_only( optionValues[0] ) ) - { - fprintf( stderr, "Invalid acousting environment ID specified: %s\n", optionValues[0] ); - exit( -1 ); - } - args->acousticEnvironmentId = (int16_t) strtol( optionValues[0], NULL, 10 ); -#endif break; case CmdLnOptionId_syncMdDelay: assert( numOptionValues == 1 ); @@ -3036,12 +2976,10 @@ static CmdlnArgs parseCmdlnArgs( exit( -1 ); /* Error printout handled by failing function */ } -#ifdef FIX_1135_EXT_RENDERER_HANDLES if ( args.outConfig.audioConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || args.outConfig.audioConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { args.Opt_Headrotation = 1; } -#endif return args; } diff --git a/lib_com/basop_util.c b/lib_com/basop_util.c index 2eaa904efa2bbc502bd92405b941b3c964ed9a2a..74fbe8a72be891f68fb75b3fa3eb775ce44a7fd9 100644 --- a/lib_com/basop_util.c +++ b/lib_com/basop_util.c @@ -2123,35 +2123,6 @@ Word32 norm_llQ31( /* o : normalized result Q31 */ return L_sum; } -#ifndef FIX_ISSUE_1817_REPLACE_CARRY_OVERFLOW -/* note: now available in basop_util.h */ -Word32 w_norm_llQ31( Word64 L_sum, Word16 *exp ); -Word32 w_norm_llQ31( /* o : normalized result Q31 */ - Word64 L_sum, /* i : upper and lower bits of accu, unsigned Q31 */ - Word16 *exp /* o : exponent of result in [-32,31] Q0 */ -) -{ - Word32 L_tmp; - Word16 exp_val; - Word64 L64_inp64 = L_sum; - move64(); - - L64_inp64 = W_shl( L64_inp64, 1 ); - exp_val = W_norm( L64_inp64 ); - L64_inp64 = W_shl( L64_inp64, exp_val ); - exp_val = sub( 31, exp_val ); - if ( EQ_64( L_sum, 0 ) ) - { - exp_val = -32; - move16(); - } - *exp = exp_val; - move16(); - - L_tmp = W_extract_h( L64_inp64 ); - return L_tmp; -} -#endif Word32 Dot_product16HQ( /* o : normalized result Q31 */ const Word32 L_off, /* i : initial sum value Qn */ diff --git a/lib_com/basop_util.h b/lib_com/basop_util.h index 0a82d112d46338b3259f53939c4f40407ff980f3..c6ac2a12c3de0e6b01290ee0887226a0463b71a7 100644 --- a/lib_com/basop_util.h +++ b/lib_com/basop_util.h @@ -641,7 +641,6 @@ Word32 norm_llQ31( /* o : normalized result Q31 */ Word16 *exp /* o : exponent of result in [-32,31] Q0 */ ); -#ifdef FIX_ISSUE_1817_REPLACE_CARRY_OVERFLOW /*------------------------------------------------------------------* * w_norm_llQ31: * @@ -656,7 +655,6 @@ static inline Word32 w_norm_llQ31( Word64 L64_var1, Word16 *S_var2 ) /*Q31 - L_t *S_var2 = ( L_result == 0 ) ? -32 : 32 - sh; return L_result; } -#endif /** * \brief Compute dot product of 1 32 bit vectors with itself diff --git a/lib_com/bits_alloc_fx.c b/lib_com/bits_alloc_fx.c index 5a5f881c643250bde289a77c0bca7164f4392ad1..9909f413da13f5b33d3d7ba6306817a812e1c5f5 100644 --- a/lib_com/bits_alloc_fx.c +++ b/lib_com/bits_alloc_fx.c @@ -623,12 +623,9 @@ ivas_error config_acelp1_fx( const Word16 tdm_lp_reuse_flag, /* i : LPC reuse flag (can be 1 only with secondary channel */ const Word16 tdm_low_rate_mode, /* i : secondary channel low rate mode flag */ const Word16 idchan, /* i : stereo channel ID */ -#ifndef NONBE_1325_TD_STEREO_QUANT_LSF_SEC - const Word16 active_cnt, /* i : Active frame counter */ -#endif - const Word16 tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag*/ - const Word16 tdm_LRTD_flag, /* i : LRTD stereo mode flag */ - const Word16 GSC_IVAS_mode /* i : GSC IVAS mode */ + const Word16 tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag*/ + const Word16 tdm_LRTD_flag, /* i : LRTD stereo mode flag */ + const Word16 GSC_IVAS_mode /* i : GSC IVAS mode */ ) { Word16 i, bits, nb_subfr; @@ -808,9 +805,6 @@ ivas_error config_acelp1_fx( test(); test(); -#ifndef NONBE_1325_TD_STEREO_QUANT_LSF_SEC - test(); -#endif IF( !tdm_lp_reuse_flag || idchan == 0 ) { /* LSF Q bit-budget */ @@ -887,11 +881,7 @@ ivas_error config_acelp1_fx( bits = sub( bits, acelp_cfg->mid_lsf_bits ); } -#ifdef NONBE_1325_TD_STEREO_QUANT_LSF_SEC ELSE IF( EQ_16( tdm_lp_reuse_flag, 1 ) && EQ_16( idchan, 1 ) ) -#else - ELSE IF( EQ_16( tdm_lp_reuse_flag, 1 ) && EQ_16( idchan, 1 ) && NE_16( active_cnt, 1 ) ) -#endif { bits = sub( bits, TDM_IC_LSF_PRED_BITS ); } diff --git a/lib_com/common_api_types.h b/lib_com/common_api_types.h index e079a6f752dc0422866d6af4e6e6398176407cb8..66f2c2d740fe37baa18bdaa0dbc548c13b69d867 100644 --- a/lib_com/common_api_types.h +++ b/lib_com/common_api_types.h @@ -315,9 +315,6 @@ typedef enum typedef struct _IVAS_ROOM_ACOUSTICS_CONFIG { -#ifndef FIX_587_DEFAULT_REVERB - Word16 override; -#endif Word16 nBands; /* Number of frequency bands for which reverb properties are provided, integer, range [2..256] */ Word32 pFc_input_fx[IVAS_CLDFB_NO_CHANNELS_MAX]; /*Q16 Center frequencies for which following values are provided: */ Word32 pAcoustic_rt60_fx[IVAS_CLDFB_NO_CHANNELS_MAX]; /*Q26 - The room's T60 per center frequency */ @@ -344,10 +341,8 @@ typedef struct _IVAS_RENDER_CONFIG ISAR_SPLIT_REND_CONFIG_DATA split_rend_config; float directivity[IVAS_MAX_NUM_OBJECTS * 3]; Word16 directivity_fx[IVAS_MAX_NUM_OBJECTS * 3]; // has the following q-factor pattern: {6, 6, 15, 6, 6, 15, 6, 6, 15, 6, 6, 15} -#ifdef CONF_DISTATT float distAtt[3]; Word32 distAtt_fx[3]; /* {Q27, Q30, Q30} */ -#endif } IVAS_RENDER_CONFIG_DATA, *IVAS_RENDER_CONFIG_HANDLE; diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 36be90470456ac81190192b67b33d932ba25e3c8..86bf5d28d283170e66474c769c24b41813c22869 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -147,13 +147,9 @@ typedef enum RENDERER_NON_DIEGETIC_DOWNMIX, RENDERER_OSBA_STEREO, RENDERER_OSBA_AMBI, -#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT RENDERER_OSBA_LS, RENDERER_OMASA_OBJECT_EXT, RENDERER_OMASA_MIX_EXT -#else - RENDERER_OSBA_LS -#endif } RENDERER_TYPE; @@ -216,9 +212,6 @@ typedef enum typedef enum { -#ifndef FIX_1101_CLEANING_JBM_CALL - TC_BUFFER_MODE_NONE = 0, -#endif TC_BUFFER_MODE_RENDERER, TC_BUFFER_MODE_BUFFER } TC_BUFFER_MODE; @@ -273,11 +266,7 @@ typedef enum #define SID_MDCT_STEREO 0x1 /* 1| 0| 0 */ #define SID_ISM 0x2 /* 0| 1| 0 */ #define SID_MASA_1TC 0x3 /* 1| 1| 0 */ -#ifdef FIX_1209_SID_SIGNALING /*reserved*/ /*0x4*/ /* 0| 0| 1 */ -#else -#define SID_MULTICHANNEL 0x4 /* 0| 0| 1 */ -#endif #define SID_SBA_1TC 0x5 /* 1| 0| 1 */ #define SID_SBA_2TC 0x6 /* 0| 1| 1 */ #define SID_MASA_2TC 0x7 /* 1| 1| 1 */ @@ -1569,9 +1558,6 @@ typedef enum typedef enum { IVAS_FILTER_ORDER_1 = 1, -#ifndef NONBE_FIX_MC_LFE_LPF - IVAS_FILTER_ORDER_2 = 2, -#endif IVAS_FILTER_ORDER_4 = 4, } ivas_filter_order; @@ -1617,17 +1603,9 @@ typedef enum /*----------------------------------------------------------------------------------* * Amplitude Panning (EFAP, VBAP) constants *----------------------------------------------------------------------------------*/ -#ifndef FIX_1050_EFAP_ALLOC -#define PANNING_AZI_RESOLUTION 2 -#define PANNING_ELE_RESOLUTION 5 -#endif #define EFAP_MAX_CHAN_NUM 5 /* Maximum number of channels that constitute a polygon, 4 or 5 */ -#ifdef FIX_1050_EFAP_ALLOC #define EFAP_MAX_POLY_SET 54 /* Upper bound on number of polygons; found to be 54 in the worst case for a speaker setup of 16.0 */ -#else -#define EFAP_MAX_POLY_SET 50 /* Upper bound on number of polygons; with a Speaker setup of 16.0, we obtain 44 polygons/triangles in the matlab implementation. */ -#endif #define EFAP_MODE_EFAP 0 /* EFAP Panning */ #define EFAP_MODE_EFIP 1 /* EFIP Panning */ diff --git a/lib_com/ivas_filters_fx.c b/lib_com/ivas_filters_fx.c index fca802cb06af63e0d161c2718138babf609b5c7f..eca54cc55e99e883982da5403341ac6e7f511c67 100644 --- a/lib_com/ivas_filters_fx.c +++ b/lib_com/ivas_filters_fx.c @@ -64,11 +64,7 @@ void ivas_filters_init_fx( test(); -#ifdef NONBE_FIX_MC_LFE_LPF IF( EQ_16( order, IVAS_FILTER_ORDER_1 ) ) -#else - IF( EQ_16( order, IVAS_FILTER_ORDER_2 ) || EQ_16( order, IVAS_FILTER_ORDER_1 ) ) -#endif { filter_state->filt_len = add( order, 1 ); move16(); @@ -170,9 +166,6 @@ void ivas_filter_process_fx( SWITCH( filter_state->order ) { case IVAS_FILTER_ORDER_1: -#ifndef NONBE_FIX_MC_LFE_LPF - case IVAS_FILTER_ORDER_2: -#endif set_val_Word16( pIn_Out_e, sub( Q31, q_factor ), length ); ivas_iir_2_filter_fx( filter_state, pIn_Out_fx, length, IVAS_FILTER_STAGE_0, pIn_Out_e ); /* Scale pIn_Out_fx back to input Q */ @@ -211,9 +204,6 @@ void ivas_filter_process_exp_fx( SWITCH( filter_state->order ) { case IVAS_FILTER_ORDER_1: -#ifndef NONBE_FIX_MC_LFE_LPF - case IVAS_FILTER_ORDER_2: -#endif ivas_iir_2_filter_fx( filter_state, pIn_Out_fx, length, IVAS_FILTER_STAGE_0, pIn_Out_e ); /* Scale pIn_Out_fx back to input Q */ BREAK; diff --git a/lib_com/ivas_lfe_com_fx.c b/lib_com/ivas_lfe_com_fx.c index ba64b517f012fafc043a56b66099a6958b1bbaa3..ab18a00565b8aa1875d935c705af9a556dba86e9 100644 --- a/lib_com/ivas_lfe_com_fx.c +++ b/lib_com/ivas_lfe_com_fx.c @@ -59,24 +59,6 @@ void ivas_lfe_lpf_select_filt_coeff_fx( SWITCH( order ) { -#ifndef NONBE_FIX_MC_LFE_LPF - case IVAS_FILTER_ORDER_2: - SWITCH( sampling_rate ) - { - case 16000: - *ppFilt_coeff_fx = ivas_lpf_2_butter_16k_fx; // Q30 - BREAK; - case 32000: - *ppFilt_coeff_fx = ivas_lpf_2_butter_32k_fx; // Q30 - BREAK; - case 48000: - *ppFilt_coeff_fx = ivas_lpf_2_butter_48k_fx; // Q30 - BREAK; - default: - BREAK; - } - BREAK; -#endif case IVAS_FILTER_ORDER_4: SWITCH( sampling_rate ) { diff --git a/lib_com/ivas_prot_fx.h b/lib_com/ivas_prot_fx.h index f32acd9ad9a21fee510d937b4fe47c11235e5922..b5d06d4b24adf3c01ed191bffb7164b9a624b70c 100644 --- a/lib_com/ivas_prot_fx.h +++ b/lib_com/ivas_prot_fx.h @@ -156,7 +156,6 @@ void ivas_omasa_rearrange_channels_fx( const Word16 output_frame /* i : output frame length per channel */ ); -#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT ivas_error ivas_omasa_combine_separate_ism_with_masa_open_fx( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); @@ -169,11 +168,7 @@ void ivas_omasa_combine_separate_ism_with_masa_fx( const Word16 output_frame /* i : output frame length per channel */ ); -#ifdef FIX_1161_REDUCE_OMASA_HEAP ivas_error ivas_omasa_objects_delay_open_fx( -#else -ivas_error ivas_omasa_render_objects_from_mix_open_fx( -#endif Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); @@ -185,7 +180,6 @@ void ivas_omasa_render_objects_from_mix_fx( Word16 *output_q /* i/o: output Q value */ ); -#endif ivas_error ivas_omasa_ism_metadata_dec_fx( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ @@ -863,11 +857,7 @@ void ivas_lfe_dec_close_fx( ivas_error ivas_create_lfe_dec_fx( LFE_DEC_HANDLE *hLFE_out, /* o : IVAS LFE decoder structure */ const Word32 output_Fs, /* i : output sampling rate */ -#ifdef NONBE_FIX_MC_LFE_LPF const Word32 delay_ns /* i : additional LFE delay to sync other channel outputs */ -#else - const Word32 binauralization_delay_ns /* i : additional LFE delay to sync with binaural renderer */ -#endif ); void ivas_lfe_dec_fx( @@ -893,9 +883,6 @@ void td_stereo_param_updt_fx( const Word16 lsp_old_PCh_fx[], /* i : primary channel old LSPs Q15 */ const Word16 lsf_old_PCh_fx[], /* i : primary channel old LSFs Qlog2(2.56) */ const Word16 pitch_buf_PCh_fx[], /* i : primary channel pitch buffer Q6 */ -#ifndef NONBE_1325_TD_STEREO_QUANT_LSF_SEC - Word16 tdm_lspQ_PCh_fx[], /* o : Q LSPs for primary channel Q15 */ -#endif Word16 tdm_lsfQ_PCh_fx[], /* o : Q LSFs for primary channel Qlog2(2.56) */ Word16 tdm_Pri_pitch_buf_fx[], /* o : pitch values for primary channel Q6 */ const Word16 flag_ACELP16k, /* i : ACELP@16kHz flag */ @@ -2338,9 +2325,7 @@ void ivas_dirac_dec_read_BS_fx( Word16 *nb_bits, /* o : number of bits read */ const Word16 last_bit_pos, /* i : last read bitstream position */ const Word16 hodirac_flag, /* i : flag to indicate HO-DirAC mode */ -#ifdef NONBE_FIX_1052_SBA_EXT const Word16 nchan_transport, /* i : number of transport channels */ -#endif Word16 *dirac_to_spar_md_bands /* o : DirAC->SPAR MD bands */ ); @@ -2501,12 +2486,10 @@ Word16 ivas_sba_get_nchan_metadata_fx( const Word32 ivas_total_brate /* i : IVAS total bitrate */ ); -#ifdef NONBE_FIX_1052_SBA_EXT /*! r: number of bits in SBQ SID frame */ Word16 ivas_sba_spar_sid_bitlen_fx( const Word16 nchan_transport /* i : number of transport channels */ ); -#endif void ivas_sba_get_spar_hoa_ch_ind_fx( const Word16 num_md_chs, /* i : number of MD channels */ @@ -3432,11 +3415,7 @@ void mctStereoIGF_enc_fx( Encoder_State **sts, /* i/o: encoder state structure */ Word32 *orig_spectrum_fx[MCT_MAX_CHANNELS][2], /* i : MDCT spectrum for ITF */ Word16 q_origSpec, /* i : Q for MDCT spectrum */ -#ifdef NONBE_FIX_1097_SBA_DTX_BRATE_SWITCHING_ENC Word32 *powerSpec[MCT_MAX_CHANNELS], /* i/o: MDCT^2 + MDST^2 spectrum,or estimate */ -#else - Word32 powerSpec_fx[MCT_MAX_CHANNELS][L_FRAME48k], /* i/o: MDCT^2 + MDST^2 spectrum,or estimate */ -#endif Word16 q_powerSpec[MCT_MAX_CHANNELS], /* i : Q for powSpec_fx */ Word32 *powerSpecMsInv_fx[MCT_MAX_CHANNELS][NB_DIV], /* i : same as powerSpec_fx but for inverse spect.*/ Word16 *q_powerSpecMsInv[MCT_MAX_CHANNELS][NB_DIV], /* i : Q for powSpecMsInv_fx */ @@ -3523,9 +3502,7 @@ void ivas_qmetadata_enc_sid_encode_fx( BSTR_ENC_HANDLE hMetaData, /* i/o: metadata bitstream handle */ IVAS_QMETADATA *q_metadata, /* i/o: metadata handle */ const Word16 masa_sid_descriptor, /* i : description of MASA SID coding structure*/ -#ifdef NONBE_FIX_1052_SBA_EXT const Word16 nchan_transport, /* i : number of transport channels */ -#endif const Word16 ivas_format /* i : ivas format */ ); void ivas_param_mc_enc_fx( @@ -3640,13 +3617,9 @@ ivas_error ivas_masa_encode_fx( void ivas_write_format_sid_fx( const IVAS_FORMAT ivas_format, /* i : IVAS format */ const Word16 element_mode, /* i : element bitrate */ -#ifdef NONBE_FIX_1052_SBA_EXT_FIX BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ const Word16 sba_order, /* i : Ambisonic (SBA) order */ const Word16 sba_planar /* i : SBA planar flag */ -#else -BSTR_ENC_HANDLE hBstr /* i/o: encoder bitstream handle */ -#endif ); void ivas_write_format_fx( @@ -3914,7 +3887,6 @@ ivas_error ivas_osba_render_sf_fx( Word32 *p_output[] /* o : rendered time signal */ ); -#ifdef NONBE_1894_OSBA_SCALING void ivas_osba_stereo_add_channels_fx( Word32 *tc_fx[], /* i : transport channels */ Word32 *output_fx[], /* i/o: output channels */ @@ -3923,18 +3895,15 @@ void ivas_osba_stereo_add_channels_fx( const Word16 nchan_ism, /* i : number of ISM channels */ const UWord16 n_samples_to_render /* i : output frame length per channel */ ); -#endif void ivas_osba_data_close_fx( SBA_ISM_DATA_HANDLE *hSbaIsmData /* i/o: OSBA rendering handle */ ); -#ifdef NONBE_FIX_ISM_XOVER_BR ISM_MODE ivas_osba_ism_mode_select( const Word32 ivas_total_brate, /* i : IVAS total bitrate */ const Word16 nchan_ism /* i : number of input ISM's */ ); -#endif void ivas_set_ism_importance_interformat_fx( const Word32 ism_total_brate, /* i/o: ISms total bitrate */ @@ -5887,9 +5856,7 @@ ivas_error ivas_dirac_enc_fx( const Word16 input_frame, /* i : input frame length */ const Word16 dtx_vad, /* i : DTX vad flag */ const IVAS_FORMAT ivas_format, /* i : ivas format */ -#ifdef NONBE_FIX_1052_SBA_EXT const Word16 nchan_transport, /* i : number of transport channels */ -#endif const Word16 hodirac_flag, /* i : hodirac flag */ const Word16 shift ); diff --git a/lib_com/ivas_rom_com.c b/lib_com/ivas_rom_com.c index 4441f3342bba7ceee66369f996acdc90c7736048..64fe2ba376bd9cb9577f0a08163b8bfdebc2b646 100644 --- a/lib_com/ivas_rom_com.c +++ b/lib_com/ivas_rom_com.c @@ -1737,15 +1737,6 @@ const Word32 ivas_param_mc_dmx_fac_CICP19_3tc_fx[36] = 0,0,2147483647,2147483647,0,0,0,0,0,0,0,0 /*Ct*/ }; -#ifndef FIX_1157_OBSOLETE_DMX_TABLE -const Word32 ivas_param_mc_dmx_fac_CICP19_4tc_fx[48] = -{ - 2147483647,0,1518500224,1518500224,2147483647,0,2147483647,0,0,0,0,0, /*Lht*/ - 0,2147483647,1518500224,1518500224,0,2147483647,0,2147483647,0,0,0,0, /*Rht*/ - 0,0,0,0,0,0,0,0,2147483647,0,2147483647,0, /*Lut*/ - 0,0,0,0,0,0,0,0,0,2147483647,0,2147483647 /*Rut*/ -}; -#endif //Q15 const Word16 ivas_param_mc_ild_fac_CICP6_2tc_fx[6] = @@ -2329,13 +2320,11 @@ const UWord16 ivas_param_mc_sym_freq_ild_delta_combined_48_16bits[2 * PARAM_MC_S *----------------------------------------------------------------------------------*/ -#ifdef FIX_1121_MASA_DESCRIPTOR const UWord8 ivasmasaFormatDescriptor[8] = { 0x49, 0x56, 0x41, 0x53, 0x4D, 0x41, 0x53, 0x41 /* "IVASMASA" */ }; -#endif const Word64 diffuseness_reconstructions_hr_fx[HR_MASA_ER_LEVELS] = { /* Q62 */ 0, 65865144550293504, @@ -2594,9 +2583,7 @@ const Word16 ivas_lfe_num_dct_pass_bins_tbl[IVAS_LFE_NUM_COEFFS_IN_SUBGRP] = { 8 const Word16 ivas_lfe_min_shift_tbl[IVAS_LFE_NUM_COEFFS_IN_SUBGRP] = { 1, 0 }; const Word16 ivas_lfe_lpf_delay_Q15[2] = { 57, 114 }; -#ifdef NONBE_FIX_MC_LFE_LPF const Word32 ivas_lfe_lpf_delay_ns[2] = { 1750000, 3500000 }; -#endif const Word16 dirac_gains_P_idx[16] = { diff --git a/lib_com/ivas_rom_com.h b/lib_com/ivas_rom_com.h index 51529369318c99f16bcf41e2afbd7774ed905d78..8233a647c53741f33e3168e92101091f101ffa93 100644 --- a/lib_com/ivas_rom_com.h +++ b/lib_com/ivas_rom_com.h @@ -225,10 +225,8 @@ extern const UWord16 ivas_param_mc_sym_freq_icc_delta_combined_48_16bits[2 * PAR * MASA ROM tables *----------------------------------------------------------------------------------*/ -#ifdef FIX_1121_MASA_DESCRIPTOR extern const UWord8 ivasmasaFormatDescriptor[8]; /* "IVASMASA" */ -#endif extern const Word16 bits_direction_masa[DIRAC_DIFFUSE_LEVELS]; extern const Word16 no_theta_masa[NO_SPHERICAL_GRIDS - 2]; extern const Word16 no_phi_masa[NO_SPHERICAL_GRIDS][MAX_NO_THETA]; @@ -283,9 +281,7 @@ extern const Word16 ivas_lfe_num_dct_pass_bins_tbl[IVAS_LFE_NUM_COEFFS_IN_SUBGRP extern const Word16 ivas_lfe_min_shift_tbl[IVAS_LFE_NUM_COEFFS_IN_SUBGRP]; extern const ivas_lfe_freq_models ivas_str_lfe_freq_models; extern const Word16 ivas_lfe_lpf_delay_Q15[2]; -#ifdef NONBE_FIX_MC_LFE_LPF extern const Word32 ivas_lfe_lpf_delay_ns[2]; -#endif extern const Word16 dirac_gains_P_idx[16]; diff --git a/lib_com/ivas_rom_com_fx.c b/lib_com/ivas_rom_com_fx.c index 1f51c6a6ba51995f7f0ad3c95a7c355f7df0769e..58c8444f82467c71cd4ac94a9b2b517b73d3c72d 100644 --- a/lib_com/ivas_rom_com_fx.c +++ b/lib_com/ivas_rom_com_fx.c @@ -1807,20 +1807,6 @@ const Word16 ivas_lpf_4_butter_48k_sos_e[IVAS_BIQUAD_FILT_LEN << 2] = { -27, -26, -27, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; -#ifndef NONBE_FIX_MC_LFE_LPF -const Word32 ivas_lpf_2_butter_16k_fx[IVAS_BIQUAD_FILT_LEN << 1] = { /* Q30 */ - 0xa4d0c, 0x149a17, 0xa4d0c, 0x40000000, 0x849e6300, 0x3b8ad140 -}; - -const Word32 ivas_lpf_2_butter_32k_fx[IVAS_BIQUAD_FILT_LEN << 1] = { /* Q30 */ - // 0x53e1a, 0x29f0d, 0x40000000, 0x824f6000, 0x3dbb1c80, 0x29f0d - 0x29F0D, 0x53E1A, 0x29F0D, 0x40000000, 0x824F5FC3, 0x3DBB1C71 -}; - -const Word32 ivas_lpf_2_butter_48k_fx[IVAS_BIQUAD_FILT_LEN << 1] = { /* Q30 */ - 0x12c07, 0x2580d, 0x12c07, 0x40000000, 0x818a4580, 0x3e7a6a80 -}; -#endif const Word32 ivas_lfe_window_coeff_48k_fx[IVAS_LFE_FADE_LEN_48K] = { // Q31 0x0003a373, 0x000608f6, 0x000888a7, 0x000b3e1b, 0x000e34f1, 0x001174a2, 0x00150328, 0x0018e5e1, 0x001d21eb, 0x0021bc4d, 0x0026ba09, 0x002c202f, 0x0031f3dc, 0x00383a43, 0x003ef8ad, 0x0046347b, 0x004df325, 0x00563a3f, 0x005f0f74, 0x00687888, 0x00727b59, 0x007d1ddb, 0x0088661c, 0x00945a41, 0x00a10087, 0x00ae5f3d, 0x00bc7ccd, 0x00cb5fb3, 0x00db0e7d, 0x00eb8fd0, 0x00fcea61, 0x010f24f8, 0x0122466a, 0x013655a0, 0x014b598e, 0x01615936, 0x01785ba8, 0x01906800, 0x01a9855e, 0x01c3baf0, 0x01df0fee, 0x01fb8b90, 0x02193514, 0x023813c4, 0x02582ee4, 0x02798db8, 0x029c378c, 0x02c033a4, 0x02e58944, 0x030c3fa8, 0x03345e0c, 0x035deba0, 0x0388ef8c, 0x03b570f0, 0x03e376dc, 0x04130858, 0x04442c58, 0x0476e9b8, 0x04ab4760, 0x04e14c00, 0x0518fe48, 0x055264c8, 0x058d8600, 0x05ca6850, 0x06091200, 0x06498930, 0x068bd3f0, 0x06cff830, 0x0715fba8, 0x075de408, 0x07a7b6c8, 0x07f37940, 0x084130a0, 0x0890e200, 0x08e29220, 0x093645c0, 0x098c0150, 0x09e3c940, 0x0a3da180, 0x0a998e30, 0x0af792e0, 0x0b57b320, 0x0bb9f240, 0x0c1e5360, 0x0c84d940, 0x0ced8690, 0x0d585dc0, 0x0dc560f0, 0x0e349200, 0x0ea5f2b0, 0x0f198450, 0x0f8f4820, 0x10073f00, 0x10816980, 0x10fdc840, 0x117c5b00, 0x11fd21e0, 0x12801c60, 0x130549a0, 0x138ca8c0, 0x14163880, 0x14a1f740, 0x152fe320, 0x15bffa00, 0x16523980, 0x16e69ee0, 0x177d2700, 0x1815cec0, 0x18b09260, 0x194d6e00, 0x19ec5d60, 0x1a8d5c20, 0x1b306580, 0x1bd57440, 0x1c7c8300, 0x1d258c40, 0x1dd08a00, 0x1e7d7600, 0x1f2c49a0, 0x1fdcfe20, 0x208f8c40, 0x2143ed00, 0x21fa1840, 0x22b20680, 0x236baf40, 0x24270a00, 0x24e40e00, 0x25a2b280, 0x2662ee00, 0x2724b700, 0x27e80400, 0x28acca80, 0x297300c0, 0x2a3a9c00, 0x2b039180, 0x2bcdd680, 0x2c995fc0, 0x2d6621c0, 0x2e341140, 0x2f032240, 0x2fd34900, 0x30a47900, 0x3176a640, 0x3249c440, 0x331dc600, 0x33f29f40, 0x34c842c0, 0x359ea340, 0x3675b3c0, 0x374d66c0, 0x3825af00, 0x38fe7ec0, 0x39d7c880, 0x3ab17e40, 0x3b8b9240, 0x3c65f6c0, 0x3d409d80, 0x3e1b7880, 0x3ef679c0, 0x3fd19340, 0x40acb680, 0x4187d580, 0x4262e280, 0x433dce80, 0x44188c00, 0x44f30c80, 0x45cd4180, 0x46a71e00, 0x47809300, 0x48599300, 0x49320f80, 0x4a09fb80, 0x4ae14880, 0x4bb7e900, 0x4c8dcf80, 0x4d62ee80, 0x4e373880, 0x4f0aa080, 0x4fdd1900, 0x50ae9600, 0x517f0980, 0x524e6780, 0x531ca380, 0x53e9b100, 0x54b58400, 0x55801080, 0x56494b00, 0x57112800, 0x57d79c00, 0x589c9c00, 0x59601d00, 0x5a221480, 0x5ae27880, 0x5ba13e00, 0x5c5e5c00, 0x5d19c880, 0x5dd37a80, 0x5e8b6800, 0x5f418980, 0x5ff5d580, 0x60a84480, 0x6158ce00, 0x62076a80, 0x62b41280, 0x635ebf80, 0x64076a80, 0x64ae0d00, 0x6552a100, 0x65f52080, 0x66958680, 0x6733cd00, 0x67cff000, 0x6869ea80, 0x6901b880, 0x69975600, 0x6a2abf80, 0x6abbf200, 0x6b4aea80, 0x6bd7a680, 0x6c622300, 0x6cea5f80, 0x6d705900, 0x6df40f00, 0x6e758080, 0x6ef4ac80, 0x6f719300, 0x6fec3380, 0x70648f00, 0x70daa580, 0x714e7880, 0x71c00880, 0x722f5780, 0x729c6700, 0x73073980, 0x736fd100, 0x73d62f80, 0x743a5900, 0x749c5080, 0x74fc1880, 0x7559b600, 0x75b52b80, 0x760e7e80, 0x7665b280, 0x76bacc80, 0x770dd180, 0x775ec600, 0x77adb000, 0x77fa9480, 0x78457900, 0x788e6400, 0x78d55b80, 0x791a6500, 0x795d8780, 0x799ec900, 0x79de3100, 0x7a1bc580, 0x7a578d80, 0x7a919100, 0x7ac9d600, 0x7b006500, 0x7b354400, 0x7b687b80, 0x7b9a1300, 0x7bca1180, 0x7bf87f80, 0x7c256400, 0x7c50c780, 0x7c7ab180, 0x7ca32a00, 0x7cca3900, 0x7cefe600, 0x7d143900, 0x7d373a80, 0x7d58f280, 0x7d796800, 0x7d98a380, 0x7db6ad00, 0x7dd38c80, 0x7def4900, 0x7e09eb00, 0x7e237a00, 0x7e3bfd80, 0x7e537d80, 0x7e6a0180, 0x7e7f9080, 0x7e943200, 0x7ea7ed80, 0x7ebaca00, 0x7ecccf00, 0x7ede0300, 0x7eee6d00, 0x7efe1400, 0x7f0cfe80, 0x7f1b3380, 0x7f28b900, 0x7f359500, 0x7f41ce80, 0x7f4d6b80, 0x7f587180, 0x7f62e680, 0x7f6cd000, 0x7f763400, 0x7f7f1780, 0x7f878080, 0x7f8f7380, 0x7f96f580, 0x7f9e0b80, 0x7fa4bb00, 0x7fab0780, 0x7fb0f600, 0x7fb68b00, 0x7fbbca00, 0x7fc0b800, 0x7fc55880, 0x7fc9af80, 0x7fcdc080, 0x7fd18f00, 0x7fd51e80, 0x7fd87280, 0x7fdb8d80, 0x7fde7380, 0x7fe12700, 0x7fe3aa80, 0x7fe60100, 0x7fe82d00, 0x7fea3180, 0x7fec1000, 0x7fedcb00, 0x7fef6500, 0x7ff0e000, 0x7ff23e00, 0x7ff38080, 0x7ff4a980, 0x7ff5ba80, 0x7ff6b580, 0x7ff79c00, 0x7ff86e80, 0x7ff92f80, 0x7ff9e000, 0x7ffa8100, 0x7ffb1380, 0x7ffb9880, 0x7ffc1180, 0x7ffc7f80, 0x7ffce300, 0x7ffd3c80, 0x7ffd8d80, 0x7ffdd680, 0x7ffe1880, 0x7ffe5300, 0x7ffe8800, 0x7ffeb700, 0x7ffee100, 0x7fff0600, 0x7fff2700, 0x7fff4480, 0x7fff5e80, 0x7fff7500, 0x7fff8900, 0x7fff9a80, 0x7fffaa00, 0x7fffb780, 0x7fffc300, 0x7fffcd00, 0x7fffd580, 0x7fffdc80, 0x7fffe300, 0x7fffe880, 0x7fffec80, 0x7ffff080, 0x7ffff380, 0x7ffff680, 0x7ffff880, 0x7ffffa00, 0x7ffffb80, 0x7ffffc80, 0x7ffffd80, 0x7ffffe80, 0x7fffff00, 0x7fffff00, 0x7fffff80, 0x7fffff80, 0x7fffffff, 0x7fffffff diff --git a/lib_com/ivas_rom_com_fx.h b/lib_com/ivas_rom_com_fx.h index 4b3b36dfafeba1df2b87ef99c1725a4174c89864..072b6ccffb1c75bcd7844f619f645c68e808b9a9 100644 --- a/lib_com/ivas_rom_com_fx.h +++ b/lib_com/ivas_rom_com_fx.h @@ -219,11 +219,6 @@ extern const Word32 ivas_lpf_4_butter_32k_sos_fx[IVAS_BIQUAD_FILT_LEN << 2]; extern const Word16 ivas_lpf_4_butter_32k_sos_e[IVAS_BIQUAD_FILT_LEN << 2]; extern const Word32 ivas_lpf_4_butter_48k_sos_fx[IVAS_BIQUAD_FILT_LEN << 2]; extern const Word16 ivas_lpf_4_butter_48k_sos_e[IVAS_BIQUAD_FILT_LEN << 2]; -#ifndef NONBE_FIX_MC_LFE_LPF -extern const Word32 ivas_lpf_2_butter_16k_fx[IVAS_BIQUAD_FILT_LEN << 1]; -extern const Word32 ivas_lpf_2_butter_32k_fx[IVAS_BIQUAD_FILT_LEN << 1]; -extern const Word32 ivas_lpf_2_butter_48k_fx[IVAS_BIQUAD_FILT_LEN << 1]; -#endif extern const Word32 ivas_lfe_window_coeff_48k_fx[IVAS_LFE_FADE_LEN_48K]; // Q31 extern const Word32 ivas_lfe_window_coeff_32k_fx[IVAS_LFE_FADE_LEN_32K]; // Q31 diff --git a/lib_com/ivas_sba_config_fx.c b/lib_com/ivas_sba_config_fx.c index bce2be80cd35cafd16349f7f39638dd6a12f6ba9..4caa22da2a0b258d80f3dcc3068db56af2c80911 100644 --- a/lib_com/ivas_sba_config_fx.c +++ b/lib_com/ivas_sba_config_fx.c @@ -167,7 +167,6 @@ Word16 ivas_sba_get_nchan_fx( } -#ifdef NONBE_FIX_1052_SBA_EXT /*-------------------------------------------------------------------* * ivas_sba_spar_sid_bitlen_fx() * @@ -189,7 +188,6 @@ Word16 ivas_sba_spar_sid_bitlen_fx( return num_bits; } -#endif /*-------------------------------------------------------------------* diff --git a/lib_com/ivas_spar_com_fx.c b/lib_com/ivas_spar_com_fx.c index b0a78848cdd34556cc6474977d4d07a7911713f3..0f93bf4d9351d8c919ab812c02e1a8b08337ec71 100644 --- a/lib_com/ivas_spar_com_fx.c +++ b/lib_com/ivas_spar_com_fx.c @@ -802,11 +802,7 @@ static void ivas_get_pred_coeffs_enc_fx( tmp64 = W_mult0_32_32( w_norm_fac, dm_w ); // Q=q_tmp IF( LT_16( q_tmp, q_cov_real[0][0][b] ) ) { -#ifdef FIX_ISSUE_1811_EXCEEDING_W_SHIFTS tmp64 = W_shr( tmp64, s_min( 63, sub( q_cov_real[0][0][b], q_tmp ) ) ); // Q=q_tmp -#else - tmp64 = W_shr( tmp64, sub( q_cov_real[0][0][b], q_tmp ) ); // Q=q_tmp -#endif } ELSE { diff --git a/lib_com/ivas_stereo_td_bit_alloc_fx.c b/lib_com/ivas_stereo_td_bit_alloc_fx.c index 27732e3a2fa8d111443feed4caef58c48b5b979f..149339c61da0d3560930e0f6650eb3b90cdab169 100644 --- a/lib_com/ivas_stereo_td_bit_alloc_fx.c +++ b/lib_com/ivas_stereo_td_bit_alloc_fx.c @@ -555,12 +555,9 @@ return; *-------------------------------------------------------------------*/ void td_stereo_param_updt_fx( - const Word16 lsp_old_PCh_fx[], /* i : primary channel old LSPs Q15 */ - const Word16 lsf_old_PCh_fx[], /* i : primary channel old LSFs Qlog2(2.56) */ - const Word16 pitch_buf_PCh_fx[], /* i : primary channel pitch buffer Q6 */ -#ifndef NONBE_1325_TD_STEREO_QUANT_LSF_SEC - Word16 tdm_lspQ_PCh_fx[], /* o : Q LSPs for primary channel Q15 */ -#endif + const Word16 lsp_old_PCh_fx[], /* i : primary channel old LSPs Q15 */ + const Word16 lsf_old_PCh_fx[], /* i : primary channel old LSFs Qlog2(2.56) */ + const Word16 pitch_buf_PCh_fx[], /* i : primary channel pitch buffer Q6 */ Word16 tdm_lsfQ_PCh_fx[], /* o : Q LSFs for primary channel Qlog2(2.56) */ Word16 tdm_Pri_pitch_buf_fx[], /* o : pitch values for primary channel Q6 */ const Word16 flag_ACELP16k, /* i : ACELP@16kHz flag Q0*/ @@ -574,56 +571,16 @@ void td_stereo_param_updt_fx( { /*not being assert*/ Copy( IAWB_Ave_fx, tdm_lsfQ_PCh_fx, M ); /*Qlog2(2.56)*/ -#ifndef NONBE_1325_TD_STEREO_QUANT_LSF_SEC - -#ifdef FIX_1111_TDM_LSP_BUFFER - IF( tdm_lspQ_PCh_fx != NULL ) - { - lsf2lsp_fx( tdm_lsfQ_PCh_fx, tdm_lspQ_PCh_fx, M, INT_FS_12k8 ); - } -#else - lsf2lsp_fx( tdm_lsfQ_PCh_fx, tdm_lspQ_PCh_fx, M, INT_FS_12k8 ); -#endif -#endif } ELSE IF( EQ_16( flag_ACELP16k, 1 ) ) { -#ifdef FIX_1111_TDM_LSP_BUFFER -#ifndef NONBE_1325_TD_STEREO_QUANT_LSF_SEC - IF( tdm_lspQ_PCh_fx != NULL ) - { - Copy( lsp_old_PCh_fx, tdm_lspQ_PCh_fx, M ); /*Q15*/ - lsp_convert_poly_fx( tdm_lspQ_PCh_fx, L_FRAME, 0 ); - lsp2lsf_fx( tdm_lspQ_PCh_fx, tdm_lsfQ_PCh_fx, M, INT_FS_12k8 ); - } - ELSE - { -#endif - Word16 lsp_temp[M]; - Copy( lsp_old_PCh_fx, lsp_temp, M ); /*Q15*/ - lsp_convert_poly_fx( lsp_temp, L_FRAME, 0 ); - lsp2lsf_fx( lsp_temp, tdm_lsfQ_PCh_fx, M, INT_FS_12k8 ); -#ifndef NONBE_1325_TD_STEREO_QUANT_LSF_SEC - } -#endif -#else - Copy( lsp_old_PCh_fx, tdm_lspQ_PCh_fx, M ); /*Q15*/ - lsp_convert_poly_fx( tdm_lspQ_PCh_fx, L_FRAME, 0 ); - lsp2lsf_fx( tdm_lspQ_PCh_fx, tdm_lsfQ_PCh_fx, M, INT_FS_12k8 ); -#endif + Word16 lsp_temp[M]; + Copy( lsp_old_PCh_fx, lsp_temp, M ); /*Q15*/ + lsp_convert_poly_fx( lsp_temp, L_FRAME, 0 ); + lsp2lsf_fx( lsp_temp, tdm_lsfQ_PCh_fx, M, INT_FS_12k8 ); } ELSE { -#ifndef NONBE_1325_TD_STEREO_QUANT_LSF_SEC -#ifdef FIX_1111_TDM_LSP_BUFFER - IF( tdm_lspQ_PCh_fx != NULL ) - { - Copy( lsp_old_PCh_fx, tdm_lspQ_PCh_fx, M ); /*Q15*/ - } -#else - Copy( lsp_old_PCh_fx, tdm_lspQ_PCh_fx, M ); /*Q15*/ -#endif -#endif Copy( lsf_old_PCh_fx, tdm_lsfQ_PCh_fx, M ); /*Qlog2(2.56)*/ } diff --git a/lib_com/options.h b/lib_com/options.h index 1f13605df5ef6728cb0237f23fa0e39d265278da..a9942fd3966c033c1eafdd4e4eae478be22959c7 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -73,112 +73,15 @@ /* Note: each compile switch (FIX_1101_...) is independent from the other ones */ -#define ISSUE_1796_replace_shl_o /* FhG: replace shl_ro by overflow-free alternatives - BE*/ #define ISSUE_1836_replace_overflow_libcom /* FhG: replace overflow operators by non-overflow-alternatives in lib_com - BE */ -#define ISSUE_1836_replace_overflow_libcom__remnant /* FhG: replace remaining overflow operators by non-overflow-alternatives in lib_com - BE */ -#define ISSUE_1866_replace_overflow_libdec /* FhG: BE - Replace BASOPoverflow operators all over the lib_dec module if Overflow result is not used */ - -#define FIX_1917_DIRAC_RENDER_PTR_INCR /* FhG: fix wrong pointer increment in ivas_dirac_dec_render_sf_fx() for object rendering */ -#define FIX_CDLFB_BUFFER_SCALING /* FhG: fix wrong buffer scaling in ivas_dirac_dec_render_sf_fx() for object rendering */ -#define FIX_ISSUE_1817_REPLACE_CARRY_OVERFLOW /* FhG: bit-exact, replace carry and overflow operations by 64-bit operations, MR 1931 */ -#define NONBE_SVD_OPTIMIZATION /* FhG: reduce WMOPS of HouseHolderReduction() in ivas_svd_dec.c() by removing redundant mathematics and using 64 bit additions */ -#define FIX_1766_TCX2ACELP_BWE_ISSUE /* VA : Fix rare BWE issue when switching from TCX to ACELP */ -#define FIX_1781_SPECTRAL_GAPS /* FhG: Change internal calculation of tcx_noise_factor_ivas_fx() to 32-bit*/ -#define FIX_ISSUE_1811_EXCEEDING_W_SHIFTS /* FhG: limit exceeding 64bit shifts */ -#define FIX_1843_IO_QFACTOR_INIT /* FhG: initialize CRend's io_qfactor also in IVAS_rend */ - - -#define FIX_1931_BIN_COHR_CROSS_MIX /* FhG: correct binauralCoherenceCrossmixGains_fx calculation */ -#define FIX_1939_REVERB_DMX_OUT_Q /*Dlb: output correct q factor for the reverb dmx function*/ - -#define EVS_BE_REUSAGE -#ifdef EVS_BE_REUSAGE -#define REUSE_EVS_BE_ACELP_LP_FILT -#define REUSE_EVS_BE_ACELP_4T64 -#define REUSE_EVS_BE_ACELP_2t32 -#define REUSE_EVS_BE_ACELP_1t64 -#define REUSE_EVS_BE_ACELP_AVQ -#define REUSE_EVS_BE_GAUSS -#define REUSE_EVS_BE_GAINQ -#define REUSE_EVS_BE_ACELP_PITCH -#define REUSE_EVS_BE_ACELP_PITCH_PIT_Q -#define REUSE_EVS_BE_GAINQ_LBR // BE by adding one condition, but could be harmonized in a non-BE way. There is a small difference in how Etot is computed - -#endif - -#define FIX_ISSUE_1817_REPLACE_CARRY_OVERFLOW /* FhG: bit-exact, replace carry and overflow operations by 64-bit operations, MR 1931 */ -#define FIX_1844_MISSING_FREE /* FhG: add missing free in ivas_binRenderer_convModuleClose_fx() */ -#define FIX_1942_ASSERTION_LOWSHELF /* FhG: Modified the target_gains_db_fx calculation in compute_t60_coeffs_fx() */ -#define FIX_1944_CRASH_FOR_STEREO /* FhG: improve TonalMDCTConceal_InsertNoise calculation precision */ +#define FIX_1942_ASSERTION_LOWSHELF /* FhG: Modified the target_gains_db_fx calculation in compute_t60_coeffs_fx() */ +#define FIX_1944_CRASH_FOR_STEREO /* FhG: improve TonalMDCTConceal_InsertNoise calculation precision */ #define FIX_1970_SBA_CRASH /* Dlb: Fix for issue 1970, SBA crash */ /* #################### Start BASOP porting switches ############################ */ -#define FIX_1372_ISAR_POST_REND -#define NONBE_FIX_984_OMASA_EXT_OUTPUT /* Nokia: issue #984: complete the OMASA EXT output implementation */ -#define FIX_1161_REDUCE_OMASA_HEAP /* VA: reduction of OMASA heap memory */ -#define USE_NEW_HRTF_BINARY_FILE_FORMAT /* Orange: to activate when decided to change the hrtf binary file format */ -#define FIX_WARNING_RENDER_CONFIG /* Orange: fix warning on windows build */ -#define FIX_1052_EXT_OUTPUT /* VA: issue 1052: define EXT decoder output configuration for stereo and MC formats */ -#define NONBE_1215_FIX_JBM_MAX_SCALING /* FhG: issue 1215: Fix assert hit in a specific VoIP decoder config. Caused by integer overflow in max scaling calculation. */ -#define NONBE_FIX_991_PARAMBIN_BINARY_HRTF /* Nokia: issue #991: fix using of binary file HRTF in ParamBin (to activate when USE_NEW_HRTF_BINARY_FILE_FORMAT and FIX_777_COMBI_RENDER_CONFIG_FILE are on ) */ -#define FIX_1050_EFAP_ALLOC /* FhG: issue 1050: reduction of memory allocated to EFAP handle */ -#define NONBE_FIX_1091_PMC_LOW_SIGNAL_BURSTS /* FhG: fix for #1091, fix limit calculation for the regularized inverse of Kx to avoid bursts in very low signals */ -#define NONBE_FIX_1070_USAN_SEGFAULT_MC_TO_BIN_BTSW_HEADROT /* fix 1070 USAN: nullptr-with-offset and Segfaults in 7_1_4 to BINAURAL and BINAURAL_ROOM_REVERB decoding with bitrate switching and head rotation*/ -#define LC3PLUS_LEA_COMPAT_BITRATES_48_6 /* FhG: treat split-rendering 256kbps lc3plus 10ms 0dof bitrate as sentinel value for LEA compatible 48_6 bitrate (124 kbps per channel) */ -#define NONBE_FIX_ISM_XOVER_BR /* FhG: issue 1072: select OSBA coding method depending on number of object and bitrate */ -#define FIX_1053_REVERB_RECONFIGURATION /* Philips: issue 1053: fix for dynamic switching of acoustic environment */ -#define CONF_DISTATT /* Eri: Make distance attenuation configurable */ -#define FIX_1068_ASAN_IN_MC_2_BINAURAL_ROOM_IR /* issue 1068 : Memory leak in MC to BINAURAL_ROOM decoding with bitrate switching*/ -#define NONBE_FIX_1052_SBA_EXT /* Dlb: SBA external output support */ -#define NONBE_FIX_MC_LFE_LPF /* Dlb: Adding the LFE LPF filter back for MC content. */ -#define FIX_1158_FASTCONV_REVERB_HRTF /* Philips: issue 1158: Rendering with FastConv to BINAURAL_ROOM_REVERB uses BRIR convolution instead of HRTF */ -#define NONBE_FIX_1096_NAN_VALUES_IN_DIRAC_TO_STEREO /* FhG: avoid sidegain DFT-Stereo param to be larger than 1 when converting from Dirac parameters */ -#define NONBE_FIX_1074_NOBJ_SIGNAL_OMASA_LBR /* Nok: issue 1074 fixing number of objects signaling in OMASA low rate */ -#define FIX_1222_OMASA_DEC_CHANNEL_BUFFERS /* VA: issue 1222: Reduction of the number of channel buffers in OMASA decoder */ -#define NONBE_FIX_1130_DIV_ZERO_LEV_DUR /* VA: issue 1130: avoid div by zero in L-D by thresholding R[0] to a min value of 100.0 */ -#define FIX_1111_TDM_LSP_BUFFER /* VA: issue 1111: remove unused buffer `tdm_lspQ_PCh[]' */ -#define FIX_1157_OBSOLETE_DMX_TABLE /* FhG: remove obsolte ParamMC DMX table ivas_param_mc_dmx_fac_CICP19_4tc[] */ -#define NONBE_1325_TD_STEREO_QUANT_LSF_SEC /* Nokia: issue 1325: fix for usage of active_cnt variable in TD stereo LSFQ */ -#define NONBE_1329_FIX_OSBA_CRASH /* FhG: issue 1329: prevent assert when bit budget is low*/ -#define NONBE_FIX_1128_OSBA_EXT_OUTPUT_ORDER /* FhG: issue 1128: set output ambisonics order to input order for EXT output */ -#define FIX_1138_SBA_EXT_ERROR_PRINTOUT /* VA: issue 1138: Fix SBA EXT output call of audioCfg2channels() */ #define NONBE_1244_FIX_SWB_BWE_MEMORY /* VA: issue 1244: fix to SWB BWE memory in case of switching from FB coding - pending a review by Huawei */ -#define FIX_745_FIX_DATA_TYPE_CONVERSION /* VA: issue 745: implicit data type conversion when calling IVAS_DEC_Configure() */ -#define NONBE_FIX_981_PARAMBIN_DEFAULT_EARLY_PART /* Nokia: Set default early part energy correction to unity for BINAURAL_ROOM_REVERB */ -#define NONBE_FIX_1174_MCMASA_LBR_LOOP_ERROR /* Nokia: Fix issue 1174 by removing the unnecessary inner loop causing problems. */ -#define FIX_587_DEFAULT_REVERB /* Philips: issue 587: inconsistent default reverb parameters across renderers */ -#define NONBE_FIX_1097_SBA_DTX_BRATE_SWITCHING_ENC /* FhG: fix out-of-bound errors when switching from SID frame to active frame*/ -#define NONBE_FIX_1052_SBA_EXT_FIX /* VA: SBA external output support fix - do not overwrite "output_config" parameter */ - #define FIX_1129_EXT_REND_OUTPUT_HIGH /* Philips: issue 1129: External renderer BINAURAL_ROOM_REVERB format output level too high compared to internal rendering output */ -#define NONBE_1289_STEREO_SW_TO_MONO /* VA: issue 1289: Fix glitch when stereo signal is decoded to mono n TD->DFT switching */ -#define NONBE_FIX_1196_TD_HEADTRACKING_INTERPOLATION /* Ericsson: Issue 1196, Always apply filter interpolation for each subframe */ -#define NONBE_FIX_1110_STEREO_DTX_BRATE_SWITCHING /* VA: issue 1110: fix encoder crash in the stereo DTX bitrate switching condition */ -#define FIX_1099_JBM_MD_HANDLE_ALLOC /* VA: issue 1099: Limit the allocation of `hJbmMetadata` handle to MASA and OMASA only */ -#define FIX_1121_MASA_DESCRIPTOR /* VA: issue 1121: Define 'ivasmasaFormatDescriptor' at one common place */ -#define NONBE_1894_OSBA_SCALING /* FhG: do not scale OSBA inputs by 0.5 any more */ -#define NONBE_FIX_1141_OSBA_ROOM_RENDERING /* FhG: Fix for issue 1141: render objects in OSBA decoder with room effect */ -#define NONBE_1360_LFE_DELAY /* Dlb: LFE delay alignment when rendering in CLDFB domain*/ -#define NONBE_1229_FIX_ISM1_DPID /* Eri: issue 1229: fix bug causing ISM 1 to use default -dpid instead of the specified one */ -#define FIX_1135_EXT_RENDERER_HANDLES /* VA: issue 1135: Memory usage reduction in external renderer: Allocate only handles that are really needed. */ -#define FIX_1209_SID_SIGNALING /* VA: issue 1209: remove dead code in IVAS SID signaling */ -#define NONBE_1250_MCMASA_LS_OUTPUT /* VA: issue 1250: fix crash in McMASA to custom LS output decoding */ -#define NONBE_FIX_1176_OSBA_REVERB_JBM_ASAN_ERROR /* Ericsson: Issue 1176, fix in TDREND_firfilt for subframes shorter than the filter length */ -#define NONBE_1131_ACELP_OOB /* VA: issue 1131: fix division-by-zero in acelp gain decoding caused by wrong length of buffer update when switching from HQ core to ACELP core */ -#define NONBE_1240_FIX_CORE_SELECTION_ISM_SW /* VA: issue 1240: Remove the forcing of the TCX core in ISM when switching from a high bitarte to a low one */ -#define FIX_1101_CLEANING_JBM_CALL /* VA: issue 1101: remove obsolete call of ivas_jbm_dec_tc_buffer_open() */ -#define FIX_VOIP_FUNCTIONS /* VA: fix data type mismatch in IVAS_DEC_VoIP_SetScale() + add sanity checks to API functions */ -#define FIX_1298_MEMORY_OPT_IVAS_CORE_ENC /* VA: issue 1298: Memory saving in ivas_core_enc() */ -#define NONBE_FIX_1337_MISSING_DIRECTIVITY_DISTATT_EXTREND /* Eri: issue 1337: Missing directivity setting and distance attenuation in external renderer IVAS_rend */ -#define NONBE_1214_PLC_LSF_MEMORY /* VA: issue 1224: reset ACELP PLC FEC memory in case of switching from MDCT stereo to TD/DFT stereo */ -#define NONBE_1293_SR_HRTF /* VA: issue 1293: add support of external HRTFs in split rendering */ -#define FIX_1249_REMOVE_OBSOLETE_ALLRAD_MATRIX /* VA: issue 1249: remove obsolete code around ALLRAD decoder matrix */ -#define NONBE_1220_OMASA_JBM_BRATE_SW_FLUSH /* VA: issue 1220: fix bug in renderer flush in OMASA 1ISM JBM bitrate switching */ -#define NONBE_1118_EVS_LR_HQ_BITERROR /* VA: issue 1118: fix EVS decoder crash in LR-HQ in case of bit errors */ -#define FIX_1139_REV_COLORATION_SHORT_T60 /* Nokia,FhG: Fix issue 1139, prevent sound coloration artefacts at very low reverberation times */ - -#define FIX_1959_assert_in_gain_enc_mless_fx /* VA: Fix saturation introduced by the usage of the non-EVS basop operators =, the saturation was expected */ #define NONBE_1328_FIX_NON_LINEARITY /* VA: Fix possible issue when computing bwe_exc_extended and previous frame were almost 0, float issue 1328 */ /* #################### End BASOP porting switches ############################ */ diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index 2b3e200f2afbc603a7f47be40d89abdee8b2a292..ddd0bfdcc51c73c5048c67f73151a6456d451501 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -10236,17 +10236,14 @@ ivas_error acelp_core_dec_fx( Word16 *unbits, /* o : number of unused bits */ Word16 *sid_bw, /* o : 0-NB/WB, 1-SWB SID */ STEREO_TD_DEC_DATA_HANDLE hStereoTD, /* i/o: TD stereo decoder handle */ -#ifndef NONBE_1325_TD_STEREO_QUANT_LSF_SEC - const Word16 tdm_lspQ_PCh_fx[M], /* i : Q LSPs for primary channel */ -#endif - const Word16 tdm_lsfQ_PCh_fx[M], /* i : Q LSFs for primary channel */ - const Word16 use_cldfb_for_dft, /* i : flag to use of CLDFB for DFT Stereo */ - const Word16 last_element_mode, /* i : last element mode */ - const Word32 last_element_brate, /* i : last element bitrate */ - const Word16 flag_sec_CNA, /* i : CNA flag for secondary channel */ - const Word16 nchan_out, /* i : number of output channels */ - STEREO_CNG_DEC_HANDLE hStereoCng, /* i : stereo CNG handle */ - const Word16 read_sid_info /* i : read SID info flag */ + const Word16 tdm_lsfQ_PCh_fx[M], /* i : Q LSFs for primary channel */ + const Word16 use_cldfb_for_dft, /* i : flag to use of CLDFB for DFT Stereo */ + const Word16 last_element_mode, /* i : last element mode */ + const Word32 last_element_brate, /* i : last element bitrate */ + const Word16 flag_sec_CNA, /* i : CNA flag for secondary channel */ + const Word16 nchan_out, /* i : number of output channels */ + STEREO_CNG_DEC_HANDLE hStereoCng, /* i : stereo CNG handle */ + const Word16 read_sid_info /* i : read SID info flag */ ); void destroy_cldfb_decoder_ivas_fx( @@ -10575,12 +10572,9 @@ ivas_error config_acelp1_fx( const Word16 tdm_lp_reuse_flag, /* i : LPC reuse flag (can be 1 only with secondary channel */ const Word16 tdm_low_rate_mode, /* i : secondary channel low rate mode flag */ const Word16 idchan, /* i : stereo channel ID */ -#ifndef NONBE_1325_TD_STEREO_QUANT_LSF_SEC - const Word16 active_cnt, /* i : Active frame counter */ -#endif - const Word16 tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag*/ - const Word16 tdm_LRTD_flag, /* i : LRTD stereo mode flag */ - const Word16 GSC_IVAS_mode /* i : GSC IVAS mode */ + const Word16 tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag*/ + const Word16 tdm_LRTD_flag, /* i : LRTD stereo mode flag */ + const Word16 GSC_IVAS_mode /* i : GSC IVAS mode */ ); #if defined( DEBUGGING ) && defined( DBG_BITSTREAM_ANALYSIS ) diff --git a/lib_com/swb_bwe_com_lr_fx.c b/lib_com/swb_bwe_com_lr_fx.c index 78422a2927e8ce284dd110ac32c7a51b0d98b656..0e6524ce8f3299dd2cb69a4f2bc1b9683986e1e0 100644 --- a/lib_com/swb_bwe_com_lr_fx.c +++ b/lib_com/swb_bwe_com_lr_fx.c @@ -2338,11 +2338,7 @@ void ton_ene_est_fx( move16(); /* 0.06=15729(Q18) */ exp_shift = sub( 18, QE_r ); -#ifdef ISSUE_1796_replace_shl_o E_r_shift_fx = shl_sat( E_r_fx, exp_shift ); -#else - E_r_shift_fx = shl_o( E_r_fx, exp_shift, &Overflow ); -#endif IF( LT_16( E_r_shift_fx, 15729 ) ) /* E_r < 0.06 */ { /* avg_pe[k] = (float) sqrt(pow(2.0f,band_energy[i])/band_width[i]); */ @@ -3213,12 +3209,6 @@ void noiseinj_hf_fx( Word16 exp_normn, exp_normd; Word16 div_fx; Word16 Qdiv; -#ifndef ISSUE_1796_replace_shl_o -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif set16_fx( map_pulse_t_fx, 0, band_end_fx[BANDS_fx - 1] + 1 ); set16_fx( map_pulse_fx, 0, band_end_fx[BANDS_fx - 1] + 1 ); @@ -3252,11 +3242,7 @@ void noiseinj_hf_fx( move32(); /**p_L_En = (float)sqrt(*p_En);*/ sqrt_32n_16_fx( *p_L_En, QbeL, p_sqrt_En_fx, &Qtemp ); -#ifdef ISSUE_1796_replace_shl_o *p_sqrt_En_fx = shl_sat( *p_sqrt_En_fx, sub( QsEn, Qtemp ) ); /* -> Q2 */ -#else - *p_sqrt_En_fx = shl_o( *p_sqrt_En_fx, sub( QsEn, Qtemp ), &Overflow ); /* -> Q2 */ -#endif move16(); } p_L_En++; @@ -3326,11 +3312,7 @@ FOR( k = BANDS_fx - NB_SWB_SUBBANDS; k < BANDS_fx; k++ ) /* SQRT Part */ sqrt_32n_16_fx( L_deposit_h( div_fx ), add( Qdiv, 16 ), &ni_scale_fx, &Qtemp ); -#ifdef ISSUE_1796_replace_shl_o ni_scale_fx = shl_sat( ni_scale_fx, sub( 14, Qtemp ) ); -#else - ni_scale_fx = shl_o( ni_scale_fx, sub( 14, Qtemp ), &Overflow ); -#endif ni_scale_fx = s_min( 20408, ni_scale_fx ); /* 1.25=20408.0(Q14) */ ni_scale_fx = s_max( 12288, ni_scale_fx ); /* 0.75=12288.0(Q14) */ diff --git a/lib_com/swb_tbe_com_fx.c b/lib_com/swb_tbe_com_fx.c index 29fb7dfc4972f1857372b0d797b9e7e7aebd6d34..48322cb71fa7bbdef4dc248a5aa2704512825660 100755 --- a/lib_com/swb_tbe_com_fx.c +++ b/lib_com/swb_tbe_com_fx.c @@ -6922,11 +6922,7 @@ void synthesise_fb_high_band_fx( Word64 W_temp; t_Q = sub( shl( exp_tmp, 1 ), 8 ); -#ifdef FIX_ISSUE_1811_EXCEEDING_W_SHIFTS P_ONE = W_shl( P_ONE, s_min( 63, sub( t_Q, 15 ) ) ); -#else - P_ONE = W_shl( P_ONE, sub( t_Q, 15 ) ); -#endif W_temp = W_add( P_ONE, temp1 ); diff --git a/lib_com/tns_base.c b/lib_com/tns_base.c index 217245eb7944825e909bf1971426b84f4f455713..42c0db406dcaa7c5ecdd3341101526aaa4e4b716 100755 --- a/lib_com/tns_base.c +++ b/lib_com/tns_base.c @@ -651,11 +651,7 @@ Word16 ITF_Detect_ivas_fx( { sum = W_mac_32_32( sum, temp_spectrum[i], temp_spectrum[i] ); // 2(Q+shift)+1 } -#ifdef FIX_ISSUE_1811_EXCEEDING_W_SHIFTS IF( LE_64( sum, W_shl( 32768 * 2 /* HLM_MIN_NRG in Q1 */, s_min( 63, shl( add( Q, shift ), 1 ) ) ) ) ) -#else - IF( LE_64( sum, W_shl( 32768 * 2 /* HLM_MIN_NRG in Q1 */, shl( add( Q, shift ), 1 ) ) ) ) -#endif { BREAK; } diff --git a/lib_com/weight_a_fx.c b/lib_com/weight_a_fx.c index 4f19f2ba1f92e4e4ae031d8924c45de88a8a3b8a..8a6caf04ab365a3dd2661f9d425cf2d4da053ea7 100644 --- a/lib_com/weight_a_fx.c +++ b/lib_com/weight_a_fx.c @@ -100,13 +100,6 @@ void weight_a_fx( Word16 i, fac; Word32 Amax; Word16 shift; -#ifndef ISSUE_1836_replace_overflow_libcom__remnant -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow; - Overflow = 0; - move32(); -#endif -#endif fac = gamma; /* Q15 */ move16(); @@ -124,11 +117,7 @@ void weight_a_fx( move16(); FOR( i = 1; i < m; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom__remnant ap[i] = round_fx_sat( L_shl( L_mult0( a[i], fac ), shift ) ); /* Q11 + shift */ -#else - ap[i] = round_fx_o( L_shl( L_mult0( a[i], fac ), shift ), &Overflow ); /* Q11 + shift */ -#endif move16(); fac = mult_r( fac, gamma ); /* Q15 */ } diff --git a/lib_com/wi_fx.c b/lib_com/wi_fx.c index 94ac31a8bddf8378b585b08e69933247303ed355..58f1a813dbe3dbedee9c399945703c5e18605b79 100644 --- a/lib_com/wi_fx.c +++ b/lib_com/wi_fx.c @@ -264,12 +264,6 @@ static Word16 DTFS_alignment_weight_fx( Word16 tmplpc_fx[M + 1]; Word16 exp, tmp; Word32 L_tmp; -#ifndef ISSUE_1836_replace_overflow_libcom__remnant -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif diff_fx = 0; /* to avoid compilation warnings */ move16(); @@ -322,17 +316,10 @@ static Word16 DTFS_alignment_weight_fx( FOR( k = 0; k <= HalfLag; k++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom__remnant ab1[k] = round_fx_sat( L_mac0_sat( L_mult0( X1.a_fx[k], X2.a_fx[k] ), X1.b_fx[k], X2.b_fx[k] ) ); /* Q(-15) */ ab2[k] = round_fx_sat( L_msu0_sat( L_mult0( X1.a_fx[k], X2.b_fx[k] ), X1.b_fx[k], X2.a_fx[k] ) ); /* Q(-15) */ move16(); move16(); -#else - ab1[k] = round_fx_o( L_mac0_o( L_mult0( X1.a_fx[k], X2.a_fx[k] ), X1.b_fx[k], X2.b_fx[k], &Overflow ), &Overflow ); /* Q(-15) */ - ab2[k] = round_fx_o( L_msu0_o( L_mult0( X1.a_fx[k], X2.b_fx[k] ), X1.b_fx[k], X2.a_fx[k], &Overflow ), &Overflow ); /* Q(-15) */ - move16(); - move16(); -#endif } start = sub( Eshift, Adiff_fx ); @@ -353,13 +340,8 @@ static Word16 DTFS_alignment_weight_fx( FOR( k = 0; k <= HalfLag; k++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom__remnant corr_fx = L_mac0_sat( corr_fx, ab1[k], cos_table[s_and( temp, 511 )] ); corr_fx = L_mac0_sat( corr_fx, ab2[k], cos_table[s_and( add( temp, 128 ), 511 )] ); -#else - corr_fx = L_mac0_o( corr_fx, ab1[k], cos_table[s_and( temp, 511 )], &Overflow ); - corr_fx = L_mac0_o( corr_fx, ab2[k], cos_table[s_and( add( temp, 128 ), 511 )], &Overflow ); -#endif move32(); move32(); temp = add( temp, temp1 ); @@ -372,7 +354,6 @@ static Word16 DTFS_alignment_weight_fx( move16(); } -#ifdef ISSUE_1836_replace_overflow_libcom__remnant temp1 = round_fx_sat( (Word32) L_shl_sat( corr_fx, Qcorr ) ); /* Q(Qcorr-16) */ wcorr_fx = L_mult_sat( temp1, shl_sat( temp, 2 ) ); /* Q(Qcorr-16+13+2+1)=Q(Qcorr) */ //!!sat IF( GE_16( Qmaxcorr, Qcorr ) ) @@ -383,18 +364,6 @@ static Word16 DTFS_alignment_weight_fx( { diff_corr = L_sub_sat( L_shl_sat( wcorr_fx, sub( Qmaxcorr, Qcorr ) ), maxcorr_fx ); /* Qmaxcorr */ } -#else - temp1 = round_fx_o( (Word32) L_shl_o( corr_fx, Qcorr, &Overflow ), &Overflow ); /* Q(Qcorr-16) */ - wcorr_fx = L_mult_o( temp1, shl_o( temp, 2, &Overflow ), &Overflow ); /* Q(Qcorr-16+13+2+1)=Q(Qcorr) */ - IF( GE_16( Qmaxcorr, Qcorr ) ) - { - diff_corr = L_sub_o( wcorr_fx, L_shl_o( maxcorr_fx, sub( Qcorr, Qmaxcorr ), &Overflow ), &Overflow ); /* Qcorr */ - } - ELSE - { - diff_corr = L_sub_o( L_shl_o( wcorr_fx, sub( Qmaxcorr, Qcorr ), &Overflow ), maxcorr_fx, &Overflow ); /* Qmaxcorr */ - } -#endif IF( diff_corr > 0 ) { @@ -444,12 +413,6 @@ Word16 DTFS_alignment_full_fx( Word16 n, fshift_fx; Word32 corr_fx, maxcorr_fx; Word16 Eshift, Adiff_fx; -#ifndef ISSUE_1836_replace_overflow_libcom__remnant -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif /* Calculating the expected alignment shift */ Eshift = mult_r( ph_offset_fx, shl( X2_DTFS_fx.lag_fx, 7 ) ); /* confirmed I<2 by smv12.org, Q7 */ @@ -482,13 +445,8 @@ Word16 DTFS_alignment_full_fx( FOR( k = 0; k <= HalfLag; k++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom__remnant ab1[k] = round_fx_sat( L_mac_sat( L_mult_sat( X1_DTFS_fx.a_fx[k], X2_DTFS_fx.a_fx[k] ), X1_DTFS_fx.b_fx[k], X2_DTFS_fx.b_fx[k] ) ); /* Q(-15); */ ab2[k] = round_fx_sat( L_msu_sat( L_mult_sat( X1_DTFS_fx.b_fx[k], X2_DTFS_fx.a_fx[k] ), X1_DTFS_fx.a_fx[k], X2_DTFS_fx.b_fx[k] ) ); /* Q(-15); */ -#else - ab1[k] = round_fx_o( L_mac_o( L_mult_o( X1_DTFS_fx.a_fx[k], X2_DTFS_fx.a_fx[k], &Overflow ), X1_DTFS_fx.b_fx[k], X2_DTFS_fx.b_fx[k], &Overflow ), &Overflow ); /* Q(-15); */ - ab2[k] = round_fx_o( L_msu_o( L_mult_o( X1_DTFS_fx.b_fx[k], X2_DTFS_fx.a_fx[k], &Overflow ), X1_DTFS_fx.a_fx[k], X2_DTFS_fx.b_fx[k], &Overflow ), &Overflow ); /* Q(-15); */ -#endif } IF( FR_flag == 0 ) { @@ -518,15 +476,9 @@ Word16 DTFS_alignment_full_fx( temp1 = add( n, shl( X2_DTFS_fx.lag_fx, 1 ) ); /* add lag_fx in Q1to make positive */ FOR( k = 0; k <= HalfLag; k++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom__remnant corr_fx = L_mac_sat( corr_fx, ab1[k], C_fx[( 2 * temp ) % ( 4 * X2_DTFS_fx.lag_fx )] ); corr_fx = L_mac_sat( corr_fx, ab2[k], S_fx[( 2 * temp ) % ( 4 * X2_DTFS_fx.lag_fx )] ); temp = add_sat( temp, temp1 ); -#else - corr_fx = L_mac_o( corr_fx, ab1[k], C_fx[( 2 * temp ) % ( 4 * X2_DTFS_fx.lag_fx )], &Overflow ); - corr_fx = L_mac_o( corr_fx, ab2[k], S_fx[( 2 * temp ) % ( 4 * X2_DTFS_fx.lag_fx )], &Overflow ); - temp = add_o( temp, temp1, &Overflow ); -#endif } IF( GT_32( corr_fx, maxcorr_fx ) ) @@ -632,12 +584,6 @@ void Q2phaseShift_fx( Word16 k; Word16 temp, HalfLag; Word32 temp2; -#ifndef ISSUE_1836_replace_overflow_libcom__remnant -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif temp2 = L_deposit_l( 0 ); HalfLag = s_min( shr( X_fx->lag_fx, 1 ), X_fx->nH_fx ); @@ -648,15 +594,9 @@ void Q2phaseShift_fx( FOR( k = 0; k <= HalfLag; k++ ) { temp = X_fx->a_fx[k]; -#ifdef ISSUE_1836_replace_overflow_libcom__remnant X_fx->a_fx[k] = round_fx_sat( L_msu_sat( L_mult_sat( temp, C_fx[temp2 % ( 4 * Lag )] ), X_fx->b_fx[k], S_fx[temp2 % ( 4 * Lag )] ) ); /* X.Q */ X_fx->b_fx[k] = round_fx_sat( L_mac_sat( L_mult_sat( X_fx->b_fx[k], C_fx[temp2 % ( 4 * Lag )] ), temp, S_fx[temp2 % ( 4 * Lag )] ) ); temp2 = L_add_sat( temp2, (Word32) ph ); -#else - X_fx->a_fx[k] = round_fx_o( L_msu_o( L_mult_o( temp, C_fx[temp2 % ( 4 * Lag )], &Overflow ), X_fx->b_fx[k], S_fx[temp2 % ( 4 * Lag )], &Overflow ), &Overflow ); /* X.Q */ - X_fx->b_fx[k] = round_fx_o( L_mac_o( L_mult_o( X_fx->b_fx[k], C_fx[temp2 % ( 4 * Lag )], &Overflow ), temp, S_fx[temp2 % ( 4 * Lag )], &Overflow ), &Overflow ); - temp2 = L_add_o( temp2, (Word32) ph, &Overflow ); -#endif move16(); move16(); } @@ -668,15 +608,9 @@ void Q2phaseShift_fx( FOR( k = 0; k <= HalfLag; k++ ) { temp = X_fx->a_fx[k]; -#ifdef ISSUE_1836_replace_overflow_libcom__remnant X_fx->a_fx[k] = round_fx_sat( L_mac_sat( L_mult_sat( temp, C_fx[temp2 % ( 4 * Lag )] ), X_fx->b_fx[k], S_fx[temp2 % ( 4 * Lag )] ) ); /* X.Q */ X_fx->b_fx[k] = round_fx_sat( L_msu_sat( L_mult_sat( X_fx->b_fx[k], C_fx[temp2 % ( 4 * Lag )] ), temp, S_fx[temp2 % ( 4 * Lag )] ) ); temp2 = add_sat( (Word16) temp2, negate( ph ) ); -#else - X_fx->a_fx[k] = round_fx_o( L_mac_o( L_mult_o( temp, C_fx[temp2 % ( 4 * Lag )], &Overflow ), X_fx->b_fx[k], S_fx[temp2 % ( 4 * Lag )], &Overflow ), &Overflow ); /* X.Q */ - X_fx->b_fx[k] = round_fx_o( L_msu_o( L_mult_o( X_fx->b_fx[k], C_fx[temp2 % ( 4 * Lag )], &Overflow ), temp, S_fx[temp2 % ( 4 * Lag )], &Overflow ), &Overflow ); - temp2 = add_o( (Word16) temp2, negate( ph ), &Overflow ); -#endif move16(); move16(); } @@ -780,12 +714,6 @@ void DTFS_to_fs_fx( Word32 La[MAXLAG_WI], Lb[MAXLAG_WI], Labmax; Word16 exp, tmp; Word32 L_tmp1; -#ifndef ISSUE_1836_replace_overflow_libcom__remnant -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif IF( !FR_flag ) { @@ -821,8 +749,7 @@ void DTFS_to_fs_fx( move16(); exp = norm_s( X_fx->lag_fx ); - tmp = div_s( shl( 1, sub( 14, exp ) ), X_fx->lag_fx ); /* Q29-exp */ -#ifdef ISSUE_1836_replace_overflow_libcom__remnant + tmp = div_s( shl( 1, sub( 14, exp ) ), X_fx->lag_fx ); /* Q29-exp */ L_tmp1 = L_mult( 12800, tmp ); /* Q(30-exp) */ diff_fx = extract_h( L_shl_sat( L_tmp1, sub( exp, 14 ) ) ); /* Q0 */ @@ -830,16 +757,7 @@ void DTFS_to_fs_fx( tmp = div_s( shl( 1, sub( 14, exp ) ), diff_fx ); /* Q29-exp */ L_tmp1 = L_mult_sat( X_fx->upper_cut_off_freq_fx, tmp ); /* Q(30-exp) */ nH_band = extract_h( L_shl_sat( L_tmp1, sub( exp, 14 ) ) ); /* Q0 */ -#else - L_tmp1 = L_mult_o( 12800, tmp, &Overflow ); /* Q(30-exp) */ - diff_fx = extract_h( L_shl_o( L_tmp1, sub( exp, 14 ), &Overflow ) ); /* Q0 */ - - exp = norm_s( diff_fx ); - tmp = div_s( shl( 1, sub( 14, exp ) ), diff_fx ); /* Q29-exp */ - L_tmp1 = L_mult_o( X_fx->upper_cut_off_freq_fx, tmp, &Overflow ); /* Q(30-exp) */ - nH_band = extract_h( L_shl_o( L_tmp1, sub( exp, 14 ), &Overflow ) ); /* Q0 */ -#endif - nH_4kHz = mult( 10240, ( X_fx->lag_fx ) ); /* 4000/12800 in Q15 */ + nH_4kHz = mult( 10240, ( X_fx->lag_fx ) ); /* 4000/12800 in Q15 */ if ( GE_16( sub( X_fx->upper_cut_off_freq_fx, shr( (Word16) L_mult( diff_fx, nH_band ), 1 ) ), diff_fx ) ) { @@ -862,13 +780,8 @@ void DTFS_to_fs_fx( exp = norm_s( N ); tmp = div_s( shl( 1, ( sub( 14, exp ) ) ), N ); -#ifdef ISSUE_1836_replace_overflow_libcom__remnant L_tmp = L_shl_sat( tmp, add( exp, 6 ) ); inv_lag = round_fx_sat( L_tmp ); -#else - L_tmp = L_shl_o( tmp, add( exp, 6 ), &Overflow ); - inv_lag = round_fx_o( L_tmp, &Overflow ); -#endif Lx0 = L_deposit_h( x[0] ); Labmax = L_deposit_l( 0 ); FOR( k = 1; k <= nH; k++ ) @@ -882,13 +795,8 @@ void DTFS_to_fs_fx( move16(); FOR( n = 1; n < N; n++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom__remnant L_a = L_mac0_sat( L_a, x[n], C_fx[( 4 * sum ) % ( 4 * N )] ); /* Q16 of x[n]*cos(sum) */ L_b = L_mac0_sat( L_b, x[n], S_fx[( 4 * sum ) % ( 4 * N )] ); /* Q16 of x[n]*sin(sum) */ -#else - L_a = L_mac0_o( L_a, x[n], C_fx[( 4 * sum ) % ( 4 * N )], &Overflow ); /* Q16 of x[n]*cos(sum) */ - L_b = L_mac0_o( L_b, x[n], S_fx[( 4 * sum ) % ( 4 * N )], &Overflow ); /* Q16 of x[n]*sin(sum) */ -#endif sum = add( sum, temp ); } La[k] = L_shr( L_a, 6 ); /* Q8 of a[k]*2.0 */ @@ -925,22 +833,13 @@ void DTFS_to_fs_fx( temp_neg = negate( temp ); FOR( n = 0; n < N - 1; n += 2 ) { -#ifdef ISSUE_1836_replace_overflow_libcom__remnant L_a = L_mac_sat( L_a, x[n], temp ); /* Q1 */ L_a = L_mac_sat( L_a, x[n + 1], temp_neg ); -#else - L_a = L_mac_o( L_a, x[n], temp, &Overflow ); /* Q1 */ - L_a = L_mac_o( L_a, x[n + 1], temp_neg, &Overflow ); -#endif /*temp= negate(temp); */ } if ( s_and( N, 1 ) ) /*if N is odd we need to calculate last */ { -#ifdef ISSUE_1836_replace_overflow_libcom__remnant L_a = L_mac_sat( L_a, x[n], temp ); /* Q1 */ -#else - L_a = L_mac_o( L_a, x[n], temp, &Overflow ); /* Q1 */ -#endif } La[k] = L_shl( L_a, 7 ); @@ -965,7 +864,6 @@ void DTFS_to_fs_fx( move16(); } -#ifdef ISSUE_1836_replace_overflow_libcom__remnant FOR( k = 1; k <= nH; k++ ) { X_fx->a_fx[k] = round_fx_sat( L_shl_sat( La[k], temp ) ); /* Q(8+temp-16)=Q(temp-8) */ @@ -988,30 +886,6 @@ void DTFS_to_fs_fx( X_fx->b_fx[k] = 0; move16(); } -#else - FOR( k = 1; k <= nH; k++ ) - { - X_fx->a_fx[k] = round_fx_o( L_shl_o( La[k], temp, &Overflow ), &Overflow ); /* Q(8+temp-16)=Q(temp-8) */ - move16(); - X_fx->a_fx[k] = mult_ro( X_fx->a_fx[k], inv_lag, &Overflow ); - move16(); /* Q(temp-8+19+1-16)=Q(temp-4) of a[k]*2.0/N */ - X_fx->b_fx[k] = round_fx_o( L_shl_o( Lb[k], temp, &Overflow ), &Overflow ); /* Q(8+temp-16)=Q(temp-8) */ - move16(); - X_fx->b_fx[k] = mult_ro( X_fx->b_fx[k], inv_lag, &Overflow ); - move16(); /* Q(temp-8+19+1-16)=Q(temp-4) of b[k]*2.0/N */ - } - - /* IF ( N%2 == 0 ) */ - IF( s_and( N, 1 ) == 0 ) - { - X_fx->a_fx[k] = round_fx_o( L_shl_o( La[k], temp, &Overflow ), &Overflow ); /* Q(8+temp-16)=Q(temp-8) */ - X_fx->a_fx[k] = mult_ro( X_fx->a_fx[k], inv_lag, &Overflow ); - move16(); - move16(); /* Q(temp-8+19+1-16)=Q(temp-4) of a[k]*1.0/N */ - X_fx->b_fx[k] = 0; - move16(); - } -#endif X_fx->Q = sub( temp, 4 ); move16(); @@ -1307,12 +1181,6 @@ void DTFS_zeroFilter_fx( Word16 temp, temp1, temp2; Word32 L_temp1, L_temp2; Word16 Qmin, Qab[MAXLAG_WI], na, nb; -#ifndef ISSUE_1836_replace_overflow_libcom__remnant -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif Qmin = 32767; move16(); HalfLag = s_min( shr( X_fx->lag_fx, 1 ), X_fx->nH_fx ); @@ -1329,7 +1197,6 @@ void DTFS_zeroFilter_fx( FOR( n = 0; n < N; n++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom__remnant sum1_fx = L_mac_sat( sum1_fx, LPC[n], C_fx[( 4 * temp2 ) % ( 4 * X_fx->lag_fx )] ); /* Q(12+15+1) */ sum2_fx = L_mac_sat( sum2_fx, LPC[n], S_fx[( 4 * temp2 ) % ( 4 * X_fx->lag_fx )] ); temp2 = add( temp2, temp ); @@ -1344,21 +1211,6 @@ void DTFS_zeroFilter_fx( L_temp2 = L_mult( temp1, X_fx->b_fx[k] ); L_temp2 = L_mac_sat( L_temp2, temp2, X_fx->a_fx[k] ); /* Q(12+Q+1) */ -#else - sum1_fx = L_mac_o( sum1_fx, LPC[n], C_fx[( 4 * temp2 ) % ( 4 * X_fx->lag_fx )], &Overflow ); /* Q(12+15+1) */ - sum2_fx = L_mac_o( sum2_fx, LPC[n], S_fx[( 4 * temp2 ) % ( 4 * X_fx->lag_fx )], &Overflow ); - temp2 = add( temp2, temp ); - } - - temp1 = round_fx_o( sum1_fx, &Overflow ); /* Q(12+15+1-16)=Q(12) */ - temp2 = round_fx_o( sum2_fx, &Overflow ); /* Q(12) */ - - /* Calculate the circular convolution */ - L_temp1 = L_mult_o( temp1, X_fx->a_fx[k], &Overflow ); - L_temp1 = L_msu_o( L_temp1, temp2, X_fx->b_fx[k], &Overflow ); /* Q(12+Q+1) */ - L_temp2 = L_mult_o( temp1, X_fx->b_fx[k], &Overflow ); - L_temp2 = L_mac_o( L_temp2, temp2, X_fx->a_fx[k], &Overflow ); /* Q(12+Q+1) */ -#endif /* normalization */ na = norm_l( L_temp1 ); if ( L_temp1 == 0 ) @@ -1378,13 +1230,8 @@ void DTFS_zeroFilter_fx( nb = na; move16(); } -#ifdef ISSUE_1836_replace_overflow_libcom__remnant X_fx->a_fx[k] = round_fx_sat( (Word32) L_shl_sat( L_temp1, nb ) ); /* Q(13+Q+nb-16)=Q(Q+nb-3) */ X_fx->b_fx[k] = round_fx_sat( (Word32) L_shl_sat( L_temp2, nb ) ); /* Q(Q+nb-3) */ -#else - X_fx->a_fx[k] = round_fx_o( (Word32) L_shl_o( L_temp1, nb, &Overflow ), &Overflow ); /* Q(13+Q+nb-16)=Q(Q+nb-3) */ - X_fx->b_fx[k] = round_fx_o( (Word32) L_shl_o( L_temp2, nb, &Overflow ), &Overflow ); /* Q(Q+nb-3) */ -#endif move32(); move32(); @@ -1400,17 +1247,9 @@ void DTFS_zeroFilter_fx( /* bring to the same Q */ FOR( k = 0; k <= HalfLag; k++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom__remnant X_fx->a_fx[k] = shl_sat( X_fx->a_fx[k], sub( Qmin, Qab[k] ) ); -#else - X_fx->a_fx[k] = shl_o( X_fx->a_fx[k], sub( Qmin, Qab[k] ), &Overflow ); -#endif move16(); /* Q(Q+Qab[k]+Qmin-Qab[k]=Q(Q+Qmin) */ -#ifdef ISSUE_1836_replace_overflow_libcom__remnant X_fx->b_fx[k] = shl_sat( X_fx->b_fx[k], sub( Qmin, Qab[k] ) ); -#else - X_fx->b_fx[k] = shl_o( X_fx->b_fx[k], sub( Qmin, Qab[k] ), &Overflow ); -#endif move16(); /* Q(Q+Qmin) */ } @@ -1655,12 +1494,6 @@ Word32 DTFS_getEngy_fx( Word32 en_fx = 0; move32(); Word16 temp_a_fx, temp_b_fx; -#ifndef ISSUE_1836_replace_overflow_libcom__remnant -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif HalfLag_fx = shr( sub( X_fx->lag_fx, 1 ), 1 ); HalfLag_fx = s_min( HalfLag_fx, X_fx->nH_fx ); FOR( k = 1; k <= HalfLag_fx; k++ ) @@ -1669,23 +1502,14 @@ Word32 DTFS_getEngy_fx( move16(); temp_b_fx = X_fx->b_fx[k]; move16(); -#ifdef ISSUE_1836_replace_overflow_libcom__remnant en_fx = L_mac0_sat( en_fx, temp_a_fx, temp_a_fx ); en_fx = L_mac0_sat( en_fx, temp_b_fx, temp_b_fx ); -#else - en_fx = L_mac0_o( en_fx, temp_a_fx, temp_a_fx, &Overflow ); - en_fx = L_mac0_o( en_fx, temp_b_fx, temp_b_fx, &Overflow ); -#endif } en_fx = L_shr( en_fx, 1 ); temp_a_fx = X_fx->a_fx[0]; move16(); -#ifdef ISSUE_1836_replace_overflow_libcom__remnant en_fx = L_mac0_sat( en_fx, temp_a_fx, temp_a_fx ); -#else - en_fx = L_mac0_o( en_fx, temp_a_fx, temp_a_fx, &Overflow ); -#endif /* IF (X_fx->lag_fx%2 == 0) */ IF( s_and( X_fx->lag_fx, 1 ) == 0 ) { @@ -1693,13 +1517,8 @@ Word32 DTFS_getEngy_fx( move16(); temp_b_fx = X_fx->b_fx[k]; move16(); -#ifdef ISSUE_1836_replace_overflow_libcom__remnant en_fx = L_mac0_sat( en_fx, temp_a_fx, temp_a_fx ); en_fx = L_mac0_sat( en_fx, temp_b_fx, temp_b_fx ); -#else - en_fx = L_mac0_o( en_fx, temp_a_fx, temp_a_fx, &Overflow ); - en_fx = L_mac0_o( en_fx, temp_b_fx, temp_b_fx, &Overflow ); -#endif } return en_fx; /* 2*X1.Q+1=Q13 */ @@ -1730,7 +1549,6 @@ Word32 DTFS_getEngy_P2A_fx( Word16 k, HalfLag_fx; Word32 en_fx = 0; move32(); -#ifdef ISSUE_1836_replace_overflow_libcom__remnant HalfLag_fx = shr( sub( X_fx->lag_fx, 1 ), 1 ); HalfLag_fx = s_min( HalfLag_fx, X_fx->nH_fx ); FOR( k = 1; k <= HalfLag_fx; k++ ) @@ -1746,27 +1564,6 @@ Word32 DTFS_getEngy_P2A_fx( en_fx = L_mac0_sat( en_fx, X_fx->a_fx[k], X_fx->a_fx[k] ); en_fx = L_mac0_sat( en_fx, X_fx->b_fx[k], X_fx->b_fx[k] ); } -#else -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif - HalfLag_fx = shr( sub( X_fx->lag_fx, 1 ), 1 ); - HalfLag_fx = s_min( HalfLag_fx, X_fx->nH_fx ); - FOR( k = 1; k <= HalfLag_fx; k++ ) - { - en_fx = L_mac0_o( en_fx, X_fx->a_fx[k], X_fx->a_fx[k], &Overflow ); - en_fx = L_mac0_o( en_fx, X_fx->b_fx[k], X_fx->b_fx[k], &Overflow ); - } - en_fx = L_shr( en_fx, 1 ); - en_fx = L_mac0_o( en_fx, X_fx->a_fx[0], X_fx->a_fx[0], &Overflow ); - /* IF (X_fx->lag_fx%2 == 0) */ - IF( s_and( X_fx->lag_fx, 1 ) == 0 ) - { - en_fx = L_mac0_o( en_fx, X_fx->a_fx[k], X_fx->a_fx[k], &Overflow ); - en_fx = L_mac0_o( en_fx, X_fx->b_fx[k], X_fx->b_fx[k], &Overflow ); - } -#endif return en_fx; /* 2*X1.Q */ } @@ -1893,23 +1690,13 @@ void DTFS_car2pol_fx( Word32 Ltemp_fx; Word32 Lacc_fx; Word16 exp, tmp, frac; -#ifndef ISSUE_1836_replace_overflow_libcom__remnant -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif HalfLag_fx = s_min( shr( sub( X_fx->lag_fx, 1 ), 1 ), X_fx->nH_fx ); FOR( k = 1; k <= HalfLag_fx; k++ ) { - Lacc_fx = L_mult( X_fx->a_fx[k], X_fx->a_fx[k] ); /* a[k]^2, 2Q+1 */ -#ifdef ISSUE_1836_replace_overflow_libcom__remnant + Lacc_fx = L_mult( X_fx->a_fx[k], X_fx->a_fx[k] ); /* a[k]^2, 2Q+1 */ Lacc_fx = L_mac_sat( Lacc_fx, X_fx->b_fx[k], X_fx->b_fx[k] ); /* a[k]^2+b[k]^2, 2Q+1 */ -#else - Lacc_fx = L_mac_o( Lacc_fx, X_fx->b_fx[k], X_fx->b_fx[k], &Overflow ); /* a[k]^2+b[k]^2, 2Q+1 */ -#endif - Lacc_fx = L_shr( Lacc_fx, 3 ); /* Lacc=(a[k]^2+b[k]^2)/4, 2Q */ + Lacc_fx = L_shr( Lacc_fx, 3 ); /* Lacc=(a[k]^2+b[k]^2)/4, 2Q */ IF( Lacc_fx ) { @@ -2016,12 +1803,6 @@ Word32 DTFS_setEngyHarm_fx( move32(); Word16 expp = 0; move16(); -#ifndef ISSUE_1836_replace_overflow_libcom__remnant -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif f_low_fx = mult( f1_fx, X_fx->lag_fx ); /* Q0 */ @@ -2033,11 +1814,7 @@ Word32 DTFS_setEngyHarm_fx( Lacc = L_deposit_l( 0 ); FOR( k = f_low_fx + 1; k <= HalfLag_fx; k++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom__remnant Lacc = L_mac0_sat( Lacc, X_fx->a_fx[k], X_fx->a_fx[k] ); /* 2*X1.Q */ -#else - Lacc = L_mac0_o( Lacc, X_fx->a_fx[k], X_fx->a_fx[k], &Overflow ); /* 2*X1.Q */ -#endif Lacc_max = L_max( Lacc_max, Lacc ); count = add( count, 1 ); @@ -2052,13 +1829,8 @@ Word32 DTFS_setEngyHarm_fx( Lacc = L_deposit_l( 0 ); FOR( k = f_low_fx + 1; k <= HalfLag_fx; k++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom__remnant L_tmp = L_mult_sat( X_fx->a_fx[k], X_fx->a_fx[k] ); Lacc = L_add_sat( Lacc, L_shr( L_tmp, expp ) ); /* 2*X1.Q-expp */ -#else - L_tmp = L_mult_o( X_fx->a_fx[k], X_fx->a_fx[k], &Overflow ); - Lacc = L_add_o( Lacc, L_shr( L_tmp, expp ), &Overflow ); /* 2*X1.Q-expp */ -#endif count = add( count, 1 ); } } @@ -2071,11 +1843,7 @@ Word32 DTFS_setEngyHarm_fx( exp = norm_s( count ); tmp = div_s( shl( 1, sub( 14, exp ) ), count ); /* 29 - exp */ -#ifdef ISSUE_1836_replace_overflow_libcom__remnant en1_fx = L_shl_sat( Mult_32_16( Lacc, tmp ), sub( exp, 14 ) ); -#else - en1_fx = L_shl_o( Mult_32_16( Lacc, tmp ), sub( exp, 14 ), &Overflow ); -#endif test(); IF( en1_fx > 0 && en2_fx > 0 ) { @@ -2086,11 +1854,7 @@ Word32 DTFS_setEngyHarm_fx( expb = norm_l( en1_fx ); -#ifdef ISSUE_1836_replace_overflow_libcom__remnant fracb = round_fx_sat( L_shl( en1_fx, expb ) ); -#else - fracb = round_fx_o( L_shl_o( en1_fx, expb, &Overflow ), &Overflow ); -#endif IF( GE_32( Lacc_max, 2147483647 /*1.Q31*/ ) ) { expb = sub( 30, add( expb, sub( shl( X_fx->Q, 1 ), expp ) ) ); @@ -2128,11 +1892,7 @@ Word32 DTFS_setEngyHarm_fx( { /*L_temp_fx =(Word32)Mpy_32_16(extract_h(factor_fx),extract_l(factor_fx), X_fx->a_fx[k]); move32(); */ /* Q(temp+X1.Q-15) */ L_temp_fx = Mult_32_16( factor_fx, X_fx->a_fx[k] ); /* Q(temp+X1.Q-15) */ -#ifdef ISSUE_1836_replace_overflow_libcom__remnant - X_fx->a_fx[k] = round_fx_sat( L_temp_fx ); /* Q(temp+X1.Q-15-16)=Q(temp+X1.Q-31); */ -#else - X_fx->a_fx[k] = round_fx_o( L_temp_fx, &Overflow ); /* Q(temp+X1.Q-15-16)=Q(temp+X1.Q-31); */ -#endif + X_fx->a_fx[k] = round_fx_sat( L_temp_fx ); /* Q(temp+X1.Q-15-16)=Q(temp+X1.Q-31); */ move16(); } @@ -2196,12 +1956,6 @@ static void cubicPhase_fx( Word16 num_flag, den_flag; Word32 N2; Word16 dbgshft; -#ifndef ISSUE_1836_replace_overflow_libcom__remnant -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif num_flag = 0; move16(); den_flag = 0; @@ -2269,11 +2023,7 @@ static void cubicPhase_fx( Ltemp3 = L_mult( N, c1 ); /* Q20 */ Ltemp3 = L_sub( Ltemp3, L_shl( Ltemp1, 1 ) ); /* Ltemp3=N*c1-2*Ltemp1, Q20 */ -#ifdef ISSUE_1836_replace_overflow_libcom__remnant IF( GE_32( L_abs( Ltemp3 ), L_shl_sat( Ltemp2, 8 ) ) ) -#else - IF( GE_32( L_abs( Ltemp3 ), L_shl_o( Ltemp2, 8, &Overflow ) ) ) -#endif { Lacc = L_add( MIN_32, 0 ); if ( Ltemp3 > 0 ) @@ -2286,11 +2036,7 @@ static void cubicPhase_fx( ELSE { expa = norm_l( Ltemp3 ); -#ifdef ISSUE_1836_replace_overflow_libcom__remnant fraca = extract_h( L_shl( Ltemp3, expa ) ); -#else - fraca = extract_h( L_shl_o( Ltemp3, expa, &Overflow ) ); -#endif expa = sub( 30, add( expa, 20 ) ); if ( fraca < 0 ) { @@ -2299,11 +2045,7 @@ static void cubicPhase_fx( } expb = norm_l( Ltemp2 ); -#ifdef ISSUE_1836_replace_overflow_libcom__remnant fracb = extract_h( L_shl( Ltemp2, expb ) ); -#else - fracb = extract_h( L_shl_o( Ltemp2, expb, &Overflow ) ); -#endif expb = sub( 30, expb ); if ( fracb < 0 ) { @@ -2320,11 +2062,7 @@ static void cubicPhase_fx( fracb = negate( fracb ); } scale = shr( sub( fracb, fraca ), 15 ); -#ifdef ISSUE_1836_replace_overflow_libcom__remnant fraca = shl_sat( fraca, scale ); -#else - fraca = shl_o( fraca, scale, &Overflow ); -#endif expa = sub( expa, scale ); tmp = div_s( fraca, fracb ); /* 15-exp */ @@ -2340,13 +2078,8 @@ static void cubicPhase_fx( tmp = negate( tmp ); } -#ifdef ISSUE_1836_replace_overflow_libcom__remnant Lacc = L_shl_sat( tmp, add( exp, 34 ) ); Lacc = L_add_sat( Lacc, 0x08000 ); -#else - Lacc = L_shl_o( tmp, add( exp, 34 ), &Overflow ); - Lacc = L_add_o( Lacc, 0x08000, &Overflow ); -#endif c0 = extract_h( Lacc ); /* c0 in Q33 */ } @@ -2472,11 +2205,7 @@ static void cubicPhase_fx( Ltemp3 = L_add( Ltemp3, 1 ); } -#ifdef ISSUE_1836_replace_overflow_libcom__remnant Ltemp3 = L_shl_sat( Mult_32_16( L_shl_sat( Ltemp3, 7 ), c0 ), 2 ); /* Ltemp3=c0*n^3, Q27 */ //?sat -#else - Ltemp3 = L_shl_o( Mult_32_16( L_shl_o( Ltemp3, 7, &Overflow ), c0 ), 2, &Overflow ); /* Ltemp3=c0*n^3, Q27 */ -#endif Ltemp2 = L_shl( Mult_32_16( N2, c1 ), 1 ); /* Ltemp2 = (Word32)L_mult_su(c1,(UNS_Word16)n2); : Ltemp2=c1*n^2, Q27 */ Ltemp1 = L_shl( L_mult( c2, n ), 7 ); /* Ltemp1=c2*n, Q27 */ @@ -2534,12 +2263,6 @@ void DTFS_to_erb_fx( Word32 sum_a_fx[NUM_ERB_WB], Ltemp_fx, L_tmp, L_temp; Word16 exp, tmp; Word16 expa, expb, fraca, fracb, scale; -#ifndef ISSUE_1836_replace_overflow_libcom__remnant -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif const Word16 *erb_fx = NULL; num_erb_fx = NUM_ERB_NB; move16(); @@ -2604,11 +2327,7 @@ void DTFS_to_erb_fx( FOR( i = 0; i < num_erb_fx; i++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom__remnant out_fx[i] = round_fx_sat( L_shl_sat( sum_a_fx[i], n ) ); /* Q13 */ //?�sat -#else - out_fx[i] = round_fx_o( L_shl_o( sum_a_fx[i], n, &Overflow ), &Overflow ); /* Q13 */ -#endif move16(); IF( GT_16( count[i], 1 ) ) { @@ -2680,12 +2399,6 @@ void erb_slot_fx( Word16 exp, tmp; Word32 L_tmp1, L_tmp; Word16 fraca, fracb, expa, expb, scale; -#ifndef ISSUE_1836_replace_overflow_libcom__remnant -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif const Word16 *erb_fx = NULL; /*move16(); */ upper_cut_off_freq_fx = 4000; @@ -2767,7 +2480,6 @@ void erb_slot_fx( } FOR( j = 0; j < num_erb_fx; j++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom__remnant mfreq_fx[j] = round_fx_sat( L_shl_sat( mf_fx[j], 11 ) ); /* Q15 */ move16(); IF( GT_16( out_fx[j], 1 ) ) @@ -2792,32 +2504,6 @@ void erb_slot_fx( mfreq_fx[j] = round_fx_sat( L_tmp ); move16(); } -#else - mfreq_fx[j] = round_fx_o( L_shl_o( mf_fx[j], 11, &Overflow ), &Overflow ); /* Q15 */ - move16(); - IF( GT_16( out_fx[j], 1 ) ) - { - expb = norm_l( mf_fx[j] ); - fracb = round_fx_o( L_shl_o( mf_fx[j], expb, &Overflow ), &Overflow ); - expb = sub( 30, add( expb, 20 ) ); - - - expa = norm_l( out_fx[j] ); - fraca = extract_h( L_shl_o( out_fx[j], expa, &Overflow ) ); - expa = sub( 30, expa ); - - scale = shr( sub( fraca, fracb ), 15 ); - fracb = shl( fracb, scale ); - expb = sub( expb, scale ); - - tmp = div_s( fracb, fraca ); - exp = sub( expb, expa ); - L_tmp = L_shl_o( tmp, add( exp, 16 ), &Overflow ); - - mfreq_fx[j] = round_fx_o( L_tmp, &Overflow ); - move16(); - } -#endif } return; } @@ -2867,12 +2553,6 @@ void DTFS_erb_inv_fx( move16(); move16(); move16(); -#ifndef ISSUE_1836_replace_overflow_libcom__remnant -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif IF( EQ_16( num_erb_fx, NUM_ERB_NB ) ) { @@ -2957,11 +2637,7 @@ void DTFS_erb_inv_fx( d2h = 31; move16(); } -#ifdef ISSUE_1836_replace_overflow_libcom__remnant X_fx->a_fx[i] = round_fx_sat( L_shl_sat( Ltemp_fx, d2h ) ); /* Q(28-n+d2h) */ -#else - X_fx->a_fx[i] = round_fx_o( L_shl_o( Ltemp_fx, d2h, &Overflow ), &Overflow ); /* Q(28-n+d2h) */ -#endif move16(); q[i] = add( sub( 28, n ), d2h ); move16(); @@ -3702,12 +3378,6 @@ void DTFS_peaktoaverage_fx( DTFS_STRUCTURE X_fx, Word32 *pos_fx, Word16 *Qpos, W Word16 expa, expb, fraca, fracb, scale; Word16 exp, tmp; Word32 L_tmp; -#ifndef ISSUE_1836_replace_overflow_libcom__remnant -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif L_sum = DTFS_getEngy_P2A_fx( &X_fx ); /* 2Q */ DTFS_fast_fs_inv_fx( &X_fx, time_fx, 256, 8 ); @@ -3751,31 +3421,18 @@ void DTFS_peaktoaverage_fx( DTFS_STRUCTURE X_fx, Word32 *pos_fx, Word16 *Qpos, W ELSE { expa = norm_l( maxPosEn_fx ); -#ifdef ISSUE_1836_replace_overflow_libcom__remnant fraca = extract_h( L_shl( maxPosEn_fx, expa ) ); expa = sub( 30, add( expa, 1 ) ); expb = norm_l( L_sum ); fracb = round_fx_sat( L_shl( L_sum, expb ) ); -#else - fraca = extract_h( L_shl_o( maxPosEn_fx, expa, &Overflow ) ); - expa = sub( 30, add( expa, 1 ) ); - - - expb = norm_l( L_sum ); - fracb = round_fx_o( L_shl_o( L_sum, expb, &Overflow ), &Overflow ); -#endif expb = sub( 30, add( expb, shl( X_fx.Q, 1 ) ) ); scale = shr( sub( fraca, fracb ), 15 ); -#ifdef ISSUE_1836_replace_overflow_libcom__remnant fracb = shl_sat( fracb, scale ); -#else - fracb = shl_o( fracb, scale, &Overflow ); -#endif expb = sub( expb, scale ); tmp = div_s( fracb, fraca ); @@ -3799,30 +3456,17 @@ void DTFS_peaktoaverage_fx( DTFS_STRUCTURE X_fx, Word32 *pos_fx, Word16 *Qpos, W { expa = norm_l( maxNegEn_fx ); -#ifdef ISSUE_1836_replace_overflow_libcom__remnant fraca = extract_h( L_shl( maxNegEn_fx, expa ) ); expa = sub( Q29, expa ); // 30 - expa - 1; expb = norm_l( L_sum ); fracb = round_fx_sat( L_shl( L_sum, expb ) ); -#else - fraca = extract_h( L_shl_o( maxNegEn_fx, expa, &Overflow ) ); - expa = sub( Q29, expa ); // 30 - expa - 1; - - - expb = norm_l( L_sum ); - fracb = round_fx_o( L_shl_o( L_sum, expb, &Overflow ), &Overflow ); -#endif expb = sub( 30, add( expb, shl( X_fx.Q, 1 ) ) ); scale = shr( sub( fraca, fracb ), 15 ); -#ifdef ISSUE_1836_replace_overflow_libcom__remnant fracb = shl_sat( fracb, scale ); -#else - fracb = shl_o( fracb, scale, &Overflow ); -#endif expb = sub( expb, scale ); tmp = div_s( fracb, fraca ); @@ -4302,12 +3946,6 @@ void copy_phase_fx( DTFS_STRUCTURE *X1_fx, DTFS_STRUCTURE X2_fx, DTFS_STRUCTURE Word32 Ltemp_fx, L_tmp; Word32 Lacc_fx; Word16 exp, tmp, exp1; -#ifndef ISSUE_1836_replace_overflow_libcom__remnant -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif retX_fx->lag_fx = X1_fx->lag_fx; move16(); @@ -4317,13 +3955,8 @@ void copy_phase_fx( DTFS_STRUCTURE *X1_fx, DTFS_STRUCTURE X2_fx, DTFS_STRUCTURE FOR( k = 1; k <= HalfLag; k++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom__remnant Lacc_fx = L_mult_sat( X1_fx->a_fx[k], X1_fx->a_fx[k] ); Lacc_fx = L_mac_sat( Lacc_fx, X1_fx->b_fx[k], X1_fx->b_fx[k] ); /* 2*Q+1 */ -#else - Lacc_fx = L_mult_o( X1_fx->a_fx[k], X1_fx->a_fx[k], &Overflow ); - Lacc_fx = L_mac_o( Lacc_fx, X1_fx->b_fx[k], X1_fx->b_fx[k], &Overflow ); /* 2*Q+1 */ -#endif exp = norm_l( Lacc_fx ); tmp = extract_h( L_shl( Lacc_fx, exp ) ); @@ -4365,7 +3998,6 @@ void copy_phase_fx( DTFS_STRUCTURE *X1_fx, DTFS_STRUCTURE X2_fx, DTFS_STRUCTURE d1h = extract_h( Ltemp_fx ); d1l = extract_l( Ltemp_fx ); Ltemp_fx = L_mult0( X1_fx->b_fx[k], d1l ); -#ifdef ISSUE_1836_replace_overflow_libcom__remnant Ltemp_fx = L_add_sat( L_shr( Ltemp_fx, 15 ), L_mult_sat( X1_fx->b_fx[k], d1h ) ); /* sin(w) in Q(q+16+Q-15) */ sn = round_fx_sat( L_shl_sat( Ltemp_fx, sub( 30, add( q, X1_fx->Q ) ) ) ); /* Q15 */ retX_fx->b_fx[k] = mult_r_sat( X2_fx.a_fx[k], sn ); /* X2_fx.Q */ @@ -4375,17 +4007,6 @@ void copy_phase_fx( DTFS_STRUCTURE *X1_fx, DTFS_STRUCTURE X2_fx, DTFS_STRUCTURE Ltemp_fx = L_add_sat( L_shr( Ltemp_fx, 15 ), L_mult_sat( X1_fx->a_fx[k], d1h ) ); /* cos(w) in Q(q+Q+1) */ cn = round_fx_sat( L_shl_sat( Ltemp_fx, sub( 30, add( q, X1_fx->Q ) ) ) ); /* Q15 */ retX_fx->a_fx[k] = mult_r_sat( X2_fx.a_fx[k], cn ); /* X2_fx.Q */ -#else - Ltemp_fx = L_add_o( L_shr( Ltemp_fx, 15 ), L_mult_o( X1_fx->b_fx[k], d1h, &Overflow ), &Overflow ); /* sin(w) in Q(q+16+Q-15) */ - sn = round_fx_o( L_shl_o( Ltemp_fx, sub( 30, add( q, X1_fx->Q ) ), &Overflow ), &Overflow ); /* Q15 */ - retX_fx->b_fx[k] = mult_ro( X2_fx.a_fx[k], sn, &Overflow ); /* X2_fx.Q */ - move16(); - - Ltemp_fx = L_mult0( X1_fx->a_fx[k], d1l ); - Ltemp_fx = L_add_o( L_shr( Ltemp_fx, 15 ), L_mult_o( X1_fx->a_fx[k], d1h, &Overflow ), &Overflow ); /* cos(w) in Q(q+Q+1) */ - cn = round_fx_o( L_shl_o( Ltemp_fx, sub( 30, add( q, X1_fx->Q ) ), &Overflow ), &Overflow ); /* Q15 */ - retX_fx->a_fx[k] = mult_ro( X2_fx.a_fx[k], cn, &Overflow ); /* X2_fx.Q */ -#endif move16(); } k = sub( k, 1 ); @@ -4439,12 +4060,6 @@ Word32 getSpEngyFromResAmp_fx( DTFS_STRUCTURE *X_fx, Word16 lband, Word16 hband, Word32 en; Word16 exp, tmp, expa, fraca, expb, fracb, scale; Word32 L_tmp; -#ifndef ISSUE_1836_replace_overflow_libcom__remnant -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif en = L_deposit_l( 0 ); if ( EQ_16( hband, X_fx->upper_cut_off_freq_fx ) ) @@ -4479,12 +4094,8 @@ Word32 getSpEngyFromResAmp_fx( DTFS_STRUCTURE *X_fx, Word16 lband, Word16 hband, FOR( i = 0; i < M + 1; i++ ) { /* Compute Re */ -#ifdef ISSUE_1836_replace_overflow_libcom__remnant Lacc = L_mac_sat( Lacc, curr_lpc[i], cos_tab[n % M_fx] ); /* Q28 */ -#else - Lacc = L_mac_o( Lacc, curr_lpc[i], cos_tab[n % M_fx], &Overflow ); /* Q28 */ -#endif - n = add( n, k4 ); /* n=4*i*k */ + n = add( n, k4 ); /* n=4*i*k */ } Re = L_shr( Lacc, 1 ); /* Q27 */ @@ -4494,21 +4105,13 @@ Word32 getSpEngyFromResAmp_fx( DTFS_STRUCTURE *X_fx, Word16 lband, Word16 hband, FOR( i = 0; i < M + 1; i++ ) { /* Compute Im */ -#ifdef ISSUE_1836_replace_overflow_libcom__remnant Lacc = L_msu_sat( Lacc, curr_lpc[i], sin_tab[n % M_fx] ); /* Q28 */ -#else - Lacc = L_msu_o( Lacc, curr_lpc[i], sin_tab[n % M_fx], &Overflow ); /* Q28 */ -#endif - n = add( n, k4 ); /* n=4*i*k */ + n = add( n, k4 ); /* n=4*i*k */ } - Im = L_shr( Lacc, 1 ); /* Q27 */ - /* Lacc=L_add(L_mult_ll(Re,Re),(Word32)L_mult_ll(Im,Im)); : Lacc=Re^2+Im^2 in Q23 */ -#ifdef ISSUE_1836_replace_overflow_libcom__remnant + Im = L_shr( Lacc, 1 ); /* Q27 */ + /* Lacc=L_add(L_mult_ll(Re,Re),(Word32)L_mult_ll(Im,Im)); : Lacc=Re^2+Im^2 in Q23 */ Lacc = L_add_sat( Mult_32_32( Re, Re ), Mult_32_32( Im, Im ) ); /* Lacc=Re^2+Im^2 in Q23 */ -#else - Lacc = L_add_o( Mult_32_32( Re, Re ), Mult_32_32( Im, Im ), &Overflow ); /* Lacc=Re^2+Im^2 in Q23 */ -#endif - Ltemp = L_mult0( X_fx->a_fx[k], X_fx->a_fx[k] ); /* 2*a[k]^2 in 2Q */ + Ltemp = L_mult0( X_fx->a_fx[k], X_fx->a_fx[k] ); /* 2*a[k]^2 in 2Q */ /* Ltemp=(Word32)L_sat32_40(divide_dp(Ltemp,Lacc,-19,1)); : Ltemp in Q(2Q-13) */ if ( Lacc < 0 ) @@ -4534,11 +4137,7 @@ Word32 getSpEngyFromResAmp_fx( DTFS_STRUCTURE *X_fx, Word16 lband, Word16 hband, tmp = div_s( fracb, fraca ); /* 15-exp */ exp = sub( expb, expa ); -#ifdef ISSUE_1836_replace_overflow_libcom__remnant Ltemp = L_shl_sat( tmp, sub( add( shl( X_fx->Q, 1 ), exp ), 27 ) ); -#else - Ltemp = L_shl_o( tmp, sub( add( shl( X_fx->Q, 1 ), exp ), 27 ), &Overflow ); -#endif } ELSE { @@ -4586,12 +4185,6 @@ void DTFS_poleFilter_fx( DTFS_STRUCTURE *X_fx, Word16 *LPC, Word16 N, Word16 *S_ Word16 k, n, na, nb; Word16 Qmin, Qab[MAXLAG_WI]; Word16 exp, tmp; -#ifndef ISSUE_1836_replace_overflow_libcom__remnant -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif Qmin = 32767; move16(); HalfLag = s_min( shr( X_fx->lag_fx, 1 ), X_fx->nH_fx ); @@ -4605,17 +4198,11 @@ void DTFS_poleFilter_fx( DTFS_STRUCTURE *X_fx, Word16 *LPC, Word16 N, Word16 *S_ sum2_fx = L_deposit_l( 0 ); FOR( n = 0; n < N; n++ ) { -#ifdef ISSUE_1836_replace_overflow_libcom__remnant sum1_fx = L_mac_sat( sum1_fx, LPC[n], C_fx[shl( temp2, 2 ) % shl( X_fx->lag_fx, 2 )] ); /* Q(12+15+1) */ sum2_fx = L_mac_sat( sum2_fx, LPC[n], S_fx[shl( temp2, 2 ) % shl( X_fx->lag_fx, 2 )] ); /* Q(12+15+1) */ -#else - sum1_fx = L_mac_o( sum1_fx, LPC[n], C_fx[shl( temp2, 2 ) % shl( X_fx->lag_fx, 2 )], &Overflow ); /* Q(12+15+1) */ - sum2_fx = L_mac_o( sum2_fx, LPC[n], S_fx[shl( temp2, 2 ) % shl( X_fx->lag_fx, 2 )], &Overflow ); /* Q(12+15+1) */ -#endif temp2 = add( temp2, k ); } -#ifdef ISSUE_1836_replace_overflow_libcom__remnant temp1 = round_fx_sat( sum1_fx ); /* Q(12+15+1-16)=Q(12) */ temp2 = round_fx_sat( sum2_fx ); /* Q(12) */ /* Calculate the circular convolution */ @@ -4625,17 +4212,6 @@ void DTFS_poleFilter_fx( DTFS_STRUCTURE *X_fx, Word16 *LPC, Word16 N, Word16 *S_ L_temp1 = L_mac_sat( L_temp1, temp2, X_fx->b_fx[k] ); /* Q(12+Q+1)=Q(13+Q) */ L_temp2 = L_mult( temp1, X_fx->b_fx[k] ); L_temp2 = L_msu_sat( L_temp2, temp2, X_fx->a_fx[k] ); /* Q(12+Q+1)=Q(13+Q) */ -#else - temp1 = round_fx_o( sum1_fx, &Overflow ); /* Q(12+15+1-16)=Q(12) */ - temp2 = round_fx_o( sum2_fx, &Overflow ); /* Q(12) */ - /* Calculate the circular convolution */ - sum = L_mac_o( L_mult_o( temp1, temp1, &Overflow ), temp2, temp2, &Overflow ); /* Q(12+12+1)=Q(25) */ - - L_temp1 = L_mult( temp1, X_fx->a_fx[k] ); - L_temp1 = L_mac_o( L_temp1, temp2, X_fx->b_fx[k], &Overflow ); /* Q(12+Q+1)=Q(13+Q) */ - L_temp2 = L_mult( temp1, X_fx->b_fx[k] ); - L_temp2 = L_msu_o( L_temp2, temp2, X_fx->a_fx[k], &Overflow ); /* Q(12+Q+1)=Q(13+Q) */ -#endif IF( sum ) { exp = norm_l( sum ); @@ -4733,12 +4309,6 @@ void poleFilter_setup_fx( const Word16 *LPC, Word16 N, DTFS_STRUCTURE X_fx, Word Word32 sum; Word16 k, n, n1, n2; Word16 exp, tmp; -#ifndef ISSUE_1836_replace_overflow_libcom__remnant -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif HalfLag = s_min( shr( X_fx.lag_fx, 1 ), X_fx.nH_fx ); FOR( k = 0; k <= HalfLag; k++ ) @@ -4751,13 +4321,8 @@ void poleFilter_setup_fx( const Word16 *LPC, Word16 N, DTFS_STRUCTURE X_fx, Word sum2_fx = L_deposit_l( 0 ); FOR( n = 0; n < N; n++ ) { -#ifndef ISSUE_1836_replace_overflow_libcom__remnant - sum1_fx = L_mac_o( sum1_fx, LPC[n], C_fx[( 4 * temp2 ) % ( 4 * X_fx.lag_fx )], &Overflow ); /* Q(12+15+1) */ - sum2_fx = L_mac_o( sum2_fx, LPC[n], S_fx[( 4 * temp2 ) % ( 4 * X_fx.lag_fx )], &Overflow ); /* Q(12+15+1) */ -#else sum1_fx = L_mac_sat( sum1_fx, LPC[n], C_fx[( 4 * temp2 ) % ( 4 * X_fx.lag_fx )] ); /* Q(12+15+1) */ sum2_fx = L_mac_sat( sum2_fx, LPC[n], S_fx[( 4 * temp2 ) % ( 4 * X_fx.lag_fx )] ); /* Q(12+15+1) */ -#endif temp2 = add( temp2, k ); } diff --git a/lib_com/window_fx.c b/lib_com/window_fx.c index 164d0e1e61256936df33edaea7ffce76890835d9..8f8652543413f3f68b9aa1165cc921dbb9931a9d 100644 --- a/lib_com/window_fx.c +++ b/lib_com/window_fx.c @@ -28,12 +28,6 @@ void ham_cos_window( { Word16 i; Word32 cte, cc; -#ifndef ISSUE_1836_replace_overflow_libcom__remnant -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move16(); -#endif -#endif assert( n1 >= 102 ); /* if n1 is too low -> overflow in div_l */ @@ -47,11 +41,7 @@ void ham_cos_window( { /* fh_f[i] = 0.54f - 0.46f * (Float32)cos(cc); */ BASOP_SATURATE_WARNING_OFF_EVS -#ifdef ISSUE_1836_replace_overflow_libcom__remnant fh[i] = sub_sat( P54_0Q15, mult_r( getCosWord16( round_fx_sat( L_shl_sat( cc, 9 ) ) ), P92_0Q15 ) ); /*0Q15*/ -#else - fh[i] = sub_o( P54_0Q15, mult_r( getCosWord16( round_fx_o( L_shl_o( cc, 9, &Overflow ), &Overflow ) ), P92_0Q15 ), &Overflow ); /*0Q15*/ -#endif move16(); BASOP_SATURATE_WARNING_ON_EVS cc = L_add( cc, cte ); /*0Q15*/ @@ -68,11 +58,7 @@ void ham_cos_window( FOR( i = n1; i < n1 + n2; i++ ) { /* fh_f[i] = (Float32)cos(cc); */ -#ifdef ISSUE_1836_replace_overflow_libcom__remnant fh[i] = shl_sat( getCosWord16( round_fx( L_shl( cc, 10 ) ) ), 1 ); /*0Q15*/ -#else - fh[i] = shl_o( getCosWord16( round_fx( L_shl( cc, 10 ) ) ), 1, &Overflow ); /*0Q15*/ -#endif move16(); cc = L_add( cc, cte ); } diff --git a/lib_dec/FEC_HQ_core_fx.c b/lib_dec/FEC_HQ_core_fx.c index 325a7bb301cde36bc451a29eb0cd30641f77e5ec..c90530d5dc23b5316d00bbf860197b4377ec78be 100644 --- a/lib_dec/FEC_HQ_core_fx.c +++ b/lib_dec/FEC_HQ_core_fx.c @@ -43,12 +43,6 @@ static void Regression_Anal_fx( Word32 L_tmp1, L_tmp2; Word16 aindex_fx[MAX_PGF + 1]; // Q0 Word32 b_p_fx[MAX_PGF + 1]; // Q10 -#ifndef ISSUE_1866_replace_overflow_libdec -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif /* Initialize */ FOR( i = 0; i < add( num_pgf, 1 ); i++ ) @@ -80,11 +74,7 @@ static void Regression_Anal_fx( { b_p_fx[0] = L_add( b_p_fx[0], L_shr( values_fx[i], 2 ) ); /*10 */ move32(); -#ifdef ISSUE_1866_replace_overflow_libdec b_p_fx[1] = L_add( b_p_fx[1], Mult_32_16( values_fx[i], shl_sat( sub( num_pgf, i ), 13 ) ) ); /*10 */ -#else - b_p_fx[1] = L_add( b_p_fx[1], Mult_32_16( values_fx[i], shl_o( sub( num_pgf, i ), 13, &Overflow ) ) ); /*10 */ -#endif move32(); } @@ -168,12 +158,6 @@ void HQ_FEC_processing_fx( Word16 energy_diff_fx; // Q10 HQ_NBFEC_HANDLE hHQ_nbfec; HQ_DEC_HANDLE hHQ_core; -#ifndef ISSUE_1866_replace_overflow_libdec -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif hHQ_nbfec = st_fx->hHQ_nbfec; hHQ_core = st_fx->hHQ_core; @@ -390,11 +374,7 @@ void HQ_FEC_processing_fx( FOR( j = 0; j < Num_bands_p[i]; j++ ) { -#ifdef ISSUE_1866_replace_overflow_libdec hHQ_nbfec->Norm_gain_fx[k] = shl_sat( tmp_fx, 1 ); -#else - hHQ_nbfec->Norm_gain_fx[k] = shl_o( tmp_fx, 1, &Overflow ); -#endif move16(); k = add( k, 1 ); } @@ -449,12 +429,6 @@ void ivas_HQ_FEC_Mem_update_fx( HQ_DEC_HANDLE hHQ_core; hHQ_nbfec = st_fx->hHQ_nbfec; hHQ_core = st_fx->hHQ_core; -#ifndef ISSUE_1866_replace_overflow_libdec -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif move32(); // for tmp_energy_fx IF( EQ_16( output_frame, L_FRAME8k ) ) { @@ -532,12 +506,8 @@ void ivas_HQ_FEC_Mem_update_fx( L_tmp = L_add( L_tmp, L_shr( normq_fx[k], 3 ) ); /*11*/ k = add( k, 1 ); } -#ifdef ISSUE_1866_replace_overflow_libdec tmp_fx = shl_sat( inv_tbl_fx[Num_bands_p[i]], 1 ); /*16*/ -#else - tmp_fx = shl_o( inv_tbl_fx[Num_bands_p[i]], 1, &Overflow ); /*16*/ -#endif - norm_values_fx[0] = Mult_32_16( L_tmp, tmp_fx ); /*11 + 16 - 15*/ + norm_values_fx[0] = Mult_32_16( L_tmp, tmp_fx ); /*11 + 16 - 15*/ move32(); tmp_energy_fx = L_add( tmp_energy_fx, L_shr( L_tmp, 3 ) ); /*8*/ } @@ -656,11 +626,7 @@ void ivas_HQ_FEC_Mem_update_fx( exp2 = norm_l( hHQ_nbfec->ynrm_values_fx[i][0] ); tmp_fx = div_s( extract_h( L_shl( en_high_fx[i], exp1 ) ), extract_h( L_shl( hHQ_nbfec->ynrm_values_fx[i][0], exp2 ) ) ); exp = add( 15, sub( exp1, exp2 ) ); -#ifdef ISSUE_1866_replace_overflow_libdec *mean_en_high_fx = add_sat( *mean_en_high_fx, shr_sat( tmp_fx, sub( exp, 5 ) ) ); -#else - *mean_en_high_fx = add_o( *mean_en_high_fx, shr_sat( tmp_fx, sub( exp, 5 ) ), &Overflow ); -#endif move16(); } *mean_en_high_fx = mult( *mean_en_high_fx, inv_tbl_fx[sub( num_Sb, k )] ); @@ -742,12 +708,6 @@ void HQ_FEC_Mem_update_fx( HQ_DEC_HANDLE hHQ_core; hHQ_nbfec = st_fx->hHQ_nbfec; hHQ_core = st_fx->hHQ_core; -#ifndef ISSUE_1866_replace_overflow_libdec -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif move32(); // tmp_energy_fx IF( EQ_16( output_frame, L_FRAME8k ) ) @@ -827,12 +787,8 @@ void HQ_FEC_Mem_update_fx( L_tmp = L_add( L_tmp, L_shr( normq_fx[k], 3 ) ); /*11*/ k = add( k, 1 ); } -#ifdef ISSUE_1866_replace_overflow_libdec tmp_fx = shl_sat( inv_tbl_fx[Num_bands_p[i]], 1 ); /*16*/ -#else - tmp_fx = shl_o( inv_tbl_fx[Num_bands_p[i]], 1, &Overflow ); /*16*/ -#endif - norm_values_fx[0] = Mult_32_16( L_tmp, tmp_fx ); /*11 + 16 - 15*/ + norm_values_fx[0] = Mult_32_16( L_tmp, tmp_fx ); /*11 + 16 - 15*/ move32(); tmp_energy_fx = L_add( tmp_energy_fx, L_shr( L_tmp, 3 ) ); /*8*/ } @@ -952,11 +908,7 @@ void HQ_FEC_Mem_update_fx( exp2 = norm_l( hHQ_nbfec->ynrm_values_fx[i][0] ); tmp_fx = div_s( extract_h( L_shl( en_high_fx[i], exp1 ) ), extract_h( L_shl( hHQ_nbfec->ynrm_values_fx[i][0], exp2 ) ) ); exp = add( 15, sub( exp1, exp2 ) ); -#ifdef ISSUE_1866_replace_overflow_libdec *mean_en_high_fx = add_sat( *mean_en_high_fx, shr_sat( tmp_fx, sub( exp, 5 ) ) ); -#else - *mean_en_high_fx = add_o( *mean_en_high_fx, shr_sat( tmp_fx, sub( exp, 5 ) ), &Overflow ); -#endif move16(); } *mean_en_high_fx = mult( *mean_en_high_fx, inv_tbl_fx[sub( num_Sb, k )] ); @@ -1027,12 +979,6 @@ static Word16 find_best_delay_fx( Word32 min_sq_cross_fx, min_corr_fx; Word32 accA_fx, accB_fx; Word32 Rxy_fx[MAXDELAY_FEC], Ryy_fx[MAXDELAY_FEC]; -#ifndef ISSUE_1866_replace_overflow_libdec -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif move16(); // d1m @@ -1098,11 +1044,7 @@ static Word16 find_best_delay_fx( L_tmp1 = L_shl( min_sq_cross_fx, exp1 ); L_tmp2 = L_shl( min_corr_fx, exp2 ); tmp = div_s( extract_h( L_tmp1 ), extract_h( L_tmp2 ) ); /*15 + exp1 - exp2 */ -#ifdef ISSUE_1866_replace_overflow_libdec - tmp = shl_sat( tmp, sub( exp2, add( exp1, 1 ) ) ); /*14 */ -#else - tmp = shl_o( tmp, sub( exp2, add( exp1, 1 ) ), &Overflow ); /*14 */ -#endif + tmp = shl_sat( tmp, sub( exp2, add( exp1, 1 ) ) ); /*14 */ } *false_flag = 0; diff --git a/lib_dec/FEC_HQ_phase_ecu_fx.c b/lib_dec/FEC_HQ_phase_ecu_fx.c index e6062420edef3fd693c2090ed2b8b61ae1d36e11..ac802a1eb438631714b30ff91e6da52a0b5799b1 100644 --- a/lib_dec/FEC_HQ_phase_ecu_fx.c +++ b/lib_dec/FEC_HQ_phase_ecu_fx.c @@ -2916,20 +2916,9 @@ static Word32 mult_32_32_q( const Word32 a, const Word32 b, const Word16 q ) { Word32 hi; UWord32 lo; -#ifndef ISSUE_1866_replace_overflow_libdec -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif - - Mpy_32_32_ss( a, b, &hi, &lo ); - - return L_or( L_shl_o( hi, sub( 32 - 1, q ), &Overflow ), L_lshr( (Word32) lo, add( q, 1 ) ) ); -#else Mpy_32_32_ss( a, b, &hi, &lo ); return L_or( L_shl_sat( hi, sub( 32 - 1, q ) ), L_lshr( (Word32) lo, add( q, 1 ) ) ); -#endif } static void fir_dwn_fx( diff --git a/lib_dec/FEC_fx.c b/lib_dec/FEC_fx.c index dec54026a2d91d8619bb911940fcb0cae5eb7eff..574e2e14f9e209a4cef2a1ea22b86bcbf3971dcd 100644 --- a/lib_dec/FEC_fx.c +++ b/lib_dec/FEC_fx.c @@ -95,12 +95,6 @@ void FEC_exc_estim_fx( Word32 cond3; Word32 predPitchLag; GSC_DEC_HANDLE hGSCDec; -#ifndef ISSUE_1866_replace_overflow_libdec -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move16(); -#endif -#endif hGSCDec = st_fx->hGSCDec; AMRWB_IO_DEC_HANDLE hAmrwb_IO; @@ -128,11 +122,7 @@ void FEC_exc_estim_fx( gainCNG = round_fx( L_shl( L_tmp, sub( exp, 12 ) ) ); /* In Q3 */ } -#ifdef ISSUE_1866_replace_overflow_libdec tmp1 = shl_sat( st_fx->lp_gainc_fx, 1 ); -#else - tmp1 = shl_o( st_fx->lp_gainc_fx, 1, &Overflow ); -#endif gainCNG = s_min( gainCNG, tmp1 ); set16_fx( exc_dct_in, 0, L_FRAME16k ); @@ -193,15 +183,9 @@ void FEC_exc_estim_fx( { test(); test(); -#ifdef ISSUE_1866_replace_overflow_libdec IF( ( LT_16( round_fx( L_shl( st_fx->old_pitch_buf_fx[2 * NB_SUBFR - 1], 6 ) ), shl_sat( mult( 29491, st_fx->bfi_pitch_fx ), 1 ) ) && GT_16( round_fx( L_shl( st_fx->old_pitch_buf_fx[2 * NB_SUBFR - 1], 6 ) ), mult( 19661, st_fx->bfi_pitch_fx ) ) ) || /* last pitch coherent with the past */ GE_16( st_fx->upd_cnt, MAX_UPD_CNT ) ) /* or last update too far in the past */ -#else - IF( ( LT_16( round_fx( L_shl( st_fx->old_pitch_buf_fx[2 * NB_SUBFR - 1], 6 ) ), shl_o( mult( 29491, st_fx->bfi_pitch_fx ), 1, &Overflow ) ) && - GT_16( round_fx( L_shl( st_fx->old_pitch_buf_fx[2 * NB_SUBFR - 1], 6 ) ), mult( 19661, st_fx->bfi_pitch_fx ) ) ) || /* last pitch coherent with the past */ - GE_16( st_fx->upd_cnt, MAX_UPD_CNT ) ) /* or last update too far in the past */ -#endif { /* take the pitch value of last subframe of the previous frame */ *tmp_tc = round_fx( L_shl( st_fx->old_pitch_buf_fx[2 * NB_SUBFR - 1], 6 ) ); @@ -212,15 +196,9 @@ void FEC_exc_estim_fx( { test(); test(); -#ifdef ISSUE_1866_replace_overflow_libdec IF( ( LT_16( round_fx( L_shl( st_fx->old_pitch_buf_fx[2 * NB_SUBFR16k - 1], 6 ) ), shl_sat( mult( 29491, st_fx->bfi_pitch_fx ), 1 ) ) && GT_16( round_fx( L_shl( st_fx->old_pitch_buf_fx[2 * NB_SUBFR16k - 1], 6 ) ), mult( 19661, st_fx->bfi_pitch_fx ) ) ) || /* last pitch coherent with the past */ GE_16( st_fx->upd_cnt, MAX_UPD_CNT ) ) /* or last update too far in the past */ -#else - IF( ( LT_16( round_fx( L_shl( st_fx->old_pitch_buf_fx[2 * NB_SUBFR16k - 1], 6 ) ), shl_o( mult( 29491, st_fx->bfi_pitch_fx ), 1, &Overflow ) ) && - GT_16( round_fx( L_shl( st_fx->old_pitch_buf_fx[2 * NB_SUBFR16k - 1], 6 ) ), mult( 19661, st_fx->bfi_pitch_fx ) ) ) || /* last pitch coherent with the past */ - GE_16( st_fx->upd_cnt, MAX_UPD_CNT ) ) /* or last update too far in the past */ -#endif { /* take the pitch value of last subframe of the previous frame */ @@ -315,11 +293,7 @@ void FEC_exc_estim_fx( IF( LE_16( st_fx->nbLostCmpt, 1 ) ) { /* if stable, do not decrease the energy, pitch_gain = 0 */ -#ifdef ISSUE_1866_replace_overflow_libdec alpha = mac_r_sat( ( 1L << 16 ) * 2 * _ALPHA_U_FX, st_fx->stab_fac_fx, 32768 - 2 * _ALPHA_U_FX ); /*st_fx->stab_fac_fx in Q15*/ -#else - alpha = mac_ro( ( 1L << 16 ) * 2 * _ALPHA_U_FX, st_fx->stab_fac_fx, 32768 - 2 * _ALPHA_U_FX, &Overflow ); /*st_fx->stab_fac_fx in Q15*/ -#endif } ELSE IF( EQ_16( st_fx->nbLostCmpt, 2 ) ) { @@ -368,11 +342,7 @@ void FEC_exc_estim_fx( L_tmp = L_deposit_h( tmp ); L_tmp = Isqrt_lc( L_tmp, &exp ); -#ifdef ISSUE_1866_replace_overflow_libdec gain = extract_h( L_shl_sat( L_tmp, exp ) ); -#else - gain = extract_h( L_shl_o( L_tmp, exp, &Overflow ) ); -#endif gain = s_min( gain, 32113 ); /*0.98 */ gain = s_max( gain, 27853 ); /*0.85 */ @@ -778,12 +748,6 @@ static void pulseRes_preCalc( Word16 *cond1, Word16 *cond2, Word32 *cond3, Word1 { Word16 tmp_pit, tmp_pit_e, tmp_frame, tmp_frame_e; Word32 tmp_pit2; -#ifndef ISSUE_1866_replace_overflow_libdec -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif tmp_pit = BASOP_Util_Divide1616_Scale( new_pit /*Q0*/, Tc /*Q0*/, &tmp_pit_e ) /*Q15*/; tmp_frame = add( extract_l( L_mult0( L_frame, 64 /*1.f/L_SUBFR Q12*/ ) /*Q12*/ ), 4096 /*1.f Q12*/ ); /*Q12*/ @@ -792,11 +756,7 @@ static void pulseRes_preCalc( Word16 *cond1, Word16 *cond2, Word32 *cond3, Word1 tmp_frame = sub( 32767 /*1.f Q15*/, tmp_frame ); /*Q15*/ BASOP_SATURATE_WARNING_OFF_EVS /*To calc Q15 threshold, overflow may happen - do negation and compare with negated value to check also highest possible value*/ -#ifdef ISSUE_1866_replace_overflow_libdec tmp_pit = shl_sat( negate( tmp_pit ), tmp_pit_e ); -#else - tmp_pit = shl_o( negate( tmp_pit ), tmp_pit_e, &Overflow ); -#endif BASOP_SATURATE_WARNING_ON_EVS *cond1 = sub( tmp_pit, negate( tmp_frame ) ); move16(); diff --git a/lib_dec/LD_music_post_filter_fx.c b/lib_dec/LD_music_post_filter_fx.c index 11d28e2dc4718fec54733e6a03eab7f162ec8de4..f07feac96a5a375ea4cec286dbce448833984e93 100644 --- a/lib_dec/LD_music_post_filter_fx.c +++ b/lib_dec/LD_music_post_filter_fx.c @@ -69,11 +69,6 @@ void LD_music_post_filter_fx( Word16 mant, exp1, s_ave, tmp16, old_tmp16; Word16 diff_sc; Word16 old_tmp16_1; -#ifndef ISSUE_1866_replace_overflow_libdec -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; -#endif -#endif move16(); move16(); move16(); @@ -188,11 +183,7 @@ void LD_music_post_filter_fx( FOR( k = j; k < mfreq_bindiv_LD[i] + j; k++ ) { /*m_ave += lf_E[k];*/ -#ifdef ISSUE_1866_replace_overflow_libdec Ltmp = L_add_sat( lf_E[k], Ltmp ); /*2*Qdct+10*/ -#else - Ltmp = L_add_o( lf_E[k], Ltmp, &Overflow ); /*2*Qdct+10*/ -#endif max_val = L_max( max_val, lf_E[k] ); } Ltmp_max = L_max( Ltmp_max, max_val ); /*2*Qdct+10*/ @@ -448,11 +439,6 @@ static void spectrum_mod_dct_fx( Word32 Lshift; Word32 dot5_scaled; const Word32 *Lpt2; -#ifndef ISSUE_1866_replace_overflow_libdec -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; -#endif -#endif move16(); move32(); @@ -531,11 +517,7 @@ static void spectrum_mod_dct_fx( IF( music_flag != 0 ) /* prevent subtraction on clean speech */ { -#ifdef ISSUE_1866_replace_overflow_libdec IF( LE_32( maxNoise, L_shl_sat( 10, scaling ) ) ) -#else - IF( LE_32( maxNoise, L_shl_o( 10, scaling, &Overflow ) ) ) -#endif { minE = 18432 / 2; /*Q14*/ move16(); @@ -611,21 +593,12 @@ static void spectrum_mod_dct_fx( Ltmp = L_mult( tmpN, m_binE ); /*2*Qdct+e_binE+9*/ e_binE = sub( add( e_tmp, e_binE ), 15 ); -#ifdef ISSUE_1866_replace_overflow_libdec Ltmp = L_shr_sat( Ltmp, e_binE ); /*2*Qdct+9*/ Lgain = L_add_sat( Ltmp, Lshift ); /*Saturation can occure here result in Q30*/ -#else - Ltmp = L_shr_o( Ltmp, e_binE, &Overflow ); /*2*Qdct+9*/ - Lgain = L_add_o( Ltmp, Lshift, &Overflow ); /*Saturation can occure here result in Q30*/ -#endif } Lpt2++; -#ifdef ISSUE_1866_replace_overflow_libdec gain = round_fx_sat( Lgain ); /*gain in Q30-16 = Q14*/ -#else - gain = round_fx_o( Lgain, &Overflow ); /*gain in Q30-16 = Q14*/ -#endif /*if (gain < minE)gain = minE;*/ gain = s_max( gain, minE ); /*Q14*/ /*if (gain > 1.0f+MAX_GN)gain = 1.0f+MAX_GN;*/ @@ -922,11 +895,6 @@ static Word16 norm_lfe( { Word32 Ltmp; Word16 exp2, tmp16, exp3; -#ifndef ISSUE_1866_replace_overflow_libdec -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; -#endif -#endif move32(); @@ -946,11 +914,7 @@ static Word16 norm_lfe( exp3 = sub( exp2, 12 + 16 - 3 ); /* if exp2 < 31, means that tmp >= 1.0 */ /* Need to shl by 3 to take into account the 3 multiplications */ } -#ifdef ISSUE_1866_replace_overflow_libdec tmp16 = shl_sat( tmp16, exp3 ); /* Result in Q12 */ -#else - tmp16 = shl_o( tmp16, exp3, &Overflow ); /* Result in Q12 */ -#endif return tmp16; } diff --git a/lib_dec/acelp_core_dec_fx.c b/lib_dec/acelp_core_dec_fx.c index 298c4f1e30e57034055e57792568952b6a8c3f75..782e777487cf42579a83121ce2694c7c5bd027a0 100644 --- a/lib_dec/acelp_core_dec_fx.c +++ b/lib_dec/acelp_core_dec_fx.c @@ -65,17 +65,14 @@ ivas_error acelp_core_dec_fx( Word16 *unbits, /* o : number of unused bits */ Word16 *sid_bw, /* o : 0-NB/WB, 1-SWB SID */ STEREO_TD_DEC_DATA_HANDLE hStereoTD, /* i/o: TD stereo decoder handle Qlog2(2.56)*/ -#ifndef NONBE_1325_TD_STEREO_QUANT_LSF_SEC - const Word16 tdm_lspQ_PCh_fx[M], /* i : Q LSPs for primary channel Q15*/ -#endif - const Word16 tdm_lsfQ_PCh_fx[M], /* i : Q LSFs for primary channel */ - const Word16 use_cldfb_for_dft, /* i : flag to use of CLDFB for DFT Stereo */ - const Word16 last_element_mode, /* i : last element mode */ - const Word32 last_element_brate, /* i : last element bitrate */ - const Word16 flag_sec_CNA, /* i : CNA flag for secondary channel */ - const Word16 nchan_out, /* i : number of output channels */ - STEREO_CNG_DEC_HANDLE hStereoCng, /* i : stereo CNG handle */ - const Word16 read_sid_info /* i : read SID info flag */ + const Word16 tdm_lsfQ_PCh_fx[M], /* i : Q LSFs for primary channel */ + const Word16 use_cldfb_for_dft, /* i : flag to use of CLDFB for DFT Stereo */ + const Word16 last_element_mode, /* i : last element mode */ + const Word32 last_element_brate, /* i : last element bitrate */ + const Word16 flag_sec_CNA, /* i : CNA flag for secondary channel */ + const Word16 nchan_out, /* i : number of output channels */ + STEREO_CNG_DEC_HANDLE hStereoCng, /* i : stereo CNG handle */ + const Word16 read_sid_info /* i : read SID info flag */ ) { Word32 synth_fx[960], save_hb_synth_fx[960] /*, bwe_exc_extended_fx[L_FRAME32k + NL_BUFF_OFFSET]*/; @@ -881,21 +878,13 @@ ivas_error acelp_core_dec_fx( move16(); } -#ifdef NONBE_1325_TD_STEREO_QUANT_LSF_SEC config_acelp1_fx( DEC, st->total_brate, st->core_brate, st->core, st->extl_orig, st->extl_brate_orig, st->L_frame, st->GSC_noisy_speech, &( st->acelp_cfg ), st->next_bit_pos, st->coder_type, st->inactive_coder_type_flag, tc_subfr_tmp, 1, &nb_bits, unbits, st->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); -#else - config_acelp1_fx( DEC, st->total_brate, st->core_brate, st->core, st->extl_orig, st->extl_brate_orig, st->L_frame, st->GSC_noisy_speech, &( st->acelp_cfg ), st->next_bit_pos, st->coder_type, st->inactive_coder_type_flag, tc_subfr_tmp, 1, &nb_bits, unbits, st->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, st->active_cnt, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); -#endif test(); test(); IF( EQ_16( st->coder_type, TRANSITION ) && LT_16( tc_subfr, L_SUBFR ) && EQ_16( st->L_frame, L_FRAME ) ) { -#ifdef NONBE_1325_TD_STEREO_QUANT_LSF_SEC config_acelp1_fx( DEC, st->total_brate, st->core_brate, st->core, st->extl_orig, st->extl_brate_orig, st->L_frame, -1, &( st->acelp_cfg ), st->next_bit_pos, TRANSITION, -1, tc_subfr, 2, &nb_bits, unbits, st->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); -#else - config_acelp1_fx( DEC, st->total_brate, st->core_brate, st->core, st->extl_orig, st->extl_brate_orig, st->L_frame, -1, &( st->acelp_cfg ), st->next_bit_pos, TRANSITION, -1, tc_subfr, 2, &nb_bits, unbits, st->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, st->active_cnt, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); -#endif } } @@ -939,22 +928,10 @@ ivas_error acelp_core_dec_fx( ELSE { const Word16 *pt_interp_2_fx; -#ifndef NONBE_1325_TD_STEREO_QUANT_LSF_SEC - IF( NE_16( st->active_cnt, 1 ) ) - { -#endif - Word16 beta_index; + Word16 beta_index; - beta_index = get_next_indice_fx( st, TDM_IC_LSF_PRED_BITS ); - tdm_SCh_lsf_reuse_fx( DEC, st->element_brate, lsf_new_fx, lsp_new_fx, tdm_lsfQ_PCh_fx, NULL, &beta_index ); -#ifndef NONBE_1325_TD_STEREO_QUANT_LSF_SEC - } - ELSE - { - Copy( tdm_lspQ_PCh_fx, lsp_new_fx, M ); - Copy( tdm_lsfQ_PCh_fx, lsf_new_fx, M ); - } -#endif + beta_index = get_next_indice_fx( st, TDM_IC_LSF_PRED_BITS ); + tdm_SCh_lsf_reuse_fx( DEC, st->element_brate, lsf_new_fx, lsp_new_fx, tdm_lsfQ_PCh_fx, NULL, &beta_index ); IF( st->rate_switching_reset ) { @@ -992,11 +969,7 @@ ivas_error acelp_core_dec_fx( tmpF_fx = *old_exc_s_fx; st->mem_deemph_fx = shl_sat( old_exc_s_fx[st->L_frame - 1], st->Q_syn ); /* Q0 -> Q_syn */ move16(); -#ifdef NONBE_1131_ACELP_OOB PREEMPH_FX( old_exc_s_fx, st->preemph_fac, st->L_frame, &tmpF_fx ); -#else - PREEMPH_FX( old_exc_s_fx, st->preemph_fac, L_FRAME16k, &tmpF_fx ); -#endif Copy( old_exc_s_fx + sub( st->L_frame, M ), st->mem_syn2_fx, M ); Scale_sig( st->mem_syn2_fx, M, st->Q_syn ); /* Q0 -> Q_syn */ Residu3_fx( Aq_fx, old_exc_s_fx, old_exc_fx + sub( L_EXC_MEM_DEC, st->L_frame ), st->L_frame, 0 ); diff --git a/lib_dec/acelp_core_switch_dec_fx.c b/lib_dec/acelp_core_switch_dec_fx.c index f075c26f51acbccc55add5807625423849dc8d0e..4b1e04e08b067331f0afb55cab6cb98ce8085391 100644 --- a/lib_dec/acelp_core_switch_dec_fx.c +++ b/lib_dec/acelp_core_switch_dec_fx.c @@ -128,11 +128,7 @@ ivas_error acelp_core_switch_dec_fx( * Excitation decoding *----------------------------------------------------------------*/ -#ifdef NONBE_1325_TD_STEREO_QUANT_LSF_SEC config_acelp1_fx( DEC, st_fx->total_brate, cbrate, st_fx->core, -1, -1, st_fx->last_L_frame, -1, &( st_fx->acelp_cfg ), st_fx->next_bit_pos, GENERIC, st_fx->inactive_coder_type_flag, -1, -1, &decode_bwe /* dummy */, &i, st_fx->element_mode, &i /*dummy*/, 0, 0, st_fx->idchan, 0, 0, 0 ); -#else - config_acelp1_fx( DEC, st_fx->total_brate, cbrate, st_fx->core, -1, -1, st_fx->last_L_frame, -1, &( st_fx->acelp_cfg ), st_fx->next_bit_pos, GENERIC, st_fx->inactive_coder_type_flag, -1, -1, &decode_bwe /* dummy */, &i, st_fx->element_mode, &i /*dummy*/, 0, 0, st_fx->idchan, st_fx->active_cnt, 0, 0, 0 ); -#endif decod_gen_voic_core_switch_fx( st_fx, L_frame_for_cs, 0, Aq, exc, cbrate, &st_fx->Q_exc ); @@ -876,12 +872,6 @@ static void decod_gen_voic_core_switch_fx( Word16 *pt1; GSC_DEC_HANDLE hGSCDec; hGSCDec = st_fx->hGSCDec; -#ifndef ISSUE_1866_replace_overflow_libdec -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move16(); -#endif -#endif /*----------------------------------------------------------------------* @@ -972,11 +962,7 @@ static void decod_gen_voic_core_switch_fx( IF( st_fx->prev_bfi ) { /*gain_code = min(gain_code, 0.5f*gain_code+0.5f*st->lp_gainc);*/ -#ifdef ISSUE_1866_replace_overflow_libdec gain_code16 = s_min( gain_code16, mac_r( L_mult( 16384, gain_code16 ), shl_sat( 16384 >> 3, st_fx->Q_exc ), st_fx->lp_gainc_fx ) ); /* st_fx->lp_gainc_fx in Q3 >>3 to bring it to Q0 as gain_code16 */ -#else - gain_code16 = s_min( gain_code16, mac_r( L_mult( 16384, gain_code16 ), shl_o( 16384 >> 3, st_fx->Q_exc, &Overflow ), st_fx->lp_gainc_fx ) ); /* st_fx->lp_gainc_fx in Q3 >>3 to bring it to Q0 as gain_code16 */ -#endif } FOR( i = 0; i < L_SUBFR; i++ ) diff --git a/lib_dec/cng_dec_fx.c b/lib_dec/cng_dec_fx.c index 9de2030173509eb541de4114c37a870746881399..dec4a7adfc69062048f09c452fcfcff62b4baae2 100644 --- a/lib_dec/cng_dec_fx.c +++ b/lib_dec/cng_dec_fx.c @@ -74,12 +74,6 @@ void CNG_dec_fx( Word16 enr_new, Aq_tmp[M + 1]; Word16 LSF_Q_prediction; /* o : LSF prediction mode - just temporary variable in CNG */ TD_CNG_DEC_HANDLE hTdCngDec; -#ifndef ISSUE_1866_replace_overflow_libdec -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif hTdCngDec = st_fx->hTdCngDec; m = 0; @@ -524,11 +518,7 @@ void CNG_dec_fx( FOR( i = 0; i < M; i++ ) { dev = abs_s( sub( lsp_tmp[i], lsp_new[i] ) ); /*Q15*/ -#ifdef ISSUE_1866_replace_overflow_libdec - dist = add_sat( dist, dev ); /*Q15*/ -#else - dist = add_o( dist, dev, &Overflow ); /*Q15*/ -#endif + dist = add_sat( dist, dev ); /*Q15*/ if ( GT_16( dev, max_dev ) ) { max_dev = dev; diff --git a/lib_dec/core_switching_dec_fx.c b/lib_dec/core_switching_dec_fx.c index ac19c381c3fd9589f7873cb8c4951decb6b1765d..f7e992add4e05280b5872fd53b0a87765df4b537 100644 --- a/lib_dec/core_switching_dec_fx.c +++ b/lib_dec/core_switching_dec_fx.c @@ -181,12 +181,6 @@ void bw_switching_pre_proc_fx( Word16 i; Word16 syn_dct_fx[L_FRAME]; Word32 L_tmp; -#ifndef ISSUE_1866_replace_overflow_libdec -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif IF( st_fx->element_mode > EVS_MONO ) { @@ -200,11 +194,7 @@ void bw_switching_pre_proc_fx( * Calculate tilt of the ACELP core synthesis *----------------------------------------------------------------------*/ -#ifdef ISSUE_1866_replace_overflow_libdec st_fx->tilt_wb_fx = round_fx_sat( L_shl_sat( calc_tilt_bwe_fx( old_syn_12k8_16k_fx, -1, st_fx->L_frame ), 3 ) ); /* Q11 */ -#else - st_fx->tilt_wb_fx = round_fx_o( L_shl_o( calc_tilt_bwe_fx( old_syn_12k8_16k_fx, -1, st_fx->L_frame ), 3, &Overflow ), &Overflow ); /* Q11 */ -#endif move16(); /*-------------------------------------------------------------------------------* * Calculate frequency energy of 0~3.2kHz and 3.2~6.4kHz the ACELP core synthesis @@ -215,11 +205,7 @@ void bw_switching_pre_proc_fx( L_tmp = L_deposit_l( 0 ); FOR( i = 0; i < L_FRAME / 2; i++ ) { -#ifdef ISSUE_1866_replace_overflow_libdec L_tmp = L_mac0_sat( L_tmp, syn_dct_fx[i], syn_dct_fx[i] ); /* (2 * Q_syn2) */ -#else - L_tmp = L_mac0_o( L_tmp, syn_dct_fx[i], syn_dct_fx[i], &Overflow ); /* (2 * Q_syn2) */ -#endif } L_tmp = L_shr( L_tmp, 7 ); /* 2 * Q_syn2 */ st_fx->enerLL_fx = Calc_freq_ener_fx( L_tmp, shl( st_fx->Q_syn2, 1 ) ); /* Q_syn2 */ @@ -227,11 +213,7 @@ void bw_switching_pre_proc_fx( L_tmp = L_deposit_l( 0 ); FOR( ; i < L_FRAME; i++ ) { -#ifdef ISSUE_1866_replace_overflow_libdec L_tmp = L_mac0_sat( L_tmp, syn_dct_fx[i], syn_dct_fx[i] ); -#else - L_tmp = L_mac0_o( L_tmp, syn_dct_fx[i], syn_dct_fx[i], &Overflow ); -#endif } L_tmp = L_shr( L_tmp, 7 ); /* 2 * Q_syn2 */ st_fx->enerLH_fx = Calc_freq_ener_fx( L_tmp, shl( st_fx->Q_syn2, 1 ) ); /* Q_syn2 */ @@ -244,11 +226,7 @@ void bw_switching_pre_proc_fx( L_tmp = L_deposit_l( 0 ); FOR( i = 0; i < 32; i++ ) { -#ifdef ISSUE_1866_replace_overflow_libdec L_tmp = L_mac0_sat( L_tmp, st_fx->t_audio_q_fx[i], st_fx->t_audio_q_fx[i] ); /* 2 * Q_syn2 */ -#else - L_tmp = L_mac0_o( L_tmp, st_fx->t_audio_q_fx[i], st_fx->t_audio_q_fx[i], &Overflow ); /* 2 * Q_syn2 */ -#endif } L_tmp = L_shr( L_tmp, 5 ); /* 2 * Q_syn2 */ st_fx->enerLL_fx = Calc_freq_ener_fx( L_tmp, shl( st_fx->Q_syn2, 1 ) ); /* Q_syn2 */ @@ -256,11 +234,7 @@ void bw_switching_pre_proc_fx( L_tmp = L_deposit_l( 0 ); FOR( ; i < 64; i++ ) { -#ifdef ISSUE_1866_replace_overflow_libdec L_tmp = L_mac0_sat( L_tmp, st_fx->t_audio_q_fx[i], st_fx->t_audio_q_fx[i] ); /* 2 * Q_syn2 */ -#else - L_tmp = L_mac0_o( L_tmp, st_fx->t_audio_q_fx[i], st_fx->t_audio_q_fx[i], &Overflow ); /* 2 * Q_syn2 */ -#endif } L_tmp = L_shr( L_tmp, 5 ); /* 2 * Q_syn2 */ st_fx->enerLH_fx = Calc_freq_ener_fx( L_tmp, shl( st_fx->Q_syn2, 1 ) ); /* Q_syn2 */ @@ -271,11 +245,7 @@ void bw_switching_pre_proc_fx( L_tmp = L_deposit_l( 0 ); FOR( i = 0; i < L_FRAME / 2; i++ ) { -#ifdef ISSUE_1866_replace_overflow_libdec L_tmp = L_mac0_sat( L_tmp, st_fx->t_audio_q_fx[i], st_fx->t_audio_q_fx[i] ); /* 2 * Q_syn2 */ -#else - L_tmp = L_mac0_o( L_tmp, st_fx->t_audio_q_fx[i], st_fx->t_audio_q_fx[i], &Overflow ); /* 2 * Q_syn2 */ -#endif } L_tmp = L_shr( L_tmp, 7 ); /* 2 * Q_syn2 */ st_fx->enerLL_fx = Calc_freq_ener_fx( L_tmp, shl( st_fx->Q_syn2, 1 ) ); /* Q_syn2 */ @@ -283,11 +253,7 @@ void bw_switching_pre_proc_fx( L_tmp = L_deposit_l( 0 ); FOR( ; i < L_FRAME; i++ ) { -#ifdef ISSUE_1866_replace_overflow_libdec L_tmp = L_mac0_sat( L_tmp, st_fx->t_audio_q_fx[i], st_fx->t_audio_q_fx[i] ); /* 2 * Q_syn2 */ -#else - L_tmp = L_mac0_o( L_tmp, st_fx->t_audio_q_fx[i], st_fx->t_audio_q_fx[i], &Overflow ); /* 2 * Q_syn2 */ -#endif } L_tmp = L_shr( L_tmp, 7 ); /* 2 * Q_syn2 */ st_fx->enerLH_fx = Calc_freq_ener_fx( L_tmp, shl( st_fx->Q_syn2, 1 ) ); /* Q_syn2 */ @@ -2480,16 +2446,11 @@ ivas_error core_switching_pre_dec_ivas_fx( test(); test(); test(); -#ifdef NONBE_1214_PLC_LSF_MEMORY test(); test(); IF( ( ( ( st->core == ACELP_CORE ) || EQ_16( st->core, AMR_WB_CORE ) ) && EQ_16( st->last_core, HQ_CORE ) ) || ( ( EQ_16( st->element_mode, IVAS_CPE_DFT ) || EQ_16( st->element_mode, IVAS_CPE_TD ) || ( EQ_16( st->element_mode, IVAS_CPE_MDCT ) && EQ_16( last_element_mode, IVAS_CPE_DFT ) ) ) && EQ_16( nchan_out, 2 ) && NE_32( st->core_brate, SID_2k40 ) && ( st->core_brate != FRAME_NO_DATA ) && ( ( last_core_brate_st0 == FRAME_NO_DATA ) || EQ_32( last_core_brate_st0, SID_2k40 ) ) ) || ( st->core == ACELP_CORE && GT_16( st->last_L_frame, L_FRAME16k ) ) /* TCX @ 25.6/32 kHz -> ACELP */ ) -#else - IF( ( ( ( st->core == ACELP_CORE ) || EQ_16( st->core, AMR_WB_CORE ) ) && EQ_16( st->last_core, HQ_CORE ) ) || ( ( EQ_16( st->element_mode, IVAS_CPE_DFT ) || EQ_16( st->element_mode, IVAS_CPE_TD ) || ( EQ_16( st->element_mode, IVAS_CPE_MDCT ) && EQ_16( last_element_mode, IVAS_CPE_DFT ) ) ) && EQ_16( nchan_out, 2 ) && - NE_32( st->core_brate, SID_2k40 ) && ( st->core_brate != FRAME_NO_DATA ) && ( ( last_core_brate_st0 == FRAME_NO_DATA ) || EQ_32( last_core_brate_st0, SID_2k40 ) ) ) ) -#endif { test(); if ( EQ_16( st->element_mode, IVAS_CPE_DFT ) || EQ_16( st->element_mode, IVAS_CPE_TD ) ) @@ -3018,10 +2979,6 @@ void ivas_bw_switching_pre_proc_fx( Word16 i; Word32 syn_dct_fx[L_FRAME]; -#ifndef ISSUE_1866_replace_overflow_libdec - Flag Overflow = 0; - move32(); -#endif IF( st->element_mode > EVS_MONO ) { @@ -3104,11 +3061,7 @@ void ivas_bw_switching_pre_proc_fx( move32(); FOR( i = 0; i < 32; i++ ) { -#ifdef ISSUE_1866_replace_overflow_libdec L_tmp = L_mac0_sat( L_tmp, st->t_audio_q_fx[i], st->t_audio_q_fx[i] ); -#else - L_tmp = L_mac0_o( L_tmp, st->t_audio_q_fx[i], st->t_audio_q_fx[i], &Overflow ); -#endif } tmp = L_shr( L_tmp, 5 ); // divide by 32 tmp = getSqrtWord32( tmp ); @@ -3121,11 +3074,7 @@ void ivas_bw_switching_pre_proc_fx( move32(); FOR( ; i < 64; i++ ) { -#ifdef ISSUE_1866_replace_overflow_libdec L_tmp = L_mac0_sat( L_tmp, st->t_audio_q_fx[i], st->t_audio_q_fx[i] ); -#else - L_tmp = L_mac0_o( L_tmp, st->t_audio_q_fx[i], st->t_audio_q_fx[i], &Overflow ); -#endif } tmp = L_shr( L_tmp, 5 ); // divide by 32 @@ -3141,11 +3090,7 @@ void ivas_bw_switching_pre_proc_fx( move32(); FOR( i = 0; i < L_FRAME / 2; i++ ) { -#ifdef ISSUE_1866_replace_overflow_libdec L_tmp = L_mac0_sat( L_tmp, st->t_audio_q_fx[i], st->t_audio_q_fx[i] ); -#else - L_tmp = L_mac0_o( L_tmp, st->t_audio_q_fx[i], st->t_audio_q_fx[i], &Overflow ); -#endif } tmp = L_shr( L_tmp, 5 ); // divide by 32 tmp = getSqrtWord32( tmp ); @@ -3158,11 +3103,7 @@ void ivas_bw_switching_pre_proc_fx( move32(); FOR( ; i < L_FRAME; i++ ) { -#ifdef ISSUE_1866_replace_overflow_libdec L_tmp = L_mac0_sat( L_tmp, st->t_audio_q_fx[i], st->t_audio_q_fx[i] ); -#else - L_tmp = L_mac0_o( L_tmp, st->t_audio_q_fx[i], st->t_audio_q_fx[i], &Overflow ); -#endif } tmp = L_shr( L_tmp, 5 ); // divide by 32 tmp = getSqrtWord32( tmp ); diff --git a/lib_dec/dec_higher_acelp_fx.c b/lib_dec/dec_higher_acelp_fx.c index f85386e17012ab0832d8d3fca88c168a66f9a8ef..5687f3b79073903ff34970148ea2cdeab3520cc2 100644 --- a/lib_dec/dec_higher_acelp_fx.c +++ b/lib_dec/dec_higher_acelp_fx.c @@ -30,12 +30,6 @@ void transf_cdbk_dec_fx( Word32 L_tmp; Word32 dct_code32[L_SUBFR]; Word16 qdct; -#ifndef ISSUE_1866_replace_overflow_libdec -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif Word16 avq_bit_sFlag; Word16 trgtSvPos; Word16 Nsv; @@ -144,11 +138,7 @@ void transf_cdbk_dec_fx( } FOR( i = 0; i < L_SUBFR; i++ ) { -#ifdef ISSUE_1866_replace_overflow_libdec code_preQ[i] = shl_sat( code_preQ[i], q_Code_preQ ); -#else - code_preQ[i] = shl_o( code_preQ[i], q_Code_preQ, &Overflow ); -#endif move16(); /* code_preQ in Q6*/ } diff --git a/lib_dec/dec_pit_exc_fx.c b/lib_dec/dec_pit_exc_fx.c index 76bdb33d500235f7b9738e25db99c4b62d88356c..ad80b53f8d27e3de7c0b4ee9a7c3201f3b6d14e4 100644 --- a/lib_dec/dec_pit_exc_fx.c +++ b/lib_dec/dec_pit_exc_fx.c @@ -73,12 +73,6 @@ void dec_pit_exc_fx( Word16 use_fcb; Word32 gc_mem[NB_SUBFR - 1]; /* gain_code from previous subframes */ Word16 gp_mem[NB_SUBFR - 1]; /* gain_pitch from previous subframes */ -#ifndef ISSUE_1866_replace_overflow_libdec -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif use_fcb = 0; move16(); @@ -250,11 +244,7 @@ void dec_pit_exc_fx( gain_pit_fx = st_fx->lp_gainp_fx; move16(); } -#ifndef ISSUE_1866_replace_overflow_libdec - gain_code_fx = L_mult0( s_max( sub( 32767, shl_o( gain_pit_fx, 1, &Overflow ) ), 16384 /*0.5.Q15*/ ), st_fx->lp_gainc_fx ); /* Use gain pitch and past gain code as an indicator to help finding the best scaling value. gain_code_fx used a temp var*/ -#else gain_code_fx = L_mult0( s_max( sub( 32767, shl_sat( gain_pit_fx, 1 ) ), 16384 /*0.5.Q15*/ ), st_fx->lp_gainc_fx ); /* Use gain pitch and past gain code as an indicator to help finding the best scaling value. gain_code_fx used a temp var*/ -#endif } /*----------------------------------------------------------------------* diff --git a/lib_dec/dec_post_fx.c b/lib_dec/dec_post_fx.c index af2b6ea7bf37acdef8444b69eb5c536d12efbef0..7c1e949cafbbe6f74bc782e2b6c27b78303719aa 100644 --- a/lib_dec/dec_post_fx.c +++ b/lib_dec/dec_post_fx.c @@ -493,22 +493,12 @@ static void modify_pst_param_fx( Word16 tmp; Word16 lp_noiseQ12; Word32 L_tmp; -#ifndef ISSUE_1866_replace_overflow_libdec -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move16(); -#endif -#endif test(); IF( NE_16( coder_type, INACTIVE ) && LT_16( lp_noise, LP_NOISE_THR_FX ) ) { -#ifdef ISSUE_1866_replace_overflow_libdec lp_noiseQ12 = shl_sat( lp_noise, 4 ); /* to go from Q8 to Q12 */ -#else - lp_noiseQ12 = shl_o( lp_noise, 4, &Overflow ); /* to go from Q8 to Q12 */ -#endif /* ftmp = lp_noise*BG1_FX + CG1_FX */ tmp = mac_r( CG1_FX * 65536L, lp_noiseQ12, BG1_FX * 8 ); /* x8 to go from Q12 to Q15 */ @@ -579,12 +569,6 @@ static void pst_ltp_fx( Word16 gain_plt; Word16 off_yup; Word16 nb_sh_sig; -#ifndef ISSUE_1866_replace_overflow_libdec -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move16(); -#endif -#endif /* i signal justified on 13 bits */ @@ -683,11 +667,7 @@ static void pst_ltp_fx( /* decrease gain in noisy condition */ /* gain_plt += (1.0f-gain_plt) * gain_factor */ /* gain_plt = gain_plt + gain_factor - gain_plt*gain_factor */ -#ifdef ISSUE_1866_replace_overflow_libdec gain_plt = msu_r_sat( L_msu( L_deposit_h( gain_plt ), gain_plt, gain_factor ), -32768, gain_factor ); // Q15 -#else - gain_plt = msu_ro( L_msu( L_deposit_h( gain_plt ), gain_plt, gain_factor ), -32768, gain_factor, &Overflow ); // Q15 -#endif /** filtering by H0(z) = harmonic filter **/ filt_plt_fx( ptr_sig_in, ptr_y_up, ptr_sig_pst0, gain_plt ); @@ -1431,12 +1411,6 @@ void Filt_mu_fx( Word16 n; Word16 mu, mu2, ga, temp; Word16 fact, sh_fact; -#ifndef ISSUE_1866_replace_overflow_libdec -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move16(); -#endif -#endif IF( parcor0 > 0 ) @@ -1462,11 +1436,7 @@ void Filt_mu_fx( temp = sub( 1, abs_s( mu ) ); BASOP_SATURATE_WARNING_OFF_EVS; -#ifdef ISSUE_1866_replace_overflow_libdec mu2 = add_sat( 32767, temp ); /* Q15 (1 - |mu|) */ -#else - mu2 = add_o( 32767, temp, &Overflow ); /* Q15 (1 - |mu|) */ -#endif BASOP_SATURATE_WARNING_ON_EVS; ga = div_s( fact, mu2 ); /* Q(sh_fact) / (1 - |mu|) */ @@ -1506,12 +1476,6 @@ void Filt_mu_ivas_fx( Word16 n; Word16 mu, mu2, ga, temp; Word16 fact, sh_fact; -#ifndef ISSUE_1866_replace_overflow_libdec -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move16(); -#endif -#endif IF( EQ_16( extl, SWB_TBE ) ) { @@ -1562,11 +1526,7 @@ void Filt_mu_ivas_fx( temp = sub( 1, abs_s( mu ) ); BASOP_SATURATE_WARNING_OFF_EVS; -#ifdef ISSUE_1866_replace_overflow_libdec mu2 = add_sat( 32767, temp ); /* Q15 (1 - |mu|) */ -#else - mu2 = add_o( 32767, temp, &Overflow ); /* Q15 (1 - |mu|) */ -#endif BASOP_SATURATE_WARNING_ON_EVS; ga = div_s( fact, mu2 ); /* Q(sh_fact) / (1 - |mu|) */ @@ -1708,26 +1668,14 @@ void blend_subfr2_fx( Word16 fac2 = 0 + 512; // 0.Q15 + ( 1.Q15 / L_SUBFR ); Word16 step = 1024; // 1.Q15 / ( L_SUBFR / 2 ); Word16 i; -#ifndef ISSUE_1866_replace_overflow_libdec -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move16(); -#endif -#endif move16(); move16(); move16(); FOR( i = 0; i < L_SUBFR / 2; i++ ) { -#ifdef ISSUE_1866_replace_overflow_libdec sigOut[i] = mac_r_sat( L_mult_sat( fac1, sigIn1[i] ), fac2, sigIn2[i] ); // Qx fac1 = sub_sat( fac1, step ); fac2 = add_sat( fac2, step ); -#else - sigOut[i] = mac_ro( L_mult_o( fac1, sigIn1[i], &Overflow ), fac2, sigIn2[i], &Overflow ); // Qx - fac1 = sub_o( fac1, step, &Overflow ); - fac2 = add_o( fac2, step, &Overflow ); -#endif move16(); } diff --git a/lib_dec/dec_tcx_fx.c b/lib_dec/dec_tcx_fx.c index e728382cc28bd914ec0abef33d22fec8bc94588d..b861b8aba6aab2e3edb0477935a0ad0f700b757e 100644 --- a/lib_dec/dec_tcx_fx.c +++ b/lib_dec/dec_tcx_fx.c @@ -547,11 +547,7 @@ void decoder_tcx_fx( st->last_gain_syn_deemph_e = add( st->last_gain_syn_deemph_e, 10 /*scaling of h1[0] and E_UTIL_synthesis * 2*/ ); move16(); tmp32 = Sqrt32( tmp32, &st->last_gain_syn_deemph_e ); -#ifdef ISSUE_1866_replace_overflow_libdec st->last_gain_syn_deemph = round_fx_sat( tmp32 ); -#else - st->last_gain_syn_deemph = round_fx_o( tmp32, &Overflow ); -#endif move16(); /*for avoiding compiler warnings*/ hTcxDec->gainHelper = 32768 / 2; @@ -1280,12 +1276,6 @@ void decoder_tcx_post_fx( Decoder_State *st_fx, Word32 tmp32; Word32 tmp32_1, tmp32_2; TCX_DEC_HANDLE hTcxDec; -#ifndef ISSUE_1866_replace_overflow_libdec -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif hTcxDec = st_fx->hTcxDec; @@ -1357,11 +1347,7 @@ void decoder_tcx_post_fx( Decoder_State *st_fx, } tmp32 = Mpy_32_16_1( tmp32, getInvFrameLen( hTcxDec->L_frameTCX ) ); tmp2 = norm_l( tmp32 ); -#ifdef ISSUE_1866_replace_overflow_libdec tmp1 = round_fx_sat( L_shl( tmp32, tmp2 ) ); -#else - tmp1 = round_fx_o( L_shl( tmp32, tmp2 ), &Overflow ); -#endif s = sub( sub( sub( 1, shl( s, 1 ) ), 6 /*table lookup for inverse framelength*/ ), tmp2 ); tmp1 = Sqrt16( tmp1, &s ); move16(); @@ -1454,30 +1440,18 @@ void decoder_tcx_post_fx( Decoder_State *st_fx, &tmp1 ); tmp2 = BASOP_Util_Add_MantExp( hTcxDec->conceal_eof_gain, 15 - 14, negate( tmp1 ), tmp2, &tmp1 ); -#ifdef ISSUE_1866_replace_overflow_libdec step = L_shl_sat( L_mult( tmp1, getInvFrameLen( st_fx->L_frame ) ), sub( tmp2, 6 /*scaling from table lookup*/ + 1 /*go to Q30*/ ) ); /*Q30*/ -#else - step = L_shl_o( L_mult( tmp1, getInvFrameLen( st_fx->L_frame ) ), sub( tmp2, 6 /*scaling from table lookup*/ + 1 /*go to Q30*/ ), &Overflow ); /*Q30*/ -#endif { Word32 stepFB; UWord32 dmy; conceal_eof_gainFB = L_deposit_h( hTcxDec->conceal_eof_gain ); /*Q30*/ Mpy_32_32_ss( step, L_shl( L_mult0( st_fx->L_frame, getInvFrameLen( hTcxDec->L_frameTCX ) ), 8 ), &stepFB, &dmy ); -#ifdef ISSUE_1866_replace_overflow_libdec stepFB = L_shl_sat( stepFB, 3 - 1 ); /*Q30*/ -#else - stepFB = L_shl_o( stepFB, 3 - 1, &Overflow ); /*Q30*/ -#endif FOR( i = 0; i < hTcxDec->L_frameTCX; i++ ) { synthFB[i] = round_fx_sat( L_shl_sat( Mpy_32_16_1( conceal_eof_gainFB, synthFB[i] ), 1 ) ); move16(); -#ifdef ISSUE_1866_replace_overflow_libdec conceal_eof_gainFB = L_sub_sat( conceal_eof_gainFB, stepFB ); -#else - conceal_eof_gainFB = L_sub_o( conceal_eof_gainFB, stepFB, &Overflow ); -#endif } } conceal_eof_gain32 = L_deposit_h( hTcxDec->conceal_eof_gain ); /*Q30*/ @@ -1485,32 +1459,18 @@ void decoder_tcx_post_fx( Decoder_State *st_fx, { xn_buf[i] = round_fx_sat( L_shl_sat( Mpy_32_16_1( conceal_eof_gain32 /*Q30*/, xn_buf[i] ), 1 ) ); move16(); -#ifdef ISSUE_1866_replace_overflow_libdec conceal_eof_gain32 = L_sub_sat( conceal_eof_gain32, step ); -#else - conceal_eof_gain32 = L_sub_o( conceal_eof_gain32, step, &Overflow ); -#endif } -#ifdef ISSUE_1866_replace_overflow_libdec hTcxDec->conceal_eof_gain = round_fx_sat( conceal_eof_gain32 ); /*Q14*/ -#else - hTcxDec->conceal_eof_gain = round_fx_o( conceal_eof_gain32, &Overflow ); /*Q14*/ -#endif move16(); /* run lpc gain compensation not for waveform adjustment */ test(); IF( 0 == st_fx->enablePlcWaveadjust || EQ_16( st_fx->hPlcInfo->concealment_method, TCX_TONAL ) ) { -#ifdef ISSUE_1866_replace_overflow_libdec st_fx->hPlcInfo->recovery_gain = extract_h( L_shl_sat( Mpy_32_16_1( conceal_eof_gainFB, st_fx->last_concealed_gain_syn_deemph ), st_fx->last_concealed_gain_syn_deemph_e ) ); /*Q30->Q14*/ -#else - st_fx->hPlcInfo->recovery_gain = extract_h( L_shl_o( Mpy_32_16_1( conceal_eof_gainFB, - st_fx->last_concealed_gain_syn_deemph ), - st_fx->last_concealed_gain_syn_deemph_e, &Overflow ) ); /*Q30->Q14*/ -#endif move16(); } ELSE @@ -1580,12 +1540,6 @@ void decoder_tcx_post_ivas_fx( Decoder_State *st_fx, Word32 tmp32; Word32 tmp32_1, tmp32_2; TCX_DEC_HANDLE hTcxDec; -#ifndef ISSUE_1866_replace_overflow_libdec -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif hTcxDec = st_fx->hTcxDec; @@ -1668,11 +1622,7 @@ void decoder_tcx_post_ivas_fx( Decoder_State *st_fx, } tmp32 = Mpy_32_16_1( tmp32, getInvFrameLen( hTcxDec->L_frameTCX ) ); tmp2 = norm_l( tmp32 ); -#ifdef ISSUE_1866_replace_overflow_libdec tmp1 = round_fx_sat( L_shl( tmp32, tmp2 ) ); -#else - tmp1 = round_fx_o( L_shl( tmp32, tmp2 ), &Overflow ); -#endif // s = sub(sub(sub(1, shl(s, 1)), 6/*table lookup for inverse framelength*/), tmp2); s = sub( 25, add( shl( add( Q_syn, s ), 1 ), tmp2 ) ); tmp1 = Sqrt16( tmp1, &s ); @@ -1845,11 +1795,7 @@ void decoder_tcx_post_ivas_fx( Decoder_State *st_fx, test(); IF( 0 == st_fx->enablePlcWaveadjust || EQ_16( st_fx->hPlcInfo->concealment_method, TCX_TONAL ) ) { -#ifdef ISSUE_1866_replace_overflow_libdec st_fx->hPlcInfo->recovery_gain = extract_h( L_shl_sat( Mpy_32_16_1( conceal_eof_gainFB, st_fx->last_concealed_gain_syn_deemph ), st_fx->last_concealed_gain_syn_deemph_e ) ); /*Q30->Q14*/ -#else - st_fx->hPlcInfo->recovery_gain = extract_h( L_shl_o( Mpy_32_16_1( conceal_eof_gainFB, st_fx->last_concealed_gain_syn_deemph ), st_fx->last_concealed_gain_syn_deemph_e, &Overflow ) ); /*Q30->Q14*/ -#endif move16(); } ELSE @@ -1906,44 +1852,6 @@ static Word32 CalculateAbsEnergy_fx( /* o : normalized resul const Word16 lg, /* i : vector length, range [0..7FFF] Q0 */ Word16 *exp /* o : exponent of result in [-32,31] Q0 */ ) -#ifndef FIX_ISSUE_1817_REPLACE_CARRY_OVERFLOW -{ - Word16 i; - Word32 L_sum, L_c; -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - Flag Carry; - move32(); -#endif - /* Clear carry flag and init sum */ - Carry = 0; - move32(); - L_c = 0; - move32(); - L_sum = L_macNs_co( L_off, 0, 0, &Carry, &Overflow ); - IF( L_sum > 0 ) - { - L_c = L_macNs_co( L_c, 0, 0, &Carry, &Overflow ); - } - IF( L_sum < 0 ) - { - L_c = L_msuNs_co( L_c, 0, 0, &Carry, &Overflow ); - } - FOR( i = 0; i < lg; i += 2 ) - { - Carry = 0; - move32(); - BASOP_SATURATE_WARNING_OFF_EVS /*multiplication of -32768 * -32768 throws an overflow, but is not critical*/ - L_sum = L_macNs_co( L_sum, x[i], x[i], &Carry, &Overflow ); - BASOP_SATURATE_WARNING_ON_EVS - Overflow = 0; /* to avoid useless warning in L_macNs calling L_mult */ - move32(); - L_c = L_macNs_co( L_c, 0, 0, &Carry, &Overflow ); - } - L_sum = norm_llQ31( L_c, L_sum, exp ); - return L_sum; -} -#else { Word16 i; Word32 L_sum; @@ -1958,7 +1866,6 @@ static Word32 CalculateAbsEnergy_fx( /* o : normalized resul L_sum = w_norm_llQ31( L_sum64, exp ); /*Q31 - *exp */ return L_sum; } -#endif /* FIX_ISSUE_1817_REPLACE_CARRY_OVERFLOW */ void IMDCT_fx( Word32 *x, Word16 x_e, Word16 *old_syn_overl, Word16 *syn_Overl_TDAC, Word16 *xn_buf, const Word16 *tcx_aldo_window_1, const PWord16 *tcx_aldo_window_1_trunc, const PWord16 *tcx_aldo_window_2, const PWord16 *tcx_mdct_window_half, const PWord16 *tcx_mdct_window_minimum, const PWord16 *tcx_mdct_window_trans, Word16 tcx_mdct_window_half_length, Word16 tcx_mdct_window_min_length, Word16 index, Word16 left_rect, Word16 tcx_offset, Word16 overlap, Word16 L_frame, Word16 L_frameTCX, Word16 L_spec_TCX5, Word16 L_frame_glob, Word16 frame_cnt, Word16 bfi, Word16 *old_out, Word16 *Q_old_wtda, Decoder_State *st, Word16 fullbandScale, Word16 *acelp_zir ) { @@ -4232,12 +4139,6 @@ void decoder_tcx_invQ_fx( move16(); move16(); -#ifndef ISSUE_1866_replace_overflow_libdec -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif tnsSize = 0; move16(); @@ -4361,11 +4262,7 @@ void decoder_tcx_invQ_fx( FOR( i = 0; i < noiseFillingSize; ++i ) { tmp32 = L_shr( x[i], sub( 31, *x_e ) ); -#ifdef ISSUE_1866_replace_overflow_libdec *nf_seed = add_sat( *nf_seed, extract_l( L_shl( i_mult( (Word16) L_abs( tmp32 ), i ), 1 ) ) ); // abs( tmp32 ) * i * 2 -#else - *nf_seed = add_o( *nf_seed, extract_l( L_shl( i_mult( (Word16) L_abs( tmp32 ), i ), 1 ) ), &Overflow ); // abs( tmp32 ) * i * 2 -#endif move16(); } } @@ -4605,11 +4502,7 @@ void decoder_tcx_invQ_fx( st->last_gain_syn_deemph_e = add( st->last_gain_syn_deemph_e, 10 /*scaling of h1[0] and E_UTIL_synthesis * 2*/ ); move16(); tmp32 = Sqrt32( tmp32, &st->last_gain_syn_deemph_e ); -#ifdef ISSUE_1866_replace_overflow_libdec st->last_gain_syn_deemph = round_fx_sat( tmp32 ); // Q15 -#else - st->last_gain_syn_deemph = round_fx_o( tmp32, &Overflow ); // Q15 -#endif move16(); } diff --git a/lib_dec/er_dec_tcx_fx.c b/lib_dec/er_dec_tcx_fx.c index ae2ddc34182ce1bf7bb4516c83fed3bddc8ee9b2..16884caaa902d537f329163bf0b5518824a1d9b6 100644 --- a/lib_dec/er_dec_tcx_fx.c +++ b/lib_dec/er_dec_tcx_fx.c @@ -36,22 +36,14 @@ static void calcGainc_fx( Word16 *exc, Word16 Q_exc, Word32 old_fpitch /*Q16*/, tmp16 = round_fx( old_fpitch ); /*Q0*/ tmp_loop = shl( L_subfr, 1 ); BASOP_SATURATE_WARNING_OFF_EVS -#ifdef ISSUE_1866_replace_overflow_libdec tmp16_2 = round_fx_sat( L_shl_sat( lp_gainp, 2 ) ); /*Q31->Q15, no severe saturation, because st->lp_gainp here is [0,1]*/ -#else - tmp16_2 = round_fx_o( L_shl_o( lp_gainp, 2, &Overflow ), &Overflow ); /*Q31->Q15, no severe saturation, because st->lp_gainp here is [0,1]*/ -#endif BASOP_SATURATE_WARNING_ON_EVS FOR( i = 0; i < tmp_loop; i++ ) { /*st->lp_gainc += ( exc[i-2*L_subfr] - st->Mode2_lp_gainp * exc[i-2*L_subfr-(int)(st->old_fpitch+0.5f)] ) * ( exc[i-2*L_subfr] - st->Mode2_lp_gainp * exc[i-2*L_subfr-(int)(st->old_fpitch+0.5f)] );*/ -#ifdef ISSUE_1866_replace_overflow_libdec tmp16_3 = sub_sat( exc[( i - ( L_subfr * 2 ) )] /*Q1*/, mult_r( tmp16_2 /*Q15*/, exc[( ( i - ( L_subfr * 2 ) ) - tmp16 )] /*Q1*/ ) /*Q1*/ ); -#else - tmp16_3 = sub_o( exc[( i - ( L_subfr * 2 ) )] /*Q1*/, mult_r( tmp16_2 /*Q15*/, exc[( ( i - ( L_subfr * 2 ) ) - tmp16 )] /*Q1*/ ) /*Q1*/, &Overflow ); -#endif L_acc = L_macNs_co( L_acc, tmp16_3, tmp16_3, &Carry, &Overflow ); /*Q3*/ Overflow = 0; move16(); diff --git a/lib_dec/er_scale_syn_fx.c b/lib_dec/er_scale_syn_fx.c index 37229c7bbcf0768f41ade82256b5eca9bcd179b9..85cad33ee600fc8b6f629d43d1a6355a4987393a 100644 --- a/lib_dec/er_scale_syn_fx.c +++ b/lib_dec/er_scale_syn_fx.c @@ -33,12 +33,6 @@ Word16 Damping_fact_fx( /* o : damping factor Word32 lp_tmp; Word16 s_gainp; Word32 gain32; -#ifndef ISSUE_1866_replace_overflow_libdec -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move16(); -#endif -#endif IF( core == ACELP_CORE ) @@ -99,14 +93,10 @@ Word16 Damping_fact_fx( /* o : damping factor move16(); gain32 = Sqrt32( lp_tmp, &s_gainp ); /*Q31-s_gainp*/ -#ifdef ISSUE_1866_replace_overflow_libdec gain = round_fx_sat( L_shl_sat( gain32, s_gainp ) ); /* Q15*/ -#else - gain = round_fx_o( L_shl_o( gain32, s_gainp, &Overflow ), &Overflow ); /* Q15*/ -#endif - gain = s_min( gain, 32113 /*0.98f Q15*/ ); /*Q15*/ - gain = s_max( gain, 27853 /*0.85f Q15*/ ); /*Q15*/ - alpha = mult_r( alpha, gain ); /*Q14*/ + gain = s_min( gain, 32113 /*0.98f Q15*/ ); /*Q15*/ + gain = s_max( gain, 27853 /*0.85f Q15*/ ); /*Q15*/ + alpha = mult_r( alpha, gain ); /*Q14*/ } ELSE IF( EQ_16( nbLostCmpt, 2 ) ) { diff --git a/lib_dec/er_sync_exc_fx.c b/lib_dec/er_sync_exc_fx.c index ebcb07b66587f12e8fc822941c8f3b6e3d8e8862..6fafb882af7de7721d889c8100c24690714fdad5 100644 --- a/lib_dec/er_sync_exc_fx.c +++ b/lib_dec/er_sync_exc_fx.c @@ -30,12 +30,6 @@ static Word16 GetMinimumPosition_fx( Word16 iMinEnergyPos, center, i; Word16 cnt, tmp_e, tmp16; Word32 energy, energy_old, tmptest; -#ifndef ISSUE_1866_replace_overflow_libdec -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move16(); -#endif -#endif filterLength = s_min( filterLength, length ); /*Q0*/ center = shr( filterLength, 1 ); /*Q0*/ @@ -63,12 +57,8 @@ static Word16 GetMinimumPosition_fx( /*if (energy == MAXVAL_WORD32)*/ BASOP_SATURATE_WARNING_OFF_EVS /*saturates if energy < 0*/ -#ifdef ISSUE_1866_replace_overflow_libdec tmptest = L_sub_sat( energy, MAXVAL_WORD32 ); /*Q31*/ -#else - tmptest = L_sub_o( energy, MAXVAL_WORD32, &Overflow ); /*Q31*/ -#endif BASOP_SATURATE_WARNING_ON_EVS IF( tmptest == 0 ) { @@ -234,12 +224,6 @@ void PulseResynchronization_fx( Word16 /*int*/ roundedPitchStart, nSamplesDelta, nSamplesDeltaRemain, iMinPos1, iMinPos[NB_PULSES_MAX + 1], iDeltaSamples[NB_PULSES_MAX + 1], maxDeltaSamples, roundedCycleDelta; Word16 tmp16, tmp16_a, freqStart_e /*exponent of freqStart*/, tmp_e, samplesDelta_e, perCycleDeltaDelta_e, cycleDelta_e, tmp2_e, tmp3_e; Word32 /* pitchDelta, */ tmp32, tmp32_a, tmp32_b, samplesDelta, absPitchDiff, cycleDelta32; -#ifndef ISSUE_1866_replace_overflow_libdec -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif test(); @@ -304,11 +288,7 @@ void PulseResynchronization_fx( tmp3_e = tmp2_e; move16(); tmp32_a = L_negate( tmp32_a ); -#ifdef ISSUE_1866_replace_overflow_libdec tmp32_a = L_add( L_shl_sat( 1, sub( 31, tmp3_e ) ), tmp32_a ); /*Q31,tmp3_e*/ /*tmp32_a= 1.0f-pitchStart*freqStart*/ -#else - tmp32_a = L_add( L_shl_o( 1, sub( 31, tmp3_e ), &Overflow ), tmp32_a ); /*Q31,tmp3_e*/ /*tmp32_a= 1.0f-pitchStart*freqStart*/ -#endif tmp2_e = norm_s( nFrameLength ); tmp16_a = shl( nFrameLength, tmp2_e ); /*Q0+tmp2_e*/ tmp32_a = Mpy_32_16_1( tmp32_a /*Q31,tmp3_e*/, tmp16_a /*Q0,-tmp2_e*/ ); /*Q16,tmp3_e-tmp2_e*/ /*tmp32_a= nFrameLength*(1.0f-pitchStart*freqStart)*/ @@ -374,11 +354,7 @@ void PulseResynchronization_fx( tmp_e = sub( 15, norm_l( tmp32 ) ); cycleDelta_e = add( cycleDelta_e, tmp_e ); tmp32 = L_shr( tmp32, sub( tmp_e, 15 ) ); /*Q31 frac, cycleDelta_e*/ -#ifdef ISSUE_1866_replace_overflow_libdec - cycleDelta = round_fx_sat( tmp32 ); /*Q15, cycleDelta_e*/ -#else - cycleDelta = round_fx_o( tmp32, &Overflow ); /*Q15, cycleDelta_e*/ -#endif + cycleDelta = round_fx_sat( tmp32 ); /*Q15, cycleDelta_e*/ if ( cycleDelta == 0 ) { cycleDelta_e = 0; diff --git a/lib_dec/er_util_fx.c b/lib_dec/er_util_fx.c index 38f4ec816540ed9fe8f7779407e68b90f5e00e67..9d9a273ac96c0b554aa710fc4c8f817b99f8c1a1 100644 --- a/lib_dec/er_util_fx.c +++ b/lib_dec/er_util_fx.c @@ -44,22 +44,12 @@ void minimumStatistics_fx( Word16 f, p, i; Word16 tmp, tmp2, tmp_e; Word32 tmp32; -#ifndef ISSUE_1866_replace_overflow_libdec -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move16(); -#endif -#endif aOpt_e = 0; move16(); BASOP_SATURATE_WARNING_OFF_EVS -#ifdef ISSUE_1866_replace_overflow_libdec IF( LT_16( shl_sat( currentFrameLevel, currentFrameLevel_e ), PLC_MIN_CNG_LEV ) ) -#else - IF( LT_16( shl_o( currentFrameLevel, currentFrameLevel_e, &Overflow ), PLC_MIN_CNG_LEV ) ) -#endif { BASOP_SATURATE_WARNING_ON_EVS currentFrameLevel = PLC_MIN_CNG_LEV; /*Q15*/ diff --git a/lib_dec/evs_dec_fx.c b/lib_dec/evs_dec_fx.c index 98849ed71c7e2c34f8bf086614b89661642926f0..d0231395bfe12568540c4073b5ab68db4475bd5a 100644 --- a/lib_dec/evs_dec_fx.c +++ b/lib_dec/evs_dec_fx.c @@ -62,12 +62,6 @@ ivas_error evs_dec_fx( push_wmops( "evs_dec_fx" ); -#ifndef ISSUE_1866_replace_overflow_libdec -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move16(); -#endif -#endif hBWE_TD = st_fx->hBWE_TD; hHQ_core = st_fx->hHQ_core; hTcxLtpDec = st_fx->hTcxLtpDec; @@ -334,11 +328,7 @@ ivas_error evs_dec_fx( IF( EQ_16( st_fx->core, ACELP_CORE ) ) { /* ACELP core decoder */ -#ifdef NONBE_1325_TD_STEREO_QUANT_LSF_SEC IF( ( error = acelp_core_dec_fx( st_fx, NULL, synth_fx, NULL, bwe_exc_extended_fx, voice_factors_fx, old_syn_12k8_16k_fx, sharpFlag, pitch_buf_fx, &unbits, &sid_bw, NULL, NULL, 0, EVS_MONO, 0, 0, 1, NULL, 1 ) ) != IVAS_ERR_OK ) -#else - IF( ( error = acelp_core_dec_fx( st_fx, NULL, synth_fx, NULL, bwe_exc_extended_fx, voice_factors_fx, old_syn_12k8_16k_fx, sharpFlag, pitch_buf_fx, &unbits, &sid_bw, NULL, NULL, NULL, 0, EVS_MONO, 0, 0, 1, NULL, 1 ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -456,11 +446,7 @@ ivas_error evs_dec_fx( /*hb_synth[i] *= (i*tmp);*/ hb_synth_fx[i] = mult_r( hb_synth_fx[i], tmp16_2 ); /*hb_synth_fx_exp*/ move16(); -#ifdef ISSUE_1866_replace_overflow_libdec tmp16_2 = add_sat( tmp16_2, tmp16 ); -#else - tmp16_2 = add_o( tmp16_2, tmp16, &Overflow ); -#endif } } diff --git a/lib_dec/fd_cng_dec_fx.c b/lib_dec/fd_cng_dec_fx.c index 5e8edc095f672bc9b1f8c84616cf632795b1b6c8..47724c6e60bd360beff8fa830c88ee4e8e049ceb 100644 --- a/lib_dec/fd_cng_dec_fx.c +++ b/lib_dec/fd_cng_dec_fx.c @@ -576,19 +576,10 @@ Word16 ApplyFdCng_fx( Word16 facTab[NPART]; Word16 facTabExp[NPART]; Word16 tmp_loop; -#ifndef FIX_ISSUE_1817_REPLACE_CARRY_OVERFLOW - Word32 L_c; -#endif Word16 lsp_cng[M]; HANDLE_FD_CNG_DEC hFdCngDec; HANDLE_FD_CNG_COM hFdCngCom; #ifdef BASOP_NOGLOB_DECLARE_LOCAL -#if !defined( ISSUE_1866_replace_overflow_libdec ) && !defined( FIX_ISSUE_1817_REPLACE_CARRY_OVERFLOW ) - Flag Overflow = 0; -#endif -#ifndef FIX_ISSUE_1817_REPLACE_CARRY_OVERFLOW - Flag Carry = 0; -#endif move16(); move16(); #endif @@ -800,40 +791,6 @@ Word16 ApplyFdCng_fx( { tmp_loop = sub( hFdCngCom->stopFFTbin, hFdCngCom->startBand ); -#ifndef FIX_ISSUE_1817_REPLACE_CARRY_OVERFLOW - L_tmp = L_deposit_h( 0 ); - L_c = L_deposit_h( 0 ); - FOR( j = 0; j < tmp_loop; j++ ) - { - - Carry = 0; - move16(); - L_tmp = L_add_co( L_tmp, *( cngNoiseLevel + j ), &Carry, &Overflow ); /*Q31*/ - Overflow = 0; - move16(); - - IF( *( cngNoiseLevel + j ) < 0 ) - { - L_c = L_msuNs( L_c, 0, 0 ); /*Q-1*/ - } - IF( *( cngNoiseLevel + j ) >= 0 ) - { - L_c = L_macNs_co( L_c, 0, 0, &Carry, &Overflow ); /*Q-1*/ - } - } - L_tmp = norm_llQ31( L_c, L_tmp, &L_tmp_exp ); /*Q31 - L_tmp_exp*/ - L_tmp_exp = sub( add( L_tmp_exp, *cngNoiseLevel_exp ), 1 ); - - L_tmp = Mpy_32_16_1( L_tmp, 1 ); /*Q16 - L_tmp_exp*/ - - L_tmp = Mpy_32_16_1( L_tmp, shr( T_DIV_L_Frame[L_shl( L_mac( -28000, NORM_MDCT_FACTOR, 95 ), 1 - 15 )], 1 ) ); /*Q16,exp -7*/ - L_tmp_exp = add( L_tmp_exp, -7 ); /*->Q16, L_tmp_exp */ - L_tmp_exp = add( L_tmp_exp, 31 - 16 ); /*->Q31, L_tmp_exp*/ - - st->hTcxDec->conCngLevelBackgroundTrace = round_fx_sat( Sqrt32( L_tmp, &L_tmp_exp ) ); /*Q15 - L_tmp_exp*/ - move16(); - L_tmp_exp = add( L_tmp_exp, 1 ); -#else L_tmp = sum_array_norm( cngNoiseLevel, tmp_loop, &L_tmp_exp ); /*Q31 - L_tmp_exp*/ L_tmp_exp = sub( add( L_tmp_exp, *cngNoiseLevel_exp ), 1 ); @@ -845,7 +802,6 @@ Word16 ApplyFdCng_fx( st->hTcxDec->conCngLevelBackgroundTrace = round_fx_sat( Sqrt32( L_tmp, &L_tmp_exp ) ); /*Q15 - L_tmp_exp*/ move16(); L_tmp_exp = add( L_tmp_exp, 1 ); -#endif st->hTcxDec->conCngLevelBackgroundTrace_e = L_tmp_exp; move16(); } @@ -853,38 +809,6 @@ Word16 ApplyFdCng_fx( { tmp_loop = sub( hFdCngCom->stopFFTbin, hFdCngCom->startBand ); -#ifndef FIX_ISSUE_1817_REPLACE_CARRY_OVERFLOW - L_tmp = L_deposit_h( 0 ); - L_c = L_deposit_h( 0 ); - FOR( j = 0; j < tmp_loop; j++ ) - { - - Carry = 0; - move16(); - L_tmp = L_add_co( L_tmp, *( cngNoiseLevel + j ), &Carry, &Overflow ); /*Q31 - L_tmp_exp*/ - Overflow = 0; - move16(); - - IF( *( cngNoiseLevel + j ) < 0 ) - { - L_c = L_msuNs( L_c, 0, 0 ); /*Q-1*/ - } - IF( *( cngNoiseLevel + j ) >= 0 ) - { - L_c = L_macNs_co( L_c, 0, 0, &Carry, &Overflow ); /*Q-1*/ - } - } - L_tmp = norm_llQ31( L_c, L_tmp, &L_tmp_exp ); /*Q31 - L_tmp_exp*/ - L_tmp_exp = sub( add( L_tmp_exp, *cngNoiseLevel_exp ), 1 ); - - L_tmp = Mpy_32_16_1( L_tmp, hFdCngCom->fftlen ); /*Q16 - L_tmp_exp*/ - - L_tmp = Mpy_32_16_1( L_tmp, T_DIV_L_Frame[L_shl( L_mac( -28000, st->L_frame, 95 ), 1 - 15 )] ); /*Q16,exp -7*/ - L_tmp_exp = add( L_tmp_exp, -7 ); /*->Q16, L_tmp_exp */ - L_tmp_exp = add( L_tmp_exp, 31 - 16 ); /*->Q31, L_tmp_exp*/ - - st->hTcxDec->conCngLevelBackgroundTrace = round_fx_sat( Sqrt32( L_tmp, &L_tmp_exp ) ); /*Q15 - L_tmp_exp*/ -#else L_tmp = sum_array_norm( cngNoiseLevel, tmp_loop, &L_tmp_exp ); L_tmp_exp = sub( add( L_tmp_exp, *cngNoiseLevel_exp ), 1 ); @@ -895,47 +819,13 @@ Word16 ApplyFdCng_fx( st->hTcxDec->conCngLevelBackgroundTrace = round_fx_sat( Sqrt32( L_tmp, &L_tmp_exp ) ); /*Q15 - L_tmp_exp*/ -#endif move16(); st->hTcxDec->conCngLevelBackgroundTrace_e = L_tmp_exp; move16(); } tmp_loop = sub( hFdCngCom->stopFFTbin, hFdCngCom->startBand ); -#ifndef FIX_ISSUE_1817_REPLACE_CARRY_OVERFLOW - L_tmp = L_deposit_h( 0 ); - L_c = L_deposit_h( 0 ); - FOR( j = 0; j < tmp_loop; j++ ) - { - - Carry = 0; - move16(); - L_tmp = L_add_co( L_tmp, *( cngNoiseLevel + j ), &Carry, &Overflow ); /*Q31 - L_tmp_exp*/ - Overflow = 0; - move16(); - - IF( *( cngNoiseLevel + j ) < 0 ) - { - L_c = L_msuNs( L_c, 0, 0 ); /*Q-1*/ - } - IF( *( cngNoiseLevel + j ) >= 0 ) - { - L_c = L_macNs_co( L_c, 0, 0, &Carry, &Overflow ); /*Q-1*/ - } - } - L_tmp = norm_llQ31( L_c, L_tmp, &L_tmp_exp ); /*Q31 - L_tmp_exp*/ - L_tmp_exp = sub( add( L_tmp_exp, *cngNoiseLevel_exp ), 1 ); - - L_tmp = Mpy_32_16_1( L_tmp, hFdCngCom->fftlen ); /*Q16 - L_tmp_exp*/ - - L_tmp = Mpy_32_16_1( L_tmp, T_DIV_L_Frame[L_shl( L_mac( -28000, st->L_frame, 95 ), 1 - 15 )] ); /*Q16,exp -7*/ - L_tmp_exp = add( L_tmp_exp, -7 ); /*->Q16, L_tmp_exp */ - L_tmp_exp = add( L_tmp_exp, 31 - 16 ); /*->Q31, L_tmp_exp*/ - - st->cngTDLevel = round_fx_sat( Sqrt32( L_tmp, &L_tmp_exp ) ); /*Q15 - L_tmp_exp*/ - move16(); -#else - L_tmp = sum_array_norm( cngNoiseLevel, tmp_loop, &L_tmp_exp ); /*Q31 - L_tmp_exp*/ + L_tmp = sum_array_norm( cngNoiseLevel, tmp_loop, &L_tmp_exp ); /*Q31 - L_tmp_exp*/ L_tmp_exp = sub( add( L_tmp_exp, *cngNoiseLevel_exp ), 1 ); L_tmp = Mpy_32_16_1( L_tmp, hFdCngCom->fftlen ); /*Q16 - L_tmp_exp*/ @@ -946,7 +836,6 @@ Word16 ApplyFdCng_fx( st->cngTDLevel = round_fx_sat( Sqrt32( L_tmp, &L_tmp_exp ) ); /*Q15 - L_tmp_exp*/ move16(); -#endif st->cngTDLevel_e = L_tmp_exp; move16(); } @@ -985,11 +874,7 @@ Word16 ApplyFdCng_fx( } L_tmp_exp = 0; move16(); -#ifdef ISSUE_1866_replace_overflow_libdec IF( GT_32( L_tmp, 21474836 ) /*0.01f Q31*/ ) -#else - IF( GT_32( L_shl_o( L_tmp, L_tmp_exp, &Overflow ), 21474836 ) /*0.01f Q31*/ ) -#endif { test(); test(); @@ -1069,43 +954,6 @@ Word16 ApplyFdCng_fx( /*st->cngTDLevel = (float)sqrt( (sumFLOAT(cngNoiseLevel, hFdCngCom->stopFFTbin - hFdCngCom->startBand) / 2 * hFdCngCom->fftlen) / st->Mode2_L_frame);*/ tmp_loop = sub( hFdCngCom->stopFFTbin, hFdCngCom->startBand ); -#ifndef FIX_ISSUE_1817_REPLACE_CARRY_OVERFLOW - L_tmp = L_deposit_h( 0 ); - L_c = L_deposit_h( 0 ); - FOR( j = 0; j < tmp_loop; j++ ) - { - - Carry = 0; - move16(); - L_tmp = L_add_co( L_tmp, *( cngNoiseLevel + j ), &Carry, &Overflow ); /*Q31 - L_tmp_exp*/ - Overflow = 0; - move16(); - - IF( *( cngNoiseLevel + j ) < 0 ) - { - L_c = L_msuNs_co( L_c, 0, 0, &Carry, &Overflow ); /*Q-1*/ - } - IF( *( cngNoiseLevel + j ) >= 0 ) - { - L_c = L_macNs_co( L_c, 0, 0, &Carry, &Overflow ); /*Q-1*/ - } - } - L_tmp = norm_llQ31( L_c, L_tmp, &L_tmp_exp ); /*Q31 - L_tmp_exp*/ - L_tmp_exp = sub( add( L_tmp_exp, *cngNoiseLevel_exp ), 1 ); - - L_tmp = Mpy_32_16_1( L_tmp, hFdCngCom->fftlen ); /*Q16 - L_tmp_exp*/ - - L_tmp = Mpy_32_16_1( L_tmp, T_DIV_L_Frame[L_shl( L_mac( -28000, st->L_frame, 95 ), 1 - 15 )] ); /*Q16,exp -7*/ - L_tmp_exp = add( L_tmp_exp, -7 ); /*->Q16, L_tmp_exp */ - L_tmp_exp = add( L_tmp_exp, 31 - 16 ); /*->Q31, L_tmp_exp*/ - -#ifdef ISSUE_1866_replace_overflow_libdec - st->cngTDLevel = round_fx_sat( Sqrt32( L_tmp, &L_tmp_exp ) ); /*Q15 - L_tmp_exp*/ -#else - st->cngTDLevel = round_fx_o( Sqrt32( L_tmp, &L_tmp_exp ), &Overflow ); /*Q15 - L_tmp_exp*/ -#endif - move16(); -#else L_tmp = sum_array_norm( cngNoiseLevel, tmp_loop, &L_tmp_exp ); /*Q31 - L_tmp_exp*/ L_tmp_exp = sub( add( L_tmp_exp, *cngNoiseLevel_exp ), 1 ); @@ -1116,7 +964,6 @@ Word16 ApplyFdCng_fx( st->cngTDLevel = round_fx( Sqrt32( L_tmp, &L_tmp_exp ) ); /*Q15 - L_tmp_exp*/ move16(); -#endif st->cngTDLevel_e = L_tmp_exp; move16(); BREAK; diff --git a/lib_dec/gain_dec_fx.c b/lib_dec/gain_dec_fx.c index 5900aa70670ae6649d0ad156663fa4c2694a36b5..e001521bf8c87f4b57d4899b2a366b76f8f4667f 100644 --- a/lib_dec/gain_dec_fx.c +++ b/lib_dec/gain_dec_fx.c @@ -1409,12 +1409,6 @@ void gain_dec_amr_wb_fx( Word16 tmp; Word32 L_tmp; Word16 expg, exp_gcode0, fracg; -#ifndef ISSUE_1866_replace_overflow_libdec -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif /**gain_inov = 1.0f/ (float)sqrt( ( dotp( code, code, L_SUBFR ) + 0.01f ) / L_SUBFR );*/ @@ -1498,11 +1492,7 @@ void gain_dec_amr_wb_fx( /* adjust gain according to energy of code */ L_tmp = Mult_32_16( *gain_code, *gain_inov ); -#ifdef ISSUE_1866_replace_overflow_libdec *gain_code = L_shl_sat( L_tmp, 3 ); /* gcode_inov in Q12*/ -#else - *gain_code = L_shl_o( L_tmp, 3, &Overflow ); /* gcode_inov in Q12*/ -#endif move32(); /*-----------------------------------------------------------------* diff --git a/lib_dec/gs_dec_fx.c b/lib_dec/gs_dec_fx.c index 7ec991d48daaae21d257dd5856e27320555aa339..a17ca6febc6d7d9d75e208bbad1b35fe0d75aa29 100644 --- a/lib_dec/gs_dec_fx.c +++ b/lib_dec/gs_dec_fx.c @@ -104,11 +104,7 @@ void decod_audio_fx( } /* set bit-allocation */ -#ifdef NONBE_1325_TD_STEREO_QUANT_LSF_SEC config_acelp1_fx( DEC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl_orig, st_fx->extl_brate_orig, st_fx->L_frame, st_fx->GSC_noisy_speech, &( st_fx->acelp_cfg ), st_fx->next_bit_pos, st_fx->coder_type, st_fx->inactive_coder_type_flag, -1, 1, &nbits, NULL, st_fx->element_mode, &nbits /*dummy*/, tdm_lp_reuse_flag, tdm_low_rate_mode, st_fx->idchan, tdm_Pitch_reuse_flag, st_fx->tdm_LRTD_flag, st_fx->GSC_IVAS_mode ); -#else - config_acelp1_fx( DEC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl_orig, st_fx->extl_brate_orig, st_fx->L_frame, st_fx->GSC_noisy_speech, &( st_fx->acelp_cfg ), st_fx->next_bit_pos, st_fx->coder_type, st_fx->inactive_coder_type_flag, -1, 1, &nbits, NULL, st_fx->element_mode, &nbits /*dummy*/, tdm_lp_reuse_flag, tdm_low_rate_mode, st_fx->idchan, st_fx->active_cnt, tdm_Pitch_reuse_flag, st_fx->tdm_LRTD_flag, st_fx->GSC_IVAS_mode ); -#endif /*---------------------------------------------------------------* * Decode energy dynamics diff --git a/lib_dec/hf_synth_fx.c b/lib_dec/hf_synth_fx.c index 49d28d5caefdc1bf5b9091f16e518d345b92ca3a..06ab1d95af82ccc90b7c1d8d3810c860bfc29606 100644 --- a/lib_dec/hf_synth_fx.c +++ b/lib_dec/hf_synth_fx.c @@ -136,12 +136,6 @@ static void hf_synthesis_fx( Word16 tmp, ener, exp1, exp2, scale; Word32 L_tmp; Word16 Ap[M16k + 1]; -#ifndef ISSUE_1866_replace_overflow_libdec -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif /*-----------------------------------------------------------------* * generate white noise vector @@ -220,21 +214,13 @@ static void hf_synthesis_fx( * modify energy of white noise according to synthesis tilt *-----------------------------------------------------------------*/ /* tmp = 1.0 - fac */ -#ifdef ISSUE_1866_replace_overflow_libdec tmp = add_sat( 1, sub( 32767 /* 1 in Q15 */, tmp ) ); -#else - tmp = add_o( 1, sub( 32767 /* 1 in Q15 */, tmp ), &Overflow ); -#endif test(); if ( core_brate == FRAME_NO_DATA || EQ_32( core_brate, SID_2k40 ) ) { /* emphasize HF noise in CNG */ /*fac *= 2.0f;*/ -#ifdef ISSUE_1866_replace_overflow_libdec tmp = add_sat( tmp, tmp ); /* Q15 */ -#else - tmp = add_o( tmp, tmp, &Overflow ); /* Q15 */ -#endif } tmp = s_max( tmp, 3277 ); /* 0.1 in Q15 */ @@ -532,12 +518,6 @@ static void filt_6k_7k_scale_fx( { Word16 i, x[L_FRAME48k / NB_SUBFR + ( L_FIR - 1 )]; Word32 L_tmp; -#ifndef ISSUE_1866_replace_overflow_libdec -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif Copy_Scale_sig( mem, x, L_FIR - 1, exp ); FOR( i = 0; i < lg; i++ ) @@ -553,18 +533,10 @@ static void filt_6k_7k_scale_fx( move32(); FOR( j = 0; j < 31; j++ ) { -#ifdef ISSUE_1866_replace_overflow_libdec L_tmp = L_mac_sat( L_tmp, x[i + j], fir_6k_7k_fx[j] ); /* Q16 */ -#else - L_tmp = L_mac_o( L_tmp, x[i + j], fir_6k_7k_fx[j], &Overflow ); /* Q16 */ -#endif } -#ifdef ISSUE_1866_replace_overflow_libdec signal[i] = round_fx_sat( L_tmp ); /* Q0 */ -#else - signal[i] = round_fx_o( L_tmp, &Overflow ); /* Q0 */ -#endif move16(); } Copy( x + lg, mem, L_FIR - 1 ); /* Qx - 2 */ @@ -1404,9 +1376,6 @@ static Word16 EnhanceClass_fx( Word16 unvoicing_tmp_fx; Word16 tmp, tmp1; Word32 L_tmp; -#ifndef ISSUE_1866_replace_overflow_libdec - Flag Overflow; -#endif /* Decide (*unvoicing_flag) to allow BWE enhancement when qq>pp */ /**voice_fac_fx = add(mult_r(*voice_fac_fx, 24576), mult_r(voice_factor_fx, 8192)); //Q15 */ @@ -1443,21 +1412,13 @@ static Word16 EnhanceClass_fx( move16(); } -#ifdef ISSUE_1866_replace_overflow_libdec if ( GT_16( sub_sat( *unvoicing_fx, *unvoicing_sm_fx ), 3277 /* 0.1 in Q15 */ ) ) -#else - if ( GT_16( sub_o( *unvoicing_fx, *unvoicing_sm_fx, &Overflow ), 3277 /* 0.1 in Q15 */ ) ) -#endif { *unvoicing_flag = 1; move16(); } -#ifdef ISSUE_1866_replace_overflow_libdec if ( LT_16( sub_sat( *unvoicing_fx, *unvoicing_sm_fx ), 1638 /* 0.05 in Q15 */ ) ) -#else - if ( LT_16( sub_o( *unvoicing_fx, *unvoicing_sm_fx, &Overflow ), 1638 /* 0.05 in Q15 */ ) ) -#endif { *unvoicing_flag = 0; move16(); diff --git a/lib_dec/hq_lr_dec_fx.c b/lib_dec/hq_lr_dec_fx.c index f7fc6440d1296078bb7a36ab911a29b32abfbf60..e8c7b365ebe4c3b019c777cd716f0f594bf16a49 100644 --- a/lib_dec/hq_lr_dec_fx.c +++ b/lib_dec/hq_lr_dec_fx.c @@ -630,7 +630,6 @@ void hq_lr_dec_fx( IF( GE_16( i, highband ) ) { -#ifdef NONBE_1118_EVS_LR_HQ_BITERROR /* safety check in case of bit errors */ IF( GT_32( Ep_fx[i], 536788991 /* max(Q30) */ ) ) { @@ -640,12 +639,10 @@ void hq_lr_dec_fx( return; } -#endif enerH_fx = L_add_sat( enerH_fx, L_shl_sat( Ep_fx[i], 2 ) ); /*Q0 */ } ELSE IF( GE_16( i, lowband ) ) { -#ifdef NONBE_1118_EVS_LR_HQ_BITERROR /* safety check in case of bit errors */ IF( GT_32( Ep_fx[i], 536788991 /* max(Q30) */ ) ) { @@ -655,7 +652,6 @@ void hq_lr_dec_fx( return; } -#endif enerL_fx = L_add_sat( enerL_fx, L_shl_sat( Ep_fx[i], 2 ) ); /*Q0 */ } } diff --git a/lib_dec/igf_dec_fx.c b/lib_dec/igf_dec_fx.c index 2b1d207d335d1badf2b80facf4f7d89f5d1b8a89..1851c04a661c642a33c8a36e839c5b96990aa3f9 100644 --- a/lib_dec/igf_dec_fx.c +++ b/lib_dec/igf_dec_fx.c @@ -1884,12 +1884,8 @@ static void IGF_appl( IGF_DEC_PRIVATE_DATA_HANDLE hPrivateData, /**< in sum = shl( sum, shift ); /* exponent of sum: sub(15, shift) */ /* divide E by sum */ -#ifdef ISSUE_1866_replace_overflow_libdec tmp = div_s( shr( round_fx_sat( E ), 1 ), sum ); /* shift E 1 bit to the right in order to make it smaller than sum */ -#else - tmp = div_s( shr( round_fx_o( E, &Overflow ), 1 ), sum ); /* shift E 1 bit to the right in order to make it smaller than sum */ -#endif - tmp_e = sub( add( E_e, 1 ), sub( 15, shift ) ); /* 15Q0 | sum is 15Q0 */ + tmp_e = sub( add( E_e, 1 ), sub( 15, shift ) ); /* 15Q0 | sum is 15Q0 */ /* multiply the result by the hopsize */ L_tmp = L_mult( tmp, hopsize ); @@ -2575,12 +2571,8 @@ static void IGF_appl_ivas( IGF_DEC_PRIVATE_DATA_HANDLE hPrivateData, /**< in sum = shl( sum, shift ); /* exponent of sum: sub(15, shift) */ /* divide E by sum */ -#ifdef ISSUE_1866_replace_overflow_libdec tmp = div_s( shr( round_fx_sat( E ), 1 ), sum ); /* shift E 1 bit to the right in order to make it smaller than sum */ -#else - tmp = div_s( shr( round_fx_o( E, &Overflow ), 1 ), sum ); /* shift E 1 bit to the right in order to make it smaller than sum */ -#endif - tmp_e = sub( add( E_e, 1 ), sub( 15, shift ) ); /* 15Q0 | sum is 15Q0 */ + tmp_e = sub( add( E_e, 1 ), sub( 15, shift ) ); /* 15Q0 | sum is 15Q0 */ /* multiply the result by the hopsize */ L_tmp = L_mult( tmp, hopsize ); @@ -2983,12 +2975,6 @@ static void IGF_RefineGrid( H_IGF_GRID hGrid /**< in Word16 sfb; Word16 tmp; Word16 delta; -#ifndef ISSUE_1866_replace_overflow_libdec -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move16(); -#endif -#endif set16_fx( a, 0, IGF_MAX_SFB + 1 ); @@ -3002,11 +2988,7 @@ static void IGF_RefineGrid( H_IGF_GRID hGrid /**< in move16(); tmp = add( tmp, 1 ); delta = sub( hGrid->swb_offset[sfb + 1], hGrid->swb_offset[sfb] ); -#ifdef ISSUE_1866_replace_overflow_libdec delta = mac_r( 0x00195000, 29491 /*0.45f Q16*/, shl_sat( delta, 5 ) ); -#else - delta = mac_r( 0x00195000, 29491 /*0.45f Q16*/, shl_o( delta, 5, &Overflow ) ); -#endif a[tmp] = add( hGrid->swb_offset[sfb], shr( delta, 6 ) ); move16(); IF( s_and( a[tmp], 1 ) != 0 ) @@ -3037,12 +3019,6 @@ static void IGF_RefineGrid_ivas_fx( H_IGF_GRID hGrid /**< in/out: | IGF grid han Word16 sfb; Word16 tmp; Word16 delta; -#ifndef ISSUE_1866_replace_overflow_libdec -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move16(); -#endif -#endif set16_fx( a, 0, IGF_MAX_SFB + 1 ); @@ -3056,11 +3032,7 @@ static void IGF_RefineGrid_ivas_fx( H_IGF_GRID hGrid /**< in/out: | IGF grid han move16(); tmp = add( tmp, 1 ); delta = sub( hGrid->swb_offset[sfb + 1], hGrid->swb_offset[sfb] ); -#ifdef ISSUE_1796_replace_shl_o delta = mac_r( 0x00195000, 29491 /*0.45f Q16*/, shl_sat( delta, 5 ) ); -#else - delta = mac_r( 0x00195000, 29491 /*0.45f Q16*/, shl_o( delta, 5, &Overflow ) ); -#endif a[tmp] = add( hGrid->swb_offset[sfb], shr( delta, 6 ) ); move16(); // Rounding off delta values >=t+0.5 to t+1 diff --git a/lib_dec/init_dec_fx.c b/lib_dec/init_dec_fx.c index 9f77d2913f94d53ae1c7e9d1ada01f4e0f0f2201..7a89118c3b041bd77316c322d945cd0f125aead9 100644 --- a/lib_dec/init_dec_fx.c +++ b/lib_dec/init_dec_fx.c @@ -1174,11 +1174,7 @@ ivas_error init_decoder_ivas_fx( move16(); st_fx->last_vad_fx = 0; move16(); -#ifdef NONBE_1325_TD_STEREO_QUANT_LSF_SEC st_fx->active_cnt = CNG_TYPE_HO; -#else - st_fx->active_cnt = 20; -#endif move16(); test(); diff --git a/lib_dec/ivas_binRenderer_internal_fx.c b/lib_dec/ivas_binRenderer_internal_fx.c index 780a272f494fca3eab40cfba2c9d2eb92031bd9f..a3620942398625cf956b67eae6389686d0821250 100644 --- a/lib_dec/ivas_binRenderer_internal_fx.c +++ b/lib_dec/ivas_binRenderer_internal_fx.c @@ -50,7 +50,6 @@ #define NUM_TAPS_F0_4 ( Word16 )( 39 ) // (Word16) ceil( 0.4f * hBinRenConvModule->numTaps ) #define NUM_TAPS_F0_3 ( Word16 )( 29 ) // (Word16) ceil( 0.3f * hBinRenConvModule->numTaps ) -#ifdef FIX_1053_REVERB_RECONFIGURATION /*----------------------------------------------------------------------------------* * Local constants *----------------------------------------------------------------------------------*/ @@ -62,7 +61,6 @@ const Word32 dmxmtx_table_fx[BINAURAL_CHANNELS][REVERB_INPUT_DOWNMIX_CHANNELS] = { 0x7fffffff, 0, 1518485623, 0x7fffffff, 0, 0x7fffffff, 0, 0x7fffffff, 0, 0x7fffffff, 0 }, { 0, 0x7fffffff, 1518485623, 0, 0x7fffffff, 0, 0x7fffffff, 0, 0x7fffffff, 0, 0x7fffffff }, }; -#endif /*------------------------------------------------------------------------- * ivas_binRenderer_filterModule_fx() @@ -902,7 +900,6 @@ static ivas_error ivas_binaural_hrtf_open_fx( * * *-------------------------------------------------------------------------*/ -#ifdef FIX_1939_REVERB_DMX_OUT_Q static void ivas_binaural_obtain_DMX_fx( const Word16 numTimeSlots, BINAURAL_RENDERER_HANDLE hBinRenderer, /* i/o: fastconv binaural renderer handle */ @@ -911,15 +908,6 @@ static void ivas_binaural_obtain_DMX_fx( Word32 realDMX[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /*Q_in_out*/ Word32 imagDMX[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /*Q_in_out*/ Word16 *Q_in_out ) /*i/o: input and output Q*/ -#else -static void ivas_binaural_obtain_DMX_fx( - const Word16 numTimeSlots, - BINAURAL_RENDERER_HANDLE hBinRenderer, /* i/o: fastconv binaural renderer handle */ - Word32 RealBuffer[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i : Contains the LS signals Q_in */ - Word32 ImagBuffer[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i : Contains the LS signals Q_in */ - Word32 realDMX[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /*Q_in-1*/ - Word32 imagDMX[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX] ) /*Q_in-1*/ -#endif { Word16 chIdx, bandIdx, k; @@ -947,12 +935,7 @@ static void ivas_binaural_obtain_DMX_fx( FOR( chIdx = 0; chIdx < hBinRenderer->nInChannels; chIdx++ ) { -#ifdef FIX_1053_REVERB_RECONFIGURATION Word32 dmxConst = dmxmtx_table_fx[chOutIdx][chIdx]; -#else - Word32 dmxConst = hBinRenderer->hReverb->dmxmtx_fx[chOutIdx][chIdx]; - move32(); -#endif FOR( bandIdx = 0; bandIdx < hBinRenderer->conv_band; bandIdx++ ) { @@ -1011,9 +994,7 @@ static void ivas_binaural_obtain_DMX_fx( } } } -#ifdef FIX_1939_REVERB_DMX_OUT_Q *Q_in_out = sub( *Q_in_out, 1 ); -#endif } ELSE IF( EQ_32( hBinRenderer->ivas_format, SBA_FORMAT ) || EQ_32( hBinRenderer->ivas_format, MASA_FORMAT ) ) { @@ -1081,12 +1062,10 @@ static void ivas_binaural_obtain_DMX_fx( } } } -#ifdef FIX_1939_REVERB_DMX_OUT_Q IF( NE_16( hBinRenderer->nInChannels, HOA3_CHANNELS ) ) { *Q_in_out = sub( *Q_in_out, 1 ); } -#endif } return; @@ -1206,15 +1185,9 @@ ivas_error ivas_binRenderer_open_fx( ) { BINAURAL_RENDERER_HANDLE hBinRenderer; -#ifdef FIX_1053_REVERB_RECONFIGURATION Word16 convBand, k; -#else - Word16 convBand, chIdx, k; -#endif ivas_error error; -#ifdef FIX_587_DEFAULT_REVERB const IVAS_ROOM_ACOUSTICS_CONFIG_DATA *pRoomAcoustics; -#endif error = IVAS_ERR_OK; move32(); @@ -1374,38 +1347,17 @@ ivas_error ivas_binRenderer_open_fx( test(); IF( EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV_ROOM ) || ( EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV ) && EQ_32( st_ivas->hOutSetup.output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) ) { -#ifdef FIX_587_DEFAULT_REVERB pRoomAcoustics = NULL; IF( EQ_32( st_ivas->hOutSetup.output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) { pRoomAcoustics = &( st_ivas->hRenderConfig->roomAcoustics ); } -#ifdef FIX_1139_REV_COLORATION_SHORT_T60 IF( NE_32( ( error = ivas_binaural_reverb_init( &( hBinRenderer->hReverb ), st_ivas->hHrtfStatistics, hBinRenderer->conv_band, hBinRenderer->timeSlots, pRoomAcoustics, st_ivas->hDecoderConfig->output_Fs, st_ivas->hHrtfFastConv->fastconvReverberationTimes_fx, st_ivas->hHrtfFastConv->fastconvReverberationEneCorrections_fx, NULL ) ), IVAS_ERR_OK ) ) -#else - IF( NE_32( ( error = ivas_binaural_reverb_init( &( hBinRenderer->hReverb ), st_ivas->hHrtfStatistics, hBinRenderer->conv_band, hBinRenderer->timeSlots, pRoomAcoustics, st_ivas->hDecoderConfig->output_Fs, st_ivas->hHrtfFastConv->fastconvReverberationTimes_fx, st_ivas->hHrtfFastConv->fastconvReverberationEneCorrections_fx ) ), IVAS_ERR_OK ) ) -#endif -#else - IF( NE_32( ( error = ivas_binaural_reverb_init( &( hBinRenderer->hReverb ), st_ivas->hHrtfStatistics, hBinRenderer->conv_band, hBinRenderer->timeSlots, &( st_ivas->hRenderConfig->roomAcoustics ), st_ivas->hDecoderConfig->output_Fs, st_ivas->hHrtfFastConv->fastconvReverberationTimes_fx, st_ivas->hHrtfFastConv->fastconvReverberationEneCorrections_fx ) ), IVAS_ERR_OK ) ) -#endif { return error; } -/* initialize the dmx matrix */ -#ifndef FIX_1053_REVERB_RECONFIGURATION - IF( NE_16( hBinRenderer->nInChannels, HOA3_CHANNELS ) ) - { - FOR( chIdx = 0; chIdx < BINAURAL_CHANNELS; chIdx++ ) - { - FOR( k = 0; k < hBinRenderer->nInChannels; k++ ) - { - hBinRenderer->hReverb->dmxmtx_fx[chIdx][k] = dmxmtx_table_fx[chIdx][k]; - move32(); - } - } - } -#endif + /* initialize the dmx matrix */ } ELSE { @@ -1869,16 +1821,10 @@ void ivas_binRenderer_fx( Word32 inRe_fx[BINAURAL_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; Word32 inIm_fx[BINAURAL_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; Word16 shift_q; -#ifdef FIX_1939_REVERB_DMX_OUT_Q Word16 q_in_out; q_in_out = *Q_in; -#endif -#ifdef FIX_1939_REVERB_DMX_OUT_Q ivas_binaural_obtain_DMX_fx( numTimeSlots, hBinRenderer, RealBuffer_fx, ImagBuffer_fx, inRe_fx, inIm_fx, &q_in_out ); -#else - ivas_binaural_obtain_DMX_fx( numTimeSlots, hBinRenderer, RealBuffer_fx, ImagBuffer_fx, inRe_fx, inIm_fx ); -#endif FOR( chIdx = 0; chIdx < BINAURAL_CHANNELS; chIdx++ ) { @@ -1890,11 +1836,7 @@ void ivas_binRenderer_fx( } ivas_binaural_reverb_processSubframe_fx( hBinRenderer->hReverb, BINAURAL_CHANNELS, numTimeSlots, inRe_fx, inIm_fx, reverbRe_fx, reverbIm_fx ); -#ifdef FIX_1939_REVERB_DMX_OUT_Q shift_q = sub( Q6, q_in_out ); -#else - shift_q = sub( Q6, sub( *Q_in, 1 ) ); -#endif FOR( i = 0; i < BINAURAL_CHANNELS; i++ ) { FOR( j = 0; j < numTimeSlots; j++ ) diff --git a/lib_dec/ivas_core_dec_fx.c b/lib_dec/ivas_core_dec_fx.c index 7d765a8a4bc41877980651e702fc9480799a1ae2..beb1f8b2b1ca3731bca1ce572304fbbee0864208 100644 --- a/lib_dec/ivas_core_dec_fx.c +++ b/lib_dec/ivas_core_dec_fx.c @@ -110,15 +110,8 @@ ivas_error ivas_core_dec_fx( move16(); move16(); -#ifdef NONBE_1325_TD_STEREO_QUANT_LSF_SEC Word16 tdm_lsfQ_PCh_fx[M]; -#else - Word16 tdm_lsfQ_PCh_fx[M], tdm_lspQ_PCh_fx[M]; -#endif Word32 conceal_eof_gain32; -#ifndef ISSUE_1866_replace_overflow_libdec - Flag Overflow; -#endif error = IVAS_ERR_OK; move32(); @@ -524,11 +517,7 @@ ivas_error ivas_core_dec_fx( Scale_sig( st->hFdCngDec->hFdCngCom->A_cng, add( M, 1 ), sub( norm_s( sub( st->hFdCngDec->hFdCngCom->A_cng[0], 1 ) ), 3 ) ); // Qx } -#ifdef NONBE_1325_TD_STEREO_QUANT_LSF_SEC IF( NE_32( ( error = acelp_core_dec_fx( st, output_16_fx[n], synth_16_fx[n], save_hb_synth_16_fx, bwe_exc_extended_fx[n], voice_factors_fx[n], old_syn_12k8_16k_fx_16, sharpFlag[n], pitch_buf_fx[n], &unbits[n], &sid_bw[n], hStereoTD, tdm_lsfQ_PCh_fx, use_cldfb_for_dft, last_element_mode, last_element_brate, flag_sec_CNA, nchan_out, hStereoCng, read_sid_info ) ), IVAS_ERR_OK ) ) -#else - IF( NE_32( ( error = acelp_core_dec_fx( st, output_16_fx[n], synth_16_fx[n], save_hb_synth_16_fx, bwe_exc_extended_fx[n], voice_factors_fx[n], old_syn_12k8_16k_fx_16, sharpFlag[n], pitch_buf_fx[n], &unbits[n], &sid_bw[n], hStereoTD, tdm_lspQ_PCh_fx, tdm_lsfQ_PCh_fx, use_cldfb_for_dft, last_element_mode, last_element_brate, flag_sec_CNA, nchan_out, hStereoCng, read_sid_info ) ), IVAS_ERR_OK ) ) -#endif { return error; } @@ -645,12 +634,7 @@ ivas_error ivas_core_dec_fx( { Copy_Scale_sig_32_16( hCPE->hCoreCoder[0]->old_pitch_buf_fx, hCPE->hCoreCoder[0]->old_pitch_buf_16_fx, add( imult1616( 2, NB_SUBFR16k ), 2 ), -Q10 ); // Q6 -#ifdef NONBE_1325_TD_STEREO_QUANT_LSF_SEC td_stereo_param_updt_fx( st->lsp_old_fx, st->lsf_old_fx, st->old_pitch_buf_16_fx + st->nb_subfr, tdm_lsfQ_PCh_fx, hStereoTD->tdm_Pri_pitch_buf_fx, st->flag_ACELP16k, hStereoTD->tdm_use_IAWB_Ave_lpc ); -#else - td_stereo_param_updt_fx( st->lsp_old_fx, st->lsf_old_fx, st->old_pitch_buf_16_fx + st->nb_subfr, - tdm_lspQ_PCh_fx, tdm_lsfQ_PCh_fx, hStereoTD->tdm_Pri_pitch_buf_fx, st->flag_ACELP16k, hStereoTD->tdm_use_IAWB_Ave_lpc ); -#endif Copy_Scale_sig_16_32_no_sat( hCPE->hCoreCoder[0]->old_pitch_buf_16_fx, hCPE->hCoreCoder[0]->old_pitch_buf_fx, add( imult1616( 2, NB_SUBFR16k ), 2 ), Q10 ); // Q16 } @@ -1122,11 +1106,7 @@ ivas_error ivas_core_dec_fx( { hb_synth_32_fx[n][i] = Mpy_32_16_1( hb_synth_32_fx[n][i], tmp16_2 ); /* Q11 */ move32(); -#ifdef ISSUE_1866_replace_overflow_libdec tmp16_2 = add_sat( tmp16_2, tmp16 ); /* Q15 */ -#else - tmp16_2 = add_o( tmp16_2, tmp16, &Overflow ); /* Q15 */ -#endif } } diff --git a/lib_dec/ivas_corecoder_dec_reconfig_fx.c b/lib_dec/ivas_corecoder_dec_reconfig_fx.c index 5b4c7f4723804b658d3ec737472c83df984118eb..e91b7f8b019ea3870f92f3a80e9822050b2b6581 100644 --- a/lib_dec/ivas_corecoder_dec_reconfig_fx.c +++ b/lib_dec/ivas_corecoder_dec_reconfig_fx.c @@ -342,11 +342,7 @@ ivas_error ivas_corecoder_dec_reconfig_fx( } ELSE IF( st_ivas->hMCT != NULL && GT_16( st_ivas->nCPE, 1 ) ) { -#ifdef NONBE_FIX_ISM_XOVER_BR IF( NE_32( ( error = mct_dec_reconfigure_fx( st_ivas, (UWord16) NE_16( nchan_transport_real, nchan_transport_old ) ) ), IVAS_ERR_OK ) ) -#else - IF( NE_32( ( error = mct_dec_reconfigure_fx( st_ivas, (UWord16) NE_16( st_ivas->nchan_transport, nchan_transport_old ) ) ), IVAS_ERR_OK ) ) -#endif { return error; } @@ -448,13 +444,9 @@ ivas_error ivas_corecoder_dec_reconfig_fx( *-----------------------------------------------------------------*/ test(); -#ifdef NONBE_FIX_ISM_XOVER_BR test(); test(); IF( EQ_16( st_ivas->ivas_format, SBA_FORMAT ) || EQ_16( st_ivas->ivas_format, MASA_FORMAT ) || EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) -#else - if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == MASA_FORMAT ) -#endif { ivas_sba_set_cna_cng_flag( st_ivas ); } diff --git a/lib_dec/ivas_cpe_dec_fx.c b/lib_dec/ivas_cpe_dec_fx.c index f8d22954025b7b4040914cc601dd5cf99fc5508b..f2172a821195e33434e0252cc2bd7672296f7ec8 100644 --- a/lib_dec/ivas_cpe_dec_fx.c +++ b/lib_dec/ivas_cpe_dec_fx.c @@ -535,13 +535,11 @@ ivas_error ivas_cpe_dec_fx( { sts[1]->active_cnt = 0; move16(); -#ifdef NONBE_1325_TD_STEREO_QUANT_LSF_SEC if ( sts[1]->ini_frame == 0 ) { sts[1]->active_cnt = CNG_TYPE_HO; move16(); } -#endif } } ELSE @@ -549,11 +547,7 @@ ivas_error ivas_cpe_dec_fx( sts[n]->VAD = 1; move16(); sts[n]->active_cnt = add( sts[n]->active_cnt, 1 ); -#ifdef NONBE_1325_TD_STEREO_QUANT_LSF_SEC sts[n]->active_cnt = s_min( sts[n]->active_cnt, 200 ); -#else - sts[n]->active_cnt = s_min( sts[n]->active_cnt, 100 ); -#endif move16(); move16(); } diff --git a/lib_dec/ivas_dirac_dec_fx.c b/lib_dec/ivas_dirac_dec_fx.c index 39bcf9039560de41b80af36d864b88242bd803a5..211b004b8bfacbf577d29d8980617174810ad7a9 100644 --- a/lib_dec/ivas_dirac_dec_fx.c +++ b/lib_dec/ivas_dirac_dec_fx.c @@ -1142,11 +1142,7 @@ ivas_error ivas_dirac_dec_config_fx( IF( st_ivas->hDiracDecBin[0] == NULL ) { -#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF IF( NE_32( ( error = ivas_dirac_dec_init_binaural_data_fx( st_ivas, &( st_ivas->hHrtfParambin ) ) ), IVAS_ERR_OK ) ) -#else - IF( NE_32( ( error = ivas_dirac_dec_init_binaural_data_fx( st_ivas, st_ivas->hHrtfParambin ) ), IVAS_ERR_OK ) ) -#endif { return error; } @@ -1246,10 +1242,8 @@ void ivas_dirac_dec_read_BS_fx( Word16 *nb_bits, /* o : number of bits read */ const Word16 last_bit_pos, /* i : last read bitstream position */ const Word16 hodirac_flag, /* i : flag to indicate HO-DirAC mode */ -#ifdef NONBE_FIX_1052_SBA_EXT - const Word16 nchan_transport, /* i : number of transport channels */ -#endif - Word16 *dirac_to_spar_md_bands /* o : DirAC->SPAR MD bands */ + const Word16 nchan_transport, /* i : number of transport channels */ + Word16 *dirac_to_spar_md_bands /* o : DirAC->SPAR MD bands */ ) { Word16 i, j, b, dir, orig_dirac_bands; @@ -1293,13 +1287,8 @@ void ivas_dirac_dec_read_BS_fx( } } -#ifdef NONBE_FIX_1052_SBA_EXT *nb_bits = add( *nb_bits, ivas_qmetadata_dec_sid_decode( hQMetaData, st->bit_stream, &( st->next_bit_pos ), nchan_transport, NULL, SBA_FORMAT ) ); move16(); -#else - *nb_bits = add( *nb_bits, ivas_qmetadata_dec_sid_decode( hQMetaData, st->bit_stream, &( st->next_bit_pos ), 0, NULL, SBA_FORMAT ) ); - move16(); -#endif FOR( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) { hQMetaData->q_direction[0].band_data[orig_dirac_bands - 1].azimuth_fx[i] = hQMetaData->q_direction[0].band_data[1].azimuth_fx[0]; @@ -1359,11 +1348,7 @@ void ivas_dirac_dec_read_BS_fx( /* subtract mode signaling bits, since bitstream was moved after mode reading */ iDiv_and_mod_32( ivas_total_brate, FRAMES_PER_SEC, &quo, &rem, 0 ); -#ifdef NONBE_FIX_1052_SBA_EXT st->next_bit_pos = extract_l( L_sub( L_sub( quo, 1 ), SID_FORMAT_NBITS + SBA_PLANAR_BITS + SBA_ORDER_BITS ) ); -#else - st->next_bit_pos = extract_l( L_sub( L_sub( quo, 1 ), SID_FORMAT_NBITS ) ); -#endif move16(); /* 1 bit flag for signaling metadata to read */ @@ -1387,13 +1372,8 @@ void ivas_dirac_dec_read_BS_fx( } } } -#ifdef NONBE_FIX_1052_SBA_EXT *nb_bits = add( *nb_bits, ivas_qmetadata_dec_sid_decode( hQMetaData, st->bit_stream, &( st->next_bit_pos ), nchan_transport, NULL, SBA_FORMAT ) ); move16(); -#else - *nb_bits = add( *nb_bits, ivas_qmetadata_dec_sid_decode( hQMetaData, st->bit_stream, &( st->next_bit_pos ), 0, NULL, SBA_FORMAT ) ); - move16(); -#endif FOR( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) { @@ -3252,16 +3232,8 @@ void ivas_dirac_dec_render_sf_fx( IF( hDirAC->hConfig->dec_param_estim ) { Word16 fac; -#ifndef ISSUE_1796_replace_shl_o - Flag flag = 0; - move32(); -#endif fac = BASOP_Util_Divide3232_Scale( 1, hSpatParamRendCom->subframe_nbslots[subframe_idx], &exp ); -#ifdef ISSUE_1796_replace_shl_o fac = shl_sat( fac, exp ); -#else - fac = shl_o( fac, exp, &flag ); -#endif IF( LT_16( q_diffuseness_vector, hSpatParamRendCom->q_diffuseness_vector ) ) { @@ -3706,168 +3678,91 @@ void ivas_dirac_dec_render_sf_fx( test(); IF( ( ( EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) && EQ_16( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) ) && EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV_ROOM ) ) ) { -#ifndef NONBE_FIX_1141_OSBA_ROOM_RENDERING - Word16 in_ch; - FOR( in_ch = 0; in_ch < st_ivas->nchan_ism; in_ch++ ) + Word16 j, k, l; + Word16 num_objects, nchan_out_woLFE; + Word16 n_slots_to_render; + Word16 n_samples_to_render; + Word32 gain_fx, prev_gain_fx; + + num_objects = st_ivas->nchan_ism; + move16(); + nchan_out_woLFE = st_ivas->hIntSetup.nchan_out_woLFE; + move16(); + n_slots_to_render = st_ivas->hSpar->subframe_nbslots[st_ivas->hSpar->subframes_rendered]; + move16(); + n_samples_to_render = imult1616( hSpatParamRendCom->num_freq_bands, n_slots_to_render ); + + test(); + IF( st_ivas->hCombinedOrientationData && st_ivas->hCombinedOrientationData->enableCombinedOrientation[0] ) { -#endif - Word16 j, k, l; -#ifndef NONBE_FIX_1141_OSBA_ROOM_RENDERING - Word16 j2, lfe_index; -#endif - Word16 num_objects, nchan_out_woLFE; - Word16 n_slots_to_render; - Word16 n_samples_to_render; -#ifndef NONBE_FIX_1141_OSBA_ROOM_RENDERING - Word16 interp_offset; -#endif - Word32 gain_fx, prev_gain_fx; - - num_objects = st_ivas->nchan_ism; - move16(); - nchan_out_woLFE = st_ivas->hIntSetup.nchan_out_woLFE; + ivas_jbm_dec_get_adapted_linear_interpolator_fx( n_samples_to_render, n_samples_to_render, st_ivas->hIsmRendererData->interpolator_fx ); + st_ivas->hIsmRendererData->interp_offset_fx = 0; move16(); - n_slots_to_render = st_ivas->hSpar->subframe_nbslots[st_ivas->hSpar->subframes_rendered]; - move16(); - n_samples_to_render = imult1616( hSpatParamRendCom->num_freq_bands, n_slots_to_render ); -#ifndef NONBE_FIX_1141_OSBA_ROOM_RENDERING - interp_offset = st_ivas->hTcBuffer->n_samples_rendered; - move16(); -#endif + } + FOR( i = 0; i < num_objects; i++ ) + { + /* Combined rotation: rotate the object positions depending the head and external orientations */ test(); - IF( st_ivas->hCombinedOrientationData && st_ivas->hCombinedOrientationData->enableCombinedOrientation[0] ) + IF( st_ivas->hCombinedOrientationData != NULL && EQ_16( st_ivas->hCombinedOrientationData->enableCombinedOrientation[0], 1 ) ) { - ivas_jbm_dec_get_adapted_linear_interpolator_fx( n_samples_to_render, n_samples_to_render, st_ivas->hIsmRendererData->interpolator_fx ); -#ifdef NONBE_FIX_1141_OSBA_ROOM_RENDERING - st_ivas->hIsmRendererData->interp_offset_fx = 0; -#else - interp_offset = 0; -#endif - move16(); + Word16 az_q0 = extract_l( L_shr( st_ivas->hIsmMetaData[i]->azimuth_fx, Q22 ) ); + Word16 el_q0 = extract_l( L_shr( st_ivas->hIsmMetaData[i]->elevation_fx, Q22 ) ); + Word32 az1_32, el1_32; + rotateAziEle_fixed( az_q0, el_q0, &az1_32, &el1_32, st_ivas->hCombinedOrientationData->Rmat_fx[0], st_ivas->hIntSetup.is_planar_setup ); + + IF( st_ivas->hEFAPdata != NULL ) + { + const Word32 azi_fx = L_shl( az1_32, Q22 - Q16 ); // Q16 -> Q22 + const Word32 ele_fx = L_shl( el1_32, Q22 - Q16 ); // Q16 -> Q22 + efap_determine_gains_fx( st_ivas->hEFAPdata, st_ivas->hIsmRendererData->gains_fx[i], azi_fx, ele_fx, EFAP_MODE_EFAP ); + } } - FOR( i = 0; i < num_objects; i++ ) + FOR( j = 0; j < nchan_out_woLFE; j++ ) { - /* Combined rotation: rotate the object positions depending the head and external orientations */ + gain_fx = st_ivas->hIsmRendererData->gains_fx[i][j]; + move32(); + prev_gain_fx = st_ivas->hIsmRendererData->prev_gains_fx[i][j]; + move32(); test(); - IF( st_ivas->hCombinedOrientationData != NULL && EQ_16( st_ivas->hCombinedOrientationData->enableCombinedOrientation[0], 1 ) ) + IF( ( L_abs( gain_fx ) > 0 || L_abs( prev_gain_fx ) > 0 ) ) { - Word16 az_q0 = extract_l( L_shr( st_ivas->hIsmMetaData[i]->azimuth_fx, Q22 ) ); - Word16 el_q0 = extract_l( L_shr( st_ivas->hIsmMetaData[i]->elevation_fx, Q22 ) ); - Word32 az1_32, el1_32; - rotateAziEle_fixed( az_q0, el_q0, &az1_32, &el1_32, st_ivas->hCombinedOrientationData->Rmat_fx[0], st_ivas->hIntSetup.is_planar_setup ); - - IF( st_ivas->hEFAPdata != NULL ) - { - const Word32 azi_fx = L_shl( az1_32, Q22 - Q16 ); // Q16 -> Q22 - const Word32 ele_fx = L_shl( el1_32, Q22 - Q16 ); // Q16 -> Q22 - efap_determine_gains_fx( st_ivas->hEFAPdata, st_ivas->hIsmRendererData->gains_fx[i], azi_fx, ele_fx, EFAP_MODE_EFAP ); - } - } + Word32 *tc_re_fx, *tc_im_fx; + Word16 *w1_fx, w2_fx; -#ifdef NONBE_FIX_1141_OSBA_ROOM_RENDERING - FOR( j = 0; j < nchan_out_woLFE; j++ ) -#else - lfe_index = 0; - move16(); - for ( j = 0, j2 = 0; j < nchan_out_woLFE; j++, j2++ ) -#endif - { -#ifndef NONBE_FIX_1141_OSBA_ROOM_RENDERING - test(); - IF( ( st_ivas->hIntSetup.num_lfe > 0 && ( EQ_16( st_ivas->hIntSetup.index_lfe[lfe_index], j ) ) ) ) - { - IF( LT_16( lfe_index, sub( st_ivas->hIntSetup.num_lfe, 1 ) ) ) - { - lfe_index = add( lfe_index, 1 ); - j2 = add( j2, 1 ); - } - ELSE - { - j2 = add( j2, 1 ); - } - } -#endif - gain_fx = st_ivas->hIsmRendererData->gains_fx[i][j]; + w1_fx = &st_ivas->hIsmRendererData->interpolator_fx[st_ivas->hIsmRendererData->interp_offset_fx]; + tc_re_fx = pppQMfFrame_ts_re_fx[nchan_transport + i][0]; move32(); - prev_gain_fx = st_ivas->hIsmRendererData->prev_gains_fx[i][j]; + tc_im_fx = pppQMfFrame_ts_im_fx[nchan_transport + i][0]; move32(); - test(); - IF( ( L_abs( gain_fx ) > 0 || L_abs( prev_gain_fx ) > 0 ) ) + FOR( k = 0; k < n_slots_to_render; k++ ) { - Word32 *tc_re_fx, *tc_im_fx; - Word16 *w1_fx, w2_fx; - -#ifdef NONBE_FIX_1141_OSBA_ROOM_RENDERING - w1_fx = &st_ivas->hIsmRendererData->interpolator_fx[st_ivas->hIsmRendererData->interp_offset_fx]; -#else - w1_fx = &st_ivas->hIsmRendererData->interpolator_fx[interp_offset]; -#endif - tc_re_fx = pppQMfFrame_ts_re_fx[nchan_transport + i][0]; - move32(); - tc_im_fx = pppQMfFrame_ts_im_fx[nchan_transport + i][0]; - move32(); - FOR( k = 0; k < n_slots_to_render; k++ ) + Word32 g_fx; + w2_fx = sub( MAX16B, *w1_fx ); + g_fx = Madd_32_16( Mpy_32_16_1( gain_fx, *w1_fx ), prev_gain_fx, w2_fx ); // Q15 + FOR( l = 0; l < hSpatParamRendCom->num_freq_bands; l++ ) { - Word32 g_fx; - w2_fx = sub( MAX16B, *w1_fx ); - g_fx = Madd_32_16( Mpy_32_16_1( gain_fx, *w1_fx ), prev_gain_fx, w2_fx ); // Q15 - FOR( l = 0; l < hSpatParamRendCom->num_freq_bands; l++ ) - { -#ifdef NONBE_FIX_1141_OSBA_ROOM_RENDERING -#ifdef FIX_CDLFB_BUFFER_SCALING - Cldfb_RealBuffer_fx[j][k][l] = Madd_32_32( Cldfb_RealBuffer_fx[j][k][l], g_fx, L_shl( *tc_re_fx, 1 ) ); -#else - Cldfb_RealBuffer_fx[j][k][l] = Madd_32_32( Cldfb_RealBuffer_fx[j][k][l], g_fx, *tc_re_fx ); -#endif -#else -#ifdef FIX_CDLFB_BUFFER_SCALING - Cldfb_RealBuffer_fx[j2][k][l] = Madd_32_32( Cldfb_RealBuffer_fx[j2][k][l], g_fx, L_shl( *tc_re_fx, 1 ) ); -#else - Cldfb_RealBuffer_fx[j2][k][l] = Madd_32_32( Cldfb_RealBuffer_fx[j2][k][l], g_fx, *tc_re_fx ); -#endif -#endif - move32(); - tc_re_fx++; -#ifdef NONBE_FIX_1141_OSBA_ROOM_RENDERING -#ifdef FIX_CDLFB_BUFFER_SCALING - Cldfb_ImagBuffer_fx[j][k][l] = Madd_32_32( Cldfb_ImagBuffer_fx[j][k][l], g_fx, L_shl( *tc_im_fx, 1 ) ); -#else - Cldfb_ImagBuffer_fx[j][k][l] = Madd_32_32( Cldfb_ImagBuffer_fx[j][k][l], g_fx, *tc_im_fx ); -#endif -#else -#ifdef FIX_CDLFB_BUFFER_SCALING - Cldfb_ImagBuffer_fx[j2][k][l] = Madd_32_32( Cldfb_ImagBuffer_fx[j2][k][l], g_fx, L_shl( *tc_im_fx, 1 ) ); -#else - Cldfb_ImagBuffer_fx[j2][k][l] = Madd_32_32( Cldfb_ImagBuffer_fx[j2][k][l], g_fx, *tc_im_fx ); -#endif -#endif - move32(); -#ifdef FIX_1917_DIRAC_RENDER_PTR_INCR - tc_im_fx++; -#else + Cldfb_RealBuffer_fx[j][k][l] = Madd_32_32( Cldfb_RealBuffer_fx[j][k][l], g_fx, L_shl( *tc_re_fx, 1 ) ); + move32(); tc_re_fx++; -#endif - } - w1_fx += hSpatParamRendCom->num_freq_bands; + Cldfb_ImagBuffer_fx[j][k][l] = Madd_32_32( Cldfb_ImagBuffer_fx[j][k][l], g_fx, L_shl( *tc_im_fx, 1 ) ); + move32(); + tc_im_fx++; } + w1_fx += hSpatParamRendCom->num_freq_bands; } - /* update here only in case of head rotation */ - test(); - IF( st_ivas->hCombinedOrientationData != NULL && EQ_16( st_ivas->hCombinedOrientationData->enableCombinedOrientation[0], 1 ) ) - { - st_ivas->hIsmRendererData->prev_gains_fx[i][j] = gain_fx; - move32(); - } + } + /* update here only in case of head rotation */ + test(); + IF( st_ivas->hCombinedOrientationData != NULL && EQ_16( st_ivas->hCombinedOrientationData->enableCombinedOrientation[0], 1 ) ) + { + st_ivas->hIsmRendererData->prev_gains_fx[i][j] = gain_fx; + move32(); } } -#ifndef NONBE_FIX_1141_OSBA_ROOM_RENDERING } -#endif -#ifdef NONBE_FIX_1141_OSBA_ROOM_RENDERING st_ivas->hIsmRendererData->interp_offset_fx = add( st_ivas->hIsmRendererData->interp_offset_fx, i_mult( hSpatParamRendCom->num_freq_bands, st_ivas->hSpar->subframe_nbslots[st_ivas->hSpar->subframes_rendered] ) ); -#endif } /* Perform binaural rendering */ @@ -4006,14 +3901,10 @@ void ivas_dirac_dec_render_sf_fx( /* Move the separated and the LFE channels to temporary variables as spatial synthesis may overwrite current channels */ Copy32( &( output_buf_fx[st_ivas->hOutSetup.separateChannelIndex][subframe_start_sample] ), tmp_separated_fx, num_samples_subframe ); -#ifdef NONBE_1250_MCMASA_LS_OUTPUT if ( hDirACRend->hOutSetup.num_lfe > 0 ) { Copy32( &( output_buf_fx[LFE_CHANNEL][subframe_start_sample] ), tmp_lfe_fx, num_samples_subframe ); } -#else - Copy32( &( output_buf_fx[LFE_CHANNEL][subframe_start_sample] ), tmp_lfe_fx, num_samples_subframe ); -#endif FOR( ch = 0; ch < outchannels; ch++ ) { diff --git a/lib_dec/ivas_dirac_output_synthesis_cov_fx.c b/lib_dec/ivas_dirac_output_synthesis_cov_fx.c index 758363bfbe9f1b33d753a98d24e39c2abd800376..954dd5f72e35211386a25ec3703f839b8944ea1e 100644 --- a/lib_dec/ivas_dirac_output_synthesis_cov_fx.c +++ b/lib_dec/ivas_dirac_output_synthesis_cov_fx.c @@ -52,13 +52,11 @@ #include "rom_dec.h" #include "ivas_prot_fx.h" -#ifdef NONBE_FIX_1091_PMC_LOW_SIGNAL_BURSTS /*-----------------------------------------------------------------------* * Local constants *-----------------------------------------------------------------------*/ #define SQRT_EPSILON_FX 68 /* Q31 square root of EPSILON */ -#endif /*-------------------------------------------------------------------* * ivas_dirac_dec_output_synthesis_cov_open() @@ -887,7 +885,6 @@ Word16 computeMixingMatrices_fx( } limit_e = add( limit_e, reg_Sx_e ); -#ifdef NONBE_FIX_1091_PMC_LOW_SIGNAL_BURSTS limit_fx = Mpy_32_32( limit_fx, reg_Sx_fx ); IF( BASOP_Util_Cmp_Mant32Exp( limit_fx, limit_e, SQRT_EPSILON_FX /* Q31 */, 0 ) < 0 ) { @@ -896,9 +893,6 @@ Word16 computeMixingMatrices_fx( limit_e = 0; move16(); } -#else /* NONBE_FIX_1091_PMC_LOW_SIGNAL_BURSTS */ - limit_fx = Madd_32_32( EPSILON_FX, limit_fx, reg_Sx_fx ); -#endif FOR( i = 0; i < lengthCx; ++i ) { diff --git a/lib_dec/ivas_init_dec_fx.c b/lib_dec/ivas_init_dec_fx.c index 9c1ba26e182f6a9a4143473006d5feb1f2fe4eea..5a87800f7e941d32a6d9f05a69bf7dea6a507313 100644 --- a/lib_dec/ivas_init_dec_fx.c +++ b/lib_dec/ivas_init_dec_fx.c @@ -52,17 +52,9 @@ static ivas_error ivas_read_format( Decoder_Struct *st_ivas, Word16 *num_bits_re static ivas_error doSanityChecks_IVAS( Decoder_Struct *st_ivas ); -#ifdef NONBE_FIX_1052_SBA_EXT -#ifdef NONBE_FIX_1128_OSBA_EXT_OUTPUT_ORDER static AUDIO_CONFIG ivas_set_audio_config_from_sba_order( const Word16 sba_order ); -#else -static AUDIO_CONFIG ivas_set_output_config_from_sba_order( const Word16 sba_order ); -#endif -#endif -#ifdef NONBE_FIX_1052_SBA_EXT -#ifdef NONBE_FIX_1128_OSBA_EXT_OUTPUT_ORDER /*-------------------------------------------------------------------* * ivas_set_audio_config_from_sba_order() * @@ -73,9 +65,6 @@ static AUDIO_CONFIG ivas_set_output_config_from_sba_order( const Word16 sba_orde static AUDIO_CONFIG ivas_set_audio_config_from_sba_order( const Word16 sba_order /* i : Ambisonic (SBA) order */ ) -#else -static AUDIO_CONFIG ivas_set_output_config_from_sba_order( const Word16 sba_order ) -#endif { AUDIO_CONFIG output_config; @@ -97,21 +86,15 @@ static AUDIO_CONFIG ivas_set_output_config_from_sba_order( const Word16 sba_orde move32(); BREAK; default: -#ifdef NONBE_FIX_1128_OSBA_EXT_OUTPUT_ORDER output_config = IVAS_AUDIO_CONFIG_INVALID; move32(); BREAK; -#else - assert( 0 ); -#endif } return output_config; } -#endif -#ifdef FIX_1209_SID_SIGNALING /*---------------------------------------------------------------------* * ivas_dec_get_format( ) * @@ -532,7 +515,6 @@ ivas_error ivas_dec_get_format_fx( return IVAS_ERR_OK; } -#endif /*-------------------------------------------------------------------* @@ -570,14 +552,10 @@ ivas_error ivas_dec_setup( * Read IVAS format *-------------------------------------------------------------------*/ -#ifdef FIX_1209_SID_SIGNALING IF( ( error = ivas_read_format( st_ivas, &num_bits_read ) ) != IVAS_ERR_OK ) { return error; } -#else - ivas_read_format( st_ivas, &num_bits_read ); -#endif /*-------------------------------------------------------------------* * Read other signling (ISM/MC mode, number of channels, etc.) @@ -635,19 +613,6 @@ ivas_error ivas_dec_setup( move16(); st_ivas->sba_order = add( st_ivas->sba_order, shl( st_ivas->bit_stream[num_bits_read], 1 ) ); move16(); -#ifndef NONBE_FIX_1052_SBA_EXT_FIX -#ifdef NONBE_FIX_1052_SBA_EXT - IF( EQ_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) ) - { -#ifdef NONBE_FIX_1128_OSBA_EXT_OUTPUT_ORDER - st_ivas->hDecoderConfig->output_config = ivas_set_audio_config_from_sba_order( st_ivas->sba_order ); -#else - st_ivas->hDecoderConfig->output_config = ivas_set_output_config_from_sba_order( st_ivas->sba_order ); -#endif - st_ivas->hDecoderConfig->nchan_out = audioCfg2channels( st_ivas->hDecoderConfig->output_config ); - } -#endif -#endif num_bits_read = add( num_bits_read, SBA_ORDER_BITS ); test(); @@ -684,13 +649,11 @@ ivas_error ivas_dec_setup( st_ivas->nchan_transport = 1; move16(); } -#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT /* this should be non-zero if original input format was MASA_ISM_FORMAT */ st_ivas->nchan_ism = add( st_ivas->bit_stream[L_sub( res_dec, 3 )], shl( st_ivas->bit_stream[L_sub( res_dec, 2 )], 1 ) ); IF( GT_16( st_ivas->nchan_ism, 0 ) ) { -#ifdef NONBE_FIX_1074_NOBJ_SIGNAL_OMASA_LBR /* the input_ivas_format should be MASA_ISM_FORMAT, but we cannot initialize it now */ /* info about the number of objects: '00' - MASA format at the encoder @@ -709,22 +672,11 @@ ivas_error ivas_dec_setup( } /* for MASA_ISM_FORMAT at input the number of MASA transport channels is always 2 and the corresponding bit is not used here*/ -#else - /* the input_ivas_format should be MASA_ISM_FORMAT, but we cannot initialize it now */ - test(); - IF( EQ_16( st_ivas->nchan_transport, 2 ) && EQ_16( st_ivas->nchan_ism, 3 ) ) - { - st_ivas->nchan_ism = 4; - move16(); - } - /* for MASA_ISM_FORMAT at input the number of MASA transport channels is always 2 */ -#endif st_ivas->nchan_transport = 2; element_mode_flag = 1; move16(); move16(); } -#endif IF( st_ivas->ini_frame > 0 ) { @@ -836,26 +788,15 @@ ivas_error ivas_dec_setup( /*correct number of CPEs for discrete ISM coding*/ test(); IF( st_ivas->ini_frame > 0 && EQ_32( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) ) -#ifdef NONBE_FIX_ISM_XOVER_BR { Word16 n; n = add( st_ivas->nchan_transport, st_ivas->nchan_ism ); st_ivas->nCPE = shr_r( n, 1 ); } -#else - { - st_ivas->nCPE = add( st_ivas->nCPE, shr( add( st_ivas->nchan_ism, 1 ), 1 ) ); - move16(); - } -#endif } -#ifdef NONBE_FIX_ISM_XOVER_BR IF( EQ_16( ivas_osba_ism_mode_select( ivas_total_brate, st_ivas->nchan_ism ), ISM_SBA_MODE_DISC ) ) -#else - IF( GE_32( ivas_total_brate, IVAS_256k ) ) -#endif { st_ivas->ism_mode = ISM_SBA_MODE_DISC; move32(); @@ -963,19 +904,6 @@ ivas_error ivas_dec_setup( BREAK; } -#ifndef NONBE_FIX_1052_SBA_EXT_FIX -#ifdef NONBE_FIX_1052_SBA_EXT - IF( EQ_32( st_ivas->ivas_format, SBA_FORMAT ) && EQ_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) ) - { -#ifdef NONBE_FIX_1128_OSBA_EXT_OUTPUT_ORDER - st_ivas->hDecoderConfig->output_config = ivas_set_audio_config_from_sba_order( st_ivas->sba_order ); -#else - st_ivas->hDecoderConfig->output_config = ivas_set_output_config_from_sba_order( st_ivas->sba_order ); -#endif - st_ivas->hDecoderConfig->nchan_out = audioCfg2channels( st_ivas->hDecoderConfig->output_config ); - } -#endif -#endif test(); IF( st_ivas->ini_frame > 0 && EQ_32( st_ivas->ivas_format, SBA_FORMAT ) ) { @@ -1258,12 +1186,6 @@ static ivas_error ivas_read_format( st_ivas->ivas_format = ISM_FORMAT; move32(); BREAK; -#ifndef FIX_1209_SID_SIGNALING - case SID_MULTICHANNEL: - st_ivas->ivas_format = MC_FORMAT; - move32(); - BREAK; -#endif case SID_SBA_1TC: st_ivas->ivas_format = SBA_FORMAT; move32(); @@ -1299,15 +1221,11 @@ static ivas_error ivas_read_format( } BREAK; default: -#ifndef FIX_1209_SID_SIGNALING -/* This should actually be impossible, since only 3 bits are read, so if this happens something is broken */ -#endif return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Invalid value %c found in SID format field.", st_ivas->sid_format ); } IF( EQ_32( st_ivas->ivas_format, SBA_FORMAT ) ) { -#ifdef NONBE_FIX_1052_SBA_EXT /* read Ambisonic (SBA) planar flag */ st_ivas->sba_planar = st_ivas->bit_stream[*num_bits_read]; move16(); @@ -1321,7 +1239,6 @@ static ivas_error ivas_read_format( move16(); *num_bits_read = add( *num_bits_read, SBA_ORDER_BITS ); move16(); -#endif if ( st_ivas->sba_analysis_order == 0 ) { @@ -1443,10 +1360,8 @@ ivas_error ivas_init_decoder_front( move16(); st_ivas->nCPE = 0; move16(); -#ifdef NONBE_FIX_1052_SBA_EXT_FIX st_ivas->nchan_ism = 0; move16(); -#endif st_ivas->nCPE_old = 0; move16(); st_ivas->nchan_transport = -1; @@ -1588,11 +1503,7 @@ ivas_error ivas_init_decoder_fx( Word16 numCldfbAnalyses, numCldfbSyntheses; Word16 granularity, n_channels_transport_jbm; Word32 output_Fs, ivas_total_brate; -#ifdef NONBE_FIX_MC_LFE_LPF Word32 delay_ns; -#else - Word32 binauralization_delay_ns; -#endif AUDIO_CONFIG output_config; DECODER_CONFIG_HANDLE hDecoderConfig; ivas_error error; @@ -1619,10 +1530,7 @@ ivas_error ivas_init_decoder_fx( test(); IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) ) { -#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT test(); -#endif -#ifdef FIX_1052_EXT_OUTPUT IF( EQ_32( st_ivas->ivas_format, STEREO_FORMAT ) ) { hDecoderConfig->nchan_out = CPE_CHANNELS; @@ -1631,29 +1539,14 @@ ivas_error ivas_init_decoder_fx( { hDecoderConfig->nchan_out = audioCfg2channels( st_ivas->transport_config ); } -#ifdef NONBE_FIX_1052_SBA_EXT_FIX ELSE IF( EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) || EQ_32( st_ivas->ivas_format, SBA_FORMAT ) ) -#else - ELSE IF( EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) -#endif -#else - IF( EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) -#endif { -#ifdef NONBE_FIX_1128_OSBA_EXT_OUTPUT_ORDER hDecoderConfig->nchan_out = audioCfg2channels( ivas_set_audio_config_from_sba_order( st_ivas->sba_order ) ); -#else - hDecoderConfig->nchan_out = audioCfg2channels( IVAS_AUDIO_CONFIG_HOA3 ); -#endif move16(); hDecoderConfig->nchan_out = add( hDecoderConfig->nchan_out, st_ivas->nchan_ism ); move16(); } -#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT ELSE IF( EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) || EQ_32( st_ivas->ivas_format, MASA_FORMAT ) ) -#else - ELSE IF( EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) ) -#endif { hDecoderConfig->nchan_out = add( st_ivas->nchan_transport, st_ivas->nchan_ism ); move16(); @@ -1677,31 +1570,21 @@ ivas_error ivas_init_decoder_fx( test(); test(); -#ifdef FIX_1052_EXT_OUTPUT IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) && EQ_32( st_ivas->ivas_format, MC_FORMAT ) ) { ivas_output_init( &( st_ivas->hOutSetup ), st_ivas->transport_config ); st_ivas->intern_config = st_ivas->transport_config; move32(); } -#ifdef NONBE_FIX_1128_OSBA_EXT_OUTPUT_ORDER -#ifdef NONBE_FIX_1052_SBA_EXT_FIX ELSE IF( output_config == IVAS_AUDIO_CONFIG_EXTERNAL && ( st_ivas->ivas_format == SBA_ISM_FORMAT || st_ivas->ivas_format == SBA_FORMAT ) ) -#else - ELSE IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) && EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) -#endif { st_ivas->intern_config = ivas_set_audio_config_from_sba_order( st_ivas->sba_order ); ivas_output_init( &( st_ivas->hOutSetup ), st_ivas->intern_config ); } -#endif ELSE { ivas_output_init( &( st_ivas->hOutSetup ), output_config ); } -#else - ivas_output_init( &( st_ivas->hOutSetup ), output_config ); -#endif test(); IF( EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) && EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) ) @@ -1715,20 +1598,6 @@ ivas_error ivas_init_decoder_fx( st_ivas->hOutSetup.nchan_out_woLFE = audioCfg2channels( st_ivas->intern_config ); move16(); } -#ifndef NONBE_FIX_1128_OSBA_EXT_OUTPUT_ORDER - test(); - IF( EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) && EQ_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) ) - { - st_ivas->hOutSetup.ambisonics_order = SBA_HOA3_ORDER; - move32(); - st_ivas->intern_config = IVAS_AUDIO_CONFIG_HOA3; - move32(); - st_ivas->hOutSetup.output_config = IVAS_AUDIO_CONFIG_HOA3; - move32(); - st_ivas->hOutSetup.nchan_out_woLFE = audioCfg2channels( IVAS_AUDIO_CONFIG_HOA3 ); - move16(); - } -#endif /* Only initialize transport setup if it is used */ IF( NE_32( st_ivas->transport_config, IVAS_AUDIO_CONFIG_INVALID ) ) @@ -1944,16 +1813,6 @@ ivas_error ivas_init_decoder_fx( } set16_fx( st_ivas->hSpar->hFbMixer->cldfb_cross_fade_fx, 0, CLDFB_NO_COL_MAX ); -#ifndef FIX_1249_REMOVE_OBSOLETE_ALLRAD_MATRIX - test(); - IF( EQ_32( st_ivas->renderer_type, RENDERER_SBA_LINEAR_DEC ) && st_ivas->hOutSetup.is_loudspeaker_setup ) - { - IF( NE_32( ( error = ivas_sba_get_hoa_dec_matrix_fx( st_ivas->hOutSetup, &st_ivas->hoa_dec_mtx, st_ivas->hIntSetup.ambisonics_order ) ), IVAS_ERR_OK ) ) - { - return error; - } - } -#endif Word16 hodirac_flag = ivas_get_hodirac_flag_fx( ivas_total_brate, st_ivas->sba_analysis_order ); IF( hodirac_flag ) { @@ -1972,12 +1831,8 @@ ivas_error ivas_init_decoder_fx( test(); test(); -#ifdef NONBE_FIX_1052_SBA_EXT_FIX test(); IF( NE_32( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_FOA ) && NE_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_STEREO ) && NE_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_MONO ) && !( EQ_32( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) && EQ_32( st_ivas->intern_config, IVAS_AUDIO_CONFIG_FOA ) ) ) -#else - IF( NE_32( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_FOA ) && NE_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_STEREO ) && NE_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_MONO ) ) -#endif { IF( NE_32( ( error = ivas_dirac_dec_config_fx( st_ivas, DIRAC_OPEN ) ), IVAS_ERR_OK ) ) { @@ -2140,16 +1995,6 @@ ivas_error ivas_init_decoder_fx( return error; } -#ifndef FIX_1249_REMOVE_OBSOLETE_ALLRAD_MATRIX - test(); - IF( EQ_32( st_ivas->renderer_type, RENDERER_SBA_LINEAR_DEC ) && st_ivas->hOutSetup.is_loudspeaker_setup ) - { - IF( NE_32( ( error = ivas_sba_get_hoa_dec_matrix_fx( st_ivas->hOutSetup, &st_ivas->hoa_dec_mtx, st_ivas->hIntSetup.ambisonics_order ) ), IVAS_ERR_OK ) ) - { - return error; - } - } -#endif Word16 hodirac_flag = ivas_get_hodirac_flag_fx( ivas_total_brate, st_ivas->sba_analysis_order ); IF( hodirac_flag ) { @@ -2213,17 +2058,12 @@ ivas_error ivas_init_decoder_fx( { st_ivas->nCPE_old = st_ivas->nCPE; move16(); -#ifdef NONBE_FIX_ISM_XOVER_BR { Word16 n_all; n_all = add( st_ivas->nchan_transport, st_ivas->nchan_ism ); st_ivas->nCPE = shr( add( n_all, 1 ), 1 ); } -#else - st_ivas->nCPE = add( st_ivas->nCPE, shr( add( st_ivas->nchan_ism, 1 ), 1 ) ); - move16(); -#endif st_ivas->element_mode_init = IVAS_CPE_MDCT; move16(); } @@ -2692,11 +2532,7 @@ ivas_error ivas_init_decoder_fx( } } -#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF IF( NE_32( ( error = ivas_dirac_dec_init_binaural_data_fx( st_ivas, &( st_ivas->hHrtfParambin ) ) ), IVAS_ERR_OK ) ) -#else - IF( NE_32( ( error = ivas_dirac_dec_init_binaural_data_fx( st_ivas, st_ivas->hHrtfParambin ) ), IVAS_ERR_OK ) ) -#endif { return error; } @@ -2850,19 +2686,11 @@ ivas_error ivas_init_decoder_fx( } } -#ifdef FIX_1161_REDUCE_OMASA_HEAP /* Allocate memory for delay buffer within 'hMasaIsmData' */ IF( NE_32( ( error = ivas_omasa_objects_delay_open_fx( st_ivas ) ), IVAS_ERR_OK ) ) { return error; } -#else - /* Allocate 'hIsmRendererData' handle and memory for delay buffer within 'hMasaIsmData' */ - IF( NE_32( ( error = ivas_omasa_separate_object_renderer_open( st_ivas ) ), IVAS_ERR_OK ) ) - { - return error; - } -#endif } test(); @@ -2871,12 +2699,10 @@ ivas_error ivas_init_decoder_fx( IF( EQ_32( st_ivas->renderer_type, RENDERER_DIRAC ) && ( EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_MASA_ONE_OBJ ) || EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_PARAM_ONE_OBJ ) || EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) ) ) { /* Allocate 'hIsmRendererData' handle and memory for delay buffer within 'hMasaIsmData' */ -#ifdef FIX_1161_REDUCE_OMASA_HEAP IF( NE_32( ( error = ivas_omasa_objects_delay_open_fx( st_ivas ) ), IVAS_ERR_OK ) ) { return error; } -#endif IF( NE_32( ( error = ivas_omasa_separate_object_renderer_open( st_ivas ) ), IVAS_ERR_OK ) ) { @@ -2884,24 +2710,13 @@ ivas_error ivas_init_decoder_fx( } } -#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT IF( EQ_32( st_ivas->renderer_type, RENDERER_OMASA_OBJECT_EXT ) ) { /* Allocate 'hIsmRendererData' handle and memory for delay buffer within 'hMasaIsmData' */ -#ifdef FIX_1161_REDUCE_OMASA_HEAP IF( NE_32( ( error = ivas_omasa_objects_delay_open_fx( st_ivas ) ), IVAS_ERR_OK ) ) { return error; } -#else - error = ivas_omasa_render_objects_from_mix_open_fx( st_ivas ); - move32(); - - IF( NE_32( error, IVAS_ERR_OK ) ) - { - return error; - } -#endif IF( ( ( error = ivas_spat_hSpatParamRendCom_config_fx( &st_ivas->hSpatParamRendCom, DIRAC_OPEN, 0, st_ivas->ivas_format, st_ivas->mc_mode, output_Fs, 0, 0 ) ), IVAS_ERR_OK ) ) { @@ -2917,7 +2732,6 @@ ivas_error ivas_init_decoder_fx( return error; } } -#endif } test(); @@ -2993,42 +2807,6 @@ ivas_error ivas_init_decoder_fx( } } -#ifndef NONBE_FIX_MC_LFE_LPF - /*-----------------------------------------------------------------* - * LFE handles for rendering after rendering to adjust LFE delay to binaural filter delay - * LFE handles for rendering after rendering to adjust LFE delay to filter delay - *-----------------------------------------------------------------*/ - test(); - IF( EQ_32( st_ivas->mc_mode, MC_MODE_MCT ) || EQ_32( st_ivas->mc_mode, MC_MODE_PARAMUPMIX ) ) - { - binauralization_delay_ns = st_ivas->binaural_latency_ns; - move32(); - IF( st_ivas->hBinRenderer != NULL ) - { - IF( st_ivas->hBinRenderer->render_lfe ) - { - IF( NE_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) && NE_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) - { - /* Account for filterbank delay */ - binauralization_delay_ns = L_add( binauralization_delay_ns, IVAS_FB_DEC_DELAY_NS ); - } - } - ELSE - { - binauralization_delay_ns = 0; - move32(); - } - } - - IF( NE_32( ( error = ivas_create_lfe_dec_fx( &st_ivas->hLFE, output_Fs, binauralization_delay_ns ) ), IVAS_ERR_OK ) ) - { - return error; - } - - set32_fx( st_ivas->hLFE->prevsynth_buf_fx, 0, LFE_PLC_BUFLEN ); - set32_fx( st_ivas->hLFE->prior_out_buffer_fx, 0, L_FRAME48k ); - } -#endif /*-----------------------------------------------------------------* * CLDFB handles for rendering *-----------------------------------------------------------------*/ @@ -3085,7 +2863,6 @@ ivas_error ivas_init_decoder_fx( move16(); } -#ifdef NONBE_FIX_MC_LFE_LPF /*-----------------------------------------------------------------* * LFE handles for rendering after rendering to adjust LFE delay to filter delay *-----------------------------------------------------------------*/ @@ -3093,7 +2870,6 @@ ivas_error ivas_init_decoder_fx( test(); IF( EQ_32( st_ivas->mc_mode, MC_MODE_MCT ) || EQ_32( st_ivas->mc_mode, MC_MODE_PARAMUPMIX ) ) { -#ifdef NONBE_1360_LFE_DELAY IF( NE_16( st_ivas->hIntSetup.index_lfe[0], -1 ) ) { delay_ns = st_ivas->binaural_latency_ns; @@ -3102,9 +2878,6 @@ ivas_error ivas_init_decoder_fx( { delay_ns = 0; } -#else - delay_ns = st_ivas->binaural_latency_ns; -#endif move32(); IF( st_ivas->hBinRenderer != NULL ) { @@ -3138,7 +2911,6 @@ ivas_error ivas_init_decoder_fx( set32_fx( st_ivas->hLFE->prevsynth_buf_fx, 0, LFE_PLC_BUFLEN ); set32_fx( st_ivas->hLFE->prior_out_buffer_fx, 0, L_FRAME48k ); } -#endif /*-----------------------------------------------------------------* * Allocate and initialize limiter struct @@ -3164,23 +2936,9 @@ ivas_error ivas_init_decoder_fx( } } -#ifndef FIX_1101_CLEANING_JBM_CALL - IF( st_ivas->hTcBuffer == NULL ) - { - /* we need the handle anyway, but without the buffer*/ - IF( NE_32( ( error = ivas_jbm_dec_tc_buffer_open_fx( st_ivas, TC_BUFFER_MODE_NONE, 0, 0, 0, 1 ) ), IVAS_ERR_OK ) ) - { - return error; - } - } -#endif test(); -#ifdef FIX_1099_JBM_MD_HANDLE_ALLOC test(); IF( ( EQ_32( st_ivas->ivas_format, MASA_FORMAT ) || EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) ) && st_ivas->hDecoderConfig->Opt_tsm ) -#else - IF( st_ivas->hJbmMetadata == NULL && st_ivas->hDecoderConfig->Opt_tsm ) -#endif { IF( EQ_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) ) { @@ -3946,7 +3704,6 @@ void ivas_init_dec_get_num_cldfb_instances_fx( move16(); } BREAK; -#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT case RENDERER_OMASA_OBJECT_EXT: *numCldfbAnalyses = st_ivas->nchan_transport; *numCldfbSyntheses = st_ivas->hDecoderConfig->nchan_out; @@ -3958,7 +3715,6 @@ void ivas_init_dec_get_num_cldfb_instances_fx( *numCldfbSyntheses = 0; move16(); BREAK; -#endif default: assert( 0 && "Renderer not handled for CLDFB reservation." ); } @@ -4035,17 +3791,12 @@ static ivas_error doSanityChecks_IVAS( test(); test(); test(); -#ifdef FIX_1052_EXT_OUTPUT test(); IF( NE_32( output_config, IVAS_AUDIO_CONFIG_MONO ) && NE_32( output_config, IVAS_AUDIO_CONFIG_STEREO ) && NE_32( output_config, IVAS_AUDIO_CONFIG_5_1 ) && NE_32( output_config, IVAS_AUDIO_CONFIG_7_1 ) && NE_32( output_config, IVAS_AUDIO_CONFIG_5_1_2 ) && NE_32( output_config, IVAS_AUDIO_CONFIG_5_1_4 ) && NE_32( output_config, IVAS_AUDIO_CONFIG_7_1_4 ) && NE_32( output_config, IVAS_AUDIO_CONFIG_LS_CUSTOM ) && NE_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) ) -#else - IF( NE_32( output_config, IVAS_AUDIO_CONFIG_MONO ) && NE_32( output_config, IVAS_AUDIO_CONFIG_STEREO ) && NE_32( output_config, IVAS_AUDIO_CONFIG_5_1 ) && NE_32( output_config, IVAS_AUDIO_CONFIG_7_1 ) && NE_32( output_config, IVAS_AUDIO_CONFIG_5_1_2 ) && NE_32( output_config, IVAS_AUDIO_CONFIG_5_1_4 ) && NE_32( output_config, IVAS_AUDIO_CONFIG_7_1_4 ) && NE_32( output_config, IVAS_AUDIO_CONFIG_LS_CUSTOM ) ) -#endif { return IVAS_ERROR( IVAS_ERR_INVALID_OUTPUT_FORMAT, "Wrong output configuration specified for Stereo!" ); } } -#ifdef FIX_1052_EXT_OUTPUT /* Verify output configuration for other formats */ ELSE { @@ -4054,40 +3805,6 @@ static ivas_error doSanityChecks_IVAS( return IVAS_ERROR( IVAS_ERR_INVALID_OUTPUT_FORMAT, "Incorrect output configuration specified!" ); } } -#else - ELSE IF( EQ_32( st_ivas->ivas_format, ISM_FORMAT ) ) - { - /* Verify ISM output configuration */ - IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_INVALID ) ) - { - return IVAS_ERROR( IVAS_ERR_INVALID_OUTPUT_FORMAT, "Incorrect output configuration specified for ISM" ); - } - } - ELSE IF( EQ_32( st_ivas->ivas_format, SBA_FORMAT ) ) - { - /* Verify SBA output coniguration */ - IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_INVALID ) ) - { - return IVAS_ERROR( IVAS_ERR_INVALID_OUTPUT_FORMAT, "Incorrect output configuration specified for SBA" ); - } - } - ELSE IF( EQ_32( st_ivas->ivas_format, MASA_FORMAT ) ) - { - IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_INVALID ) ) - { - return IVAS_ERROR( IVAS_ERR_INVALID_OUTPUT_FORMAT, "Incorrect output configuration specified for MASA!" ); - } - } - ELSE IF( EQ_32( st_ivas->ivas_format, MC_FORMAT ) ) - { - /* Verify MC output configuration */ - test(); - IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_INVALID ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) ) - { - return IVAS_ERROR( IVAS_ERR_INVALID_OUTPUT_FORMAT, "Incorrect output configuration specified for Multi-channel" ); - } - } -#endif IF( ( EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) && NE_32( output_Fs, 48000 ) ) { @@ -4131,16 +3848,5 @@ static ivas_error doSanityChecks_IVAS( } } -#ifndef NONBE_FIX_984_OMASA_EXT_OUTPUT - IF( EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) ) - { - test(); - IF( NE_32( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) && EQ_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) ) - { - - return IVAS_ERROR( IVAS_ERR_INVALID_OUTPUT_FORMAT, "Incorrect output configuration specified for combined MASA and ISM format" ); - } - } -#endif return IVAS_ERR_OK; } diff --git a/lib_dec/ivas_ism_dec_fx.c b/lib_dec/ivas_ism_dec_fx.c index a4588aadf78c953607bc9be9a7dd9d5b15eb80b3..79275105aa3269ca8923dd5dd9c6b44311fc9799 100644 --- a/lib_dec/ivas_ism_dec_fx.c +++ b/lib_dec/ivas_ism_dec_fx.c @@ -261,11 +261,7 @@ static ivas_error ivas_ism_bitrate_switching_dec_fx( return error; } -#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF IF( NE_32( ( error = ivas_dirac_dec_init_binaural_data_fx( st_ivas, &( st_ivas->hHrtfParambin ) ) ), IVAS_ERR_OK ) ) -#else - IF( NE_32( ( error = ivas_dirac_dec_init_binaural_data_fx( st_ivas, st_ivas->hHrtfParambin ) ), IVAS_ERR_OK ) ) -#endif { return error; } @@ -292,11 +288,7 @@ static ivas_error ivas_ism_bitrate_switching_dec_fx( return error; } -#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF IF( NE_32( ( error = ivas_dirac_dec_init_binaural_data_fx( st_ivas, &( st_ivas->hHrtfParambin ) ) ), IVAS_ERR_OK ) ) -#else - IF( NE_32( ( error = ivas_dirac_dec_init_binaural_data_fx( st_ivas, st_ivas->hHrtfParambin ) ), IVAS_ERR_OK ) ) -#endif { return error; } diff --git a/lib_dec/ivas_ism_param_dec_fx.c b/lib_dec/ivas_ism_param_dec_fx.c index f9d03f6f91bb4ec98d89655420f4a9c996927d87..1b7435305f4817f52f9976367c91b48e40d2b329 100644 --- a/lib_dec/ivas_ism_param_dec_fx.c +++ b/lib_dec/ivas_ism_param_dec_fx.c @@ -939,21 +939,13 @@ void ivas_ism_dec_digest_tc_fx( test(); test(); -#ifdef NONBE_FIX_1141_OSBA_ROOM_RENDERING test(); test(); test(); -#endif -#ifdef NONBE_FIX_1141_OSBA_ROOM_RENDERING IF( EQ_32( st_ivas->renderer_type, RENDERER_SBA_LINEAR_ENC ) || EQ_32( st_ivas->renderer_type, RENDERER_OSBA_AMBI ) || EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV ) || ( EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV_ROOM ) && EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) && EQ_32( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) ) ) -#else - IF( EQ_32( st_ivas->renderer_type, RENDERER_SBA_LINEAR_ENC ) || - EQ_32( st_ivas->renderer_type, RENDERER_OSBA_AMBI ) || - EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV ) ) -#endif { st_ivas->hIsmRendererData->interpolator_fx[0] = 0; move16(); @@ -978,10 +970,8 @@ void ivas_ism_dec_digest_tc_fx( ivas_jbm_dec_get_adapted_linear_interpolator_fx( extract_l( Mpy_32_32( st_ivas->hDecoderConfig->output_Fs, ONE_BY_FRAMES_PER_SEC_Q31 ) ), st_ivas->hTcBuffer->n_samples_available, st_ivas->hIsmRendererData->interpolator_fx ); move16(); } -#ifdef NONBE_FIX_1141_OSBA_ROOM_RENDERING st_ivas->hIsmRendererData->interp_offset_fx = 0; move16(); -#endif /* also get the gains here */ FOR( i = 0; i < st_ivas->nchan_ism; i++ ) @@ -1008,23 +998,14 @@ void ivas_ism_dec_digest_tc_fx( test(); test(); test(); -#ifdef NONBE_FIX_1141_OSBA_ROOM_RENDERING test(); test(); test(); -#endif -#ifdef NONBE_FIX_1141_OSBA_ROOM_RENDERING IF( ( EQ_32( st_ivas->renderer_type, RENDERER_TD_PANNING ) || EQ_32( st_ivas->renderer_type, RENDERER_OSBA_LS ) || EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_MIXER_CONV_ROOM ) || ( EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV_ROOM ) && EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) && EQ_32( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) ) ) && st_ivas->hCombinedOrientationData == NULL ) -#else - IF( ( EQ_32( st_ivas->renderer_type, RENDERER_TD_PANNING ) || - EQ_32( st_ivas->renderer_type, RENDERER_OSBA_LS ) || - EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_MIXER_CONV_ROOM ) ) && - st_ivas->hCombinedOrientationData == NULL ) -#endif { if ( st_ivas->hIntSetup.is_planar_setup ) { diff --git a/lib_dec/ivas_ism_renderer_fx.c b/lib_dec/ivas_ism_renderer_fx.c index 3aad49c26fb01c05f28706444f9f53b36862d5db..a0fa5a3d59934aa287810ff2cec588cc9e36e1dc 100644 --- a/lib_dec/ivas_ism_renderer_fx.c +++ b/lib_dec/ivas_ism_renderer_fx.c @@ -70,15 +70,11 @@ ivas_error ivas_ism_renderer_open_fx( test(); test(); test(); -#ifdef FIX_1050_EFAP_ALLOC test(); IF( st_ivas->hIntSetup.is_loudspeaker_setup && st_ivas->hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_STEREO && st_ivas->hIntSetup.ls_azimuth_fx != NULL && st_ivas->hIntSetup.ls_elevation_fx != NULL && st_ivas->hEFAPdata == NULL ) -#else - IF( st_ivas->hIntSetup.is_loudspeaker_setup && st_ivas->hIntSetup.ls_azimuth_fx != NULL && st_ivas->hIntSetup.ls_elevation_fx != NULL && st_ivas->hEFAPdata == NULL ) -#endif { IF( NE_32( ( error = efap_init_data_fx( &( st_ivas->hEFAPdata ), st_ivas->hIntSetup.ls_azimuth_fx, st_ivas->hIntSetup.ls_elevation_fx, st_ivas->hIntSetup.nchan_out_woLFE, EFAP_MODE_EFAP ) ), IVAS_ERR_OK ) ) { @@ -453,36 +449,6 @@ ivas_error ivas_omasa_separate_object_renderer_open( st_ivas->hIsmRendererData->interpolator_len = interpolator_length; move16(); -#ifndef FIX_1161_REDUCE_OMASA_HEAP - st_ivas->hMasaIsmData->delayBuffer_size = extract_l( ( st_ivas->hDecoderConfig->output_Fs / 50 ) / MAX_PARAM_SPATIAL_SUBFRAMES ); - move16(); - - test(); - IF( EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_MASA_ONE_OBJ ) || EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_PARAM_ONE_OBJ ) ) - { - st_ivas->hMasaIsmData->delayBuffer_nchan = 1; - move16(); - } - ELSE - { - st_ivas->hMasaIsmData->delayBuffer_nchan = st_ivas->nchan_ism; - move16(); - } - - IF( ( st_ivas->hMasaIsmData->delayBuffer_fx = (Word32 **) malloc( st_ivas->hMasaIsmData->delayBuffer_nchan * sizeof( Word32 * ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for MASA ISM delay buffer \n" ) ); - } - - FOR( i = 0; i < st_ivas->hMasaIsmData->delayBuffer_nchan; i++ ) - { - IF( ( st_ivas->hMasaIsmData->delayBuffer_fx[i] = (Word32 *) malloc( st_ivas->hMasaIsmData->delayBuffer_size * sizeof( Word32 ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for MASA ISM delay buffer \n" ) ); - } - set32_fx( st_ivas->hMasaIsmData->delayBuffer_fx[i], 0, st_ivas->hMasaIsmData->delayBuffer_size ); - } -#endif return IVAS_ERR_OK; } diff --git a/lib_dec/ivas_jbm_dec_fx.c b/lib_dec/ivas_jbm_dec_fx.c index 6fe8fd9b0b55621b9113d9e59437f68dfa5c28b2..b8b234d8adba73f60b615fcd0a4a0543d02ef39c 100644 --- a/lib_dec/ivas_jbm_dec_fx.c +++ b/lib_dec/ivas_jbm_dec_fx.c @@ -122,18 +122,6 @@ ivas_error ivas_jbm_dec_tc_fx( } } -#ifndef FIX_1101_CLEANING_JBM_CALL - IF( st_ivas->hDecoderConfig->Opt_tsm == 0 ) - { - FOR( n = 0; n < ivas_get_nchan_buffers_dec_fx( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); n++ ) - { - set_zero_fx( st_ivas->p_output_fx[n], L_FRAME48k ); - st_ivas->hTcBuffer->tc_fx[n] = st_ivas->p_output_fx[n]; - } - st_ivas->hTcBuffer->no_channels = ivas_get_nchan_buffers_dec_fx( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); - move16(); - } -#endif /*----------------------------------------------------------------* * Decoding + pre-rendering *----------------------------------------------------------------*/ @@ -661,7 +649,6 @@ ivas_error ivas_jbm_dec_tc_fx( Scale_sig32( p_output_fx[i], output_frame, negate( q_shift ) ); } -#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT test(); /* external output */ IF( EQ_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) && EQ_32( st_ivas->hMasa->config.input_ivas_format, MASA_ISM_FORMAT ) ) @@ -673,7 +660,6 @@ ivas_error ivas_jbm_dec_tc_fx( ivas_omasa_rearrange_channels_fx( p_output_fx, st_ivas->nchan_ism, output_frame ); } -#endif } ELSE IF( EQ_16( st_ivas->ivas_format, SBA_FORMAT ) && ( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) || EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) ) { @@ -798,7 +784,6 @@ ivas_error ivas_jbm_dec_tc_fx( } ELSE IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) ) { -#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT IF( EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) ) { ivas_omasa_rearrange_channels_fx( p_output_fx, nchan_transport_ism, output_frame ); @@ -813,15 +798,6 @@ ivas_error ivas_jbm_dec_tc_fx( /* Extract objects from MASA, output MASA + all objects (i.e., extracted and separated objects) */ ivas_omasa_render_objects_from_mix_fx( st_ivas, p_output_fx, st_ivas->nchan_ism, output_frame, &output_q ); } -#else - /* sanity check in case of bitrate switching */ - IF( NE_32( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) ) - { - return IVAS_ERROR( IVAS_ERR_INVALID_OUTPUT_FORMAT, "Incorrect output configuration specified for combined MASA and ISM format" ); - } - - ivas_omasa_rearrange_channels_fx( p_output_fx, nchan_transport_ism, output_frame ); -#endif IF( st_ivas->hDecoderConfig->Opt_tsm ) { @@ -1328,16 +1304,10 @@ ivas_error ivas_jbm_dec_tc_fx( test(); test(); test(); -#ifdef FIX_1052_EXT_OUTPUT test(); /* Delay the separated channel to sync with CLDFB delay of the DirAC synthesis, and synthesize the LFE signal. */ IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_5_1 ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_7_1 ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_5_1_4 ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_7_1_4 ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_5_1_2 ) || ( EQ_32( output_config, IVAS_AUDIO_CONFIG_LS_CUSTOM ) && st_ivas->hOutSetup.num_lfe > 0 ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) ) -#else - /* Delay the separated channel to sync with CLDFB delay of the DirAC synthesis, and synthesize the LFE signal. */ - IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_5_1 ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_7_1 ) || - EQ_32( output_config, IVAS_AUDIO_CONFIG_5_1_4 ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_7_1_4 ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_5_1_2 ) || ( EQ_32( output_config, IVAS_AUDIO_CONFIG_LS_CUSTOM ) && st_ivas->hOutSetup.num_lfe > 0 ) ) -#endif { ivas_lfe_synth_with_filters_fx( st_ivas->hMasa->hMasaLfeSynth, p_output_fx, output_frame, n, LFE_CHANNEL ); } @@ -1592,7 +1562,6 @@ void ivas_jbm_dec_feed_tc_to_renderer_fx( p_data_f_fx[n] = &data_f_fx[n][0]; } -#ifdef FIX_1101_CLEANING_JBM_CALL IF( st_ivas->hDecoderConfig->Opt_tsm == 0 ) { FOR( n = 0; n < ivas_get_nchan_buffers_dec_fx( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); n++ ) @@ -1601,7 +1570,6 @@ void ivas_jbm_dec_feed_tc_to_renderer_fx( } } -#endif IF( st_ivas->hDecoderConfig->Opt_tsm ) { ivas_jbm_dec_copy_tc( st_ivas, nSamplesForRendering, nSamplesResidual, data_fx, p_data_f_fx, 11 ); @@ -1737,7 +1705,6 @@ void ivas_jbm_dec_feed_tc_to_renderer_fx( } ELSE IF( EQ_16( st_ivas->ivas_format, MASA_ISM_FORMAT ) ) { -#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT test(); IF( EQ_32( st_ivas->renderer_type, RENDERER_OMASA_MIX_EXT ) || EQ_32( st_ivas->renderer_type, RENDERER_OMASA_OBJECT_EXT ) ) { @@ -1749,7 +1716,6 @@ void ivas_jbm_dec_feed_tc_to_renderer_fx( } ELSE { -#endif test(); IF( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) && EQ_16( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) ) { @@ -1773,9 +1739,7 @@ void ivas_jbm_dec_feed_tc_to_renderer_fx( { ivas_ism_dec_digest_tc_fx( st_ivas ); } -#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT } -#endif test(); IF( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) || EQ_16( st_ivas->renderer_type, RENDERER_DIRAC ) ) @@ -2165,9 +2129,7 @@ ivas_error ivas_jbm_dec_render_fx( move16(); test(); test(); -#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT test(); -#endif IF( EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) || EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) || EQ_32( st_ivas->renderer_type, RENDERER_STEREO_PARAMETRIC ) ) { test(); @@ -2187,13 +2149,11 @@ ivas_error ivas_jbm_dec_render_fx( { ivas_omasa_dirac_rend_jbm_fx( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, nchan_remapped, p_output_fx ); } -#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT ELSE IF( EQ_32( st_ivas->renderer_type, RENDERER_OMASA_OBJECT_EXT ) || EQ_32( st_ivas->renderer_type, RENDERER_OMASA_MIX_EXT ) ) { ivas_jbm_dec_tc_buffer_playout_fx( st_ivas, nSamplesAskedLocal, nSamplesRendered, p_output_fx ); ivas_omasa_rearrange_channels_fx( p_output_fx, st_ivas->nchan_ism, *nSamplesRendered ); } -#endif } ELSE IF( EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) { @@ -2235,14 +2195,7 @@ ivas_error ivas_jbm_dec_render_fx( ivas_ism_render_sf_fx( st_ivas, st_ivas->renderer_type, p_output_fx, *nSamplesRendered ); /* add already rendered SBA part */ -#ifdef NONBE_1894_OSBA_SCALING ivas_osba_stereo_add_channels_fx( p_tc_fx, p_output_fx, ONE_IN_Q11, nchan_out, st_ivas->nchan_ism, *nSamplesRendered ); -#else - FOR( n = 0; n < nchan_out; n++ ) - { - v_add_fixed_no_hdrm( p_output_fx[n], p_tc_fx[n + st_ivas->nchan_ism], p_output_fx[n], *nSamplesRendered ); - } -#endif } ELSE IF( EQ_32( st_ivas->renderer_type, RENDERER_OSBA_AMBI ) || EQ_32( st_ivas->renderer_type, RENDERER_OSBA_LS ) || EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV_ROOM ) ) { @@ -2274,12 +2227,10 @@ ivas_error ivas_jbm_dec_render_fx( ELSE IF( EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) || EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) { ivas_dirac_dec_binaural_render_fx( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, nchan_remapped, p_output_fx ); -#ifdef NONBE_1894_OSBA_SCALING FOR( n = 0; n < st_ivas->hDecoderConfig->nchan_out; n++ ) { scale_sig32( p_output_fx[n], *nSamplesRendered, 1 ); } -#endif } ELSE { @@ -2299,12 +2250,10 @@ ivas_error ivas_jbm_dec_render_fx( set32_fx( p_output_fx[n], 0, *nSamplesRendered ); } } -#ifdef NONBE_1894_OSBA_SCALING FOR( n = 0; n < st_ivas->hDecoderConfig->nchan_out; n++ ) { scale_sig32( p_output_fx[n], *nSamplesRendered, 1 ); } -#endif } } ELSE IF( EQ_32( st_ivas->ivas_format, MC_FORMAT ) ) @@ -2817,7 +2766,6 @@ ivas_error ivas_jbm_dec_flush_renderer_fx( { IF( EQ_16( mc_mode_old, MC_MODE_MCT ) ) { -#ifdef NONBE_FIX_1070_USAN_SEGFAULT_MC_TO_BIN_BTSW_HEADROT Word16 crendInPlaceRotation = FALSE; test(); @@ -2832,7 +2780,6 @@ ivas_error ivas_jbm_dec_flush_renderer_fx( ivas_mc2sba_fx( st_ivas->hTransSetup, hTcBuffer->tc_fx, p_output_fx, hTcBuffer->n_samples_granularity, hIntSetupOld->ambisonics_order, GAIN_LFE_FX ); } } -#endif test(); IF( EQ_16( renderer_type_old, RENDERER_BINAURAL_MIXER_CONV ) || EQ_16( renderer_type_old, RENDERER_BINAURAL_MIXER_CONV_ROOM ) ) @@ -2850,15 +2797,9 @@ ivas_error ivas_jbm_dec_flush_renderer_fx( *st_ivas->hCrendWrapper->p_io_qfactor = 11; move16(); -#ifdef NONBE_FIX_1070_USAN_SEGFAULT_MC_TO_BIN_BTSW_HEADROT IF( NE_32( 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, crendInPlaceRotation ? p_output_fx : st_ivas->hTcBuffer->tc_fx, p_output_fx, hTcBuffer->n_samples_granularity, st_ivas->hDecoderConfig->output_Fs, 0 ), IVAS_ERR_OK ) ) -#else - IF( NE_32( ( 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_fx, p_output_fx, hTcBuffer->n_samples_granularity, st_ivas->hDecoderConfig->output_Fs, 0 ) ), - IVAS_ERR_OK ) ) -#endif { return error; } @@ -2887,11 +2828,7 @@ ivas_error ivas_jbm_dec_flush_renderer_fx( { IF( EQ_16( ism_mode_old, ISM_MASA_MODE_DISC ) ) { -#ifdef NONBE_1220_OMASA_JBM_BRATE_SW_FLUSH Word32 *tc_local_fx[MAX_NUM_OBJECTS]; -#else - Word32 *tc_local_fx[MAX_TRANSPORT_CHANNELS]; -#endif move16(); FOR( ch_idx = 0; ch_idx < st_ivas->nchan_ism; ch_idx++ ) @@ -2900,31 +2837,10 @@ ivas_error ivas_jbm_dec_flush_renderer_fx( Copy32( st_ivas->hMasaIsmData->delayBuffer_fx[ch_idx], tc_local_fx[ch_idx], st_ivas->hMasaIsmData->delayBuffer_size ); /*Q11*/ } -#ifdef NONBE_1220_OMASA_JBM_BRATE_SW_FLUSH IF( NE_32( ( error = ivas_td_binaural_renderer_sf_fx( st_ivas, p_output_fx, hTcBuffer->n_samples_granularity ) ), IVAS_ERR_OK ) ) { return error; } -#else - IF( st_ivas->nchan_ism > 0 ) - { - IF( NE_32( ( error = ivas_td_binaural_renderer_sf_fx( st_ivas, p_output_fx, hTcBuffer->n_samples_granularity ) ), IVAS_ERR_OK ) ) - { - return error; - } - } - ELSE - { - FOR( ch_idx = 0; ch_idx < st_ivas->hDecoderConfig->nchan_out; ch_idx++ ) - { - set_zero_fx( p_output_fx[ch_idx], (Word16) ( *nSamplesRendered ) ); - } - st_ivas->hTcBuffer->slots_rendered = add( st_ivas->hTcBuffer->slots_rendered, 1 ); - st_ivas->hTcBuffer->subframes_rendered = add( st_ivas->hTcBuffer->subframes_rendered, 1 ); - move16(); - move16(); - } -#endif } } ELSE IF( EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) @@ -3639,18 +3555,6 @@ ivas_error ivas_jbm_dec_tc_buffer_open_fx( set16_fx( hTcBuffer->subframe_nbslots, 0, MAX_JBM_SUBFRAMES_5MS ); set16_fx( hTcBuffer->subframe_nbslots, nMaxSlotsPerSubframe, MAX_PARAM_SPATIAL_SUBFRAMES ); -#ifndef FIX_1101_CLEANING_JBM_CALL - IF( EQ_16( hTcBuffer->tc_buffer_mode, TC_BUFFER_MODE_NONE ) ) - { - hTcBuffer->tc_buffer_fx = NULL; - - FOR( ch_idx = 0; ch_idx < MAX_TRANSPORT_CHANNELS + MAX_NUM_OBJECTS; ch_idx++ ) - { - hTcBuffer->tc_fx[ch_idx] = NULL; - } - } - ELSE -#endif { Word16 n_samp_full, n_samp_residual; Word32 offset; @@ -4033,10 +3937,8 @@ TC_BUFFER_MODE ivas_jbm_dec_get_tc_buffer_mode( case RENDERER_PARAM_ISM: case RENDERER_BINAURAL_MIXER_CONV: case RENDERER_BINAURAL_MIXER_CONV_ROOM: -#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT case RENDERER_OMASA_OBJECT_EXT: case RENDERER_OMASA_MIX_EXT: -#endif case RENDERER_OSBA_AMBI: case RENDERER_OSBA_LS: buffer_mode = TC_BUFFER_MODE_RENDERER; @@ -4122,9 +4024,6 @@ void ivas_jbm_dec_copy_tc_no_tsm_fx( ) { Word16 Q_tc; -#ifndef FIX_1101_CLEANING_JBM_CALL - Word16 n_ch_full_copy; -#endif Word16 n_ch_cldfb; Word16 ch_idx; DECODER_TC_BUFFER_HANDLE hTcBuffer; @@ -4134,29 +4033,13 @@ void ivas_jbm_dec_copy_tc_no_tsm_fx( hTcBuffer->n_samples_available = hTcBuffer->n_samples_buffered; move16(); move16(); -#ifndef FIX_1101_CLEANING_JBM_CALL - n_ch_full_copy = s_min( hTcBuffer->nchan_transport_jbm, hTcBuffer->nchan_buffer_full ); -#endif n_ch_cldfb = sub( hTcBuffer->nchan_transport_jbm, hTcBuffer->nchan_buffer_full ); Q_tc = 11; /*tc buffer is at Q11*/ move16(); -#ifdef FIX_1101_CLEANING_JBM_CALL #ifdef DEBUGGING assert( st_ivas->hDecoderConfig->Opt_tsm == 0 ); -#endif -#else - /* copy full tcs*/ - IF( st_ivas->hDecoderConfig->Opt_tsm ) - { - FOR( ch_idx = 0; ch_idx < n_ch_full_copy; ch_idx++ ) - { - Copy32( tc_fx[ch_idx], st_ivas->hTcBuffer->tc_fx[ch_idx], hTcBuffer->n_samples_buffered ); // keeping tc_fx in Q11 - } - } - ch_idx = 0; - move16(); #endif /* CLDFB ana for ParamMC/ParamISM */ IF( n_ch_cldfb > 0 ) @@ -4190,11 +4073,7 @@ void ivas_jbm_dec_copy_tc_no_tsm_fx( } /* CLDFB Analysis*/ -#ifdef FIX_1101_CLEANING_JBM_CALL FOR( ( ch_idx = 0, cldfb_ch = 0 ); cldfb_ch < n_ch_cldfb; ( cldfb_ch++, ch_idx++ ) ) -#else - FOR( cldfb_ch = 0; cldfb_ch < n_ch_cldfb; ( cldfb_ch++, ch_idx++ ) ) -#endif { FOR( slot_idx = 0; slot_idx < DEFAULT_JBM_CLDFB_TIMESLOTS; slot_idx++ ) { diff --git a/lib_dec/ivas_lfe_dec_fx.c b/lib_dec/ivas_lfe_dec_fx.c index d4d1d727ec0cf801a38c2fa0bdf57ae9e4fe945f..29a64da58ad02646b6483d68a94acdc00cb2b2ed 100644 --- a/lib_dec/ivas_lfe_dec_fx.c +++ b/lib_dec/ivas_lfe_dec_fx.c @@ -295,7 +295,6 @@ static Word16 ivas_lfe_dec_dequant_fx( } -#ifdef NONBE_FIX_MC_LFE_LPF /*------------------------------------------------------------------------- * ivas_create_lfe_lpf_dec_fx() * @@ -315,7 +314,6 @@ static void ivas_create_lfe_lpf_dec_fx( return; } -#endif /*-----------------------------------------------------------------------------------------* * Function ivas_lfe_dec_fx() @@ -402,9 +400,7 @@ void ivas_lfe_dec_fx( move32(); j = add( j, shr( output_frame, 5 ) ); } -#ifdef NONBE_FIX_MC_LFE_LPF q_out = Q9; -#endif } IF( hLFE->filter_state.order > 0 ) @@ -432,25 +428,16 @@ void ivas_lfe_dec_fx( ivas_error ivas_create_lfe_dec_fx( LFE_DEC_HANDLE *hLFE_out, /* o : IVAS LFE decoder structure */ const Word32 output_Fs, /* i : output sampling rate Q0*/ -#ifdef NONBE_FIX_MC_LFE_LPF - const Word32 delay_ns /* i : additional LFE delay to sync other channel outputs */ -#else - const Word32 binauralization_delay_ns /* i : additional LFE delay to sync with binaural renderer */ -#endif + const Word32 delay_ns /* i : additional LFE delay to sync other channel outputs */ ) { Word16 low_pass_delay_dec_out, block_offset_s; Word16 filt_order, output_frame; LFE_DEC_HANDLE hLFE; Word16 i, j; -#ifndef NONBE_1360_LFE_DELAY - int16_t add_delay_sa; - Word16 lfe_addl_delay_s; -#else Word16 lfe_block_delay_s_fx; Word16 block_offset_samples, lfe_block_delay_samples; Word16 lfe_addl_delay_samples; -#endif Word32 output_fs_fx; low_pass_delay_dec_out = 0; @@ -491,11 +478,7 @@ ivas_error ivas_create_lfe_dec_fx( hLFE->cum_freq_models[1][3] = &ivas_str_lfe_freq_models.entropy_coder_model_coarse_sg4; /* delay calculation */ -#ifndef NONBE_1360_LFE_DELAY - hLFE->lfe_block_delay_s_fx = add( IVAS_LFE_FADE_S_Q15, ivas_lfe_lpf_delay_Q15[IVAS_FILTER_ORDER_4 - 3] ); // Q15 -#else lfe_block_delay_s_fx = add( IVAS_LFE_FADE_S_Q15, ivas_lfe_lpf_delay_Q15[IVAS_FILTER_ORDER_4 - 3] ); // Q15 -#endif move16(); block_offset_s = BLOCK_OFFSET_S_Q15; // Q15 @@ -505,24 +488,17 @@ ivas_error ivas_create_lfe_dec_fx( low_pass_delay_dec_out = 0; // Q15 move16(); -#ifdef NONBE_FIX_MC_LFE_LPF if ( delay_ns > ivas_lfe_lpf_delay_ns[IVAS_FILTER_ORDER_4 - 3] ) { filt_order = 4; low_pass_delay_dec_out = ivas_lfe_lpf_delay_Q15[IVAS_FILTER_ORDER_4 - 3]; ivas_create_lfe_lpf_dec_fx( &( hLFE->filter_state ), output_Fs ); } -#endif hLFE->filter_state.order = filt_order; move16(); -#ifndef NONBE_1360_LFE_DELAY - hLFE->lfe_block_delay_s_fx = add( hLFE->lfe_block_delay_s_fx, low_pass_delay_dec_out ); // Q15 - move16(); -#else - lfe_block_delay_s_fx = add( lfe_block_delay_s_fx, low_pass_delay_dec_out ); // Q15 -#endif - hLFE->lfe_prior_buf_len = NS2SA_FX2( output_Fs, IVAS_LFE_FADE_NS ); // Q0 + lfe_block_delay_s_fx = add( lfe_block_delay_s_fx, low_pass_delay_dec_out ); // Q15 + hLFE->lfe_prior_buf_len = NS2SA_FX2( output_Fs, IVAS_LFE_FADE_NS ); // Q0 move16(); hLFE->bfi_count = 0; @@ -545,7 +521,6 @@ ivas_error ivas_create_lfe_dec_fx( } move32(); -#ifdef NONBE_1360_LFE_DELAY block_offset_samples = (Word16) L_shr( imult3216( output_Fs, block_offset_s ), 15 ); // Q0 block_offset_samples = add( block_offset_samples, (Word16) W_round64_L( W_mult0_32_32( L_shl( delay_ns, 1 ), output_fs_fx ) ) ); // Q0 lfe_block_delay_samples = (Word16) L_shr( imult3216( output_Fs, lfe_block_delay_s_fx ), 15 ); // Q0 @@ -555,27 +530,6 @@ ivas_error ivas_create_lfe_dec_fx( move16(); hLFE->delay_ns = delay_ns; move32(); -#else - lfe_addl_delay_s = sub( block_offset_s, hLFE->lfe_block_delay_s_fx ); // Q15 - lfe_addl_delay_s = s_max( 0, lfe_addl_delay_s ); -#ifdef NONBE_FIX_MC_LFE_LPF - add_delay_sa = (Word16) W_round64_L( W_mult0_32_32( L_shl( delay_ns, 1 ), output_fs_fx ) ); // Q0 -#else - add_delay_sa = (Word16) W_round64_L( W_mult0_32_32( L_shl( binauralization_delay_ns, 1 ), output_fs_fx ) ); // Q0 -#endif - move16(); - hLFE->lfe_addl_delay = add( (Word16) L_shr( imult3216( output_Fs, lfe_addl_delay_s ), 15 ), add_delay_sa ); // Q0 - move16(); - IF( add_delay_sa == 0 ) - { - hLFE->lfe_block_delay_s_fx = add( hLFE->lfe_block_delay_s_fx, lfe_addl_delay_s ); - } - ELSE - { - hLFE->lfe_block_delay_s_fx = add( hLFE->lfe_block_delay_s_fx, add( lfe_addl_delay_s, idiv1616( add_delay_sa, extract_l( output_Fs ) ) ) ); - } - move16(); -#endif IF( hLFE->lfe_addl_delay > 0 ) { diff --git a/lib_dec/ivas_lfe_plc_fx.c b/lib_dec/ivas_lfe_plc_fx.c index 2510ded1564a1971c7a8df0f5298abfd548a487a..03037af421d871b771333e532d52b0f441f84ded 100755 --- a/lib_dec/ivas_lfe_plc_fx.c +++ b/lib_dec/ivas_lfe_plc_fx.c @@ -646,11 +646,7 @@ static void d_syn_filt_fx( } ELSE { -#ifdef FIX_ISSUE_1811_EXCEEDING_W_SHIFTS s_fx = W_sub( W_shr( s_fx, s_min( 63, sub( s_q_fx, temp_q ) ) ), temp ); -#else - s_fx = W_sub( W_shr( s_fx, sub( s_q_fx, temp_q ) ), temp ); -#endif s_q_fx = temp_q; move16(); } diff --git a/lib_dec/ivas_masa_dec_fx.c b/lib_dec/ivas_masa_dec_fx.c index 0f22a8b29a1ab8194cb37d050850ab36b946cf46..087ff9ae6e6382f87505c30e51398b76597c79bb 100644 --- a/lib_dec/ivas_masa_dec_fx.c +++ b/lib_dec/ivas_masa_dec_fx.c @@ -184,7 +184,6 @@ ivas_error ivas_masa_decode_fx( test(); IF( NE_32( ivas_format, MC_FORMAT ) || NE_16( st_ivas->mc_mode, MC_MODE_MCMASA ) ) { -#ifdef NONBE_FIX_1074_NOBJ_SIGNAL_OMASA_LBR Word16 bits_per_frame = extract_l( Mpy_32_32( ivas_total_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) ); IF( EQ_32( ivas_format, MASA_FORMAT ) ) { @@ -239,7 +238,6 @@ ivas_error ivas_masa_decode_fx( } ELSE { -#endif IF( NE_32( ivas_format, MASA_ISM_FORMAT ) ) { /* number of transport channels is always 2 for MASA_ISM format */ @@ -376,17 +374,7 @@ ivas_error ivas_masa_decode_fx( } } } -#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT - -#ifndef NONBE_FIX_1074_NOBJ_SIGNAL_OMASA_LBR - /* read 2 bits: - '00' - MASA format at the encoder - '01' - MASA_ISM_FORMAT at the encoder, with 1 object - '10' - MASA_ISM_FORMAT at the encoder, with 2 objects - '11' - MASA_ISM_FORMAT at the encoder, with 3 or 4 objects - reading if 3 or 4 object is performed later - */ -#endif + byteBuffer = st->bit_stream[st->next_bit_pos]; move16(); st->next_bit_pos = sub( st->next_bit_pos, 1 ); @@ -404,24 +392,6 @@ ivas_error ivas_masa_decode_fx( hMasa->config.input_ivas_format = MASA_ISM_FORMAT; move32(); } -#else - /* read the MASA_ISM_FORMAT bit */ - byteBuffer = st->bit_stream[( st->next_bit_pos )--]; - move16(); - IF( EQ_32( byteBuffer, 1 ) ) - { - hMasa->config.input_ivas_format = MASA_ISM_FORMAT; - } - ELSE - { - hMasa->config.input_ivas_format = MASA_FORMAT; - } - move32(); - - /* reserved bit */ - byteBuffer = st->bit_stream[( st->next_bit_pos )--]; - move16(); -#endif *nb_bits_read = add( *nb_bits_read, MASA_HEADER_BITS ); /* read number of directions */ @@ -431,9 +401,7 @@ ivas_error ivas_masa_decode_fx( move16(); hMasa->config.numberOfDirections = (UWord8) L_add( byteBuffer, 1 ); move16(); -#ifdef NONBE_FIX_1074_NOBJ_SIGNAL_OMASA_LBR } -#endif } ELSE { @@ -528,14 +496,12 @@ ivas_error ivas_masa_decode_fx( } } } -#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT ELSE IF( EQ_32( st_ivas->renderer_type, RENDERER_OMASA_OBJECT_EXT ) ) { *nb_bits_read = add( *nb_bits_read, ivas_decode_masaism_metadata_fx( hQMetaData, st_ivas->hMasa, st_ivas->hMasaIsmData, st_ivas->nchan_ism, st->bit_stream, &st->next_bit_pos, st_ivas->hMasaIsmData->idx_separated_ism, ism_imp, st_ivas->hSpatParamRendCom->dirac_bs_md_write_idx, st_ivas->hSpatParamRendCom->dirac_md_buffer_length ) ); } -#endif ELSE { *nb_bits_read = add( *nb_bits_read, ivas_decode_masaism_metadata_fx( hQMetaData, st_ivas->hMasa, st_ivas->hMasaIsmData, st_ivas->nchan_ism, st->bit_stream, &st->next_bit_pos, @@ -593,13 +559,9 @@ ivas_error ivas_masa_decode_fx( hMasa->config.coherencePresent = !hQMetaData->all_coherence_zero; move16(); -#ifdef FIX_1052_EXT_OUTPUT test(); test(); IF( EQ_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) && ( EQ_32( ivas_format, MASA_FORMAT ) || EQ_32( ivas_format, MASA_ISM_FORMAT ) ) ) -#else - IF( EQ_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) ) -#endif { index_16bits_fx( hQMetaData, hMasa->data.sph_grid16 ); } @@ -690,7 +652,6 @@ ivas_error ivas_masa_decode_fx( ivas_qmetadata_to_dirac_fx( hQMetaData, st_ivas->hDirAC, hMasa, st_ivas->hSpatParamRendCom, ivas_total_brate, ivas_format, 0, 0 ); } -#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT ELSE IF( EQ_32( st_ivas->renderer_type, RENDERER_OMASA_OBJECT_EXT ) ) { Word16 index = add( st_ivas->hSpatParamRendCom->dirac_bs_md_write_idx, MAX_PARAM_SPATIAL_SUBFRAMES ); @@ -702,7 +663,6 @@ ivas_error ivas_masa_decode_fx( st_ivas->hSpatParamRendCom->dirac_bs_md_write_idx = index; move16(); } -#endif IF( EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) ) { @@ -860,7 +820,6 @@ ivas_error ivas_masa_dec_open_fx( ism_total_brate = 0; move32(); -#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT /* ISM metadata */ test(); test(); @@ -869,7 +828,6 @@ ivas_error ivas_masa_dec_open_fx( /* these are not needed -> clean. EXT metafile writer in OMASA needs only the number of ISMs and writes default null-data */ ivas_ism_metadata_close( st_ivas->hIsmMetaData, 0 ); } -#endif test(); test(); test(); @@ -892,13 +850,9 @@ ivas_error ivas_masa_dec_open_fx( move16(); /* Create spherical grid only for external output */ -#ifdef FIX_1052_EXT_OUTPUT test(); test(); IF( EQ_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) && ( EQ_32( st_ivas->ivas_format, MASA_FORMAT ) || EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) ) ) -#else - IF( EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) ) -#endif { IF( ( hMasa->data.sph_grid16 = (SPHERICAL_GRID_DATA *) malloc( sizeof( SPHERICAL_GRID_DATA ) ) ) == NULL ) { @@ -959,10 +913,8 @@ ivas_error ivas_masa_dec_open_fx( nchan_to_allocate = nchan_transport; move16(); -#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT test(); test(); -#endif test(); test(); IF( EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) && EQ_32( st_ivas->renderer_type, RENDERER_MONO_DOWNMIX ) ) @@ -972,13 +924,11 @@ ivas_error ivas_masa_dec_open_fx( nchan_to_allocate = 1; move16(); } -#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT ELSE IF( EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) && ( EQ_32( st_ivas->renderer_type, RENDERER_OMASA_MIX_EXT ) || EQ_32( st_ivas->renderer_type, RENDERER_OMASA_OBJECT_EXT ) ) ) { nchan_transport = add( st_ivas->nchan_transport, st_ivas->nchan_ism ); nchan_to_allocate = add( st_ivas->nchan_transport, st_ivas->nchan_ism ); } -#endif ELSE IF( EQ_16( st_ivas->nchan_transport, 1 ) && EQ_32( st_ivas->renderer_type, RENDERER_DIRAC ) ) { /* addtl channel for CNG */ @@ -1438,7 +1388,6 @@ static ivas_error init_lfe_synth_data_fx( test(); test(); test(); -#ifdef FIX_1052_EXT_OUTPUT test(); IF( st_ivas->hOutSetup.separateChannelEnabled && ( EQ_16( output_config, IVAS_AUDIO_CONFIG_5_1 ) || EQ_16( output_config, IVAS_AUDIO_CONFIG_7_1 ) || @@ -1448,15 +1397,6 @@ static ivas_error init_lfe_synth_data_fx( EQ_16( output_config, IVAS_AUDIO_CONFIG_FOA ) || EQ_16( output_config, IVAS_AUDIO_CONFIG_HOA2 ) || EQ_16( output_config, IVAS_AUDIO_CONFIG_HOA3 ) || ( EQ_16( output_config, IVAS_AUDIO_CONFIG_LS_CUSTOM ) && ( st_ivas->hOutSetup.num_lfe > 0 ) ) ) ) -#else - IF( st_ivas->hOutSetup.separateChannelEnabled && - ( EQ_16( output_config, IVAS_AUDIO_CONFIG_5_1 ) || EQ_16( output_config, IVAS_AUDIO_CONFIG_7_1 ) || - EQ_16( output_config, IVAS_AUDIO_CONFIG_5_1_2 ) || - EQ_16( output_config, IVAS_AUDIO_CONFIG_5_1_4 ) || EQ_16( output_config, IVAS_AUDIO_CONFIG_7_1_4 ) || - EQ_16( output_config, IVAS_AUDIO_CONFIG_FOA ) || EQ_16( output_config, IVAS_AUDIO_CONFIG_HOA2 ) || - EQ_16( output_config, IVAS_AUDIO_CONFIG_HOA3 ) || - ( EQ_16( output_config, IVAS_AUDIO_CONFIG_LS_CUSTOM ) && ( st_ivas->hOutSetup.num_lfe > 0 ) ) ) ) -#endif { Word16 bufferSize; Word16 i; @@ -1985,7 +1925,6 @@ ivas_error ivas_masa_dec_reconfigure_fx( IF( EQ_32( st_ivas->ivas_format, MASA_FORMAT ) ) { -#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT IF( NE_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) ) { move16(); @@ -1993,10 +1932,6 @@ ivas_error ivas_masa_dec_reconfigure_fx( with reading of the format: nchan_ism is needed in MASA format because for the EXT output in MASA-only (pre-rendering mode of OMASA) the number of ISMs to output correct number of empty objects is needed */ } -#else - st_ivas->nchan_ism = 0; - move16(); -#endif st_ivas->ism_mode = ISM_MODE_NONE; move16(); } @@ -2019,19 +1954,13 @@ ivas_error ivas_masa_dec_reconfigure_fx( test(); test(); test(); -#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT test(); test(); -#endif IF( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) || EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) || EQ_16( st_ivas->renderer_type, RENDERER_STEREO_PARAMETRIC ) ) { IF( EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) ) { -#ifdef FIX_1222_OMASA_DEC_CHANNEL_BUFFERS tc_nchan_to_allocate = add( BINAURAL_CHANNELS, st_ivas->nchan_ism ); -#else - tc_nchan_to_allocate = add( shl( BINAURAL_CHANNELS, 1 ), 2 ); -#endif } ELSE { @@ -2067,13 +1996,11 @@ ivas_error ivas_masa_dec_reconfigure_fx( /* addtl channel for CNG */ tc_nchan_to_allocate = add( tc_nchan_to_allocate, 1 ); } -#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT ELSE IF( EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) && ( EQ_32( st_ivas->renderer_type, RENDERER_OMASA_MIX_EXT ) || EQ_32( st_ivas->renderer_type, RENDERER_OMASA_OBJECT_EXT ) ) ) { tc_nchan_transport = add( st_ivas->nchan_transport, st_ivas->nchan_ism ); tc_nchan_to_allocate = add( st_ivas->nchan_transport, st_ivas->nchan_ism ); } -#endif test(); test(); IF( NE_16( tc_nchan_transport, st_ivas->hTcBuffer->nchan_transport_jbm ) || NE_16( tc_nchan_to_allocate, st_ivas->hTcBuffer->nchan_transport_internal ) || NE_16( buffer_mode_new, st_ivas->hTcBuffer->tc_buffer_mode ) ) @@ -2695,25 +2622,12 @@ static void create_masa_ext_out_meta_fx( IVAS_QMETADATA_HANDLE hQMetaData, const Word16 nchan_transport ) { -#ifndef FIX_1121_MASA_DESCRIPTOR - const UWord8 ivasmasaFormatDescriptor[8] = { 0x49, 0x56, 0x41, 0x53, 0x4D, 0x41, 0x53, 0x41 }; /* "IVASMASA" */ -#endif Word16 i, sf, b_old, b_new, dir; MASA_DECRIPTIVE_META *descMeta; Word16 *bandMap; UWord8 numCodingBands; UWord8 numDirections; MASA_DECODER_EXT_OUT_META *extOutMeta; -#ifndef FIX_1121_MASA_DESCRIPTOR - move16(); /*ivasmasaFormatDescriptor*/ - move16(); - move16(); - move16(); - move16(); - move16(); - move16(); - move16(); -#endif numDirections = hMasa->config.numberOfDirections; move16(); @@ -3516,14 +3430,12 @@ static Word16 ivas_decode_masaism_metadata_fx( move32(); } -#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT IF( hMasaIsmData->hExtData != NULL ) { hMasaIsmData->hExtData->masa_render_masa_to_total[meta_write_index][b] = hMasaIsmData->masa_to_total_energy_ratio_fx[i][band]; move32(); } -#endif } } } diff --git a/lib_dec/ivas_mc_param_dec_fx.c b/lib_dec/ivas_mc_param_dec_fx.c index 73ba585d157ec29c7d3dddba982306b4b6482385..608440286b2d778c0a2ff5bb3dfc61573fc92bd6 100644 --- a/lib_dec/ivas_mc_param_dec_fx.c +++ b/lib_dec/ivas_mc_param_dec_fx.c @@ -165,11 +165,7 @@ ivas_error ivas_param_mc_dec_open_fx( test(); test(); test(); -#ifdef FIX_1052_EXT_OUTPUT IF( EQ_32( st_ivas->renderer_type, RENDERER_SBA_LINEAR_ENC ) || EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV ) || EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV_ROOM ) || EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_OBJECTS_TD ) || EQ_32( st_ivas->transport_config, output_config ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) ) -#else - IF( EQ_32( st_ivas->renderer_type, RENDERER_SBA_LINEAR_ENC ) || EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV ) || EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV_ROOM ) || EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_OBJECTS_TD ) || EQ_32( st_ivas->transport_config, output_config ) ) -#endif { hParamMC->synthesis_conf = PARAM_MC_SYNTH_DIRECT; move32(); @@ -1799,7 +1795,6 @@ void ivas_param_mc_dec_digest_tc_fx( test(); IF( hParamMC->hMetadataPMC->bAttackPresent && ( EQ_32( hParamMC->synthesis_conf, PARAM_MC_SYNTH_LS_CONV_COV ) || EQ_32( hParamMC->synthesis_conf, PARAM_MC_SYNTH_MONO_STEREO ) ) ) { -#ifdef NONBE_SVD_OPTIMIZATION Word16 len = imult1616( nchan_transport, nchan_transport ); Word16 sc = s_min( getScaleFactor32( cx_fx, len ), getScaleFactor32( cx_next_band_fx, len ) ); IF( EQ_16( sc, 0 ) ) @@ -1811,10 +1806,6 @@ void ivas_param_mc_dec_digest_tc_fx( } v_add_fx( cx_fx, cx_next_band_fx, cx_fx, len ); Copy32( cx_fx, cx_next_band_fx, len ); -#else - v_add_fx( cx_fx, cx_next_band_fx, cx_fx, imult1616( nchan_transport, nchan_transport ) ); - Copy32( cx_fx, cx_next_band_fx, imult1616( nchan_transport, nchan_transport ) ); -#endif } FOR( is_next_band = 0; is_next_band < 2; is_next_band++ ) diff --git a/lib_dec/ivas_mc_paramupmix_dec_fx.c b/lib_dec/ivas_mc_paramupmix_dec_fx.c index c49b413420b7196c23825263692814b65df8f786..48b6b8c7533153af1428d4a03beea9a25b78dcd2 100644 --- a/lib_dec/ivas_mc_paramupmix_dec_fx.c +++ b/lib_dec/ivas_mc_paramupmix_dec_fx.c @@ -960,38 +960,30 @@ static void ivas_mc_paramupmix_dec_sf( { FOR( ch = 0; ch < MC_PARAMUPMIX_COMBINATIONS; ch++ ) { -#ifdef NONBE_1360_LFE_DELAY /*delay is handled within LFE decoder*/ IF( NE_16( st_ivas->hIntSetup.index_lfe[0], ch ) ) { -#endif Word32 tmp_buf_fx[L_SUBFRAME5MS_48k]; Copy32( &output_fx[ch][n_samples_rendered - noparamupmix_delay], tmp_buf_fx, noparamupmix_delay ); Copy32( output_fx[ch], &output_fx[ch][noparamupmix_delay], sub( n_samples_rendered, noparamupmix_delay ) ); Copy32( hMCParamUpmix->pcm_delay_fx[ch], output_fx[ch], noparamupmix_delay ); Copy32( tmp_buf_fx, hMCParamUpmix->pcm_delay_fx[ch], noparamupmix_delay ); -#ifdef NONBE_1360_LFE_DELAY } -#endif } } ELSE { FOR( ch = 0; ch < MC_PARAMUPMIX_COMBINATIONS; ch++ ) { -#ifdef NONBE_1360_LFE_DELAY /*delay is handled within LFE decoder*/ IF( NE_16( st_ivas->hIntSetup.index_lfe[0], ch ) ) { -#endif Word32 tmp_buf_fx[L_SUBFRAME5MS_48k]; Copy32( &output_fx[ch][0], tmp_buf_fx, n_samples_rendered ); Copy32( hMCParamUpmix->pcm_delay_fx[ch], output_fx[ch], n_samples_rendered ); Copy32( &hMCParamUpmix->pcm_delay_fx[ch][n_samples_rendered], &hMCParamUpmix->pcm_delay_fx[ch][0], sub( noparamupmix_delay, n_samples_rendered ) ); Copy32( tmp_buf_fx, &hMCParamUpmix->pcm_delay_fx[ch][noparamupmix_delay - n_samples_rendered], n_samples_rendered ); -#ifdef NONBE_1360_LFE_DELAY } -#endif } } } diff --git a/lib_dec/ivas_mct_dec_fx.c b/lib_dec/ivas_mct_dec_fx.c index af49f142a309babb90858f9bb39f563eff3abf23..4a06299a98ba10159bb558db4c7029e6a9f46f79 100644 --- a/lib_dec/ivas_mct_dec_fx.c +++ b/lib_dec/ivas_mct_dec_fx.c @@ -849,11 +849,7 @@ ivas_error ivas_mc_dec_config_fx( IF( st_ivas->ini_frame != 0 ) { test(); -#ifdef FIX_1052_EXT_OUTPUT IF( NE_32( st_ivas->hDecoderConfig->last_ivas_total_brate, st_ivas->hDecoderConfig->ivas_total_brate ) || last_mc_mode != st_ivas->mc_mode ) -#else - IF( NE_32( 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 ) -#endif { IF( st_ivas->hRenderConfig ) { @@ -1333,65 +1329,6 @@ static ivas_error ivas_mc_dec_reconfig_fx( return error; } -#ifndef NONBE_1360_LFE_DELAY - /*-----------------------------------------------------------------* - * Allocate the LFE handle that is coded separately after the allocation of the core coders - *-----------------------------------------------------------------*/ - - test(); - test(); - IF( ( EQ_16( st_ivas->mc_mode, MC_MODE_MCT ) || EQ_16( st_ivas->mc_mode, MC_MODE_PARAMUPMIX ) ) && st_ivas->hLFE == NULL ) - { -#ifdef NONBE_FIX_MC_LFE_LPF - Word32 delay_ns = st_ivas->binaural_latency_ns; -#else - Word32 binauralization_delay_ns = st_ivas->binaural_latency_ns; -#endif - move32(); - IF( st_ivas->hBinRenderer != NULL ) - { - IF( st_ivas->hBinRenderer->render_lfe ) - { - /* Account for filterbank delay */ -#ifdef NONBE_FIX_MC_LFE_LPF - delay_ns = L_add( delay_ns, IVAS_FB_DEC_DELAY_NS ); -#else - binauralization_delay_ns = L_add( binauralization_delay_ns, IVAS_FB_DEC_DELAY_NS ); -#endif - } - ELSE - { -#ifdef NONBE_FIX_MC_LFE_LPF - delay_ns = 0; -#else - binauralization_delay_ns = 0; -#endif - move32(); - } - } -#ifdef NONBE_FIX_MC_LFE_LPF - ELSE - { - IF( EQ_16( st_ivas->mc_mode, MC_MODE_PARAMUPMIX ) && ( st_ivas->cldfbSynDec[0] != NULL ) ) - { - delay_ns = L_add( delay_ns, IVAS_FB_DEC_DELAY_NS ); - } - } -#endif - -#ifdef NONBE_FIX_MC_LFE_LPF - IF( NE_32( ( error = ivas_create_lfe_dec_fx( &st_ivas->hLFE, st_ivas->hDecoderConfig->output_Fs, delay_ns ) ), IVAS_ERR_OK ) ) -#else - IF( NE_32( ( error = ivas_create_lfe_dec_fx( &st_ivas->hLFE, st_ivas->hDecoderConfig->output_Fs, binauralization_delay_ns ) ), IVAS_ERR_OK ) ) -#endif - { - return error; - } - - set32_fx( st_ivas->hLFE->prevsynth_buf_fx, 0, LFE_PLC_BUFLEN ); - set32_fx( st_ivas->hLFE->prior_out_buffer_fx, 0, L_FRAME48k ); - } -#endif /*-----------------------------------------------------------------* * Reconfigure renderers @@ -1453,13 +1390,11 @@ static ivas_error ivas_mc_dec_reconfig_fx( IF( st_ivas->hBinRenderer != NULL && ( NE_16( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV ) && NE_16( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV_ROOM ) ) ) { ivas_binRenderer_close_fx( &st_ivas->hBinRenderer ); -#ifdef FIX_1068_ASAN_IN_MC_2_BINAURAL_ROOM_IR test(); IF( ( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation ) ) { efap_free_data_fx( &st_ivas->hEFAPdata ); } -#endif } test(); @@ -1552,21 +1487,12 @@ static ivas_error ivas_mc_dec_reconfig_fx( return error; } -#ifdef NONBE_1360_LFE_DELAY /*-----------------------------------------------------------------* * Allocate the LFE handle that is coded separately after the allocation of the core coders *-----------------------------------------------------------------*/ -#ifdef NONBE_1360_LFE_DELAY test(); IF( ( EQ_16( st_ivas->mc_mode, MC_MODE_MCT ) || EQ_16( st_ivas->mc_mode, MC_MODE_PARAMUPMIX ) ) ) -#else - test(); - test(); - IF( ( EQ_16( st_ivas->mc_mode, MC_MODE_MCT ) || EQ_16( st_ivas->mc_mode, MC_MODE_PARAMUPMIX ) ) && st_ivas->hLFE == NULL ) -#endif { -#ifdef NONBE_FIX_MC_LFE_LPF -#ifdef NONBE_1360_LFE_DELAY Word32 delay_ns; IF( NE_16( st_ivas->hIntSetup.index_lfe[0], -1 ) ) { @@ -1576,35 +1502,20 @@ static ivas_error ivas_mc_dec_reconfig_fx( { delay_ns = 0; } -#else - Word32 delay_ns = st_ivas->binaural_latency_ns; -#endif -#else - Word32 binauralization_delay_ns = st_ivas->binaural_latency_ns; -#endif move32(); IF( st_ivas->hBinRenderer != NULL ) { IF( st_ivas->hBinRenderer->render_lfe ) { /* Account for filterbank delay */ -#ifdef NONBE_FIX_MC_LFE_LPF delay_ns = L_add( delay_ns, IVAS_FB_DEC_DELAY_NS ); -#else - binauralization_delay_ns = L_add( binauralization_delay_ns, IVAS_FB_DEC_DELAY_NS ); -#endif } ELSE { -#ifdef NONBE_FIX_MC_LFE_LPF delay_ns = 0; -#else - binauralization_delay_ns = 0; -#endif move32(); } } -#ifdef NONBE_FIX_MC_LFE_LPF ELSE { IF( EQ_16( st_ivas->mc_mode, MC_MODE_PARAMUPMIX ) && ( st_ivas->cldfbSynDec[0] != NULL ) ) @@ -1612,9 +1523,7 @@ static ivas_error ivas_mc_dec_reconfig_fx( delay_ns = L_add( delay_ns, IVAS_FB_DEC_DELAY_NS ); } } -#endif -#ifdef NONBE_1360_LFE_DELAY IF( st_ivas->hLFE != NULL ) { IF( NE_32( st_ivas->hLFE->delay_ns, delay_ns ) ) @@ -1622,28 +1531,18 @@ static ivas_error ivas_mc_dec_reconfig_fx( ivas_lfe_dec_close_fx( &( st_ivas->hLFE ) ); } } -#endif -#ifdef NONBE_1360_LFE_DELAY IF( st_ivas->hLFE == NULL ) { -#endif -#ifdef NONBE_FIX_MC_LFE_LPF IF( NE_32( ( error = ivas_create_lfe_dec_fx( &st_ivas->hLFE, st_ivas->hDecoderConfig->output_Fs, delay_ns ) ), IVAS_ERR_OK ) ) -#else - IF( NE_32( ( error = ivas_create_lfe_dec_fx( &st_ivas->hLFE, st_ivas->hDecoderConfig->output_Fs, binauralization_delay_ns ) ), IVAS_ERR_OK ) ) -#endif { return error; } set32_fx( st_ivas->hLFE->prevsynth_buf_fx, 0, LFE_PLC_BUFLEN ); set32_fx( st_ivas->hLFE->prior_out_buffer_fx, 0, L_FRAME48k ); -#ifdef NONBE_1360_LFE_DELAY } -#endif } -#endif /*-----------------------------------------------------------------* * JBM TC buffers diff --git a/lib_dec/ivas_objectRenderer_internal_fx.c b/lib_dec/ivas_objectRenderer_internal_fx.c index 786523366d270811ba002d00e1915d1908016cfc..914dde94e33c16435d54b1810e5ac9e7068c0568 100644 --- a/lib_dec/ivas_objectRenderer_internal_fx.c +++ b/lib_dec/ivas_objectRenderer_internal_fx.c @@ -62,11 +62,7 @@ ivas_error ivas_td_binaural_open_fx( move16(); } -#ifdef CONF_DISTATT return ivas_td_binaural_open_unwrap_fx( &st_ivas->hHrtfTD, st_ivas->hDecoderConfig->output_Fs, *num_src, st_ivas->ivas_format, st_ivas->transport_config, st_ivas->hRenderConfig->directivity_fx, st_ivas->hRenderConfig->distAtt_fx, st_ivas->hTransSetup, &st_ivas->hBinRendererTd, &st_ivas->binaural_latency_ns, SrcInd ); -#else - return ivas_td_binaural_open_unwrap_fx( &st_ivas->hHrtfTD, st_ivas->hDecoderConfig->output_Fs, *num_src, st_ivas->ivas_format, st_ivas->transport_config, st_ivas->hRenderConfig->directivity_fx, st_ivas->hTransSetup, &st_ivas->hBinRendererTd, &st_ivas->binaural_latency_ns, SrcInd ); -#endif } @@ -100,13 +96,9 @@ ivas_error ivas_td_binaural_renderer_sf_fx( Word16 enableCombinedOrientation; /* Set the number of ISMs */ -#ifdef NONBE_1220_OMASA_JBM_BRATE_SW_FLUSH test(); test(); IF( EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) || ( EQ_32( st_ivas->ivas_format, MASA_FORMAT ) && GT_16( st_ivas->nchan_ism, 0 ) ) ) -#else - IF( EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) ) -#endif { nchan_ism_internal = st_ivas->nchan_ism; move16(); @@ -272,11 +264,7 @@ ivas_error ivas_td_binaural_renderer_sf_fx( /* Render subframe */ /* ism_md_subframe_update_jbm != subframe_idx: trigger update only for ism_md_subframe_update_jbm == subframe_idx, where then the two TDREND_GetMix()-arguments subframe_idx and ism_md_subframe_update are equal, and we want to enforce the update inside TDREND_GetMix to use subframe_idx == 0 */ -#ifdef NONBE_FIX_1196_TD_HEADTRACKING_INTERPOLATION IF( NE_32( ( error = TDREND_GetMix_fx( st_ivas->hBinRendererTd, output_fx_local, output_frame, 0 ) ), IVAS_ERR_OK ) ) -#else - IF( NE_32( ( error = TDREND_GetMix_fx( st_ivas->hBinRendererTd, output_fx_local, output_frame, 0, ism_md_subframe_update_jbm != subframe_idx ) ), IVAS_ERR_OK ) ) -#endif { return error; } @@ -345,7 +333,6 @@ ivas_error ivas_td_binaural_renderer_sf_splitBinaural( { continue; } -#ifdef CONF_DISTATT IF( ( error = ivas_td_binaural_open_unwrap_fx( &st_ivas->hHrtfTD, st_ivas->hDecoderConfig->output_Fs, st_ivas->nchan_transport, @@ -357,18 +344,6 @@ ivas_error ivas_td_binaural_renderer_sf_splitBinaural( &st_ivas->hTdRendHandles[i], &st_ivas->binaural_latency_ns, SrcInd ) ) != IVAS_ERR_OK ) -#else - IF( ( error = ivas_td_binaural_open_unwrap_fx( &st_ivas->hHrtfTD, - st_ivas->hDecoderConfig->output_Fs, - st_ivas->nchan_transport, - st_ivas->ivas_format, - st_ivas->transport_config, - st_ivas->hRenderConfig->directivity_fx, - st_ivas->hTransSetup, - &st_ivas->hTdRendHandles[i], - &st_ivas->binaural_latency_ns, - SrcInd ) ) != IVAS_ERR_OK ) -#endif { return error; } diff --git a/lib_dec/ivas_omasa_dec_fx.c b/lib_dec/ivas_omasa_dec_fx.c index 1982188997e4875527cee6b9ddd7d53cf4771077..439958731f2b132b4abf437f1618a24e6258372b 100644 --- a/lib_dec/ivas_omasa_dec_fx.c +++ b/lib_dec/ivas_omasa_dec_fx.c @@ -32,9 +32,7 @@ #include "options.h" #include -#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT #include -#endif #include "ivas_cnst.h" #include "ivas_prot_fx.h" #include "prot_fx.h" @@ -48,7 +46,6 @@ * Local constants *------------------------------------------------------------------------*/ -#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT #define EXT_RENDER_IIR_FAC 0.95f #define MULT_17_DIV_20_Q15 ( Word16 )( ( 17.0 / 20.0f ) * pow( 2, 15 ) + 0.5f ) @@ -306,7 +303,6 @@ static void mantissa_exp_to_qvalue( return; } -#endif /*-------------------------------------------------------------------* * ivas_omasa_data_open() @@ -372,7 +368,6 @@ ivas_error ivas_omasa_data_open_fx( set16_fx( hMasaIsmData->azimuth_separated_ism, 0, MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR ); set16_fx( hMasaIsmData->elevation_separated_ism, 0, MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR ); -#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT hMasaIsmData->hExtData = NULL; move32(); @@ -416,7 +411,6 @@ ivas_error ivas_omasa_data_open_fx( hMasaIsmData->hExtData = hExtData; move32(); } -#endif st_ivas->hMasaIsmData = hMasaIsmData; @@ -452,14 +446,12 @@ void ivas_omasa_data_close_fx( ( *hMasaIsmData )->delayBuffer_fx = NULL; } -#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT IF( ( *hMasaIsmData )->hExtData != NULL ) { free( ( *hMasaIsmData )->hExtData ); ( *hMasaIsmData )->hExtData = NULL; move32(); } -#endif free( *hMasaIsmData ); *hMasaIsmData = NULL; @@ -611,7 +603,6 @@ ivas_error ivas_omasa_dec_config_fx( n_MD = 0; move16(); -#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT IF( EQ_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) ) { /* the full number of hIsmMetaData are needed for EXT output */ @@ -667,36 +658,6 @@ ivas_error ivas_omasa_dec_config_fx( ivas_ism_metadata_close( st_ivas->hIsmMetaData, n_MD ); } -#else - test(); - IF( EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_MASA_ONE_OBJ ) || EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_PARAM_ONE_OBJ ) ) - { - n_MD = 1; - move16(); - - IF( st_ivas->hIsmMetaData[0] == NULL ) - { - IF( NE_32( ( error = ivas_ism_metadata_dec_create_fx( st_ivas, 1, NULL ) ), IVAS_ERR_OK ) ) - { - return error; - } - } - } - ELSE IF( EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) ) - { - n_MD = st_ivas->nchan_ism; - move16(); - - ivas_ism_metadata_close( st_ivas->hIsmMetaData, 0 ); - - IF( NE_32( ( error = ivas_ism_metadata_dec_create_fx( st_ivas, st_ivas->nchan_ism, NULL ) ), IVAS_ERR_OK ) ) - { - return error; - } - } - - ivas_ism_metadata_close( st_ivas->hIsmMetaData, n_MD ); -#endif st_ivas->hCPE[0]->element_brate = L_sub( ivas_total_brate, ism_total_brate ); @@ -726,15 +687,10 @@ ivas_error ivas_omasa_dec_config_fx( } /* objects renderer reconfig. */ -#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT test(); IF( st_ivas->hMasaIsmData != NULL || st_ivas->hIsmRendererData != NULL ) { /* this calls also ivas_ism_renderer_close() closing st_ivas->hIsmRendererData used by the EXT renderers. also cleans st_ivas->hMasaIsmData */ -#else - IF( st_ivas->hMasaIsmData != NULL ) - { -#endif ivas_omasa_separate_object_renderer_close( st_ivas ); } @@ -760,17 +716,10 @@ ivas_error ivas_omasa_dec_config_fx( } /* Allocate 'hIsmRendererData' handle and memory for delay buffer within 'hMasaIsmData' */ -#ifdef FIX_1161_REDUCE_OMASA_HEAP IF( NE_32( ( error = ivas_omasa_objects_delay_open_fx( st_ivas ) ), IVAS_ERR_OK ) ) { return error; } -#else - IF( NE_32( ( error = ivas_omasa_separate_object_renderer_open( st_ivas ) ), IVAS_ERR_OK ) ) - { - return error; - } -#endif } ELSE { @@ -797,12 +746,10 @@ ivas_error ivas_omasa_dec_config_fx( IF( EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_MASA_ONE_OBJ ) || EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_PARAM_ONE_OBJ ) || EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) ) { /* Allocate 'hIsmRendererData' handle and memory for delay buffer within 'hMasaIsmData' */ -#ifdef FIX_1161_REDUCE_OMASA_HEAP IF( NE_32( ( error = ivas_omasa_objects_delay_open_fx( st_ivas ) ), IVAS_ERR_OK ) ) { return error; } -#endif IF( NE_32( ( error = ivas_omasa_separate_object_renderer_open( st_ivas ) ), IVAS_ERR_OK ) ) { @@ -816,7 +763,6 @@ ivas_error ivas_omasa_dec_config_fx( } } -#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT IF( EQ_32( st_ivas->renderer_type, RENDERER_OMASA_MIX_EXT ) ) { /* Allocate 'hIsmRendererData' handle */ @@ -842,26 +788,16 @@ ivas_error ivas_omasa_dec_config_fx( move32(); /* Allocate 'hIsmRendererData' handle and memory for delay buffer within 'hMasaIsmData' */ -#ifdef FIX_1161_REDUCE_OMASA_HEAP IF( NE_32( ( error = ivas_omasa_objects_delay_open_fx( st_ivas ) ), IVAS_ERR_OK ) ) { return error; } -#else - error = ivas_omasa_render_objects_from_mix_open_fx( st_ivas ); - move32(); - IF( NE_32( error, IVAS_ERR_OK ) ) - { - return error; - } -#endif IF( NE_32( ( error = ivas_spat_hSpatParamRendCom_config_fx( &st_ivas->hSpatParamRendCom, common_rend_config_flag, 0, st_ivas->ivas_format, st_ivas->mc_mode, st_ivas->hDecoderConfig->output_Fs, 0, 0 ) ), IVAS_ERR_OK ) ) { return error; } } -#endif /*-----------------------------------------------------------------* * TD Decorrelator @@ -1051,9 +987,7 @@ ivas_error ivas_omasa_ism_metadata_dec_fx( move16(); } -#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT test(); -#endif test(); IF( EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) || EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_MASA_ONE_OBJ ) ) { @@ -1119,7 +1053,6 @@ ivas_error ivas_omasa_ism_metadata_dec_fx( } } } -#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT ELSE IF( EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_MASA_ONE_OBJ ) && EQ_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) ) { azimuth_ism = extract_l( L_shr_r( L_abs( st_ivas->hIsmMetaData[0]->azimuth_fx ), 22 ) ); @@ -1148,7 +1081,6 @@ ivas_error ivas_omasa_ism_metadata_dec_fx( move16(); } } -#endif } return IVAS_ERR_OK; @@ -1234,23 +1166,14 @@ ivas_error ivas_omasa_dirac_td_binaural_jbm_fx( { Word16 n; ivas_error error; -#ifdef NONBE_1220_OMASA_JBM_BRATE_SW_FLUSH Word32 *p_sepobj_fx[BINAURAL_CHANNELS]; // Q11 Word32 data_separated_objects_fx[BINAURAL_CHANNELS][L_FRAME48k]; -#else - Word32 *p_sepobj_fx[MAX_NUM_OBJECTS]; // Q11 - Word32 data_separated_objects_fx[MAX_NUM_OBJECTS][L_FRAME48k]; -#endif Word16 slot_idx_start; slot_idx_start = st_ivas->hSpatParamRendCom->slots_rendered; move16(); -#ifdef NONBE_1220_OMASA_JBM_BRATE_SW_FLUSH FOR( n = 0; n < BINAURAL_CHANNELS; n++ ) -#else - FOR( n = 0; n < MAX_NUM_OBJECTS; n++ ) -#endif { p_sepobj_fx[n] = &data_separated_objects_fx[n][0]; } @@ -1358,7 +1281,6 @@ void ivas_omasa_rearrange_channels_fx( return; } -#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT /*-------------------------------------------------------------------------* * ivas_omasa_combine_separate_ism_with_masa_open_fx() @@ -1692,7 +1614,6 @@ void ivas_omasa_combine_separate_ism_with_masa_fx( } -#ifdef FIX_1161_REDUCE_OMASA_HEAP /*-------------------------------------------------------------------------* * ivas_omasa_objects_delay_open() * @@ -1700,22 +1621,12 @@ void ivas_omasa_combine_separate_ism_with_masa_fx( *-------------------------------------------------------------------------*/ ivas_error ivas_omasa_objects_delay_open_fx( -#else -/*-------------------------------------------------------------------------* - * ivas_omasa_render_objects_from_mix_open_fx() - * - * Open structures, reserve memory, and init values. - *-------------------------------------------------------------------------*/ - -ivas_error ivas_omasa_render_objects_from_mix_open_fx( -#endif Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ) { Word16 i; Word32 size; -#ifdef FIX_1161_REDUCE_OMASA_HEAP test(); IF( EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_MASA_ONE_OBJ ) || EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_PARAM_ONE_OBJ ) ) { @@ -1727,10 +1638,6 @@ ivas_error ivas_omasa_render_objects_from_mix_open_fx( st_ivas->hMasaIsmData->delayBuffer_nchan = st_ivas->nchan_ism; move16(); } -#else - st_ivas->hMasaIsmData->delayBuffer_nchan = 1; - move16(); -#endif st_ivas->hMasaIsmData->delayBuffer_size = extract_l( Mult_32_16( st_ivas->hDecoderConfig->output_Fs, OMASA_DELAYFRAMES_PER_SEC_Q15 ) ); @@ -2228,4 +2135,3 @@ void ivas_omasa_render_objects_from_mix_fx( return; } -#endif diff --git a/lib_dec/ivas_osba_dec_fx.c b/lib_dec/ivas_osba_dec_fx.c index 2e9d0c3f65195d90f26aa1f62e7ba4d063a2d38b..3aae0517988ad88923af7e492d1a886e835662e3 100644 --- a/lib_dec/ivas_osba_dec_fx.c +++ b/lib_dec/ivas_osba_dec_fx.c @@ -160,9 +160,7 @@ ivas_error ivas_osba_dirac_td_binaural_jbm_fx( return error; } -#ifdef NONBE_FIX_ISM_XOVER_BR ivas_combined_orientation_set_to_start_index( st_ivas->hCombinedOrientationData ); -#endif IF( EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { Word16 slot_idx, num_cldfb_bands, b, nchan_transport_orig; @@ -203,21 +201,11 @@ ivas_error ivas_osba_dirac_td_binaural_jbm_fx( FOR( b = 0; b < num_cldfb_bands; b++ ) { st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_RealBuffer_Binaural_fx[n][slot_idx_start + slot_idx][b] = -#ifdef NONBE_1894_OSBA_SCALING L_add( st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_RealBuffer_Binaural_fx[n][add( slot_idx_start, slot_idx )][b], Cldfb_RealBuffer[b] ); -#else - L_add( L_shr( st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_RealBuffer_Binaural_fx[n][add( slot_idx_start, slot_idx )][b], 1 ), - L_shr( Cldfb_RealBuffer[b], 1 ) ); -#endif move32(); st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural_fx[n][slot_idx_start + slot_idx][b] = -#ifdef NONBE_1894_OSBA_SCALING L_add( st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural_fx[n][add( slot_idx_start, slot_idx )][b], Cldfb_ImagBuffer[b] ); -#else - L_add( L_shr( st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural_fx[n][add( slot_idx_start, slot_idx )][b], 1 ), - L_shr( Cldfb_ImagBuffer[b], 1 ) ); -#endif move32(); } } @@ -235,11 +223,7 @@ ivas_error ivas_osba_dirac_td_binaural_jbm_fx( Word16 i; FOR( i = 0; i < nSamplesAsked; i++ ) { -#ifdef NONBE_1894_OSBA_SCALING output_fx[n][i] = L_add( output_fx[channel_offset + n][i], p_sepobj_fx[n][i] ); -#else - output_fx[n][i] = L_add( L_shr( output_fx[channel_offset + n][i], 1 ), L_shr( p_sepobj_fx[n][i], 1 ) ); -#endif move32(); } } @@ -330,25 +314,14 @@ ivas_error ivas_osba_render_sf_fx( { IF( NE_32( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV_ROOM ) ) { -#ifndef NONBE_1894_OSBA_SCALING - v_add_fixed( p_output[n], p_output_ism[n], p_output[n], *nSamplesRendered, 1 ); // takes care of downscaling by 0.5f -#else v_add_fixed_no_hdrm( p_output[n], p_output_ism[n], p_output[n], *nSamplesRendered ); -#endif } -#ifndef NONBE_1894_OSBA_SCALING - ELSE - { - scale_sig32( p_output[n], *nSamplesRendered, -1 ); - } -#endif } return IVAS_ERR_OK; } -#ifdef NONBE_1894_OSBA_SCALING /*-------------------------------------------------------------------------* * ivas_osba_stereo_add_channels() * @@ -394,4 +367,3 @@ void ivas_osba_stereo_add_channels_fx( return; } -#endif diff --git a/lib_dec/ivas_out_setup_conversion_fx.c b/lib_dec/ivas_out_setup_conversion_fx.c index 05226af32dfa4811b67cdba46b585912c1e072e6..fde543e96e2c1b0289dd050e7735ea03521dc3dc 100644 --- a/lib_dec/ivas_out_setup_conversion_fx.c +++ b/lib_dec/ivas_out_setup_conversion_fx.c @@ -381,9 +381,7 @@ ivas_error ivas_ls_setup_conversion_open_fx( Word16 output_frame; Word32 output_Fs; Word16 paramUpmixMonoStereo; -#ifdef FIX_1052_EXT_OUTPUT ivas_error error; -#endif test(); test(); @@ -510,37 +508,25 @@ ivas_error ivas_ls_setup_conversion_open_fx( { IF( EQ_16( paramUpmixMonoStereo, TRUE ) ) { -#ifdef FIX_1052_EXT_OUTPUT IF( ( error = get_ls_conversion_matrix_fx( hLsSetUpConversion, IVAS_AUDIO_CONFIG_5_1_2, st_ivas->hDecoderConfig->output_config ) ) != IVAS_ERR_OK ) { return error; } -#else - get_ls_conversion_matrix_fx( hLsSetUpConversion, IVAS_AUDIO_CONFIG_5_1_2, st_ivas->hDecoderConfig->output_config ); -#endif } ELSE { -#ifdef FIX_1052_EXT_OUTPUT IF( ( error = get_ls_conversion_matrix_fx( hLsSetUpConversion, st_ivas->transport_config, st_ivas->hDecoderConfig->output_config ) ) != IVAS_ERR_OK ) { return error; } -#else - get_ls_conversion_matrix_fx( hLsSetUpConversion, st_ivas->transport_config, st_ivas->hDecoderConfig->output_config ); -#endif } } ELSE { -#ifdef FIX_1052_EXT_OUTPUT IF( ( error = get_ls_conversion_matrix_fx( hLsSetUpConversion, st_ivas->intern_config, st_ivas->hDecoderConfig->output_config ) ) != IVAS_ERR_OK ) { return error; } -#else - get_ls_conversion_matrix_fx( hLsSetUpConversion, st_ivas->intern_config, st_ivas->hDecoderConfig->output_config ); -#endif } } diff --git a/lib_dec/ivas_output_config_fx.c b/lib_dec/ivas_output_config_fx.c index 2b4be8bf411ba4d2291413d11163a1d722c639b4..e8250d0d2f1e4304fa08d3534709ae24ed83d051 100644 --- a/lib_dec/ivas_output_config_fx.c +++ b/lib_dec/ivas_output_config_fx.c @@ -144,12 +144,7 @@ void ivas_renderer_select( test(); test(); test(); -#ifdef FIX_1158_FASTCONV_REVERB_HRTF IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) -#else - test(); - IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) -#endif { *renderer_type = RENDERER_BINAURAL_FASTCONV; move16(); @@ -284,12 +279,8 @@ void ivas_renderer_select( ELSE IF( EQ_32( st_ivas->ivas_format, STEREO_FORMAT ) ) { test(); -#ifdef FIX_1052_EXT_OUTPUT test(); IF( NE_32( output_config, IVAS_AUDIO_CONFIG_STEREO ) && NE_32( output_config, IVAS_AUDIO_CONFIG_MONO ) && NE_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) ) -#else - IF( NE_32( output_config, IVAS_AUDIO_CONFIG_STEREO ) && NE_32( output_config, IVAS_AUDIO_CONFIG_MONO ) ) -#endif { *renderer_type = RENDERER_MC; move16(); @@ -397,49 +388,24 @@ void ivas_renderer_select( test(); test(); test(); -#ifndef FIX_1249_REMOVE_OBSOLETE_ALLRAD_MATRIX - test(); - test(); -#endif IF( EQ_32( ivas_format, SBA_FORMAT ) && ( NE_32( output_config, IVAS_AUDIO_CONFIG_5_1 ) && NE_32( output_config, IVAS_AUDIO_CONFIG_5_1_2 ) && NE_32( output_config, IVAS_AUDIO_CONFIG_5_1_4 ) && NE_32( output_config, IVAS_AUDIO_CONFIG_7_1 ) && NE_32( output_config, IVAS_AUDIO_CONFIG_7_1_4 ) && NE_32( output_config, IVAS_AUDIO_CONFIG_LS_CUSTOM ) && NE_32( output_config, IVAS_AUDIO_CONFIG_MONO ) && NE_32( output_config, IVAS_AUDIO_CONFIG_STEREO ) ) ) { test(); test(); -#ifdef NONBE_FIX_1052_SBA_EXT_FIX IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) ) { /* 'internal_config' was already set in ivas_set_audio_config_from_sba_order() */ } ELSE IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_HOA2 ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_FOA ) ) -#else - IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_HOA2 ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_FOA ) ) -#endif { *internal_config = output_config; move16(); } -#ifdef FIX_1249_REMOVE_OBSOLETE_ALLRAD_MATRIX ELSE { *internal_config = IVAS_AUDIO_CONFIG_HOA3; move16(); } -#else - ELSE IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_MONO ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_STEREO ) ) - { - *internal_config = IVAS_AUDIO_CONFIG_FOA; - move16(); - } -#ifdef NONBE_FIX_1128_OSBA_EXT_OUTPUT_ORDER - ELSE IF( NE_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) ) -#else - IF( NE_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) ) -#endif - { - *internal_config = IVAS_AUDIO_CONFIG_HOA3; - move16(); - } -#endif *renderer_type = RENDERER_SBA_LINEAR_DEC; move16(); } @@ -464,13 +430,6 @@ void ivas_renderer_select( *renderer_type = RENDERER_DISABLE; move16(); } -#ifndef FIX_1249_REMOVE_OBSOLETE_ALLRAD_MATRIX - ELSE IF( EQ_32( ivas_format, SBA_FORMAT ) && EQ_32( output_config, IVAS_AUDIO_CONFIG_MONO ) ) - { - *renderer_type = RENDERER_SBA_LINEAR_DEC; - move16(); - } -#endif ELSE IF( EQ_32( ivas_format, SBA_ISM_FORMAT ) && EQ_32( output_config, IVAS_AUDIO_CONFIG_STEREO ) ) { *renderer_type = RENDERER_OSBA_STEREO; @@ -514,7 +473,6 @@ void ivas_renderer_select( } ELSE IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) ) { -#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT IF( EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_PARAM_ONE_OBJ ) ) { *renderer_type = RENDERER_OMASA_OBJECT_EXT; @@ -530,10 +488,6 @@ void ivas_renderer_select( *renderer_type = RENDERER_DISABLE; move32(); } -#else - *renderer_type = RENDERER_DISABLE; - move16(); -#endif } } ELSE IF( EQ_32( st_ivas->ivas_format, MC_FORMAT ) ) @@ -542,12 +496,8 @@ void ivas_renderer_select( move16(); test(); -#ifdef FIX_1052_EXT_OUTPUT test(); IF( EQ_32( st_ivas->mc_mode, MC_MODE_MCT ) && NE_32( *internal_config, output_config ) && NE_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) ) -#else - IF( EQ_32( st_ivas->mc_mode, MC_MODE_MCT ) && NE_32( *internal_config, output_config ) ) -#endif { test(); test(); @@ -567,12 +517,8 @@ void ivas_renderer_select( *internal_config = transport_config; move16(); -#ifdef FIX_1052_EXT_OUTPUT test(); IF( NE_32( *internal_config, output_config ) && NE_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) ) -#else - IF( NE_32( *internal_config, output_config ) ) -#endif { test(); test(); @@ -604,16 +550,11 @@ void ivas_renderer_select( } ELSE IF( EQ_32( st_ivas->mc_mode, MC_MODE_MCMASA ) ) { -#ifdef FIX_1052_EXT_OUTPUT if ( NE_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) ) { *internal_config = output_config; move16(); } -#else - *internal_config = output_config; - move16(); -#endif /* No rendering for 1TC to Mono or Stereo and 2TC to Stereo */ test(); diff --git a/lib_dec/ivas_qmetadata_dec_fx.c b/lib_dec/ivas_qmetadata_dec_fx.c index bf0cbbd8e5bf391ca94de5b84806fac3dd9190bf..40da176d81720fd6514a49e70bbb575001f16c5c 100644 --- a/lib_dec/ivas_qmetadata_dec_fx.c +++ b/lib_dec/ivas_qmetadata_dec_fx.c @@ -1185,20 +1185,13 @@ Word16 ivas_qmetadata_dec_sid_decode( Word32 direction_vector_fx[3]; Word16 metadata_sid_bits; /* bits allocated to SID for metadata */ Word16 bits_delta, bits_dir; -#ifdef NONBE_FIX_1052_SBA_EXT Word16 sba_spar_bitlen; -#endif IF( EQ_16( ivas_format, SBA_FORMAT ) ) { -#ifdef NONBE_FIX_1052_SBA_EXT sba_spar_bitlen = ivas_sba_spar_sid_bitlen_fx( nchan_transport ); metadata_sid_bits = (int16_t) ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS - SBA_ORDER_BITS - SBA_PLANAR_BITS - 1; /* -1 for inactive mode header bit*/ metadata_sid_bits = sub( metadata_sid_bits, sba_spar_bitlen ); -#else - metadata_sid_bits = (Word16) ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - ( SPAR_DTX_BANDS * SPAR_SID_BITS_TAR_PER_BAND ) - 2 - SID_FORMAT_NBITS; /* -1 for inactive mode header bit*/ - move16(); -#endif } ELSE { diff --git a/lib_dec/ivas_rom_dec.h b/lib_dec/ivas_rom_dec.h index b2df85c555c1ea5af07d26056ff5042a08999e2f..7f471e695e10a02f5845149b4303a0536e713b0d 100644 --- a/lib_dec/ivas_rom_dec.h +++ b/lib_dec/ivas_rom_dec.h @@ -90,12 +90,6 @@ extern const UWord16 *const sym_freq_ECSQ_tab_abs_lsbs[1 + 4]; extern const Word16 dirac_dithering_azi_scale_fx[DIRAC_DIFFUSE_LEVELS]; extern const Word16 dirac_dithering_ele_scale_fx[DIRAC_DIFFUSE_LEVELS]; -#ifndef FIX_1053_REVERB_RECONFIGURATION -/*----------------------------------------------------------------------------------* - * FASTCONV and PARAMETRIC binaural renderer ROM tables - *----------------------------------------------------------------------------------*/ -extern const Word32 dmxmtx_table_fx[BINAURAL_CHANNELS][11]; -#endif /*----------------------------------------------------------------------* * MC ParamUpmix ROM tables diff --git a/lib_dec/ivas_rom_dec_fx.c b/lib_dec/ivas_rom_dec_fx.c index 63b1cb6a8491c3297e7517a41f712c7b76bf00d6..8b2a2d27e30190397fede143c25f4d1ac07b923c 100644 --- a/lib_dec/ivas_rom_dec_fx.c +++ b/lib_dec/ivas_rom_dec_fx.c @@ -373,17 +373,6 @@ const Word16 dirac_dithering_ele_scale_fx[DIRAC_DIFFUSE_LEVELS] = * FASTCONV and PARAMETRIC binaural renderer ROM tables *----------------------------------------------------------------------------------*/ -#ifndef FIX_1053_REVERB_RECONFIGURATION -/*----------------------------------------------------------------------------------* - * FASTCONV and PARAMETRIC binaural renderer ROM tables - *----------------------------------------------------------------------------------*/ - -const Word32 dmxmtx_table_fx[BINAURAL_CHANNELS][11] = -{ // Q31 - { 0x7fffffff, 0, 1518485623, 0x7fffffff, 0, 0x7fffffff, 0, 0x7fffffff, 0, 0x7fffffff, 0 }, - { 0, 0x7fffffff, 1518485623, 0, 0x7fffffff, 0, 0x7fffffff, 0, 0x7fffffff, 0, 0x7fffffff }, -}; -#endif /*----------------------------------------------------------------------* diff --git a/lib_dec/ivas_sba_dec_fx.c b/lib_dec/ivas_sba_dec_fx.c index 7478fd2371ac5a1dbf03a954b01709d155e144c0..c5df63529a3e351386b9154f60a7e24d2f597059 100644 --- a/lib_dec/ivas_sba_dec_fx.c +++ b/lib_dec/ivas_sba_dec_fx.c @@ -59,9 +59,7 @@ void ivas_sba_set_cna_cng_flag( test(); test(); test(); -#ifdef NONBE_FIX_ISM_XOVER_BR test(); -#endif IF( EQ_16( st_ivas->ivas_format, SBA_FORMAT ) && EQ_16( st_ivas->nchan_transport, 1 ) ) { /* skip as done in init function */ @@ -75,11 +73,7 @@ void ivas_sba_set_cna_cng_flag( st_ivas->hSCE[0]->hCoreCoder[0]->cng_sba_flag = 1; move16(); } -#ifdef NONBE_FIX_ISM_XOVER_BR ELSE IF( EQ_16( st_ivas->nchan_transport, 2 ) && NE_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) -#else - ELSE IF( EQ_16( st_ivas->nchan_transport, 2 ) ) -#endif { FOR( n = 0; n < CPE_CHANNELS; n++ ) { @@ -131,9 +125,7 @@ ivas_error ivas_sba_dec_reconfigure_fx( ivas_error error; ISM_MODE ism_mode_old; Word16 granularity_new; -#ifdef NONBE_FIX_ISM_XOVER_BR Word16 nchan_transport; -#endif ism_mode_old = st_ivas->ism_mode; hDecoderConfig = st_ivas->hDecoderConfig; @@ -156,11 +148,7 @@ ivas_error ivas_sba_dec_reconfigure_fx( IF( EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) { -#ifdef NONBE_FIX_ISM_XOVER_BR IF( EQ_16( ivas_osba_ism_mode_select( ivas_total_brate, st_ivas->nchan_ism ), ISM_SBA_MODE_DISC ) ) -#else - IF( GE_32( ivas_total_brate, IVAS_256k ) ) -#endif { st_ivas->ism_mode = ISM_SBA_MODE_DISC; move16(); @@ -512,10 +500,8 @@ ivas_error ivas_sba_dec_reconfigure_fx( * Allocate, initialize, and configure SCE/CPE/MCT handles *-----------------------------------------------------------------*/ -#ifdef NONBE_FIX_ISM_XOVER_BR nchan_transport = st_ivas->nchan_transport; move16(); -#endif IF( EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) { test(); @@ -597,12 +583,8 @@ ivas_error ivas_sba_dec_reconfigure_fx( { return error; } -#ifdef NONBE_FIX_ISM_XOVER_BR nchan_transport = add( nchan_transport, st_ivas->nchan_ism ); st_ivas->nCPE = shr_r( nchan_transport, 1 ); -#else - st_ivas->nCPE = add( st_ivas->nCPE, shr( add( st_ivas->nchan_ism, 1 ), 1 ) ); /*Q0*/ -#endif move16(); } ELSE IF( EQ_16( ism_mode_old, ISM_SBA_MODE_DISC ) && EQ_16( st_ivas->ism_mode, ISM_MODE_NONE ) ) @@ -617,29 +599,17 @@ ivas_error ivas_sba_dec_reconfigure_fx( { ivas_td_binaural_close_fx( &st_ivas->hBinRendererTd ); } -#ifdef NONBE_FIX_ISM_XOVER_BR nchan_transport = st_ivas->nchan_transport; move16(); -#endif nchan_transport_old = add( nchan_transport_old, st_ivas->nchan_ism ); /*Q0*/ st_ivas->ism_mode = ISM_MODE_NONE; move16(); } ELSE IF( EQ_16( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) ) { -#ifdef NONBE_FIX_ISM_XOVER_BR nchan_transport = add( st_ivas->nchan_transport, st_ivas->nchan_ism ); st_ivas->nCPE = shr_r( nchan_transport, 1 ); nchan_transport_old = add( nchan_transport_old, st_ivas->nchan_ism ); -#else - st_ivas->nCPE = add( st_ivas->nCPE, shr( add( st_ivas->nchan_ism, 1 ), 1 ) ); /*Q0*/ - move16(); - nCPE_old = st_ivas->nCPE; - move16(); - nchan_transport_old = st_ivas->nchan_transport; - move16(); - nchan_transport_old = add( nchan_transport_old, st_ivas->nchan_ism ); /*Q0*/ -#endif } } @@ -806,12 +776,8 @@ void ivas_sba_dec_digest_tc_fx( Word16 ch_idx, nchan_transport; /* set the md map */ -#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT test(); IF( st_ivas->hDirAC != NULL || EQ_32( st_ivas->renderer_type, RENDERER_OMASA_OBJECT_EXT ) ) -#else - IF( st_ivas->hDirAC ) -#endif { ivas_dirac_dec_set_md_map_fx( st_ivas, nCldfbSlots ); } diff --git a/lib_dec/ivas_sba_dirac_stereo_dec_fx.c b/lib_dec/ivas_sba_dirac_stereo_dec_fx.c index d68571c1ffade78de2650d9f1b7cda07aab8d395..377543f601cb079e604083caacc72476c56ac8d4 100644 --- a/lib_dec/ivas_sba_dirac_stereo_dec_fx.c +++ b/lib_dec/ivas_sba_dirac_stereo_dec_fx.c @@ -622,10 +622,8 @@ static void map_params_dirac_to_stereo( move32(); } } -#ifdef NONBE_FIX_1096_NAN_VALUES_IN_DIRAC_TO_STEREO /* Clamp values here. [-1, 1] is the allowed range, but due to precision issues they can be slightly off which can cause problems later. */ /* In Q31, this clamping happens implicitly */ -#endif q_sqrt = 0; move16(); side_gain[b] = Mpy_32_32( side_gain[b], Sqrt32( L_sub( MAX_32, diffuseness[b] ), &q_sqrt ) ); /*Q31 - q_sqrt*/ @@ -644,18 +642,11 @@ static void map_params_dirac_to_stereo( q_sqrt = 0; move16(); } -#ifdef NONBE_FIX_1096_NAN_VALUES_IN_DIRAC_TO_STEREO /* for residual prediction gain, allowed range is [0, 1]*/ res_pred_gain[b] = L_max( Mpy_32_16_1( diffuseness[b], sub( MAX_16, surrCoh[b] ) ), 0 ); /*Q31*/ move32(); res_pred_gain[b + STEREO_DFT_BAND_MAX] = L_max( Mpy_32_16_1( diffuseness[b], sub( MAX_16, surrCoh[b] ) ), 0 ); /*Q31*/ move32(); -#else - res_pred_gain[b] = Mpy_32_16_1( diffuseness[b], sub( MAX_16, surrCoh[b] ) ); /*Q31*/ - move32(); - res_pred_gain[b + STEREO_DFT_BAND_MAX] = Mpy_32_16_1( diffuseness[b], sub( MAX_16, surrCoh[b] ) ); /*Q31*/ - move32(); -#endif } } diff --git a/lib_dec/ivas_spar_decoder_fx.c b/lib_dec/ivas_spar_decoder_fx.c index 8832730bafaf5151a1890403d42bb3d72f5288c4..b1404824cd81a02a32dac897a8810bd23b3ea7ef 100644 --- a/lib_dec/ivas_spar_decoder_fx.c +++ b/lib_dec/ivas_spar_decoder_fx.c @@ -416,11 +416,7 @@ ivas_error ivas_spar_dec_fx( /* read DirAC bitstream */ IF( st_ivas->hQMetaData != NULL ) { -#ifdef NONBE_FIX_1052_SBA_EXT ivas_dirac_dec_read_BS_fx( hDecoderConfig->ivas_total_brate, st0, st_ivas->hDirAC, st_ivas->hSpatParamRendCom, st_ivas->hQMetaData, nb_bits_read, last_bit_pos, ivas_get_hodirac_flag_fx( hDecoderConfig->ivas_total_brate, st_ivas->sba_analysis_order ), st_ivas->nchan_transport, st_ivas->hSpar->dirac_to_spar_md_bands ); -#else - ivas_dirac_dec_read_BS_fx( hDecoderConfig->ivas_total_brate, st0, st_ivas->hDirAC, st_ivas->hSpatParamRendCom, st_ivas->hQMetaData, nb_bits_read, last_bit_pos, ivas_get_hodirac_flag_fx( hDecoderConfig->ivas_total_brate, st_ivas->sba_analysis_order ), st_ivas->hSpar->dirac_to_spar_md_bands ); -#endif } IF( EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) @@ -437,11 +433,7 @@ ivas_error ivas_spar_dec_fx( test(); if ( !st0->bfi && EQ_32( hDecoderConfig->ivas_total_brate, IVAS_SID_5k2 ) ) { -#ifdef NONBE_FIX_1052_SBA_EXT last_bit_pos = sub( last_bit_pos, ( SID_FORMAT_NBITS + SBA_PLANAR_BITS + SBA_ORDER_BITS ) ); /*Q0*/ -#else - last_bit_pos = sub( last_bit_pos, SID_FORMAT_NBITS ); /*Q0*/ -#endif } nb_bits_read_orig = *nb_bits_read; /*Q0*/ move16(); @@ -484,11 +476,7 @@ ivas_error ivas_spar_dec_fx( IF( !st0->bfi && EQ_32( hDecoderConfig->ivas_total_brate, IVAS_SID_5k2 ) ) { Word16 zero_pad_bits; -#ifdef NONBE_FIX_1052_SBA_EXT *nb_bits_read = add( *nb_bits_read, SID_FORMAT_NBITS + SBA_PLANAR_BITS + SBA_ORDER_BITS ); /*Q0*/ -#else - *nb_bits_read = add( *nb_bits_read, SID_FORMAT_NBITS ); /*Q0*/ -#endif move16(); zero_pad_bits = sub( ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC, *nb_bits_read ); /*Q0*/ assert( zero_pad_bits <= 1 ); @@ -1869,11 +1857,7 @@ void ivas_spar_dec_upmixer_sf_fx( test(); test(); -#ifdef NONBE_FIX_1052_SBA_EXT_FIX IF( LT_32( hDecoderConfig->ivas_total_brate, IVAS_24k4 ) && ( EQ_32( st_ivas->intern_config, IVAS_AUDIO_CONFIG_HOA2 ) || EQ_32( st_ivas->intern_config, IVAS_AUDIO_CONFIG_HOA3 ) ) ) -#else - IF( ( LT_32( hDecoderConfig->ivas_total_brate, IVAS_24k4 ) ) && ( ( EQ_32( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA2 ) ) || ( EQ_32( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA3 ) ) ) ) -#endif { Word16 q_cldfb = 6; move16(); @@ -1893,11 +1877,7 @@ void ivas_spar_dec_upmixer_sf_fx( test(); test(); -#ifdef NONBE_FIX_1052_SBA_EXT_FIX IF( LT_32( hDecoderConfig->ivas_total_brate, IVAS_24k4 ) && ( EQ_32( st_ivas->intern_config, IVAS_AUDIO_CONFIG_HOA2 ) || EQ_32( st_ivas->intern_config, IVAS_AUDIO_CONFIG_HOA3 ) ) ) -#else - IF( ( LT_32( hDecoderConfig->ivas_total_brate, IVAS_24k4 ) ) && ( ( EQ_32( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA2 ) ) || ( EQ_32( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA3 ) ) ) ) -#endif { FOR( spar_band = 0; spar_band < num_spar_bands; spar_band++ ) { @@ -2040,13 +2020,9 @@ void ivas_spar_dec_upmixer_sf_fx( test(); test(); -#ifdef NONBE_FIX_1052_SBA_EXT_FIX test(); test(); IF( NE_32( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_FOA ) && NE_32( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_STEREO ) && NE_32( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_MONO ) && !( EQ_32( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) && EQ_32( st_ivas->intern_config, IVAS_AUDIO_CONFIG_FOA ) ) ) -#else - IF( NE_32( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_FOA ) && NE_32( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_STEREO ) && NE_32( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_MONO ) ) -#endif { ivas_dirac_dec_render_sf_fx( st_ivas, output_fx, nchan_internal, cldfb_in_ts_re_fx, cldfb_in_ts_im_fx ); } diff --git a/lib_dec/ivas_spar_md_dec_fx.c b/lib_dec/ivas_spar_md_dec_fx.c index 204840cc44dbab99b7840796d6b761260728c57f..25749e5efb62fb3892079b21f4d25f71e323c028 100644 --- a/lib_dec/ivas_spar_md_dec_fx.c +++ b/lib_dec/ivas_spar_md_dec_fx.c @@ -2646,9 +2646,7 @@ static void ivas_parse_parameter_bitstream_dtx( Word32 pr_min_max_fx[2]; Word16 pr_q_lvls, pr, pd, pd_q_lvls, pr_pd_bits; Word16 zero_pad_bits, sid_bits_len; -#ifdef NONBE_FIX_1052_SBA_EXT Word16 sba_spar_bitlen; -#endif sid_bits_len = st0->next_bit_pos; /*Q0*/ move16(); @@ -2734,12 +2732,8 @@ static void ivas_parse_parameter_bitstream_dtx( } sid_bits_len = sub( st0->next_bit_pos, sid_bits_len ); -#ifdef NONBE_FIX_1052_SBA_EXT sba_spar_bitlen = ivas_sba_spar_sid_bitlen_fx( num_dmx_per_band[0] ); zero_pad_bits = sub( sba_spar_bitlen, sid_bits_len ); -#else - zero_pad_bits = sub( ( SPAR_DTX_BANDS * SPAR_SID_BITS_TAR_PER_BAND ), sid_bits_len ); -#endif assert( zero_pad_bits >= 0 ); if ( EQ_16( num_dmx_per_band[0], 2 ) ) { diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index a2aa551c2aa0aca1bdb71e81ce9365027dbe1d49..eb70b72ed23dd4a49de435050531c2069a7aa121 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -834,11 +834,7 @@ typedef struct ivas_lfe_dec_data_structure LFE_WINDOW_HANDLE pWindow_state; const UWord16 *cum_freq_models[IVAS_MAX_NUM_QUANT_STRATS][IVAS_MAX_NUM_DCT_COEF_GROUPS]; Word16 lfe_dec_indices_coeffs_tbl[IVAS_MAX_NUM_QUANT_STRATS][IVAS_MAX_NUM_DCT_COEF_GROUPS]; -#ifdef NONBE_1360_LFE_DELAY Word32 delay_ns; /* Q0 */ -#else - Word16 lfe_block_delay_s_fx; /* Q15 */ -#endif Word16 lfe_prior_buf_len; Word32 prior_out_buffer_fx[L_FRAME48k]; /* Q9 */ @@ -859,9 +855,7 @@ typedef struct renderer_struct Word32 prev_gains_fx[MAX_NUM_OBJECTS][MAX_OUTPUT_CHANNELS]; /*Q30*/ Word16 *interpolator_fx; /*Q15*/ Word16 interpolator_len; -#ifdef NONBE_FIX_1141_OSBA_ROOM_RENDERING Word16 interp_offset_fx; -#endif Word32 gains_fx[MAX_NUM_OBJECTS][MAX_OUTPUT_CHANNELS]; /*Q30*/ } ISM_RENDERER_DATA, *ISM_RENDERER_HANDLE; @@ -932,7 +926,6 @@ typedef struct ivas_masa_decoder_struct } MASA_DECODER, *MASA_DECODER_HANDLE; -#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT /* Data structure for MASA_ISM EXT rendering */ typedef struct ivas_masa_ism_ext_data_structure { @@ -949,7 +942,6 @@ typedef struct ivas_masa_ism_ext_data_structure Word32 masa_render_masa_to_total[MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR][CLDFB_NO_CHANNELS_MAX]; // Q30 } MASA_ISM_EXT_DATA, *MASA_ISM_EXT_DATA_HANDLE; -#endif /* Data structure for MASA_ISM rendering */ typedef struct ivas_masa_ism_data_structure @@ -981,9 +973,7 @@ typedef struct ivas_masa_ism_data_structure Word16 delayBuffer_size; Word16 delayBuffer_nchan; -#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT MASA_ISM_EXT_DATA_HANDLE hExtData; -#endif } MASA_ISM_DATA, *MASA_ISM_DATA_HANDLE; diff --git a/lib_dec/ivas_stereo_cng_dec_fx.c b/lib_dec/ivas_stereo_cng_dec_fx.c index c214b36fc9e1c9d58e3d81730e4bf0b23f791f9b..a481d9ccbbc3d621f84dc9bbfa4b66a9990f24bb 100644 --- a/lib_dec/ivas_stereo_cng_dec_fx.c +++ b/lib_dec/ivas_stereo_cng_dec_fx.c @@ -1429,10 +1429,8 @@ void stereo_cna_update_params_fx( } ELSE { -#ifdef NONBE_FIX_1110_STEREO_DTX_BRATE_SWITCHING hFdCngDec->first_cna_noise_updated = 0; move16(); -#endif return; } diff --git a/lib_dec/ivas_stereo_dft_plc_fx.c b/lib_dec/ivas_stereo_dft_plc_fx.c index fa4e914c5c72ec2507258e7519fb36721ca57b4e..c29e1e4b54805a2b8dcfb596281740043c7d59b9 100644 --- a/lib_dec/ivas_stereo_dft_plc_fx.c +++ b/lib_dec/ivas_stereo_dft_plc_fx.c @@ -655,9 +655,6 @@ void stereo_dft_res_subst_spec_fx( /* Apply phase adjustment of identified peaks, including Np=1 peak neighbors on each side */ FOR( i = *num_plocs - 1; i >= 0; i-- ) { -#ifndef ISSUE_1796_replace_shl_o - Flag flg_ov; -#endif IF( k == 0 ) { Word32 op; @@ -709,11 +706,7 @@ void stereo_dft_res_subst_spec_fx( move32(); } -#ifdef ISSUE_1796_replace_shl_o cos_F = shl_sat( getCosWord16( extract_l( corr_phase ) ), 1 ); -#else - cos_F = shl_o( getCosWord16( extract_l( corr_phase ) ), 1, &flg_ov ); -#endif sin_F = getSinWord16( extract_l( corr_phase ) ); idx = s_max( 0, sub( plocs[i], Np ) ); /* Iterate over plocs[i]-1:plocs[i]+1, considering the edges of the spectrum */ diff --git a/lib_dec/ivas_stereo_switching_dec_fx.c b/lib_dec/ivas_stereo_switching_dec_fx.c index 8801ccf604447a6383cc01f8fed4ab1a8ec3747c..ef4cd013a6cf7d855333fb4069c6e12564597e2f 100644 --- a/lib_dec/ivas_stereo_switching_dec_fx.c +++ b/lib_dec/ivas_stereo_switching_dec_fx.c @@ -1268,12 +1268,8 @@ void synchro_synthesis_fx( test(); test(); test(); -#ifdef NONBE_1289_STEREO_SW_TO_MONO test(); IF( ( !use_cldfb_for_last_dft && NE_16( hCPE->last_element_mode, IVAS_CPE_DFT ) && !sba_dirac_stereo_flag && NE_16( dft_mono_brate_switch, -1 ) ) || EQ_16( dft_mono_brate_switch, 1 ) ) -#else - IF( ( NE_16( hCPE->last_element_mode, IVAS_CPE_DFT ) && !sba_dirac_stereo_flag && NE_16( dft_mono_brate_switch, -1 ) ) || EQ_16( dft_mono_brate_switch, 1 ) ) -#endif { Word32 *pPrev_synth_fx; Word32 inv_fade_len_fx = 0; @@ -1997,10 +1993,8 @@ void stereo_switching_dec( Copy( sts[0]->lsf_old_fx, sts[1]->lsf_old_fx, M ); /* Q2.56 */ Copy( sts[0]->lsp_old_fx, sts[1]->lsp_old_fx, M ); /* Q15 */ -#ifdef NONBE_FIX_1110_STEREO_DTX_BRATE_SWITCHING sts[1]->last_core_brate = sts[0]->last_core_brate; move16(); -#endif IF( EQ_16( hCPE->element_mode, IVAS_CPE_MDCT ) ) { diff --git a/lib_dec/ivas_svd_dec_fx.c b/lib_dec/ivas_svd_dec_fx.c index f625cbfe98a2e26fb716f249a0e3218c558bda31..e904281b6ace1a7c00503e14c45e6e6d36a5c675 100755 --- a/lib_dec/ivas_svd_dec_fx.c +++ b/lib_dec/ivas_svd_dec_fx.c @@ -64,7 +64,6 @@ static void HouseholderReduction_fx( const Word16 nChannelsC, /* Q0 */ Word32 *eps_x_fx, /* exp(eps_x_fx_e) */ Word16 *eps_x_fx_e ); -#ifdef NONBE_SVD_OPTIMIZATION static void biDiagonalReductionLeft_fx( Word32 singularVectors[][MAX_OUTPUT_CHANNELS], /* exp(singularVectors_e) */ @@ -83,35 +82,6 @@ static void biDiagonalReductionRight_fx( const Word16 currChannel, /* Q0 */ Word32 *g, Word16 *g_e ); -#else -static void biDiagonalReductionLeft_fx( - Word32 singularVectors[][MAX_OUTPUT_CHANNELS], /* exp(singularVectors_e) */ - Word32 singularValues[MAX_OUTPUT_CHANNELS], /* exp(singularValues_e) */ - Word32 secDiag[MAX_OUTPUT_CHANNELS], /* exp(secDiag_e) */ - Word16 singularVectors2_e[][MAX_OUTPUT_CHANNELS], - Word16 singularValues_e[MAX_OUTPUT_CHANNELS], - Word16 *secDiag_e, - const Word16 nChannelsL, /* Q0 */ - const Word16 nChannelsC, /* Q0 */ - const Word16 currChannel, /* Q0 */ - Word32 *sig_x, /* exp(sig_x_e) */ - Word16 *sig_x_e, - Word32 *g /* Q31 */ -); - -static void biDiagonalReductionRight_fx( - Word32 singularVectors[][MAX_OUTPUT_CHANNELS], /* exp(singularVectors_e) */ - Word32 secDiag[MAX_OUTPUT_CHANNELS], /* exp(secDiag_e) */ - Word16 singularVectors2_e[][MAX_OUTPUT_CHANNELS], - Word16 *secDiag_e, - const Word16 nChannelsL, /* Q0 */ - const Word16 nChannelsC, /* Q0 */ - const Word16 currChannel, /* Q0 */ - Word32 *sig_x, /* exp(sig_x_e) */ - Word16 *sig_x_e, - Word32 *g /* Q31 */ -); // Q31 -#endif static void singularVectorsAccumulationLeft_fx( Word32 singularVectors_Left[][MAX_OUTPUT_CHANNELS], /* exp(singularVectors_e) as Input, Q31 as output */ @@ -841,7 +811,6 @@ static void HouseholderReduction_fx( Word16 *eps_x_fx_e ) { Word16 nCh; -#ifdef NONBE_SVD_OPTIMIZATION Word32 g_left_fx = 0; Word16 g_left_e = 0; @@ -852,20 +821,10 @@ static void HouseholderReduction_fx( move32(); move16(); -#else - - // float g = 0.0f, sig_x = 0.0f;// to be removed - Word32 g_fx = 0, sig_x_fx = 0; - move32(); - move32(); - Word16 sig_x_fx_e = 0; - move16(); -#endif Word16 iCh, jCh; Word16 singularVectors_Left_fx_e[MAX_OUTPUT_CHANNELS][MAX_OUTPUT_CHANNELS]; -#ifdef NONBE_SVD_OPTIMIZATION Word16 sc = 0; move16(); sc = getScaleFactor32( singularVectors_Left_fx[0], nChannelsC ); @@ -922,34 +881,6 @@ static void HouseholderReduction_fx( } } -#else - - FOR( jCh = 0; jCh < nChannelsL; jCh++ ) - { - FOR( iCh = 0; iCh < nChannelsC; iCh++ ) - { - singularVectors_Left_fx_e[jCh][iCh] = singularVectors_Left_e; - move16(); - } - } - - /* Bidiagonal Reduction for every channel */ - FOR( nCh = 0; nCh < nChannelsC; nCh++ ) /* nChannelsC */ - { - biDiagonalReductionLeft_fx( singularVectors_Left_fx, singularValues_fx, secDiag_fx, singularVectors_Left_fx_e, singularValues_fx_e, secDiag_fx_e, nChannelsL, nChannelsC, nCh, &sig_x_fx, &sig_x_fx_e, &g_fx ); - biDiagonalReductionRight_fx( singularVectors_Left_fx, secDiag_fx, singularVectors_Left_fx_e, secDiag_fx_e, nChannelsL, nChannelsC, nCh, &sig_x_fx, &sig_x_fx_e, &g_fx ); - - Word16 L_temp_e; - Word32 L_temp = BASOP_Util_Add_Mant32Exp( L_abs( singularValues_fx[nCh] ), singularValues_fx_e[nCh], L_abs( secDiag_fx[nCh] ), secDiag_fx_e[nCh], &L_temp_e ); /* exp(L_temp_e) */ - IF( EQ_16( BASOP_Util_Cmp_Mant32Exp( L_temp, L_temp_e, *eps_x_fx, *eps_x_fx_e ), 1 ) ) - { - *eps_x_fx = L_temp; /* exp(L_temp_e) */ - move32(); - *eps_x_fx_e = L_temp_e; - move32(); - } - } -#endif /* SingularVecotr Accumulation */ singularVectorsAccumulationRight_fx( singularVectors_Left_fx, singularVectors_Right_fx, secDiag_fx, singularVectors_Left_fx_e, secDiag_fx_e, nChannelsC ); @@ -960,7 +891,6 @@ static void HouseholderReduction_fx( return; } -#ifdef NONBE_SVD_OPTIMIZATION /*------------------------------------------------------------------------- * biDiagonalReductionLeft() * @@ -1157,291 +1087,6 @@ static void biDiagonalReductionRight_fx( return; } -#else -/*------------------------------------------------------------------------- - * biDiagonalReductionLeft() - * - * - *-------------------------------------------------------------------------*/ - -static void biDiagonalReductionLeft_fx( - Word32 singularVectors[][MAX_OUTPUT_CHANNELS], /* exp(singularVectors_e) */ - Word32 singularValues[MAX_OUTPUT_CHANNELS], /* exp(singularValues_e) */ - Word32 secDiag[MAX_OUTPUT_CHANNELS], /* exp(secDiag_e) */ - Word16 singularVectors2_e[][MAX_OUTPUT_CHANNELS], - Word16 singularValues_e[MAX_OUTPUT_CHANNELS], - Word16 *secDiag_e, - const Word16 nChannelsL, /* Q0 */ - const Word16 nChannelsC, /* Q0 */ - const Word16 currChannel, /* Q0 */ - Word32 *sig_x, /* exp(sig_x_e) */ - Word16 *sig_x_e, - Word32 *g /* Q31 */ -) -{ - Word16 iCh, jCh, idx; - Word32 norm_x, f, r; - Word16 norm_x_e, f_e, r_e; - Word32 L_temp; - Word16 L_temp_e; - - secDiag[currChannel] = Mpy_32_32( *sig_x, *g ); /* exp(sig_x_e) */ - move32(); - secDiag_e[currChannel] = *sig_x_e; - move16(); - - /* Setting values to 0 */ - ( *sig_x ) = 0; - move32(); - ( *g ) = 0; - move32(); - - IF( LT_16( currChannel, nChannelsL ) ) /* i <= m */ - { - idx = currChannel; - move16(); - - FOR( jCh = idx; jCh < nChannelsL; jCh++ ) /* nChannelsL */ - { - ( *sig_x ) = BASOP_Util_Add_Mant32Exp( *sig_x, *sig_x_e, L_abs( singularVectors[jCh][currChannel] ), singularVectors2_e[jCh][currChannel], sig_x_e ); /* exp(sig_x_e) */ - } - - IF( ( *sig_x ) ) /*(fabsf(*sig_x) > EPSILON * fabsf(*sig_x)) { */ - { - Word16 invVal_e; - Word32 invVal; - invVal = BASOP_Util_Divide3232_Scale_newton( MAXVAL_WORD32, maxWithSign_fx( *sig_x ), &invVal_e ); - Word64 temp = 0; - move64(); - Word16 max_e = MIN_16; - move16(); - FOR( jCh = idx; jCh < nChannelsL; jCh++ ) /* nChannelsL */ - { - Word16 temp_e = norm_l( singularVectors[jCh][currChannel] ); - singularVectors[jCh][currChannel] = Mpy_32_32( L_shl( singularVectors[jCh][currChannel], temp_e ), invVal ); /* exp(sing_exp + (singularVectors_e - sig_x_e) */ - move32(); - singularVectors2_e[jCh][currChannel] = sub( add( invVal_e, sub( singularVectors2_e[jCh][currChannel], *sig_x_e ) ), temp_e ); - move16(); - max_e = s_max( max_e, singularVectors2_e[jCh][currChannel] ); - } - - FOR( jCh = idx; jCh < nChannelsL; jCh++ ) /* nChannelsL */ - { - temp = W_add( temp, L_shr( Mpy_32_32( singularVectors[jCh][currChannel], singularVectors[jCh][currChannel] ), shl( sub( max_e, singularVectors2_e[jCh][currChannel] ), 1 ) ) ); - } - - Word16 nrm = W_norm( temp ); - nrm = sub( nrm, 32 ); - norm_x = W_shl_sat_l( temp, nrm ); - norm_x_e = sub( add( max_e, max_e ), nrm ); - - IF( GT_16( norm_x_e, 0 ) ) - { - norm_x = MAX_32; - move32(); - norm_x_e = 0; - move16(); - } - L_temp_e = norm_x_e; - move16(); - L_temp = Sqrt32( norm_x, &L_temp_e ); - L_temp = L_shl_r( L_temp, L_temp_e ); // Q31 - //( *g ) = L_negate( GE_32( singularVectors[currChannel][idx], 0 ) ? L_temp : L_negate( L_temp ) ); - if ( singularVectors[currChannel][idx] >= 0 ) - { - L_temp = L_negate( L_temp ); - } - ( *g ) = L_temp; - move32(); - - r = BASOP_Util_Add_Mant32Exp( Mpy_32_32( ( *g ), singularVectors[currChannel][idx] ), singularVectors2_e[currChannel][idx], -norm_x, norm_x_e, &r_e ); /* exp(r_e) */ - singularVectors[currChannel][idx] = BASOP_Util_Add_Mant32Exp( singularVectors[currChannel][idx], singularVectors2_e[currChannel][idx], -( *g ), 0, &singularVectors2_e[currChannel][idx] ); /* sing_exp */ - move32(); - - invVal = BASOP_Util_Divide3232_Scale_newton( MAXVAL_WORD32, maxWithSign_fx( r ), &invVal_e ); - - FOR( iCh = currChannel + 1; iCh < nChannelsC; iCh++ ) /* nChannelsC */ - { - Word16 max2_e = MIN_16; - max_e = MIN_16; - move16(); - move16(); - temp = 0; - move64(); - - FOR( jCh = idx; jCh < nChannelsL; jCh++ ) /* nChannelsL */ - { - max_e = s_max( max_e, singularVectors2_e[jCh][currChannel] ); /* exp(norm_x_e) */ - max2_e = s_max( max2_e, singularVectors2_e[jCh][iCh] ); /* exp(norm_x_e) */ - } - max_e = add( max_e, max2_e ); - - FOR( jCh = idx; jCh < nChannelsL; jCh++ ) /* nChannelsL */ - { - temp = W_add( temp, L_shr( Mpy_32_32( singularVectors[jCh][currChannel], singularVectors[jCh][iCh] ), sub( max_e, add( singularVectors2_e[jCh][currChannel], singularVectors2_e[jCh][iCh] ) ) ) ); - } - nrm = W_norm( temp ); - nrm = sub( nrm, 32 ); - norm_x = W_shl_sat_l( temp, nrm ); - norm_x_e = sub( max_e, nrm ); - - f = Mpy_32_32( norm_x, invVal ); /* invVal_e + (norm_x_e - r_e) */ - f_e = add( invVal_e, sub( norm_x_e, r_e ) ); - - FOR( jCh = idx; jCh < nChannelsL; jCh++ ) /* nChannelsL */ - { - singularVectors[jCh][iCh] = BASOP_Util_Add_Mant32Exp( singularVectors[jCh][iCh], singularVectors2_e[jCh][iCh], Mpy_32_32( f, singularVectors[jCh][currChannel] ), add( f_e, singularVectors2_e[jCh][currChannel] ), &singularVectors2_e[jCh][iCh] ); - move32(); - } - } - - - FOR( jCh = idx; jCh < nChannelsL; jCh++ ) /* nChannelsL */ - { - singularVectors[jCh][currChannel] = Mpy_32_32( singularVectors[jCh][currChannel], ( *sig_x ) ); /* sing_exp + sig_x_e */ - move32(); - singularVectors2_e[jCh][currChannel] = add( singularVectors2_e[jCh][currChannel], *sig_x_e ); - move16(); - } - } - - // rescaling block - singularValues[currChannel] = Mpy_32_32( ( *sig_x ), ( *g ) ); /* sig_x_e */ - move32(); - singularValues_e[currChannel] = *sig_x_e; - move16(); - } - - return; -} - -/*------------------------------------------------------------------------- - * biDiagonalReductionRight() - * - * - *-------------------------------------------------------------------------*/ - -static void biDiagonalReductionRight_fx( - Word32 singularVectors[][MAX_OUTPUT_CHANNELS], /* exp(singularVectors_e) */ - Word32 secDiag[MAX_OUTPUT_CHANNELS], /* exp(secDiag_exp[]) */ - Word16 singularVectors2_e[][MAX_OUTPUT_CHANNELS], - Word16 *secDiag_exp, - const Word16 nChannelsL, /* Q0 */ - const Word16 nChannelsC, /* Q0 */ - const Word16 currChannel, /* Q0 */ - Word32 *sig_x, /* exp(sig_x_e) */ - Word16 *sig_x_e, - Word32 *g /* Q31 */ -) -{ - Word16 iCh, jCh, idx; - Word32 norm_x, r; - Word16 norm_x_e, r_e; - Word32 L_temp; - Word16 L_temp_e; - - /* Setting values to 0 */ - ( *sig_x ) = 0; - move32(); - ( *g ) = 0; - move32(); - - IF( LT_16( currChannel, nChannelsL ) && NE_16( currChannel, sub( nChannelsC, 1 ) ) ) /* i <=m && i !=n */ - { - idx = add( currChannel, 1 ); /* Q0 */ - - FOR( jCh = idx; jCh < nChannelsC; jCh++ ) /* nChannelsC */ - { - ( *sig_x ) = BASOP_Util_Add_Mant32Exp( *sig_x, *sig_x_e, L_abs( singularVectors[currChannel][jCh] ), singularVectors2_e[currChannel][jCh], sig_x_e ); /* exp(sig_x_e) */ - } - - IF( ( *sig_x ) ) /*(fabsf(*sig_x) > EPSILON * fabsf(*sig_x)) { */ - { - norm_x = 0; - move32(); - norm_x_e = 0; - move16(); - - Word16 invVal_e, temp_e; - Word32 invVal; - invVal = BASOP_Util_Divide3232_Scale_newton( MAXVAL_WORD32, maxWithSign_fx( *sig_x ), &invVal_e ); - FOR( jCh = idx; jCh < nChannelsC; jCh++ ) /*nChannelsC */ - { - temp_e = norm_l( singularVectors[currChannel][jCh] ); - singularVectors[currChannel][jCh] = Mpy_32_32( L_shl( singularVectors[currChannel][jCh], temp_e ), invVal ); /* exp(sing_exp + (singularVectors_e - sig_x_e) */ - move32(); - singularVectors2_e[currChannel][jCh] = add( sub( invVal_e, temp_e ), sub( singularVectors2_e[currChannel][jCh], *sig_x_e ) ); - move16(); - norm_x = BASOP_Util_Add_Mant32Exp( norm_x, norm_x_e, Mpy_32_32( singularVectors[currChannel][jCh], singularVectors[currChannel][jCh] ), shl( singularVectors2_e[currChannel][jCh], 1 ), &norm_x_e ); /* exp(norm_x_e) */ - } - IF( GT_16( norm_x_e, 0 ) ) - { - norm_x = MAX_32; - move32(); - norm_x_e = 0; - move16(); - } - L_temp_e = norm_x_e; - move16(); - L_temp = Sqrt32( norm_x, &L_temp_e ); - L_temp = L_shl_r( L_temp, L_temp_e ); // Q31 - IF( singularVectors[currChannel][idx] >= 0 ) - { - ( *g ) = L_negate( L_temp ); /* exp(L_temp_e) */ - move32(); - } - ELSE - { - ( *g ) = L_negate( L_negate( L_temp ) ); /* exp(L_temp_e) */ - move32(); - } - - r = BASOP_Util_Add_Mant32Exp( Mpy_32_32( ( *g ), singularVectors[currChannel][idx] ), singularVectors2_e[currChannel][idx], -norm_x, norm_x_e, &r_e ); /* exp(r_e) */ - singularVectors[currChannel][idx] = BASOP_Util_Add_Mant32Exp( singularVectors[currChannel][idx], singularVectors2_e[currChannel][idx], -( *g ), 0, &singularVectors2_e[currChannel][idx] ); /* exp(sing_exp) */ - move32(); - - invVal = BASOP_Util_Divide3232_Scale_newton( MAXVAL_WORD32, maxWithSign_fx( r ), &invVal_e ); - - FOR( jCh = idx; jCh < nChannelsC; jCh++ ) /* nChannelsC */ - { - temp_e = norm_l( singularVectors[currChannel][jCh] ); - secDiag[jCh] = Mpy_32_32( L_shl( singularVectors[currChannel][jCh], temp_e ), invVal ); /* exp(sing_exp + (singularVectors_e - sig_x_e) */ - move32(); - secDiag_exp[jCh] = add( sub( invVal_e, temp_e ), sub( singularVectors2_e[currChannel][jCh], r_e ) ); - move16(); - } - - FOR( iCh = currChannel + 1; iCh < nChannelsL; iCh++ ) /* nChannelsL */ - { - norm_x = 0; - move32(); - norm_x_e = 0; - move16(); - FOR( jCh = idx; jCh < nChannelsC; jCh++ ) /* nChannelsC */ - { - norm_x = BASOP_Util_Add_Mant32Exp( norm_x, norm_x_e, Mpy_32_32( singularVectors[iCh][jCh], singularVectors[currChannel][jCh] ), add( singularVectors2_e[iCh][jCh], singularVectors2_e[currChannel][jCh] ), &norm_x_e ); /* exp(norm_x_e) */ - } - - FOR( jCh = idx; jCh < nChannelsC; jCh++ ) /* nChannelsC */ - { - singularVectors[iCh][jCh] = BASOP_Util_Add_Mant32Exp( singularVectors[iCh][jCh], singularVectors2_e[iCh][jCh], Mpy_32_32( norm_x, secDiag[jCh] ), add( norm_x_e, secDiag_exp[jCh] ), &singularVectors2_e[iCh][jCh] ); /* exp(sing_exp2) */ - move32(); - } - } - - FOR( jCh = idx; jCh < nChannelsC; jCh++ ) /* nChannelsC */ - { - singularVectors[currChannel][jCh] = Mpy_32_32( singularVectors[currChannel][jCh], ( *sig_x ) ); /* exp(sing_exp + sig_x_e) */ - move32(); - singularVectors2_e[currChannel][jCh] = add( singularVectors2_e[currChannel][jCh], *sig_x_e ); - move16(); - } - } - } - - return; -} -#endif /*------------------------------------------------------------------------- * singularVectorsAccumulationLeft() @@ -1504,11 +1149,7 @@ static void singularVectorsAccumulationLeft_fx( FOR( k = nCh + 1; k < nChannelsL; k++ ) /* nChannelsL */ { -#ifdef FIX_ISSUE_1811_EXCEEDING_W_SHIFTS acc = W_add( acc, W_shr( prod[k], s_min( 63, sub( max_e, prod_e[k] ) ) ) ); -#else - acc = W_add( acc, W_shr( prod[k], sub( max_e, prod_e[k] ) ) ); -#endif } Word16 acc_e = W_norm( acc ); acc = W_shl( acc, acc_e ); diff --git a/lib_dec/jbm_jb4sb_fx.c b/lib_dec/jbm_jb4sb_fx.c index 56b840d1189a1aa4188aac51df30a867b595effe..b8e4bff7d7068fe1635322c1049d5807c58bc3f5 100644 --- a/lib_dec/jbm_jb4sb_fx.c +++ b/lib_dec/jbm_jb4sb_fx.c @@ -926,15 +926,11 @@ static void JB4_adaptActivePlayout( } rate = (UWord32) W_add( temp3, dropRateMin ); *scale = idiv1616( sub( 1000, (Word16) rate ), 10 ); -#ifdef NONBE_1215_FIX_JBM_MAX_SCALING /* Limit max scaling to the duration of one frame. APA will not exceed this limit * anyway due to the 50% limitation of APA_MIN_SCALE and APA_MAX_SCALE. Limiting * the value to a sensible range here avoids integer overflows at later stages when * converting maxScaling from milliseconds to samples. */ *maxScaling = (UWord32) JB4_MIN( W_sub( currPlayoutDelay, targetMax ), 1000 / IVAS_NUM_FRAMES_PER_SEC ); -#else - *maxScaling = (UWord32) W_sub( currPlayoutDelay, targetMax ); -#endif move32(); move32(); } @@ -955,15 +951,11 @@ static void JB4_adaptActivePlayout( { *scale = 120; move32(); -#ifdef NONBE_1215_FIX_JBM_MAX_SCALING /* Limit max scaling to the duration of one frame. APA will not exceed this limit * anyway due to the 50% limitation of APA_MIN_SCALE and APA_MAX_SCALE. Limiting * the value to a sensible range here avoids integer overflows at later stages when * converting maxScaling from milliseconds to samples. */ *maxScaling = (UWord32) JB4_MIN( W_sub( targetMaxStretch, currPlayoutDelay ), 1000 / IVAS_NUM_FRAMES_PER_SEC ); -#else - *maxScaling = (UWord32) W_sub( targetMaxStretch, currPlayoutDelay ); -#endif move32(); } } diff --git a/lib_dec/lib_dec.h b/lib_dec/lib_dec.h index cc5185a72d7055d7a402f81fc013002a37e3daa7..458b441242f0cf35c25ba32db4edffe6350ee646 100644 --- a/lib_dec/lib_dec.h +++ b/lib_dec/lib_dec.h @@ -102,7 +102,6 @@ ivas_error IVAS_DEC_Open( /*! r: error code */ ivas_error IVAS_DEC_Configure( -#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ const UWord32 sampleRate, /* i : output sampling frequency */ const IVAS_AUDIO_CONFIG outputConfig, /* i : output configuration */ @@ -119,24 +118,6 @@ ivas_error IVAS_DEC_Configure( const bool dpidEnabled, /* i : enable directivity pattern option */ const UWord16 acousticEnvironmentId, /* i : Acoustic environment ID */ const bool delayCompensationEnabled /* i : enable delay compensation */ -#else - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - const UWord32 sampleRate, /* i : output sampling frequency */ - const IVAS_AUDIO_CONFIG outputConfig, /* i : audio configuration */ - const Word16 tsmEnabled, /* i : enable TSM */ - const IVAS_RENDER_FRAMESIZE renderFramesize, /* i : rendering frame size */ - const Word16 customLsOutputEnabled, /* i : enable custom loudspeaker setup handle */ - const Word16 hrtfReaderEnabled, /* i : enable HRTF binary file input */ - const Word16 enableHeadRotation, /* i : enable head rotation for binaural output */ - const Word16 enableExternalOrientation, /* i : enable external orientations */ - const IVAS_HEAD_ORIENT_TRK_T orientation_tracking, /* i : head orientation tracking type */ - const Word16 renderConfigEnabled, /* i : enable Renderer config. file for binaural output */ - const Word16 Opt_non_diegetic_pan, /* i : diegetic or not */ - const Word16 non_diegetic_pan_gain_fx, /* i : non diegetic panning gain Q15 */ - const Word16 Opt_dpid_on, /* i : enable directivity pattern option */ - const UWord16 acousticEnvironmentId, /* i : Acoustic environment ID */ - const Word16 delayCompensationEnabled /* i : enable delay compensation */ -#endif ); void IVAS_DEC_Close( @@ -455,11 +436,7 @@ const char *IVAS_DEC_GetErrorMessage( ivas_error error /* i : decoder error code enum */ ); -#ifdef FIX_VOIP_FUNCTIONS ivas_error IVAS_DEC_PrintConfig( -#else -void IVAS_DEC_PrintConfig( -#endif const IVAS_DEC_HANDLE hIvasDec, /* i : IVAS decoder handle */ const bool quietModeEnabled, /* i : quiet mode flag: if true, reduces the amount of config info printed */ const bool voipMode diff --git a/lib_dec/lib_dec_fx.c b/lib_dec/lib_dec_fx.c index 66a890eda277db79c394fcdf04967013a0d618af..c1cc0bd04f18dc0a9b90da6451a9ce61b628d0d2 100644 --- a/lib_dec/lib_dec_fx.c +++ b/lib_dec/lib_dec_fx.c @@ -455,7 +455,6 @@ static IVAS_DEC_BS_FORMAT mapIvasFormat( *---------------------------------------------------------------------*/ ivas_error IVAS_DEC_Configure( -#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ const UWord32 sampleRate, /* i : output sampling frequency */ const IVAS_AUDIO_CONFIG outputConfig, /* i : output configuration */ @@ -472,24 +471,6 @@ ivas_error IVAS_DEC_Configure( const bool dpidEnabled, /* i : enable directivity pattern option */ const UWord16 acousticEnvironmentId, /* i : Acoustic environment ID */ const bool delayCompensationEnabled /* i : enable delay compensation */ -#else - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - const UWord32 sampleRate, /* i : output sampling frequency */ - const AUDIO_CONFIG outputConfig, /* i : output configuration */ - const Word16 tsmEnabled, /* i : enable time scale modification */ - const IVAS_RENDER_FRAMESIZE renderFramesize, /* i : rendering frame size */ - const Word16 customLsOutputEnabled, /* i : enable custom loudspeaker setup handle */ - const Word16 hrtfReaderEnabled, /* i : enable HRTF binary file input */ - const Word16 enableHeadRotation, /* i : enable head rotation for binaural output */ - const Word16 enableExternalOrientation, /* i : enable external orientations */ - const IVAS_HEAD_ORIENT_TRK_T orientation_tracking, /* i : head orientation tracking type */ - const Word16 renderConfigEnabled, /* i : enable Renderer config. file for binaural output */ - const Word16 Opt_non_diegetic_pan, /* i : diegetic or not */ - const Word16 non_diegetic_pan_gain_fx, /* i : non diegetic panning gain Q15 */ - const Word16 Opt_dpid_on, /* i : enable directivity pattern option */ - const UWord16 acousticEnvironmentId, /* i : Acoustic environment ID */ - const Word16 delayCompensationEnabled /* i : enable delay compensation */ -#endif ) { Decoder_Struct *st_ivas; @@ -514,13 +495,8 @@ ivas_error IVAS_DEC_Configure( test(); test(); test(); -#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION IF( EQ_16( hIvasDec->mode, IVAS_DEC_MODE_EVS ) && !( ( EQ_16( outputConfig, IVAS_AUDIO_CONFIG_MONO ) && non_diegetic_pan_enabled == false ) || ( EQ_16( outputConfig, IVAS_AUDIO_CONFIG_STEREO ) && non_diegetic_pan_enabled ) ) ) -#else - IF( EQ_16( hIvasDec->mode, IVAS_DEC_MODE_EVS ) && !( ( EQ_16( outputConfig, IVAS_AUDIO_CONFIG_MONO ) && Opt_non_diegetic_pan == 0 ) || - ( EQ_16( outputConfig, IVAS_AUDIO_CONFIG_STEREO ) && EQ_16( Opt_non_diegetic_pan, 1 ) ) ) ) -#endif { return IVAS_ERR_WRONG_MODE; } @@ -552,37 +528,17 @@ ivas_error IVAS_DEC_Configure( move16(); } -#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION hDecoderConfig->Opt_tsm = (Word16) tsmEnabled; hDecoderConfig->Opt_LsCustom = (Word16) customLsOutputEnabled; hDecoderConfig->Opt_Headrotation = (Word16) enableHeadRotation; -#else - hDecoderConfig->Opt_tsm = tsmEnabled; - hDecoderConfig->Opt_LsCustom = customLsOutputEnabled; - hDecoderConfig->Opt_Headrotation = enableHeadRotation; -#endif hDecoderConfig->orientation_tracking = orientation_tracking; -#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION hDecoderConfig->Opt_HRTF_binary = (Word16) hrtfReaderEnabled; hDecoderConfig->Opt_RendConfigCustom = (Word16) renderConfigEnabled; hDecoderConfig->Opt_non_diegetic_pan = (Word16) non_diegetic_pan_enabled; -#else - hDecoderConfig->Opt_HRTF_binary = hrtfReaderEnabled; - hDecoderConfig->Opt_RendConfigCustom = renderConfigEnabled; - hDecoderConfig->Opt_non_diegetic_pan = Opt_non_diegetic_pan; -#endif hDecoderConfig->non_diegetic_pan_gain_fx = non_diegetic_pan_gain_fx; // Q15 -#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION hDecoderConfig->Opt_delay_comp = (Word16) delayCompensationEnabled; -#else - hDecoderConfig->Opt_delay_comp = delayCompensationEnabled; -#endif hDecoderConfig->Opt_ExternalOrientation = enableExternalOrientation; -#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION hDecoderConfig->Opt_dpid_on = (Word16) dpidEnabled; -#else - hDecoderConfig->Opt_dpid_on = Opt_dpid_on; -#endif IF( NE_32( (Word32) acousticEnvironmentId, 65535 ) ) { hDecoderConfig->Opt_aeid_on = TRUE; @@ -618,13 +574,6 @@ ivas_error IVAS_DEC_Configure( } move16(); -#ifndef FIX_1135_EXT_RENDERER_HANDLES - IF( EQ_32( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_32( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) - { - hDecoderConfig->Opt_Headrotation = TRUE; - move16(); - } -#endif /* Set decoder parameters to initial values */ IF( NE_32( ( error = ivas_init_decoder_front( st_ivas ) ), IVAS_ERR_OK ) ) { @@ -1369,14 +1318,12 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream( Word16 ro_md_flag; IVAS_QUATERNION Quaternion; -#ifdef FIX_VOIP_FUNCTIONS test(); IF( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } -#endif st_ivas = hIvasDec->st_ivas; output_config = st_ivas->hDecoderConfig->output_config; output_Fs = st_ivas->hDecoderConfig->output_Fs; @@ -2041,12 +1988,10 @@ ivas_error IVAS_DEC_GetNumObjects( UWord16 *numObjects /* o : number of objects for which the decoder has been configured */ ) { -#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT Word16 is_masa_ism; is_masa_ism = 0; move16(); -#endif test(); IF( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) @@ -2054,7 +1999,6 @@ ivas_error IVAS_DEC_GetNumObjects( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } -#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT IF( hIvasDec->st_ivas->hMasa != NULL ) { IF( EQ_32( hIvasDec->st_ivas->hMasa->config.input_ivas_format, MASA_ISM_FORMAT ) ) @@ -2071,11 +2015,6 @@ ivas_error IVAS_DEC_GetNumObjects( EQ_32( hIvasDec->st_ivas->ivas_format, SBA_ISM_FORMAT ) || EQ_32( hIvasDec->st_ivas->ivas_format, MASA_ISM_FORMAT ) || EQ_16( is_masa_ism, 1 ) ) -#else - test(); - test(); - IF( EQ_16( (Word16) hIvasDec->st_ivas->ivas_format, ISM_FORMAT ) || EQ_16( (Word16) hIvasDec->st_ivas->ivas_format, SBA_ISM_FORMAT ) || EQ_16( (Word16) hIvasDec->st_ivas->ivas_format, MASA_ISM_FORMAT ) ) -#endif { *numObjects = hIvasDec->st_ivas->nchan_ism; } @@ -2101,14 +2040,12 @@ ivas_error IVAS_DEC_GetFormat( IVAS_DEC_BS_FORMAT *format /* o : format detected from bitstream fed to the decoder */ ) { -#ifdef FIX_VOIP_FUNCTIONS test(); IF( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } -#endif IF( hIvasDec->hasDecodedFirstGoodFrame ) { *format = mapIvasFormat( hIvasDec->st_ivas->ivas_format ); @@ -2119,14 +2056,12 @@ ivas_error IVAS_DEC_GetFormat( } move32(); -#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT test(); if ( EQ_32( *format, IVAS_DEC_BS_MASA ) && EQ_32( hIvasDec->st_ivas->hMasa->config.input_ivas_format, MASA_ISM_FORMAT ) ) { *format = IVAS_DEC_BS_MASA_ISM; move32(); } -#endif return IVAS_ERR_OK; } @@ -2210,14 +2145,12 @@ ivas_error IVAS_DEC_GetNumOutputChannels( Word16 *numOutputChannels /* o : number of PCM output channels */ ) { -#ifdef FIX_VOIP_FUNCTIONS test(); IF( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } -#endif IF( hIvasDec->hasDecodedFirstGoodFrame ) { *numOutputChannels = hIvasDec->st_ivas->hDecoderConfig->nchan_out; @@ -2246,12 +2179,10 @@ ivas_error IVAS_DEC_GetObjectMetadata( { Decoder_Struct *st_ivas; ISM_METADATA_HANDLE hIsmMeta; -#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT Word16 is_masa_ism; is_masa_ism = 0; move16(); -#endif test(); IF( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) @@ -2261,7 +2192,6 @@ ivas_error IVAS_DEC_GetObjectMetadata( st_ivas = hIvasDec->st_ivas; -#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT IF( hIvasDec->st_ivas->hMasa != NULL ) { IF( EQ_32( hIvasDec->st_ivas->hMasa->config.input_ivas_format, MASA_ISM_FORMAT ) ) @@ -2278,11 +2208,6 @@ ivas_error IVAS_DEC_GetObjectMetadata( NE_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) && NE_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) && EQ_16( is_masa_ism, 0 ) ) -#else - test(); - test(); - IF( NE_16( st_ivas->ivas_format, ISM_FORMAT ) && NE_16( st_ivas->ivas_format, MASA_ISM_FORMAT ) && NE_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) -#endif { return IVAS_ERR_WRONG_MODE; } @@ -2294,16 +2219,12 @@ ivas_error IVAS_DEC_GetObjectMetadata( hIsmMeta = st_ivas->hIsmMetaData[objectIdx]; -#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT test(); test(); test(); IF( hIsmMeta == NULL || EQ_16( zero_flag, 1 ) || ( EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) && EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_MASA_ONE_OBJ ) ) ) -#else - IF( hIsmMeta == NULL || zero_flag ) -#endif { metadata->azimuth_fx = 0; // Q22 metadata->elevation_fx = 0; // Q22 @@ -2779,9 +2700,6 @@ static ivas_error copyRendererConfigStruct( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } -#ifndef FIX_587_DEFAULT_REVERB - hRCout->roomAcoustics.override = hRCin->roomAcoustics.override; -#endif hRCout->roomAcoustics.nBands = hRCin->roomAcoustics.nBands; hRCout->roomAcoustics.acousticPreDelay_fx = hRCin->roomAcoustics.acousticPreDelay_fx; hRCout->roomAcoustics.inputPreDelay_fx = hRCin->roomAcoustics.inputPreDelay_fx; @@ -2869,9 +2787,6 @@ ivas_error IVAS_DEC_FeedRenderConfig( } hRenderConfig = hIvasDec->st_ivas->hRenderConfig; -#ifndef FIX_587_DEFAULT_REVERB - hRenderConfig->roomAcoustics.override = renderConfig.roomAcoustics.override; -#endif hRenderConfig->roomAcoustics.nBands = renderConfig.roomAcoustics.nBands; hRenderConfig->roomAcoustics.acousticPreDelay_fx = renderConfig.roomAcoustics.acousticPreDelay_fx; hRenderConfig->roomAcoustics.inputPreDelay_fx = renderConfig.roomAcoustics.inputPreDelay_fx; @@ -2898,7 +2813,6 @@ ivas_error IVAS_DEC_FeedRenderConfig( Copy32( renderConfig.roomAcoustics.pAcoustic_rt60_fx, hRenderConfig->roomAcoustics.pAcoustic_rt60_fx, CLDFB_NO_CHANNELS_MAX ); // Q26 Copy32( renderConfig.roomAcoustics.pAcoustic_dsr_fx, hRenderConfig->roomAcoustics.pAcoustic_dsr_fx, CLDFB_NO_CHANNELS_MAX ); // Q30 -#ifdef FIX_1053_REVERB_RECONFIGURATION /* Re-initialize reverb instance if already available */ /* TD renderer Jot reverberator */ @@ -2926,11 +2840,7 @@ ivas_error IVAS_DEC_FeedRenderConfig( IF( hIvasDec->st_ivas->hDiracDecBin[0] != NULL && hIvasDec->st_ivas->hDiracDecBin[0]->hReverb != NULL ) { ivas_binaural_reverb_close_fx( &( hIvasDec->st_ivas->hDiracDecBin[0]->hReverb ) ); -#ifdef FIX_1139_REV_COLORATION_SHORT_T60 IF( ( error = ivas_binaural_reverb_init( &( hIvasDec->st_ivas->hDiracDecBin[0]->hReverb ), hIvasDec->st_ivas->hHrtfStatistics, hIvasDec->st_ivas->hSpatParamRendCom->num_freq_bands, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, &( hRenderConfig->roomAcoustics ), hIvasDec->st_ivas->hDecoderConfig->output_Fs, NULL, NULL, NULL ) ) != IVAS_ERR_OK ) -#else - IF( ( error = ivas_binaural_reverb_init( &( hIvasDec->st_ivas->hDiracDecBin[0]->hReverb ), hIvasDec->st_ivas->hHrtfStatistics, hIvasDec->st_ivas->hSpatParamRendCom->num_freq_bands, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, &( hRenderConfig->roomAcoustics ), hIvasDec->st_ivas->hDecoderConfig->output_Fs, NULL, NULL ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -2941,21 +2851,14 @@ ivas_error IVAS_DEC_FeedRenderConfig( IF( hIvasDec->st_ivas->hBinRenderer != NULL && hIvasDec->st_ivas->hBinRenderer->hReverb != NULL ) { ivas_binaural_reverb_close_fx( &( hIvasDec->st_ivas->hBinRenderer->hReverb ) ); -#ifdef FIX_1139_REV_COLORATION_SHORT_T60 IF( ( error = ivas_binaural_reverb_init( &( hIvasDec->st_ivas->hBinRenderer->hReverb ), hIvasDec->st_ivas->hHrtfStatistics, hIvasDec->st_ivas->hBinRenderer->conv_band, hIvasDec->st_ivas->hBinRenderer->timeSlots, &( hRenderConfig->roomAcoustics ), hIvasDec->st_ivas->hDecoderConfig->output_Fs, NULL, NULL, NULL ) ) != IVAS_ERR_OK ) -#else - IF( ( error = ivas_binaural_reverb_init( &( hIvasDec->st_ivas->hBinRenderer->hReverb ), hIvasDec->st_ivas->hHrtfStatistics, hIvasDec->st_ivas->hBinRenderer->conv_band, hIvasDec->st_ivas->hBinRenderer->timeSlots, &( hRenderConfig->roomAcoustics ), hIvasDec->st_ivas->hDecoderConfig->output_Fs, NULL, NULL ) ) != IVAS_ERR_OK ) -#endif { return error; } } -#endif Copy( renderConfig.directivity_fx, hRenderConfig->directivity_fx, 3 * MAX_NUM_OBJECTS ); -#ifdef CONF_DISTATT Copy32( renderConfig.distAtt_fx, hRenderConfig->distAtt_fx, 3 ); -#endif hRenderConfig->split_rend_config = renderConfig.split_rend_config; @@ -3027,13 +2930,8 @@ ivas_error IVAS_DEC_GetDelay( } move32(); -#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT nSamples[1] = NS2SA_FX2( hDecoderConfig->output_Fs, get_delay_fx( DEC, hDecoderConfig->output_Fs, st_ivas->ivas_format, st_ivas->cldfbSynDec[0], (Word16) EQ_16( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ) ); move16(); -#else - nSamples[1] = NS2SA_FX2( hDecoderConfig->output_Fs, get_delay_fx( DEC, hDecoderConfig->output_Fs, st_ivas->ivas_format, st_ivas->cldfbAnaDec[0], hDecoderConfig->output_config ) ); - move16(); -#endif nSamples[2] = extract_l( W_round64_L( W_mult0_32_32( L_shl( st_ivas->binaural_latency_ns, 1 ), out_fs_fx ) ) ); move16(); nSamples[0] = add( nSamples[1], nSamples[2] ); @@ -3193,7 +3091,6 @@ ivas_error IVAS_DEC_VoIP_FeedFrame( Word16 partialCopyFrameType, partialCopyOffset; Word16 result; -#ifdef FIX_VOIP_FUNCTIONS test(); test(); IF( hIvasDec == NULL || hIvasDec->hVoIP == NULL || au == NULL ) @@ -3201,7 +3098,6 @@ ivas_error IVAS_DEC_VoIP_FeedFrame( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } -#endif IF( auSize == 0 ) { return IVAS_ERR_OK; /* ignore empty/NO_DATA frame - shouldn't be transmitted in RTP */ @@ -3304,14 +3200,12 @@ ivas_error IVAS_DEC_VoIP_SetScale( const Word16 scale /* i : TSM scale to set in percent of the default frame size */ ) { -#ifdef FIX_VOIP_FUNCTIONS test(); IF( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } -#endif IF( !hIvasDec->st_ivas->hDecoderConfig->Opt_tsm ) { return IVAS_ERR_TSM_NOT_ENABLED; @@ -3348,14 +3242,12 @@ ivas_error IVAS_DEC_TSM_SetQuality( const Word16 quality /* i : target TSM quality Q14 */ ) { -#ifdef FIX_VOIP_FUNCTIONS test(); IF( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } -#endif IF( !hIvasDec->st_ivas->hDecoderConfig->Opt_tsm ) { return IVAS_ERR_TSM_NOT_ENABLED; @@ -3399,7 +3291,6 @@ ivas_error IVAS_DEC_VoIP_GetSamples( Word16 nSamplesRendered; UWord8 nOutChannels; -#ifdef FIX_VOIP_FUNCTIONS test(); test(); IF( hIvasDec == NULL || hIvasDec->st_ivas == NULL || hIvasDec->hVoIP == NULL ) @@ -3407,7 +3298,6 @@ ivas_error IVAS_DEC_VoIP_GetSamples( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } -#endif st_ivas = hIvasDec->st_ivas; hDecoderConfig = st_ivas->hDecoderConfig; hVoIP = hIvasDec->hVoIP; @@ -3642,14 +3532,12 @@ ivas_error IVAS_DEC_Flush( UWord16 nSamplesToRender; UWord16 nSamplesFlushedLocal; -#ifdef FIX_VOIP_FUNCTIONS test(); IF( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } -#endif *nSamplesFlushed = s_min( nSamplesPerChannel, hIvasDec->nSamplesAvailableNext ); move16(); @@ -3685,14 +3573,12 @@ bool IVAS_DEC_VoIP_IsEmpty( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ const Word16 nSamplesAsked ) { -#ifdef FIX_VOIP_FUNCTIONS test(); IF( hIvasDec == NULL || hIvasDec->hVoIP == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } -#endif test(); return ( JB4_bufferedDataUnits( hIvasDec->hVoIP->hJBM ) == 0 && LT_16( hIvasDec->nSamplesAvailableNext, nSamplesAsked ) ); } @@ -3814,13 +3700,9 @@ ivas_error IVAS_DEC_GetJbmData( ) { -#ifdef FIX_VOIP_FUNCTIONS test(); test(); IF( hIvasDec == NULL || hIvasDec->hVoIP == NULL || JbmTraceData == NULL ) -#else - IF( hIvasDec->hVoIP == NULL ) -#endif { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } @@ -4050,30 +3932,20 @@ static ivas_error printConfigInfo_dec( * Print decoder set-up info *---------------------------------------------------------------------*/ -#ifdef FIX_VOIP_FUNCTIONS ivas_error IVAS_DEC_PrintConfig( -#else -void IVAS_DEC_PrintConfig( -#endif const IVAS_DEC_HANDLE hIvasDec, const bool quietModeEnabled, const bool voipMode ) { -#ifdef FIX_VOIP_FUNCTIONS test(); IF( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } -#endif printConfigInfo_dec( hIvasDec->st_ivas, hIvasDec->bitstreamformat, voipMode, quietModeEnabled ); -#ifdef FIX_VOIP_FUNCTIONS return IVAS_ERR_OK; -#else - return; -#endif } diff --git a/lib_dec/pitch_extr_fx.c b/lib_dec/pitch_extr_fx.c index f33effc994f901905b1f7d01117e0c8c41f37188..5cabc98b1009ce6c096943078c72b295235bceaf 100644 --- a/lib_dec/pitch_extr_fx.c +++ b/lib_dec/pitch_extr_fx.c @@ -157,9 +157,6 @@ void pitch_pred_linear_fit( { Word32 t1, t2, t3, t4, t5, t6, t7; Word16 e1, e2, e3, e4, e5, e6, e7; -#ifndef ISSUE_1866_replace_overflow_libdec - Flag Overflow; -#endif t1 = L_mult0( pg[4], pg[3] ); /*Q24*/ /* t1 = pg[4]*pg[3] */ e1 = 7; move16(); @@ -182,12 +179,8 @@ void pitch_pred_linear_fit( t6 = BASOP_Util_Add_Mant32Exp( t3, e3, t4, e4, &e6 ); t7 = BASOP_Util_Add_Mant32Exp( t5, e5, t6, e6, &e7 ); /*Q31,e7*/ sum0_q = norm_l( t7 ); -#ifdef ISSUE_1866_replace_overflow_libdec sum0 = round_fx_sat( L_shl( t7, sum0_q ) ); /*Q15,e7-sum0_q*/ -#else - sum0 = round_fx_o( L_shl( t7, sum0_q ), &Overflow ); /*Q15,e7-sum0_q*/ -#endif - sum0_q = add( 15, sub( sum0_q, e7 ) ); /* sum0 is now Qsum0_q*/ + sum0_q = add( 15, sub( sum0_q, e7 ) ); /* sum0 is now Qsum0_q*/ } pit = 0; diff --git a/lib_dec/post_dec_fx.c b/lib_dec/post_dec_fx.c index 77b33d952ab3a927bf45558beba1753b35201a15..b593c99c57227b019d4d837b9dd5a82e70929298 100644 --- a/lib_dec/post_dec_fx.c +++ b/lib_dec/post_dec_fx.c @@ -606,12 +606,6 @@ void cldfb_synth_set_bandsToZero( Word16 realQ1, imagQ1, flag, offset, WBcnt; Word16 perc_detect, perc_miss; Word16 i, k, tmp1, tmp2, tmp3, tmp, update_perc; -#ifndef ISSUE_1866_replace_overflow_libdec -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif realQ1 = 0; @@ -658,13 +652,8 @@ void cldfb_synth_set_bandsToZero( /* use 16-bit precision of real and imag buffers */ realQ1 = extract_l( L_shr( rAnalysis[k][i], sub( 31 + 3 - 15, scaleFactor.lb_scale ) ) ); /*31 - (15 + scaleFactor.lb_scale) + 3 )*/ imagQ1 = extract_l( L_shr( iAnalysis[k][i], sub( 31 + 3 - 15, scaleFactor.lb_scale ) ) ); /* Q(-3), headroom */ -#ifdef ISSUE_1866_replace_overflow_libdec nrgQ31 = L_mac0_sat( nrgQ31, realQ1, realQ1 ); nrgQ31 = L_mac0_sat( nrgQ31, imagQ1, imagQ1 ); /* keep in Q(-6) */ -#else - nrgQ31 = L_mac0_o( nrgQ31, realQ1, realQ1, &Overflow ); - nrgQ31 = L_mac0_o( nrgQ31, imagQ1, imagQ1, &Overflow ); /* keep in Q(-6) */ -#endif } nrg_band[i] = ( nrgQ31 ); move16(); diff --git a/lib_dec/pvq_core_dec_fx.c b/lib_dec/pvq_core_dec_fx.c index f4191a5f174299e85be98268b60bab15b753965c..c507c134424edb72054d9510813c4169992a0748 100644 --- a/lib_dec/pvq_core_dec_fx.c +++ b/lib_dec/pvq_core_dec_fx.c @@ -477,12 +477,6 @@ static void densitySymbolIndexDecode_fx( Word32 acc; Word16 alpha = 0; move16(); -#ifndef ISSUE_1866_replace_overflow_libdec -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move16(); -#endif -#endif IF( s_and( (Word16) 0xFFFE, density ) == 0 ) { /* odd density exit */ @@ -494,11 +488,7 @@ static void densitySymbolIndexDecode_fx( sym_freq = L_deposit_l( 1 ); angle = atan2_fx( SQRT_DIM_fx[opp_sz], SQRT_DIM_fx[near_sz] ); // Q13 -#ifdef ISSUE_1866_replace_overflow_libdec angle = shl_sat( angle, 1 ); -#else - angle = shl_o( angle, 1, &Overflow ); -#endif angle = mult_r( angle, 20861 ); c = mult_r( density, angle ); density_c = sub( density, c ); diff --git a/lib_dec/pvq_decode_fx.c b/lib_dec/pvq_decode_fx.c index f48a343972d3ef0335fef51732a11badbeda5eca..3bd3e12d1817d431a8b74f84105a5fe9da14963b 100644 --- a/lib_dec/pvq_decode_fx.c +++ b/lib_dec/pvq_decode_fx.c @@ -33,12 +33,6 @@ void pvq_decode_fx( Word32 L_yy, L_isqrt, L_tmp; UWord16 u16_tmp; -#ifndef ISSUE_1866_replace_overflow_libdec -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move16(); -#endif -#endif entry = get_size_mpvq_calc_offset_fx( dim, k_val, h_mem ); /* get size & prepare H(adaptive table for entry.size=N_MPVQ(dim,k_val) */ @@ -105,13 +99,8 @@ void pvq_decode_fx( Mpy_32_16_ss( L_isqrt, shl( y[i], shift_num ), &L_tmp, &u16_tmp ); /* Q31*Q(0+x) *2*/ Mpy_32_16_ss( L_tmp, neg_gain_norm, &L_tmp, &u16_tmp ); /* Q31*Q(0+x) *Q15 *2*/ -#ifdef ISSUE_1866_replace_overflow_libdec L_tmp = L_shr_sat( L_tmp, shift_tot ); xq[i] = round_fx_sat( L_tmp ); /* Q15 , array move */ -#else - L_tmp = L_shr_o( L_tmp, shift_tot, &Overflow ); - xq[i] = round_fx_o( L_tmp, &Overflow ); /* Q15 , array move */ -#endif move16(); } } diff --git a/lib_dec/swb_tbe_dec_fx.c b/lib_dec/swb_tbe_dec_fx.c index 3a0e4364f59c422027b49e9dfbf16731faceb4f2..0de93c9375e25eaec4129c64295af52d17564ef2 100644 --- a/lib_dec/swb_tbe_dec_fx.c +++ b/lib_dec/swb_tbe_dec_fx.c @@ -634,12 +634,6 @@ void ivas_wb_tbe_dec_fx( Word32 dummy2[HILBERT_MEM_SIZE]; Word16 f, inc; Word64 W_tmp; -#ifndef ISSUE_1866_replace_overflow_libdec -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif TD_BWE_DEC_HANDLE hBWE_TD; hBWE_TD = st_fx->hBWE_TD; set32_fx( &dummy2[0], 0, HILBERT_MEM_SIZE ); @@ -964,11 +958,7 @@ void ivas_wb_tbe_dec_fx( n = norm_s( max ); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { -#ifdef ISSUE_1866_replace_overflow_libdec shaped_wb_excitation_frac[i] = shl_sat( shaped_wb_excitation[i], n ); /*Q14*/ -#else - shaped_wb_excitation_frac[i] = shl_o( shaped_wb_excitation[i], n, &Overflow ); /*Q14*/ -#endif move16(); } n = sub( 14, n ); @@ -976,13 +966,8 @@ void ivas_wb_tbe_dec_fx( move32(); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { -#ifdef ISSUE_1866_replace_overflow_libdec L_tmp = L_mult_sat( shaped_wb_excitation_frac[i], shaped_wb_excitation_frac[i] ); /*Q29*/ curr_frame_pow = L_add_sat( curr_frame_pow, L_shr( L_tmp, 7 ) ); /*Q22*/ -#else - L_tmp = L_mult_o( shaped_wb_excitation_frac[i], shaped_wb_excitation_frac[i], &Overflow ); /*Q29*/ - curr_frame_pow = L_add_o( curr_frame_pow, L_shr( L_tmp, 7 ), &Overflow ); /*Q22*/ -#endif } } curr_frame_pow_exp = add( n, n ); @@ -1176,11 +1161,7 @@ void ivas_wb_tbe_dec_fx( L_tmp = Mult_32_16( Lacc, 102 ); /* Q22 */ exp = norm_l( L_tmp ); -#ifdef ISSUE_1866_replace_overflow_libdec tmp = round_fx_sat( L_shl( L_tmp, exp ) ); -#else - tmp = round_fx_o( L_shl_o( L_tmp, exp, &Overflow ), &Overflow ); -#endif exp = sub( add( exp, 22 ), 30 ); tmp = div_s( 16384, tmp ); L_tmp = Isqrt_lc( L_deposit_h( tmp ), &exp ); /* Q(31-exp) */ @@ -1296,12 +1277,6 @@ void wb_tbe_dec_fx( move16(); Word32 dummy2[HILBERT_MEM_SIZE]; Word16 f, inc; -#ifndef ISSUE_1866_replace_overflow_libdec -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif TD_BWE_DEC_HANDLE hBWE_TD; hBWE_TD = st_fx->hBWE_TD; set32_fx( &dummy2[0], 0, HILBERT_MEM_SIZE ); @@ -1622,11 +1597,7 @@ void wb_tbe_dec_fx( n = norm_s( max ); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { -#ifdef ISSUE_1866_replace_overflow_libdec shaped_wb_excitation_frac[i] = shl_sat( shaped_wb_excitation[i], n ); /*Q14*/ -#else - shaped_wb_excitation_frac[i] = shl_o( shaped_wb_excitation[i], n, &Overflow ); /*Q14*/ -#endif move16(); } n = sub( 14, n ); @@ -1634,13 +1605,8 @@ void wb_tbe_dec_fx( move32(); FOR( i = 0; i < L_FRAME16k / 4; i++ ) { -#ifdef ISSUE_1866_replace_overflow_libdec L_tmp = L_mult_sat( shaped_wb_excitation_frac[i], shaped_wb_excitation_frac[i] ); /*Q29*/ curr_frame_pow = L_add_sat( curr_frame_pow, L_shr( L_tmp, 7 ) ); /*Q22*/ -#else - L_tmp = L_mult_o( shaped_wb_excitation_frac[i], shaped_wb_excitation_frac[i], &Overflow ); /*Q29*/ - curr_frame_pow = L_add_o( curr_frame_pow, L_shr( L_tmp, 7 ), &Overflow ); /*Q22*/ -#endif } } curr_frame_pow_exp = add( n, n ); @@ -1836,11 +1802,7 @@ void wb_tbe_dec_fx( L_tmp = Mult_32_16( Lacc, 102 ); /* Q22 */ exp = norm_l( L_tmp ); -#ifdef ISSUE_1866_replace_overflow_libdec tmp = round_fx_sat( L_shl( L_tmp, exp ) ); -#else - tmp = round_fx_o( L_shl_o( L_tmp, exp, &Overflow ), &Overflow ); -#endif exp = sub( add( exp, 22 ), 30 ); tmp = div_s( 16384, tmp ); L_tmp = Isqrt_lc( L_deposit_h( tmp ), &exp ); /* Q(31-exp) */ diff --git a/lib_dec/syn_outp_fx.c b/lib_dec/syn_outp_fx.c index b5f45e64def7cc9bb73fef789a724a2e2e694fab..96ee58142430e2790f438dd817847e3566efc94f 100644 --- a/lib_dec/syn_outp_fx.c +++ b/lib_dec/syn_outp_fx.c @@ -67,12 +67,6 @@ void unscale_AGC( { Word16 i, fac, tmp, frame_fac, max_val; Word32 L_tmp; -#ifndef ISSUE_1866_replace_overflow_libdec -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif /*----------------------------------------------------------------* * calculate AGC factor to avoid saturation @@ -84,11 +78,7 @@ void unscale_AGC( max_val = s_max( max_val, abs_s( x[i] ) ); } BASOP_SATURATE_WARNING_OFF_EVS -#ifdef ISSUE_1866_replace_overflow_libdec tmp = shl_sat( 30000, Qx ); /* saturation can occur here */ -#else - tmp = shl_o( 30000, Qx, &Overflow ); /* saturation can occur here */ -#endif BASOP_SATURATE_WARNING_ON_EVS frame_fac = 0; move16(); diff --git a/lib_dec/tonalMDCTconcealment_fx.c b/lib_dec/tonalMDCTconcealment_fx.c index 89332ccdd5593c482eb1198ea0b9b1bf7589a5c1..82f741e5626ba2869dd18354962b597ff0c9842d 100644 --- a/lib_dec/tonalMDCTconcealment_fx.c +++ b/lib_dec/tonalMDCTconcealment_fx.c @@ -724,12 +724,6 @@ static void ivas_CalcPowerSpecAndDetectTonalComponents_fx( Word16 invScaleFactors[FDNS_NPTS]; Word16 invScaleFactors_exp[FDNS_NPTS]; Word16 powerSpectrum_exp, tmp_exp, old_exp; -#ifndef ISSUE_1866_replace_overflow_libdec -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif Word16 nBands; Word32 invScaleFactors_fx[FDNS_NPTS]; @@ -859,11 +853,7 @@ static void ivas_CalcPowerSpecAndDetectTonalComponents_fx( /* 16 bits are now enough for storing the power spectrum */ FOR( i = 0; i < nSamples; i++ ) { -#ifdef ISSUE_1866_replace_overflow_libdec hTonalMDCTConc->secondLastPowerSpectrum[i] = round_fx_sat( powerSpectrum[i] ); // Q31 - powerSpectrum_exp -#else - hTonalMDCTConc->secondLastPowerSpectrum[i] = round_fx_o( powerSpectrum[i], &Overflow ); // Q31 - powerSpectrum_exp -#endif move32(); } @@ -888,12 +878,6 @@ static void CalcPowerSpecAndDetectTonalComponents( Word16 invScaleFactors[FDNS_NPTS]; Word16 invScaleFactors_exp[FDNS_NPTS]; Word16 powerSpectrum_exp, tmp_exp, old_exp; -#ifndef ISSUE_1866_replace_overflow_libdec -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif nSamples = hTonalMDCTConc->nNonZeroSamples; @@ -983,11 +967,7 @@ static void CalcPowerSpecAndDetectTonalComponents( /* 16 bits are now enough for storing the power spectrum */ FOR( i = 0; i < nSamples; i++ ) { -#ifdef ISSUE_1866_replace_overflow_libdec hTonalMDCTConc->secondLastPowerSpectrum[i] = round_fx_sat( powerSpectrum[i] ); // Q31-powerSpectrum_exp -#else - hTonalMDCTConc->secondLastPowerSpectrum[i] = round_fx_o( powerSpectrum[i], &Overflow ); // Q31-powerSpectrum_exp -#endif move32(); } diff --git a/lib_dec/transition_dec_fx.c b/lib_dec/transition_dec_fx.c index 2c9926656bf074fef7e5e22c5c80dec8acdf5a04..00d70785d74a4746fe648ac8c0477c447ff97693 100644 --- a/lib_dec/transition_dec_fx.c +++ b/lib_dec/transition_dec_fx.c @@ -676,12 +676,6 @@ static void tc_dec_fx( Word16 j, sc; Word16 tempS; Word16 index; -#ifndef ISSUE_1866_replace_overflow_libdec -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif /*----------------------------------------------------------------* * find the number of bits *----------------------------------------------------------------*/ @@ -831,11 +825,7 @@ static void tc_dec_fx( j = s_min( L_SUBFR, add( imp_pos, L_IMPULSE2 ) ); FOR( ; i <= j; i++ ) { -#ifdef ISSUE_1866_replace_overflow_libdec exc[i + i_subfr] = round_fx_sat( L_shl_sat( L_mult_sat( pt_shape[i], gain_trans ), sc ) ); /* (Qx * Q14 ) */ -#else - exc[i + i_subfr] = round_fx_o( L_shl_o( L_mult_o( pt_shape[i], gain_trans, &Overflow ), sc, &Overflow ), &Overflow ); /* (Qx * Q14 ) */ -#endif move16(); } FOR( ; i < L_SUBFR; i++ ) diff --git a/lib_enc/acelp_core_enc_fx.c b/lib_enc/acelp_core_enc_fx.c index d621923ba4e9e15c20f1571b2ec24a0020946296..eec55c1c720af4b43788900120db86bf6680bd00 100644 --- a/lib_enc/acelp_core_enc_fx.c +++ b/lib_enc/acelp_core_enc_fx.c @@ -391,14 +391,7 @@ ivas_error acelp_core_enc_fx( test(); IF( !nelp_mode && !ppp_mode ) { -#ifdef NONBE_1325_TD_STEREO_QUANT_LSF_SEC config_acelp1_fx( ENC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl, st_fx->extl_brate, st_fx->L_frame, st_fx->GSC_noisy_speech, &( st_fx->acelp_cfg ), hBstr->nb_bits_tot, st_fx->coder_type, st_fx->inactive_coder_type_flag, tc_subfr_fx, 0, &nb_bits, unbits_fx, st_fx->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st_fx->idchan, tdm_Pitch_reuse_flag, st_fx->tdm_LRTD_flag, st_fx->GSC_IVAS_mode ); -#else - config_acelp1_fx( ENC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl, st_fx->extl_brate, - st_fx->L_frame, st_fx->GSC_noisy_speech, &( st_fx->acelp_cfg ), hBstr->nb_bits_tot, st_fx->coder_type, st_fx->inactive_coder_type_flag, - tc_subfr_fx, 0, &nb_bits, unbits_fx, st_fx->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st_fx->idchan, st_fx->active_cnt, - tdm_Pitch_reuse_flag, st_fx->tdm_LRTD_flag, st_fx->GSC_IVAS_mode ); -#endif } /*-----------------------------------------------------------------* @@ -463,14 +456,7 @@ ivas_error acelp_core_enc_fx( { tc_classif_enc_fx( Q_new, st_fx->L_frame, &tc_subfr_fx, &position, attack_flag, st_fx->pitch[0], res_fx ); -#ifdef NONBE_1325_TD_STEREO_QUANT_LSF_SEC config_acelp1_fx( ENC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl, st_fx->extl_brate, st_fx->L_frame, -1, &( st_fx->acelp_cfg ), hBstr->nb_bits_tot, TRANSITION, -1, tc_subfr_fx, 1, NULL, unbits_fx, st_fx->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st_fx->idchan, tdm_Pitch_reuse_flag, st_fx->tdm_LRTD_flag, st_fx->GSC_IVAS_mode ); - -#else - config_acelp1_fx( ENC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl, st_fx->extl_brate, st_fx->L_frame, - -1, &( st_fx->acelp_cfg ), hBstr->nb_bits_tot, TRANSITION, -1, tc_subfr_fx, 1, NULL, unbits_fx, st_fx->element_mode, &uc_two_stage_flag, - tdm_lp_reuse_flag, tdm_low_rate_mode, st_fx->idchan, st_fx->active_cnt, tdm_Pitch_reuse_flag, st_fx->tdm_LRTD_flag, st_fx->GSC_IVAS_mode ); -#endif } /*---------------------------------------------------------------* @@ -522,13 +508,7 @@ ivas_error acelp_core_enc_fx( lsp_mid_bck_fx, mCb1_fx, Bin_E_fx, Bin_E_old_fx, mem_syn_bck_fx, mem_w0_bck_fx, streaklimit_fx, pstreaklen_fx ); /* Configure ACELP bit allocation */ -#ifdef NONBE_1325_TD_STEREO_QUANT_LSF_SEC config_acelp1_fx( ENC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl, st_fx->extl_brate, st_fx->L_frame, -1, &( st_fx->acelp_cfg ), hBstr->nb_bits_tot, st_fx->coder_type, st_fx->inactive_coder_type_flag, tc_subfr_fx, 0, &nb_bits, unbits_fx, 0, &uc_two_stage_flag, 0, 0, st_fx->idchan, tdm_Pitch_reuse_flag, st_fx->tdm_LRTD_flag, st_fx->GSC_IVAS_mode ); -#else - config_acelp1_fx( ENC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl, st_fx->extl_brate, st_fx->L_frame, - -1, &( st_fx->acelp_cfg ), hBstr->nb_bits_tot, st_fx->coder_type, st_fx->inactive_coder_type_flag, tc_subfr_fx, 0, &nb_bits, unbits_fx, 0, &uc_two_stage_flag, 0, 0, - st_fx->idchan, st_fx->active_cnt, tdm_Pitch_reuse_flag, st_fx->tdm_LRTD_flag, st_fx->GSC_IVAS_mode ); -#endif /* redo LSF quantization */ lsf_enc_fx( st_fx, lsf_new_fx, lsp_new_fx, lsp_mid_fx, Aq_fx, st_fx->Nb_ACELP_frames, tdm_low_rate_mode, st_fx->GSC_IVAS_mode, Q_new ); @@ -1186,11 +1166,7 @@ ivas_error acelp_core_enc_ivas_fx( test(); IF( !nelp_mode && !ppp_mode ) { -#ifdef NONBE_1325_TD_STEREO_QUANT_LSF_SEC config_acelp1_fx( ENC, st->total_brate, st->core_brate, st->core, st->extl, st->extl_brate, st->L_frame, st->GSC_noisy_speech, &( st->acelp_cfg ), hBstr->nb_bits_tot, st->coder_type, st->inactive_coder_type_flag, tc_subfr, 0, &nb_bits, unbits, st->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); -#else - config_acelp1_fx( ENC, st->total_brate, st->core_brate, st->core, st->extl, st->extl_brate, st->L_frame, st->GSC_noisy_speech, &( st->acelp_cfg ), hBstr->nb_bits_tot, st->coder_type, st->inactive_coder_type_flag, tc_subfr, 0, &nb_bits, unbits, st->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, st->active_cnt, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); -#endif } /*-----------------------------------------------------------------* @@ -1238,21 +1214,14 @@ ivas_error acelp_core_enc_ivas_fx( ELSE { const Word16 *pt_interp_2_fx; -#ifndef NONBE_1325_TD_STEREO_QUANT_LSF_SEC - IF( NE_16( st->active_cnt, 1 ) ) - { -#endif - Word16 beta_index; - Word16 lsf_wgts_fx[M]; - - /* intra_frame prediction for the LSFs */ - lsp2lsf_fx( lsp_new, lsf_new_fx, M, 12800 ); - Unified_weighting_fx( &st->Bin_E_fx[L_FFT / 2], add( Q_new, ( QSCALE - 2 ) ), lsf_new_fx, lsf_wgts_fx, st->bwidth == NB, (Word16) EQ_16( st->coder_type, UNVOICED ), st->sr_core, M ); - tdm_SCh_lsf_reuse_fx( ENC, st->element_brate, lsf_new_fx, lsp_new, tdm_lsfQ_PCh, lsf_wgts_fx, &beta_index ); - push_indice( hBstr, IND_IC_LSF_PRED, beta_index, TDM_IC_LSF_PRED_BITS ); -#ifndef NONBE_1325_TD_STEREO_QUANT_LSF_SEC - } -#endif + Word16 beta_index; + Word16 lsf_wgts_fx[M]; + + /* intra_frame prediction for the LSFs */ + lsp2lsf_fx( lsp_new, lsf_new_fx, M, 12800 ); + Unified_weighting_fx( &st->Bin_E_fx[L_FFT / 2], add( Q_new, ( QSCALE - 2 ) ), lsf_new_fx, lsf_wgts_fx, st->bwidth == NB, (Word16) EQ_16( st->coder_type, UNVOICED ), st->sr_core, M ); + tdm_SCh_lsf_reuse_fx( ENC, st->element_brate, lsf_new_fx, lsp_new, tdm_lsfQ_PCh, lsf_wgts_fx, &beta_index ); + push_indice( hBstr, IND_IC_LSF_PRED, beta_index, TDM_IC_LSF_PRED_BITS ); pt_interp_2_fx = interpol_frac_12k8_fx; @@ -1327,11 +1296,7 @@ ivas_error acelp_core_enc_ivas_fx( { tc_classif_enc_fx( Q_new, st->L_frame, &tc_subfr, &position, attack_flag, st->pitch[0], res_fx ); -#ifdef NONBE_1325_TD_STEREO_QUANT_LSF_SEC config_acelp1_fx( ENC, st->total_brate, st->core_brate, st->core, st->extl, st->extl_brate, st->L_frame, -1, &( st->acelp_cfg ), hBstr->nb_bits_tot, TRANSITION, -1, tc_subfr, 1, NULL, unbits, st->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); -#else - config_acelp1_fx( ENC, st->total_brate, st->core_brate, st->core, st->extl, st->extl_brate, st->L_frame, -1, &( st->acelp_cfg ), hBstr->nb_bits_tot, TRANSITION, -1, tc_subfr, 1, NULL, unbits, st->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, st->active_cnt, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); -#endif } /*---------------------------------------------------------------* @@ -1390,11 +1355,7 @@ ivas_error acelp_core_enc_ivas_fx( lsf_syn_mem_restore_ivas_fx( st, tilt_code_bck_fx, gc_threshold_bck_fx, clip_var_bck_fx, next_force_sf_bck, lsp_new, lsp_mid, clip_var_fx, mem_AR_fx, mem_MA_fx, lsp_new_bck_fx, lsp_mid_bck_fx, Bin_E_fx, Bin_E_old_fx, mem_syn_bck_fx, mem_w0_bck_fx, streaklimit_fx, pstreaklen ); /* Configure ACELP bit allocation */ -#ifdef NONBE_1325_TD_STEREO_QUANT_LSF_SEC config_acelp1_fx( ENC, st->total_brate, st->core_brate, st->core, st->extl, st->extl_brate, st->L_frame, -1, &( st->acelp_cfg ), hBstr->nb_bits_tot, st->coder_type, st->inactive_coder_type_flag, tc_subfr, 0, &nb_bits, unbits, 0, &uc_two_stage_flag, 0, 0, st->idchan, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); -#else - config_acelp1_fx( ENC, st->total_brate, st->core_brate, st->core, st->extl, st->extl_brate, st->L_frame, -1, &( st->acelp_cfg ), hBstr->nb_bits_tot, st->coder_type, st->inactive_coder_type_flag, tc_subfr, 0, &nb_bits, unbits, 0, &uc_two_stage_flag, 0, 0, st->idchan, st->active_cnt, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); -#endif /* redo LSF quantization */ lsf_enc_ivas_fx( st, lsf_new_fx, lsp_new, lsp_mid, Aq, tdm_low_rate_mode, 0, NULL, Q_new ); diff --git a/lib_enc/acelp_core_switch_enc_fx.c b/lib_enc/acelp_core_switch_enc_fx.c index 1854b2875afeccd5ed2b3dff9b683f0c2e1431f9..7ab5492f728a3182109eb3806060f42e75ccaed8 100644 --- a/lib_enc/acelp_core_switch_enc_fx.c +++ b/lib_enc/acelp_core_switch_enc_fx.c @@ -134,13 +134,8 @@ void acelp_core_switch_enc_fx( * Excitation encoding *----------------------------------------------------------------*/ -#ifdef NONBE_1325_TD_STEREO_QUANT_LSF_SEC config_acelp1_fx( ENC, st_fx->total_brate, cbrate, st_fx->core, -1, -1, st_fx->last_L_frame, -1, &( st_fx->acelp_cfg ), hBstr->nb_bits_tot, GENERIC, st_fx->inactive_coder_type_flag, -1, -1, &j, &i, st_fx->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st_fx->idchan, 0 /*tdm_Pitch_reuse_flag*/, 0, 0 /*GSC_IVAS_mode*/ ); -#else - config_acelp1_fx( ENC, st_fx->total_brate, cbrate, st_fx->core, -1, -1, st_fx->last_L_frame, -1, &( st_fx->acelp_cfg ), hBstr->nb_bits_tot, - GENERIC, st_fx->inactive_coder_type_flag, -1, -1, &j, &i, st_fx->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st_fx->idchan, st_fx->active_cnt, 0 /*tdm_Pitch_reuse_flag*/, 0, 0 /*GSC_IVAS_mode*/ ); -#endif encod_gen_voic_core_switch_fx( st_fx, st_fx->last_L_frame, inp, Aq, A, T_op, exc, cbrate, shift, Q_new ); @@ -249,12 +244,7 @@ void acelp_core_switch_enc_ivas_fx( * Excitation encoding *----------------------------------------------------------------*/ -#ifdef NONBE_1325_TD_STEREO_QUANT_LSF_SEC config_acelp1_fx( ENC, st_fx->total_brate, cbrate, st_fx->core, -1, -1, st_fx->last_L_frame, -1, &( st_fx->acelp_cfg ), hBstr->nb_bits_tot, GENERIC, st_fx->inactive_coder_type_flag, -1, -1, &j, &i, st_fx->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st_fx->idchan, 0 /*tdm_Pitch_reuse_flag*/, 0, 0 /*GSC_IVAS_mode*/ ); -#else - config_acelp1_fx( ENC, st_fx->total_brate, cbrate, st_fx->core, -1, -1, st_fx->last_L_frame, -1, &( st_fx->acelp_cfg ), hBstr->nb_bits_tot, - GENERIC, st_fx->inactive_coder_type_flag, -1, -1, &j, &i, st_fx->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st_fx->idchan, st_fx->active_cnt, 0 /*tdm_Pitch_reuse_flag*/, 0, 0 /*GSC_IVAS_mode*/ ); -#endif encod_gen_voic_core_switch_ivas_fx( st_fx, st_fx->last_L_frame, inp, Aq, A, T_op, exc, cbrate, shift, Q_new ); @@ -413,7 +403,7 @@ static void encod_gen_voic_core_switch_fx( set16_fx( dummyF, -1, NB_SUBFR16k ); /* hack to signal ACELP->HQ switching frame */ pitch = pit_encode_fx( hBstr, st_fx->acelp_cfg.pitch_bits, core_bitrate, 0, L_frame, GENERIC, &pitch_limit_flag, 0, exc, L_SUBFR, T_op, &T0_min, &T0_max, &T0, &T0_frac, h1, xn, 0 /*hStereoTD->tdm_Pitch_reuse_flag*/, dummyF /*hStereoTD->tdm_Pri_pitch_buf*/ -#if defined REUSE_EVS_BE_ACELP_PITCH && !defined REUSE_EVS_ACELP_PITCH_NORM_CORR +#if !defined REUSE_EVS_ACELP_PITCH_NORM_CORR , st_fx->element_mode, Q_new #endif @@ -623,18 +613,13 @@ static void encod_gen_voic_core_switch_ivas_fx( * Adaptive exc. construction *----------------------------------------------------------------*/ set16_fx( dummyF, -1, NB_SUBFR16k ); /* hack to signal ACELP->HQ switching frame */ -#ifndef REUSE_EVS_BE_ACELP_PITCH - pitch = pit_encode_ivas_fx( hBstr, - st_fx->acelp_cfg.pitch_bits, core_bitrate, 0, L_frame, GENERIC, &pitch_limit_flag, 0, exc, L_SUBFR, T_op, &T0_min, &T0_max, &T0, &T0_frac, h1, xn, 0 /*hStereoTD->tdm_Pitch_reuse_flag*/, dummyF /*hStereoTD->tdm_Pri_pitch_buf*/, Q_new ); /* Q6 */ -#else pitch = pit_encode_fx( hBstr, st_fx->acelp_cfg.pitch_bits, core_bitrate, 0, L_frame, GENERIC, &pitch_limit_flag, 0, exc, L_SUBFR, T_op, &T0_min, &T0_max, &T0, &T0_frac, h1, xn, 0 /*hStereoTD->tdm_Pitch_reuse_flag*/, dummyF /*hStereoTD->tdm_Pri_pitch_buf*/ -#if defined REUSE_EVS_BE_ACELP_PITCH && !defined REUSE_EVS_ACELP_PITCH_NORM_CORR +#if !defined REUSE_EVS_ACELP_PITCH_NORM_CORR , st_fx->element_mode, Q_new #endif - ); /* Q6 */ -#endif + ); /* Q6 */ /*-----------------------------------------------------------------* * Find adaptive exitation *-----------------------------------------------------------------*/ @@ -651,13 +636,9 @@ static void encod_gen_voic_core_switch_ivas_fx( /*-----------------------------------------------------------------* * LP filtering of the adaptive excitation, codebook target computation *-----------------------------------------------------------------*/ - lp_flag = st_fx->acelp_cfg.ltf_mode; /* Q0 */ - Scale_sig( h1, L_SUBFR, sub( 14, q_h1 ) ); /* set h1[] in Q14 with scaling for convolution Q14+shift*/ -#ifdef REUSE_EVS_BE_ACELP_LP_FILT + lp_flag = st_fx->acelp_cfg.ltf_mode; /* Q0 */ + Scale_sig( h1, L_SUBFR, sub( 14, q_h1 ) ); /* set h1[] in Q14 with scaling for convolution Q14+shift*/ lp_select = lp_filt_exc_enc_fx( MODE1, GENERIC, 0, exc, h1, xn, y1, xn2, L_SUBFR, L_frame, g_corr, clip_gain, &gain_pit, &lp_flag ); /* Q0 */ -#else - lp_select = lp_filt_exc_enc_ivas_fx( MODE1, GENERIC, 0, exc, h1, xn, y1, xn2, L_SUBFR, L_frame, g_corr, clip_gain, &gain_pit, &lp_flag ); /* Q0 */ -#endif IF( EQ_16( lp_flag, NORMAL_OPERATION ) ) { push_indice( hBstr, IND_LP_FILT_SELECT, lp_select, 1 ); @@ -673,18 +654,6 @@ static void encod_gen_voic_core_switch_ivas_fx( /*-----------------------------------------------------------------* * Gain encoding *-----------------------------------------------------------------*/ -#ifndef REUSE_EVS_BE_GAINQ - IF( EQ_16( L_frame, L_FRAME ) ) - { - gain_enc_mless_ivas_fx( hBstr, st_fx->acelp_cfg.gains_mode, st_fx->element_mode, L_frame, 0, -1, xn, y1, shift_wsp, y2, code, st_fx->old_Es_pred_fx, - &gain_pit, &gain_code, &gain_inov, &norm_gain_code, g_corr, clip_gain ); - } - ELSE - { - gain_enc_mless_ivas_fx( hBstr, st_fx->acelp_cfg.gains_mode, st_fx->element_mode, L_frame, 0, -1, xn, y1, shift_wsp, y2, code, st_fx->old_Es_pred_fx, - &gain_pit, &gain_code, &gain_inov, &norm_gain_code, g_corr, clip_gain ); - } -#else IF( EQ_16( L_frame, L_FRAME ) ) { gain_enc_mless_fx( hBstr, st_fx->acelp_cfg.gains_mode, st_fx->element_mode, L_frame, 0, -1, xn, y1, shift_wsp, y2, code, st_fx->old_Es_pred_fx, @@ -695,7 +664,6 @@ static void encod_gen_voic_core_switch_ivas_fx( gain_enc_mless_fx( hBstr, st_fx->acelp_cfg.gains_mode, st_fx->element_mode, L_frame, 0, -1, xn, y1, shift_wsp, y2, code, st_fx->old_Es_pred_fx, &gain_pit, &gain_code, &gain_inov, &norm_gain_code, g_corr, clip_gain ); } -#endif gp_clip_test_gain_pit_fx( st_fx->element_mode, core_bitrate, gain_pit, st_fx->clip_var_fx ); Lgcode = L_shl( gain_code, Q_new ); /* scaled gain_code with Qnew -> Q16*/ diff --git a/lib_enc/arith_coder_enc_fx.c b/lib_enc/arith_coder_enc_fx.c index 2e88b1f00e95a70547bf733cd212fb8184e110a8..bb02c3001f99d9ba4edc2cec3fd80417ffff0561 100644 --- a/lib_enc/arith_coder_enc_fx.c +++ b/lib_enc/arith_coder_enc_fx.c @@ -367,12 +367,6 @@ static Word16 tcx_arith_rateloop( Word32 L_tmp; Word16 tmp, tmp3; Word32 tmp2; -#ifndef ISSUE_1796_replace_shl_o -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif scale = tcx_arith_estimate_scale( abs_spectrum, abs_spectrum_e, L_frame, envelope, envelope_e, &tmp ); @@ -381,11 +375,7 @@ static Word16 tcx_arith_rateloop( scale_max = tcx_arith_find_max_scale( abs_spectrum, abs_spectrum_e, L_frame, envelope, envelope_e, exps, deadzone, scale_e ); -#ifdef ISSUE_1796_replace_shl_o scale = shl_sat( scale, sub( tmp, *scale_e ) ); -#else - scale = shl_o( scale, sub( tmp, *scale_e ), &Overflow ); -#endif scale = s_min( scale, scale_max ); scale_best = scale; @@ -446,11 +436,7 @@ static Word16 tcx_arith_rateloop( { /* Update estimator temporal compensation factor */ tmp = BASOP_Util_Divide3232_Scale( L_mult0( target_bits, 1 << 9 ), bits, &s ); -#ifdef ISSUE_1796_replace_shl_o tmp = shl_sat( mult_r( *target_bits_fac, tmp ), s ); -#else - tmp = shl_o( mult_r( *target_bits_fac, tmp ), s, &Overflow ); -#endif tmp = s_min( tmp, 20480 /*1.25f Q14*/ ); tmp = s_max( tmp, 12288 /*0.75f Q14*/ ); *target_bits_fac = tmp; @@ -480,16 +466,8 @@ static Word16 tcx_arith_rateloop( { /* adjust = 1.25f * target_bits / (float)bits; */ tmp = BASOP_Util_Divide3232_Scale( L_mult0( target_bits, 0x280 ), bits, &s ); -#ifdef ISSUE_1796_replace_shl_o adjust = shl_sat( tmp, sub( s, 1 ) ); /* Q14 */ -#else - adjust = shl_o( tmp, sub( s, 1 ), &Overflow ); /* Q14 */ -#endif -#ifdef ISSUE_1796_replace_shl_o scale = shl_sat( mult_r( scale, adjust ), 1 ); -#else - scale = shl_o( mult_r( scale, adjust ), 1, &Overflow ); -#endif scale = s_min( scale, scale_max ); } } diff --git a/lib_enc/avq_cod_fx.c b/lib_enc/avq_cod_fx.c index 27f385b5212555271c38a3a432c1a3c4659642f6..31de693283422167ee0d765f33cdb8fbe0a773ca 100644 --- a/lib_enc/avq_cod_fx.c +++ b/lib_enc/avq_cod_fx.c @@ -14,9 +14,6 @@ * Local prototypes *-------------------------------------------------------------------*/ static void wrte_cv( BSTR_ENC_HANDLE hBstr, const Word16 nq, const Word16 i_ind, const Word16 kv_ind, UWord16 I, Word16 kv[], Word16 *bits ); -#ifndef REUSE_EVS_BE_ACELP_AVQ -static void wrte_cv_ivas_fx( BSTR_ENC_HANDLE hBstr, const Word16 nq, const Word16 i_ind, const Word16 kv_ind, UWord16 I, Word16 kv[], Word16 *bits ); -#endif /*-------------------------------------------------------------------* * Function AVQ_cod() * * * @@ -183,9 +180,7 @@ void AVQ_encmux_fx( Word16 bitsMod, Nsvm1, Nsvm2; Word16 unusedbitsFlag; Word16 svOrder[NSV_MAX], k, nullVec, dummy_bits; -#ifdef REUSE_EVS_BE_ACELP_AVQ Word16 tmp; -#endif test(); IF( EQ_16( extl, SWB_BWE_HIGHRATE ) || EQ_16( extl, FB_BWE_HIGHRATE ) ) { @@ -347,7 +342,6 @@ void AVQ_encmux_fx( test(); test(); test(); -#ifdef REUSE_EVS_BE_ACELP_AVQ tmp = bits; move16(); WHILE( GE_16( tmp, 5 ) ) @@ -357,9 +351,6 @@ void AVQ_encmux_fx( assert( tmp == bits % 5 ); IF( EQ_16( avq_bit_sFlag, 2 ) && EQ_16( tmp, 4 ) && GT_16( bits, 8 ) && LT_16( bits, 30 ) && GE_16( k, trgtSvPos ) && LT_16( i, Nsvm1 ) ) -#else - IF( EQ_16( avq_bit_sFlag, 2 ) && EQ_16( s_and( bits, 4 ), 4 ) && GT_16( bits, 8 ) && LT_16( bits, 30 ) && GE_16( k, trgtSvPos ) && LT_16( i, Nsvm1 ) ) -#endif { ordr_esti( sub( Nsv, i ), &trgtSvPos, &svOrder[i], Nsv ); k = svOrder[i]; @@ -423,10 +414,6 @@ void AVQ_encmux_fx( test(); IF( avq_bit_sFlag > 0 && GT_16( bits, 8 ) ) { -#ifndef REUSE_EVS_BE_ACELP_AVQ - // PMT("code not validated yet") - bitsMod = s_and( bits, 4 /*bits%5*/ ); -#else /* bitsMod = bits % 5;*/ bitsMod = bits; move16(); @@ -435,7 +422,6 @@ void AVQ_encmux_fx( bitsMod = sub( bitsMod, 5 ); } assert( bitsMod == bits % 5 ); -#endif i = svOrder[Nsvm1]; move16(); IF( NE_16( i, Nsvm1 ) ) @@ -471,15 +457,10 @@ void AVQ_encmux_fx( bitsMod = 0; move16(); } -#ifdef REUSE_EVS_BE_ACELP_AVQ ELSE IF( GT_16( nq_est, 4 ) && ( ( bitsMod == 0 && GT_16( nullVec, 3 ) && LT_16( nullVec, 6 ) ) || ( EQ_16( bitsMod, 4 ) && EQ_16( nullVec, 5 ) ) ) && nq[svOrder[Nsvm2]] == 0 ) /* wasted bits 4, 5 for nq 6,7..*/ -#else - ELSE IF( nq_est > 4 && ( ( bitsMod == 0 && GT_16( nullVec, 3 ) && GT_16( nullVec, 6 ) ) || ( EQ_16( bitsMod, 4 ) && EQ_16( nullVec, 5 ) ) ) && nq[svOrder[Nsvm2]] == 0 ) /* wasted bits 4, 5 for nq 6,7..*/ -#endif { overflow = 0; move16(); -#ifdef REUSE_EVS_BE_ACELP_AVQ tmp = add( bitsMod, nullVec ); WHILE( tmp >= 5 ) { @@ -487,9 +468,6 @@ void AVQ_encmux_fx( } assert( tmp == add( bitsMod, nullVec ) % 5 ); if ( tmp != 0 ) -#else - if ( s_and( add( bitsMod, nullVec ), 4 ) != 0 ) -#endif { overflow = 1; move16(); @@ -516,7 +494,6 @@ void AVQ_encmux_fx( unused_bits = sub( unused_bits, 1 ); /*Stop Bit*/ } /*unused_bits_idx = (int16_t)unused_bits / 5;*/ -#ifdef REUSE_EVS_BE_ACELP_AVQ IF( unused_bits >= 0 ) { unused_bits_idx = mult( unused_bits, 6554 /*1/5 in Q15*/ ); @@ -525,9 +502,6 @@ void AVQ_encmux_fx( { unused_bits_idx = negate( mult( negate( unused_bits ), 6554 /*1/5 in Q15*/ ) ); } -#else - unused_bits_idx = mult( unused_bits, 6554 ); -#endif assert( unused_bits_idx == unused_bits / 5 ); unusedbitsFlag = 0; move16(); @@ -557,11 +531,7 @@ void AVQ_encmux_fx( IF( j > 0 ) { /* write the unary code */ -#ifdef REUSE_EVS_BE_ACELP_AVQ push_indice( hBstr, nq_ind, u_extract_l( L_sub( L_shl_sat( 1, j ), 1 ) ), j ); -#else - push_indice( hBstr, nq_ind, sub( shl( 1, j ), 1 ), j ); -#endif } IF( nq[i] != 0 ) @@ -613,434 +583,6 @@ void AVQ_encmux_fx( return; } -#ifndef REUSE_EVS_BE_ACELP_AVQ -void AVQ_encmux_ivas_fx( - BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */ - const Word16 extl, /* i : extension layer */ - Word16 xriq[], /* i/o: rounded subvectors [0..8*Nsv-1] followed - by rounded bit allocations [8*Nsv..8*Nsv+Nsv-1] */ - Word16 *nb_bits, /* i/o: number of allocated bits */ - const Word16 Nsv, /* i: number of subvectors */ - Word16 nq_out[], /* o : AVQ nq index */ - Word16 avq_bit_sFlag, /* i : flag for AVQ bit saving solution */ - Word16 trgtSvPos /* i : target SV for AVQ bit savings */ -) -{ - Word16 i, j = 0, bits, pos, pos_max, overflow, pos_tmp, bit_tmp; - Word16 sort_idx[NSV_MAX], nq[NSV_MAX], kv[NSV_MAX * 8]; - Word16 *t; - UWord16 I[NSV_MAX]; - Word16 nq_ind, i_ind, kv_ind; - Word16 nq_est, unused_bits, unused_bits_idx; - Word16 bitsMod, Nsvm1, Nsvm2; - Word16 unusedbitsFlag; - Word16 svOrder[NSV_MAX], k, nullVec, dummy_bits; - Word16 tmp; - - test(); - IF( EQ_16( extl, SWB_BWE_HIGHRATE ) || EQ_16( extl, FB_BWE_HIGHRATE ) ) - { - nq_ind = IND_NQ2; - move16(); - i_ind = IND_I2; - move16(); - kv_ind = IND_KV2; - move16(); - } - ELSE - { - nq_ind = IND_NQ; - move16(); - i_ind = IND_I; - move16(); - kv_ind = IND_KV; - move16(); - } - - FOR( i = 0; i < NSV_MAX; i++ ) - { - I[i] = (UWord16) -1; - move16(); - } - unusedbitsFlag = 0; - bitsMod = 0; - move16(); - move16(); - /*----------------------------------------------------------------- - * Encode subvectors and fix possible overflows in total bit budget, - * i.e. find for each subvector a codebook index nq (nq=0,2,3,4,...,NSV_MAX), - * a base codebook index (I), and a Voronoi index (kv) - *-----------------------------------------------------------------*/ - - /* sort subvectors by estimated bit allocations in decreasing order */ - t = kv; - /* reuse vector to save memory */ - /*ptr init*/ - FOR( i = 0; i < Nsv; i++ ) - { - t[i] = xriq[8 * Nsv + i]; - move16(); - } - - FOR( i = 0; i < Nsv; i++ ) - { - bits = t[0]; - move16(); - pos = 0; - move16(); - FOR( j = 1; j < Nsv; j++ ) - { - if ( GT_16( t[j], bits ) ) - { - pos = j; - move16(); - } - bits = s_max( t[j], bits ); - } - sort_idx[i] = pos; - move16(); - t[pos] = -1; - move16(); - } - - /* compute multi-rate indices and avoid bit budget overflow */ - pos_max = 0; - move16(); - bits = 0; - move16(); - FOR( i = 0; i < Nsv; i++ ) - { - /* find vector to quantize (criteria: nb of estimated bits) */ - pos = sort_idx[i]; - move16(); - - /* compute multi-rate index of rounded subvector (nq,I,kv[]) */ - re8_cod_fx( &xriq[pos * 8], &nq[pos], &I[pos], &kv[8 * pos] ); - - IF( nq[pos] > 0 ) - { - j = pos_max; - move16(); - j = s_max( pos, j ); - - /* compute (number of bits -1) to describe Q #nq */ - IF( GE_16( nq[pos], 2 ) ) - { - overflow = sub( i_mult2( nq[pos], 5 ), 1 ); - } - ELSE - { - overflow = 0; - move16(); - } - - /* check for overflow and compute number of bits-1 (n) */ - IF( GT_16( add( bits, add( overflow, j ) ), *nb_bits ) ) - { - /* if budget overflow */ - pos_tmp = add( shl( pos, 3 ), 8 ); /*(pos*8)+8*/ - FOR( j = pos * 8; j < pos_tmp; j++ ) - { - xriq[j] = 0; - move16(); - } - nq[pos] = 0; - move16(); /* force Q0 */ - } - ELSE - { - bits = add( bits, overflow ); - pos_max = j; - move16(); /* update index of the last described subvector */ - } - } - } - nullVec = 0; - Nsvm1 = sub( Nsv, 1 ); - Nsvm2 = sub( Nsvm1, 1 ); - dummy_bits = 0; - svOrder[Nsvm1] = trgtSvPos; - svOrder[0] = 0; - svOrder[1] = 1; - i = 2; - j = i; - move16(); - move16(); - move16(); - move16(); - move16(); - move16(); - move16(); - if ( EQ_16( avq_bit_sFlag, 2 ) ) - { - j = add( i, 1 ); - } - WHILE( LT_16( i, Nsvm1 ) ) - { - svOrder[i] = j; - move16(); - i++; /*ptr*/ - j = add( j, 1 ); - } - /* write indexes to the bitstream */ - /* ============================== */ - - bits = *nb_bits; - move16(); - overflow = 0; - move16(); - FOR( i = 0; i < Nsv; i++ ) - { - k = svOrder[i]; - move16(); - test(); - test(); - test(); - test(); - test(); - tmp = bits; - move16(); - WHILE( GE_16( tmp, 5 ) ) - { - tmp = sub( tmp, 5 ); - } - assert( tmp == bits % 5 ); - IF( EQ_16( avq_bit_sFlag, 2 ) && EQ_16( tmp, 4 ) && GT_16( bits, 8 ) && LT_16( bits, 30 ) && GE_16( k, trgtSvPos ) && LT_16( i, Nsvm1 ) ) - { - ordr_esti( sub( Nsv, i ), &trgtSvPos, &svOrder[i], Nsv ); - k = svOrder[i]; - move16(); - avq_bit_sFlag = 1; - move16(); - } - - test(); - IF( EQ_16( k, trgtSvPos ) && avq_bit_sFlag > 0 ) - { - test(); - test(); - IF( EQ_16( sub( *nb_bits, bits ), 7 ) || LT_16( bits, BIT_SAVING_LOW_THR ) || GE_16( bits, BIT_SAVING_HIGH_THR ) ) - { - avq_bit_sFlag = 0; - move16(); - } - ELSE - { - BREAK; - } - } - - if ( EQ_16( sub( i_mult2( 5, nq[k] ), 1 ), bits ) ) /* check the overflow */ - { - overflow = 1; - move16(); - } - - IF( GT_16( bits, 8 ) ) - { - /* write the unary code for nq[i] */ - j = sub( nq[k], 1 ); - IF( nq[k] > 0 ) - { - /* write the unary code */ - FOR( ; j > 16; j -= 16 ) - { - push_indice( hBstr, nq_ind, 65535, 16 ); - bits = sub( bits, 16 ); - } - - IF( j > 0 ) - { - push_indice( hBstr, nq_ind, extract_l( L_sub( L_shl( 1L, j ), 1L ) ), j ); - bits = sub( bits, j ); - } - } - IF( !overflow ) - { - /* write the stop bit */ - push_indice( hBstr, nq_ind, 0, 1 ); - bits = sub( bits, 1 ); - } - - wrte_cv( hBstr, nq[k], i_ind, kv_ind, I[k], &kv[k * 8], &bits ); - } - } /* for */ - /* Bit Saving Solution */ - test(); - IF( avq_bit_sFlag > 0 && GT_16( bits, 8 ) ) - { - // PMT("code not validated yet") - // bitsMod = bits%5; - bitsMod = bits; - move16(); - WHILE( bitsMod >= 5 ) - { - bitsMod = sub( bitsMod, 5 ); - } - assert( bitsMod == bits % 5 ); - i = svOrder[Nsvm1]; - move16(); - IF( NE_16( i, Nsvm1 ) ) - { - nullVec = 0; - move16(); - FOR( j = i; j < Nsv - 1; j++ ) - { - IF( nq[svOrder[j]] == 0 ) - { - nullVec = add( nullVec, 1 ); - } - } - /*nq_est = bits / 5;*/ - nq_est = mult( bits, 6554 /*1/5 in Q15*/ ); - assert( nq_est == bits / 5 ); - - test(); - test(); - test(); - test(); - test(); - test(); - test(); - test(); - test(); - test(); - - IF( ( bitsMod > 0 || ( EQ_16( nullVec, 4 ) && EQ_16( nq_est, 5 ) ) ) && NE_16( bitsMod, 4 ) && GE_16( add( bits, nullVec ), add( add( shl( nq_est, 2 ), nq_est ), 4 ) ) /*5 * nq_est + 4*/ && nq[svOrder[Nsvm2]] == 0 ) /* detect need for dummy bits */ - { - dummy_bits = sub( 5, bitsMod ); - bits = add( bits, dummy_bits ); /* add dummy bits */ - bitsMod = 0; - move16(); - } - ELSE IF( GT_16( nq_est, 4 ) && ( ( bitsMod == 0 && GT_16( nullVec, 3 ) && LT_16( nullVec, 6 ) ) || ( EQ_16( bitsMod, 4 ) && EQ_16( nullVec, 5 ) ) ) && nq[svOrder[Nsvm2]] == 0 ) /* wasted bits 4, 5 for nq 6,7..*/ - { - overflow = 0; - move16(); - tmp = add( bitsMod, nullVec ); - WHILE( tmp >= 5 ) - { - tmp = sub( tmp, 5 ); - } - assert( tmp == add( bitsMod, nullVec ) % 5 ); - if ( tmp != 0 ) - { - overflow = 1; - move16(); - } - dummy_bits = add( nullVec, overflow ); - bits = add( bits, dummy_bits ); /* add dummy bits */ - bitsMod = 0; - move16(); - } - } - - overflow = 1; - move16(); - IF( NE_16( bitsMod, 4 ) ) - { - overflow = 0; - move16(); - bits = sub( bits, bitsMod ); - } - bits = add( bits, overflow ); /*add fake bit */ - unused_bits = sub( bits, add( shl( nq[i], 2 ), nq[i] ) ); - IF( nq[i] == 0 ) /*no bit savings*/ - { - unused_bits = sub( unused_bits, 1 ); /*Stop Bit*/ - } - /*unused_bits_idx = (int16_t)unused_bits / 5;*/ - IF( unused_bits >= 0 ) - { - unused_bits_idx = mult( unused_bits, 6554 /*1/5 in Q15*/ ); - } - ELSE - { - unused_bits_idx = negate( mult( negate( unused_bits ), 6554 /*1/5 in Q15*/ ) ); - } - assert( unused_bits_idx == unused_bits / 5 ); - unusedbitsFlag = 0; - move16(); - IF( dummy_bits == 0 ) - { - test(); - test(); - IF( EQ_16( unused_bits_idx, 1 ) && GT_16( bits, BIT_SAVING_LOW_THR ) ) - { - unused_bits_idx = 0; - unusedbitsFlag = 1; - move16(); - move16(); - } - ELSE IF( unused_bits_idx == 0 && GT_16( bits, BIT_SAVING_LOW_THR ) ) - { - unused_bits_idx = 1; - unusedbitsFlag = -1; - move16(); - move16(); - } - } - - j = unused_bits_idx; - move16(); - /*Encode Unused Bit Unary Codeword */ - IF( j > 0 ) - { - /* write the unary code */ - push_indice( hBstr, nq_ind, u_extract_l( L_sub( L_shl_sat( 1, j ), 1 ) ), j ); - assert( abs( ( 1 << j ) - 1 ) <= 65536 ); - } - - IF( nq[i] != 0 ) - { - /* write the stop bit */ - push_indice( hBstr, nq_ind, 0, 1 ); - } - - /*Compute AVQ code book number from unused Bits */ - bit_tmp = add( unusedbitsFlag, unused_bits_idx ); - /*nq_est = (int16_t)ceil(0.2f * (bits - 5 * (unusedbitsFlag + unused_bits_idx)));*/ - nq_est = mult( 6554 /*.2 in Q15*/, sub( bits, add( shl( bit_tmp, 2 ), bit_tmp ) ) ); - assert( (Word16) ceil( 0.2f * ( bits - 5 * ( unusedbitsFlag + unused_bits_idx ) ) ) == nq_est ); - - if ( EQ_16( nq_est, 1 ) ) - { - nq_est = 0; - move16(); - } - bits = sub( bits, overflow ); - - bits = sub( bits, j ); - - IF( nq_est != 0 ) - { - bits = sub( bits, 1 ); - } - nq[i] = nq_est; - move16(); - - /* write codebook indices (rank I and event. Voronoi index kv) */ - wrte_cv( hBstr, nq[i], i_ind, kv_ind, I[i], &kv[i * 8], &bits ); - - bits = sub( bits, dummy_bits ); - - IF( NE_16( bitsMod, 4 ) ) - { - bits = add( bits, bitsMod ); - } - } - *nb_bits = bits; - move16(); - - FOR( i = 0; i < Nsv; i++ ) - { - nq_out[i] = nq[i]; - move16(); - } - - return; -} -#endif /*-------------------------------------------------------------------* * Function AVQ_cod_lpc_fx() * * * @@ -1189,64 +731,3 @@ static void wrte_cv( move16(); return; } -#ifndef REUSE_EVS_BE_ACELP_AVQ -static void wrte_cv_ivas_fx( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - const Word16 nq, /* i : AVQ nq index */ - const Word16 i_ind, /* i : Base Bitstream index */ - const Word16 kv_ind, /* i : Vornoi Bitstream index */ - UWord16 I, /* o : rank I code book index */ - Word16 kv[], /* o : Vornoi index kv */ - Word16 *nbits /* i/o: bits */ -) -{ - Word16 pos, j; - Word16 bits, nq4; - - bits = *nbits; - move16(); - - /* write codebook indices (rank I and event. Voronoi index kv) */ - IF( nq == 0 ) /* Q0 */ - { - /* nothing to write */ - } - ELSE IF( LT_16( nq, 5 ) ) /* Q2, Q3, Q4 */ - { - nq4 = shl( nq, 2 ); - push_indice( hBstr, i_ind, I, nq4 ); - bits = sub( bits, nq4 ); - } - ELSE IF( EQ_16( s_and( nq, 1 ), 0 ) ) /* Q4 + Voronoi extensions r=1,2,3,... */ - { - push_indice( hBstr, i_ind, I, 4 * 4 ); - bits = sub( bits, 4 * 4 ); - /*pos = (int16_t)(nq / 2 - 2);*/ /* Voronoi order determination */ - pos = sub( shr( nq, 1 ), 2 ); - FOR( j = 0; j < 8; j++ ) - { - push_indice( hBstr, kv_ind, kv[j], pos ); - } - - bits = sub( bits, shl( pos, 3 ) ); - } - ELSE /* Q3 + Voronoi extensions r=1,2,3,... */ - { - push_indice( hBstr, i_ind, I, 4 * 3 ); - bits = sub( bits, 4 * 3 ); - - /*pos = (int16_t)(nq / 2 - 1);*/ /* Voronoi order determination */ - pos = sub( shr( nq, 1 ), 1 ); - FOR( j = 0; j < 8; j++ ) - { - push_indice( hBstr, kv_ind, kv[j], pos ); - } - - bits = sub( bits, shl( pos, 3 ) ); - } - - *nbits = bits; - move16(); - return; -} -#endif diff --git a/lib_enc/bass_psfilter_enc_fx.c b/lib_enc/bass_psfilter_enc_fx.c index f417a09048b6d84974166cece0c39ac3eb9ca33d..15421594a35655eba9f85a3a9fb972235026ea13 100644 --- a/lib_enc/bass_psfilter_enc_fx.c +++ b/lib_enc/bass_psfilter_enc_fx.c @@ -129,11 +129,7 @@ Word16 bass_pf_enc_fx( /* gain = tmp/nrg; */ gain = BASOP_Util_Divide3232_Scale( tmp, nrg, &tmp16 ); BASOP_SATURATE_WARNING_OFF_EVS; -#ifdef ISSUE_1796_replace_shl_o gain = shl_sat( gain, tmp16 ); /* Q15 */ -#else - gain = shl_o( gain, tmp16, &Overflow ); /* Q15 */ -#endif BASOP_SATURATE_WARNING_ON_EVS; if ( gain < 0 ) @@ -214,11 +210,7 @@ Word16 bass_pf_enc_fx( tmp32 = L_deposit_l( 1 ); tmp16 = BASOP_Util_Divide3232_Scale( tmp, tmp32, &st ); BASOP_SATURATE_WARNING_OFF_EVS; -#ifdef ISSUE_1796_replace_shl_o tmp16 = shl_sat( tmp16, sub( st, 2 ) ); /* Q15 */ -#else - tmp16 = shl_o( tmp16, sub( st, 2 ), &Overflow ); /* Q15 */ -#endif if ( GT_16( tmp16, 16384 /*0.5f Q15*/ ) ) { diff --git a/lib_enc/cod2t32_fx.c b/lib_enc/cod2t32_fx.c index e3761618250f513adde23630047a530f3b6f13b5..5c3684429219ea5042ee5ccf5c034765eba522d0 100644 --- a/lib_enc/cod2t32_fx.c +++ b/lib_enc/cod2t32_fx.c @@ -296,279 +296,6 @@ void acelp_2t32_fx( } return; } -#ifndef REUSE_EVS_BE_ACELP_2t32 -void acelp_2t32_ivas_fx( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - const Word16 dn[], /* i : corr. between target and h[]. Qx*/ - const Word16 h[], /* i : impulse response of weighted synthesis filter Q12*/ - Word16 code[], /* o : algebraic (fixed) codebook excitation Q9 */ - Word16 y[] /* o : filtered fixed codebook excitation Q9 */ -) -{ - Word16 i, j, k, i0, i1, ix, iy, pos, pos2, sign0, sign1, index; - Word16 ps1, ps2, alpk, alp1, alp2; - Word16 sq, psk; - Word16 pol[L_SUBFR], dn_p[L_SUBFR]; - Word16 ii, jj; - Word16 *p0, *p1, *p2; - const Word16 *ptr_h1, *ptr_h2, *ptr_hf; - - Word32 s, L_cor; - Word32 L_tmp; - Word16 rrixix[NB_TRACK_FCB_2T][NB_POS_FCB_2T]; - Word16 rrixiy[MSIZE]; -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif - /*----------------------------------------------------------------* - * Compute rrixix[][] needed for the codebook search. - *----------------------------------------------------------------*/ - - /* Init pointers to last position of rrixix[] */ - p0 = &rrixix[0][NB_POS_FCB_2T - 1]; - p1 = &rrixix[1][NB_POS_FCB_2T - 1]; - - ptr_h1 = h; - move16(); - L_cor = L_deposit_h( 1 ); - FOR( i = 0; i < NB_POS_FCB_2T; i++ ) - { - L_cor = L_mac_o( L_cor, *ptr_h1, *ptr_h1, &Overflow ); - ptr_h1++; - *p1-- = extract_h( L_cor ); - move16(); /*Q9 Q7*/ - L_cor = L_mac_o( L_cor, *ptr_h1, *ptr_h1, &Overflow ); - ptr_h1++; - *p0-- = extract_h( L_cor ); - move16(); /*Q9 Q7*/ - } - - p0 = rrixix[0]; - p1 = rrixix[1]; - - FOR( i = 0; i < NB_POS_FCB_2T; i++ ) - { - *p0 = shr( *p0, 1 ); - move16(); - p0++; - *p1 = shr( *p1, 1 ); - move16(); - p1++; - } - - /*------------------------------------------------------------* - * Compute rrixiy[][] needed for the codebook search. - *------------------------------------------------------------*/ - - pos = MSIZE - 1; - move16(); - pos2 = MSIZE - 2; - move16(); - ptr_hf = h + 1; - - FOR( k = 0; k < NB_POS_FCB_2T; k++ ) - { - /* Init pointers to last position of diagonals */ - p1 = &rrixiy[pos]; - p0 = &rrixiy[pos2]; - - ptr_h1 = h; - ptr_h2 = ptr_hf; - - L_cor = L_mult( *ptr_h1++, *ptr_h2++ ); // Q25 - FOR( i = k; i < NB_POS_FCB_2T - 1; i++ ) - { - *p1 = round_fx_o( L_cor, &Overflow ); // Q9 - L_cor = L_mac_o( L_cor, *ptr_h1++, *ptr_h2++, &Overflow ); - *p0 = round_fx_o( L_cor, &Overflow ); // Q9 - L_cor = L_mac_o( L_cor, *ptr_h1++, *ptr_h2++, &Overflow ); - move16(); - move16(); - p1 -= ( NB_POS_FCB_2T + 1 ); - p0 -= ( NB_POS_FCB_2T + 1 ); - } - - *p1 = round_fx_o( L_cor, &Overflow ); - pos -= NB_POS_FCB_2T; - move16(); - pos2 = sub( pos2, 1 ); - ptr_hf += STEP; - move16(); - } - - /*----------------------------------------------------------------* - * computing reference vector and pre-selection of polarities - *----------------------------------------------------------------*/ - - L_tmp = L_deposit_h( dn[0] ); - FOR( i = 0; i < L_SUBFR; i++ ) - { - /* FIR high-pass filtering */ - IF( i == 0 ) - { - L_tmp = L_msu( L_tmp, dn[1], 11469 /*.3f Q15*/ ); - } - ELSE IF( EQ_16( i, L_SUBFR - 1 ) ) - { - L_tmp = L_deposit_h( dn[i] ); - L_tmp = L_msu( L_tmp, dn[i - 1], 11469 /*.3f Q15*/ ); - } - ELSE - { - L_tmp = L_deposit_h( dn[i] ); - L_tmp = L_msu( L_tmp, dn[i - 1], 11469 /*.3f Q15*/ ); - L_tmp = L_msu( L_tmp, dn[i + 1], 11469 /*.3f Q15*/ ); - } - - /* pre-selection of polarities */ - IF( L_tmp >= 0 ) - { - pol[i] = 1; - move16(); - dn_p[i] = dn[i]; - move16(); - } - ELSE - { - pol[i] = -1; - move16(); - dn_p[i] = negate( dn[i] ); - move16(); - } - } - - /*----------------------------------------------------------------* - * compute denominator ( multiplied by polarity ) - *----------------------------------------------------------------*/ - - k = 0; - ii = 0; - move16(); - move16(); - FOR( i = 0; i < NB_POS_FCB_2T; i++ ) - { - jj = 1; - move16(); - FOR( j = 0; j < NB_POS_FCB_2T; j++ ) - { - test(); - if ( EQ_16( s_and( pol[ii], pol[jj] ), 1 ) && EQ_16( s_or( pol[ii], pol[jj] ), -1 ) ) - { - rrixiy[k + j] = negate( rrixiy[k + j] ); - move16(); - } - jj = add( jj, 2 ); - } - ii = add( ii, 2 ); - k = add( k, NB_POS_FCB_2T ); - } - - /*----------------------------------------------------------------* - * search 2 pulses - * All combinaisons are tested: - * 32 pos x 32 pos x 2 signs = 2048 tests - *----------------------------------------------------------------*/ - - p0 = rrixix[0]; - p1 = rrixix[1]; - p2 = rrixiy; - psk = -1; - move16(); - alpk = 1; - move16(); - ix = 0; - move16(); - iy = 1; - move16(); - - FOR( i0 = 0; i0 < L_SUBFR; i0 += STEP ) - { - ps1 = dn_p[i0]; - move16(); - alp1 = *p0++; - move16(); - pos = -1; - move16(); - FOR( i1 = 1; i1 < L_SUBFR; i1 += STEP ) - { - ps2 = add( ps1, dn_p[i1] ); - alp2 = add_o( alp1, add_o( *p1++, *p2++, &Overflow ), &Overflow ); - sq = mult( ps2, ps2 ); - s = L_msu_o( L_mult( alpk, sq ), psk, alp2, &Overflow ); - IF( s > 0 ) - { - psk = sq; - move16(); - alpk = alp2; - move16(); - pos = i1; - move16(); - } - } - p1 -= NB_POS_FCB_2T; - - IF( pos >= 0 ) - { - ix = i0; - move16(); - iy = pos; - move16(); - } - } - - i0 = shr( ix, 1 ); - i1 = shr( iy, 1 ); - - sign0 = shl( pol[ix], 9 ); // Q9 - sign1 = shl( pol[iy], 9 ); // Q9 - - /*-------------------------------------------------------------------* - * Build the codeword, the filtered codeword and index of codevector. - *-------------------------------------------------------------------*/ - - set16_fx( code, 0, L_SUBFR ); - - code[ix] = sign0; - move16(); - code[iy] = sign1; - move16(); - - index = add( shl( i0, 6 ), i1 ); - - - if ( sign0 < 0 ) - { - index = add( index, 0x800 ); - } - if ( sign1 < 0 ) - { - index = add( index, 0x20 ); /* move16();*/ - } - - set16_fx( y, 0, L_SUBFR ); - /* y_Q9 = sign_Q9<<3 * h_Q12 */ - - sign0 = shl( sign0, 3 ); - sign1 = shl( sign1, 3 ); - - FOR( i = ix; i < L_SUBFR; i++ ) - { - y[i] = mult_r( sign0, h[i - ix] ); // Q9 - move16(); - } - FOR( i = iy; i < L_SUBFR; i++ ) - { - y[i] = round_fx( L_mac( L_deposit_h( y[i] ), sign1, h[i - iy] ) ); // Q9 - move16(); - } - { - /* write index to array of indices */ - push_indice( hBstr, IND_ALG_CDBK_2T32, index, 12 ); - } - return; -} -#endif /*---------------------------------------------------------------------------------- * Function acelp_1t64() * @@ -646,73 +373,3 @@ void acelp_1t64_fx( return; } -#ifndef REUSE_EVS_BE_ACELP_1t64 -void acelp_1t64_ivas_fx( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - const Word16 dn[], /* i : corr. between target and h[]. Qx */ - const Word16 h[], /* i : impulse response of weighted synthesis filter Q12*/ - Word16 code[], /* o : algebraic (fixed) codebook excitation Q9*/ - Word16 y[], /* o : filtered fixed codebook excitation Q9*/ - const Word16 L_subfr /* i : subframe length */ -) -{ - Word16 i, pos, sgn, index; - Word32 L_tmp; - /*-------------------------------------------------------------------* - * Find position and sign of maximum impulse. - *-------------------------------------------------------------------*/ - pos = emaximum_fx( 0, dn, L_subfr, &L_tmp ); - - IF( dn[pos] < 0 ) - { - sgn = -512; //-1 in Q9 - move16(); - } - ELSE - { - sgn = 512; // 1 in Q9 - move16(); - } - - /*-------------------------------------------------------------------* - * Build the codeword, the filtered codeword and index of codevector. - *-------------------------------------------------------------------*/ - - set16_fx( code, 0, L_subfr ); - code[pos] = sgn; - move16(); - - set16_fx( y, 0, L_subfr ); - - FOR( i = pos; i < L_subfr; i++ ) - { - IF( sgn > 0 ) - { - y[i] = shr_r( h[i - pos], 3 ); // Q9 - move16(); - } - ELSE - { - y[i] = negate( shr_r( h[i - pos], 3 ) ); // Q9 - move16(); - } - } - - index = pos; - move16(); - if ( sgn > 0 ) - { - index = add( index, L_subfr ); - } - IF( EQ_16( L_subfr, L_SUBFR ) ) - { - push_indice( hBstr, IND_ALG_CDBK_1T64, index, 7 ); - } - ELSE /* L_subfr == 2*L_SUBFR */ - { - push_indice( hBstr, IND_ALG_CDBK_1T64, index, 8 ); - } - - return; -} -#endif diff --git a/lib_enc/cod4t64_fx.c b/lib_enc/cod4t64_fx.c index 6d9e8fa431ae6bb6435adcf5f16d8b985564d9a5..8c480b77986ad00eb2ed561214f5affcaa0dcca5 100644 --- a/lib_enc/cod4t64_fx.c +++ b/lib_enc/cod4t64_fx.c @@ -66,11 +66,8 @@ Word16 acelp_4t64_fx( Word16 nbbits, /* i : number of bits per codebook */ const Word16 cmpl_flag, /* i : complexity reduction flag */ const Word16 Opt_AMR_WB /* i : flag indicating AMR-WB IO mode */ -#ifdef REUSE_EVS_BE_ACELP_4T64 , - const Word16 element_mode -#endif -) + const Word16 element_mode ) { Word16 i, k, index, track; @@ -303,21 +300,13 @@ Word16 acelp_4t64_fx( IF( acelpautoc ) { -#ifdef REUSE_EVS_BE_ACELP_4T64 E_ACELP_4tsearchx_fx( dn, cn, R, code, &config, ind, element_mode ); -#else - E_ACELP_4tsearchx_fx( dn, cn, R, code, &config, ind ); -#endif /* Generate weighted code */ E_ACELP_weighted_code( code, H, 12, y ); } ELSE { -#ifdef REUSE_EVS_BE_ACELP_4T64 E_ACELP_4tsearch_fx( dn, cn, H, code, &config, ind, y, 0 ); -#else - E_ACELP_4tsearch_fx( dn, cn, H, code, &config, ind, y ); -#endif FOR( i = 0; i < L_SUBFR; i++ ) { y[i] = shr( y[i], 3 ); @@ -478,421 +467,6 @@ Word16 acelp_4t64_fx( return saved_bits; } -#ifndef REUSE_EVS_BE_ACELP_4T64 -Word16 acelp_4t64_ivas_fx( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - Word16 dn[], /* i : corr. between target and h[]. */ - const Word16 cn[], /* i : residual after long term prediction Q_new*/ - const Word16 H[], /* i : impulse response of weighted synthesis filter Q12*/ - Word16 R[], /* i : autocorrelation values */ - const Word16 acelpautoc, /* i : autocorrealtion flag */ - Word16 code[], /* o : algebraic (fixed) codebook excitation Q9*/ - Word16 y[], /* o : filtered fixed codebook excitation Q9*/ - Word16 nbbits, /* i : number of bits per codebook */ - const Word16 cmpl_flag, /* i : complexity reduction flag */ - const Word16 Opt_AMR_WB, /* i : flag indicating AMR-WB IO mode */ - Word16 element_mode ) -{ - - Word16 i, k, index, track; - Word32 L_index; - Word16 ind[NPMAXPT * NB_TRACK_FCB_4T + 32]; /* VE3: why +32 ???*/ - Word16 codvec[NB_PULSE_MAX + 4] = { 0 }; - Word16 saved_bits = 0; - - PulseConfig config; - Word16 indexing_indices[6], wordcnt, bitcnt; - - set16_fx( codvec, 0, NB_PULSE_MAX + 4 ); - SWITCH( nbbits ) - { - - case 20: /* EVS/AMR-WB pulse indexing: 20 bits, 4 pulses, 4 tracks */ - config.nbiter = 4; - move16(); /* 4x12x16=768 loop */ - config.alp = 16384; - move16(); /* 2 in Q13*/ - config.nb_pulse = 4; - move16(); - config.fixedpulses = 0; - move16(); - config.nbpos[0] = 4; - move16(); - config.nbpos[1] = 8; - move16(); - BREAK; - - case 28: /* EVS pulse indexing: 28 bits, 6 pulses, 4 tracks */ - config.nbiter = 4; - move16(); /* 4x20x16=1280 loops */ - config.alp = 8192; /*1 in Q13*/ - move16(); /* coeff FOR sign setting */ - config.nb_pulse = 6; - move16(); - config.fixedpulses = 0; - move16(); - config.nbpos[0] = 6; - move16(); - config.nbpos[1] = 6; - move16(); - config.nbpos[2] = 8; - move16(); - BREAK; - - case 36: /* EVS/AMR-WB pulse indexing: 36 bits, 8 pulses, 4 tracks */ - config.nbiter = 4; - move16(); /* 4x20x16=1280 loops */ - config.alp = 8192; /*1 in Q13*/ - move16(); /* coeff FOR sign setting */ - config.nb_pulse = 8; - move16(); - config.fixedpulses = 2; - move16(); - config.nbpos[0] = 4; - move16(); - config.nbpos[1] = 8; - move16(); - config.nbpos[2] = 8; - move16(); - BREAK; - - case 43: /* EVS pulse indexing: 43 bits, 10 pulses, 4 tracks */ - case 44: /* AMR-WB pulse indexing: 44 bits, 10 pulses, 4 tracks */ - config.nbiter = 4; - move16(); /* 4x26x16=1664 loops */ - config.alp = 8192; /*1 in Q13*/ - move16(); - config.nb_pulse = 10; - move16(); - config.fixedpulses = 2; - move16(); - config.nbpos[0] = 4; - move16(); - config.nbpos[1] = 6; - move16(); - config.nbpos[2] = 8; - move16(); - config.nbpos[3] = 8; - move16(); - BREAK; - - case 50: /* EVS pulse indexing: 50 bits, 12 pulses, 4 tracks */ - case 52: /* AMR-WB pulse indexing: 52 bits, 12 pulses, 4 tracks */ - config.nbiter = 4; - move16(); /* 4x26x16=1664 loops */ - config.alp = 8192; /*1 in Q13*/ - move16(); - config.nb_pulse = 12; - move16(); - config.fixedpulses = 4; - move16(); - config.nbpos[0] = 4; - move16(); - config.nbpos[1] = 6; - move16(); - config.nbpos[2] = 8; - move16(); - config.nbpos[3] = 8; - move16(); - BREAK; - - case 62: /* EVS pulse indexing: 62 bits, 16 pulses, 4 tracks */ - case 64: /* AMR-WB pulse indexing: 64 bits, 16 pulses, 4 tracks */ - config.nbiter = 3; - move16(); /* 3x36x16=1728 loops */ - config.alp = 6554; /*.8f in Q13*/ - move16(); - config.nb_pulse = 16; - move16(); - config.fixedpulses = 4; - move16(); - config.nbpos[0] = 4; - move16(); - config.nbpos[1] = 4; - move16(); - config.nbpos[2] = 6; - move16(); - config.nbpos[3] = 6; - move16(); - config.nbpos[4] = 8; - move16(); - config.nbpos[5] = 8; - move16(); - BREAK; - - case 72: /* AMR-WB pulse indexing: 72 bits, 18 pulses, 4 tracks */ - config.nbiter = 3; - move16(); /* 3x35x16=1680 loops */ - config.alp = 6144; /*.75f in Q13*/ - move16(); - config.nb_pulse = 18; - move16(); - config.fixedpulses = 4; - move16(); - config.nbpos[0] = 2; - move16(); - config.nbpos[1] = 3; - move16(); - config.nbpos[2] = 4; - move16(); - config.nbpos[3] = 5; - move16(); - config.nbpos[4] = 6; - move16(); - config.nbpos[5] = 7; - move16(); - config.nbpos[6] = 8; - move16(); - BREAK; - - case 88: /* AMR-WB pulse indexing: 88 bits, 24 pulses, 4 tracks */ - config.nbiter = 2; - move16(); /* 2x53x16=1696 loop */ - config.alp = 4096; /*.5f in Q13*/ - move16(); - config.nb_pulse = 24; - move16(); - config.fixedpulses = 4; - move16(); - config.nbpos[0] = 2; - move16(); - config.nbpos[1] = 2; - move16(); - config.nbpos[2] = 3; - move16(); - config.nbpos[3] = 4; - move16(); - config.nbpos[4] = 5; - move16(); - config.nbpos[5] = 6; - move16(); - config.nbpos[6] = 7; - move16(); - config.nbpos[7] = 8; - move16(); - config.nbpos[8] = 8; - move16(); - config.nbpos[9] = 8; - move16(); - BREAK; - - case 87: /* EVS pulse indexing: 87 bits, 26 pulses, 4 tracks */ - config.nbiter = 1; - move16(); - config.alp = 4096; /*.5f in Q13*/ - move16(); - config.nb_pulse = 26; - move16(); - config.fixedpulses = 4; - move16(); - config.nbpos[0] = 4; - move16(); - config.nbpos[1] = 6; - move16(); - config.nbpos[2] = 6; - move16(); - config.nbpos[3] = 8; - move16(); - config.nbpos[4] = 8; - move16(); - config.nbpos[5] = 8; - move16(); - config.nbpos[6] = 8; - move16(); - config.nbpos[7] = 8; - move16(); - config.nbpos[8] = 8; - move16(); - config.nbpos[9] = 8; - move16(); - config.nbpos[10] = 8; - move16(); - BREAK; - } - - /* reduce the number of iterations as a compromise between the performance and complexity */ - if ( cmpl_flag > 0 ) - { - config.nbiter = cmpl_flag; - move16(); - } - - config.codetrackpos = TRACKPOS_FIXED_FIRST; - move32(); - config.bits = nbbits; - move16(); - - IF( acelpautoc ) - { - E_ACELP_4tsearchx_ivas_fx( dn, cn, R, code, &config, ind, element_mode ); - - /* Generate weighted code */ - E_ACELP_weighted_code( code, H, 12, y ); - } - ELSE - { - E_ACELP_4tsearch_fx( dn, cn, H, code, &config, ind, y ); - - FOR( i = 0; i < L_SUBFR; i++ ) - { - y[i] = shr( y[i], 3 ); - move16(); /*Q9 */ - } - } - - /*-----------------------------------------------------------------* - * Indexing - *-----------------------------------------------------------------*/ - - IF( !Opt_AMR_WB ) - { - saved_bits = E_ACELP_indexing_fx( code, &config, NB_TRACK_FCB_4T, indexing_indices ); - - saved_bits = 0; - move16(); - - wordcnt = shr( nbbits, 4 ); - bitcnt = s_and( nbbits, 15 ); - FOR( i = 0; i < wordcnt; i++ ) - { - push_indice( hBstr, IND_ALG_CDBK_4T64, indexing_indices[i], 16 ); - } - IF( bitcnt ) - { - push_indice( hBstr, IND_ALG_CDBK_4T64, indexing_indices[i], bitcnt ); - } - } - ELSE - { - /* AMR-WB pulse indexing */ - - IF( EQ_16( nbbits, 20 ) ) - { - FOR( track = 0; track < NB_TRACK_FCB_4T; track++ ) - { - k = i_mult2( track, NPMAXPT ); - index = quant_1p_N1_fx( ind[k], 4 ); - push_indice( hBstr, IND_ALG_CDBK_4T64, index, 5 ); - } - } - ELSE IF( EQ_16( nbbits, 36 ) ) - { - FOR( track = 0; track < NB_TRACK_FCB_4T; track++ ) - { - - k = i_mult2( track, NPMAXPT ); /* k = track * NPMAXPT;*/ - index = quant_2p_2N1_fx( ind[k], ind[k + 1], 4 ); - push_indice( hBstr, IND_ALG_CDBK_4T64, index, 9 ); - } - } - ELSE IF( EQ_16( nbbits, 44 ) ) /* AMR-WB pulse indexing */ - { - FOR( track = 0; track < ( NB_TRACK_FCB_4T - 2 ); track++ ) - { - k = i_mult2( track, NPMAXPT ); - index = quant_3p_3N1_fx( ind[k], ind[k + 1], ind[k + 2], 4 ); - push_indice( hBstr, IND_ALG_CDBK_4T64, index, 13 ); - } - - FOR( track = 2; track < NB_TRACK_FCB_4T; track++ ) - { - k = i_mult2( track, NPMAXPT ); - index = quant_2p_2N1_fx( ind[k], ind[k + 1], 4 ); - push_indice( hBstr, IND_ALG_CDBK_4T64, index, 9 ); - } - } - ELSE IF( EQ_16( nbbits, 52 ) ) /* AMR-WB pulse indexing */ - { - FOR( track = 0; track < NB_TRACK_FCB_4T; track++ ) - { - k = i_mult2( track, NPMAXPT ); - index = quant_3p_3N1_fx( ind[k], ind[k + 1], ind[k + 2], 4 ); - push_indice( hBstr, IND_ALG_CDBK_4T64, index, 13 ); - } - } - ELSE IF( EQ_16( nbbits, 64 ) ) /* AMR-WB pulse indexing */ - { - FOR( track = 0; track < NB_TRACK_FCB_4T; track++ ) - { - k = i_mult2( track, NPMAXPT ); - L_index = quant_4p_4N_fx( &ind[k], 4 ); - index = extract_l( L_shr( L_index, 14 ) & 3 ); - logic16(); - push_indice( hBstr, IND_ALG_CDBK_4T64_1, index, 2 ); - } - - FOR( track = 0; track < NB_TRACK_FCB_4T; track++ ) - { - k = i_mult2( track, NPMAXPT ); - L_index = quant_4p_4N_fx( &ind[k], 4 ); - index = extract_l( L_index & 0x3FFF ); - logic16(); - push_indice( hBstr, IND_ALG_CDBK_4T64_2, index, 14 ); - } - } - ELSE IF( EQ_16( nbbits, 72 ) ) - { - FOR( track = 0; track < ( NB_TRACK_FCB_4T - 2 ); track++ ) - { - k = i_mult2( track, NPMAXPT ); - L_index = quant_5p_5N_fx( &ind[k], 4 ); - index = extract_l( L_shr( L_index, 10 ) & 0x03FF ); - logic16(); - push_indice( hBstr, IND_ALG_CDBK_4T64_1, index, 10 ); - } - - FOR( track = 2; track < NB_TRACK_FCB_4T; track++ ) - { - k = i_mult2( track, NPMAXPT ); - L_index = quant_4p_4N_fx( &ind[k], 4 ); - index = extract_l( L_shr( L_index, 14 ) & 3 ); - logic16(); - push_indice( hBstr, IND_ALG_CDBK_4T64_1, index, 2 ); - } - - FOR( track = 0; track < ( NB_TRACK_FCB_4T - 2 ); track++ ) - { - k = i_mult2( track, NPMAXPT ); - L_index = quant_5p_5N_fx( &ind[k], 4 ); - index = extract_l( L_index & 0x03FF ); - logic16(); - push_indice( hBstr, IND_ALG_CDBK_4T64_2, index, 10 ); - } - - FOR( track = 2; track < NB_TRACK_FCB_4T; track++ ) - { - k = i_mult2( track, NPMAXPT ); - L_index = quant_4p_4N_fx( &ind[k], 4 ); - index = extract_l( L_index & 0x3FFF ); - logic16(); - push_indice( hBstr, IND_ALG_CDBK_4T64_2, index, 14 ); - } - } - ELSE IF( EQ_16( nbbits, 88 ) ) - { - FOR( track = 0; track < NB_TRACK_FCB_4T; track++ ) - { - k = i_mult2( track, NPMAXPT ); - L_index = quant_6p_6N_2_fx( &ind[k], 4 ); - index = extract_l( L_shr( L_index, 11 ) & 0x07FF ); - logic16(); - push_indice( hBstr, IND_ALG_CDBK_4T64_1, index, 11 ); - } - - FOR( track = 0; track < NB_TRACK_FCB_4T; track++ ) - { - k = i_mult2( track, NPMAXPT ); - L_index = quant_6p_6N_2_fx( &ind[k], 4 ); - index = extract_l( L_index & 0x07FF ); - logic16(); - push_indice( hBstr, IND_ALG_CDBK_4T64_2, index, 11 ); - } - } - } - - return saved_bits; -} -#endif /*---------------------------------------------------------------------* *encode class for 3p 4p 5p 6p/track * *---------------------------------------------------------------------*/ diff --git a/lib_enc/cod_tcx_fx.c b/lib_enc/cod_tcx_fx.c index c598af5385fc6fe8ea6816d91b00d636fa1520e3..3ab224a62b2eabae46f3c8227943db9ee044cf69 100644 --- a/lib_enc/cod_tcx_fx.c +++ b/lib_enc/cod_tcx_fx.c @@ -1657,11 +1657,7 @@ void QuantizeSpectrum_fx( tmp1 = BASOP_Util_Divide1616_Scale( sqTargetBits, tmp1, &tmp2 ); BASOP_SATURATE_WARNING_OFF_EVS -#ifdef ISSUE_1796_replace_shl_o hTcxEnc->tcx_target_bits_fac = shl_sat( mult( hTcxEnc->tcx_target_bits_fac, tmp1 ), tmp2 ); -#else - hTcxEnc->tcx_target_bits_fac = shl_o( mult( hTcxEnc->tcx_target_bits_fac, tmp1 ), tmp2, &Overflow ); -#endif move16(); BASOP_SATURATE_WARNING_ON_EVS @@ -1781,11 +1777,7 @@ void QuantizeSpectrum_fx( } /* Limit low sqGain for avoiding saturation of the gain quantizer*/ -#ifdef ISSUE_1796_replace_shl_o tmp1 = mult_r( shl_sat( L_spec, 5 ), 26214 /*128.f/NORM_MDCT_FACTOR Q15*/ ); -#else - tmp1 = mult_r( shl_o( L_spec, 5, &Overflow ), 26214 /*128.f/NORM_MDCT_FACTOR Q15*/ ); -#endif s = 15 - 5 - 7; IF( L_spec >= 1024 ) { @@ -2745,11 +2737,7 @@ void QuantizeSpectrum_fx( BASOP_SATURATE_WARNING_OFF_EVS; FOR( i = 0; i < L_frame; i++ ) { -#ifdef ISSUE_1796_replace_shl_o xn_buf16[i] = shl_sat( xn_buf16[i], TCX_IMDCT_HEADROOM ); -#else - xn_buf16[i] = shl_o( xn_buf16[i], TCX_IMDCT_HEADROOM, &Overflow ); -#endif move16(); } BASOP_SATURATE_WARNING_ON_EVS; @@ -3256,11 +3244,7 @@ void QuantizeTCXSpectrum_fx( tmp1 = BASOP_Util_Divide1616_Scale( sqTargetBits, tmp1, &tmp2 ); BASOP_SATURATE_WARNING_OFF_EVS -#ifdef ISSUE_1796_replace_shl_o hTcxEnc->tcx_target_bits_fac = shl_sat( mult( hTcxEnc->tcx_target_bits_fac, tmp1 ), tmp2 ); -#else - hTcxEnc->tcx_target_bits_fac = shl_o( mult( hTcxEnc->tcx_target_bits_fac, tmp1 ), tmp2, &Overflow ); -#endif BASOP_SATURATE_WARNING_ON_EVS if ( GT_16( hTcxEnc->tcx_target_bits_fac, 20480 /*1.25 in Q14*/ ) ) @@ -4023,12 +4007,6 @@ void InternalTCXDecoder_fx( Word16 Aq_old_fx[M + 1]; Word32 sns_interpolated_scalefactors_fx[FDNS_NPTS], A_fx32[M + 1]; Word16 *xn_buf16 = (Word16 *) xn_buf32; -#if !defined( ISSUE_1796_replace_shl_o ) -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif Copy32( x_quant_fx, spectrum_fx, s_max( L_frame, L_spec ) ); @@ -4677,11 +4655,7 @@ void InternalTCXDecoder_fx( BASOP_SATURATE_WARNING_OFF_EVS; FOR( i = 0; i < L_frame; i++ ) { -#ifdef ISSUE_1796_replace_shl_o xn_buf16[i] = shl_sat( xn_buf16[i], TCX_IMDCT_HEADROOM ); -#else - xn_buf16[i] = shl_o( xn_buf16[i], TCX_IMDCT_HEADROOM, &Overflow ); -#endif move16(); } BASOP_SATURATE_WARNING_ON_EVS; diff --git a/lib_enc/core_enc_ol_fx.c b/lib_enc/core_enc_ol_fx.c index 2f2682b8ee0ed035ee3a9c9d00879c99b3d122cd..bd9d5375f1d74b5f8e1a142a3dbc997ac1ade924 100644 --- a/lib_enc/core_enc_ol_fx.c +++ b/lib_enc/core_enc_ol_fx.c @@ -552,11 +552,7 @@ void core_encode_openloop_fx( /*v_sub(lsf_uq_rf, lsf_q_1st_rf, lsf_q_d_rf, M);*/ FOR( i = 0; i < M; i++ ) { -#ifdef ISSUE_1796_replace_shl_o lsf_q_d_rf[i] = shl_sat( mult_r( sub_o( lsf_uq_rf[i], lsf_q_1st_rf[i], &Overflow ), 25600 ), 5 ); -#else - lsf_q_d_rf[i] = shl_o( mult_r( sub_o( lsf_uq_rf[i], lsf_q_1st_rf[i], &Overflow ), 25600 ), 5, &Overflow ); -#endif move16(); /*input value is in Qx2.56, convert to Q6 to match table, quantizer table kept at Q6 to avoid losing precision */ /*Assume this difference data max range can be represented by Q6*/ diff --git a/lib_enc/core_switching_enc_fx.c b/lib_enc/core_switching_enc_fx.c index fcfe151f6efe39d21dff2d5d42890cb4e2ff4c6d..5b657e9c538f9ba6fe2391015d5d914e83cec162 100644 --- a/lib_enc/core_switching_enc_fx.c +++ b/lib_enc/core_switching_enc_fx.c @@ -183,16 +183,11 @@ void core_switching_pre_enc_fx( test(); test(); test(); -#ifdef NONBE_1214_PLC_LSF_MEMORY test(); test(); IF( ( ( ( st_fx->core == ACELP_CORE ) || EQ_16( st_fx->core, AMR_WB_CORE ) ) && EQ_16( st_fx->last_core, HQ_CORE ) ) /* EVS and HQ -> ACELP */ || ( ( EQ_16( st_fx->element_mode, IVAS_CPE_DFT ) || EQ_16( st_fx->element_mode, IVAS_CPE_TD ) || ( EQ_16( st_fx->element_mode, IVAS_CPE_MDCT ) && EQ_16( last_element_mode, IVAS_CPE_DFT ) ) ) && EQ_16( active_cnt, 1 ) ) || ( st_fx->core == ACELP_CORE && GT_16( st_fx->last_L_frame, L_FRAME16k ) ) /* TCX @ 25.6/32 kHz -> ACELP */ ) -#else - IF( ( ( ( st_fx->core == ACELP_CORE ) || EQ_16( st_fx->core, AMR_WB_CORE ) ) && EQ_16( st_fx->last_core, HQ_CORE ) ) || - ( ( EQ_16( st_fx->element_mode, IVAS_CPE_DFT ) || EQ_16( st_fx->element_mode, IVAS_CPE_TD ) || ( EQ_16( st_fx->element_mode, IVAS_CPE_MDCT ) && EQ_16( last_element_mode, IVAS_CPE_DFT ) ) ) && EQ_16( active_cnt, 1 ) ) ) -#endif { IF( EQ_16( st_fx->L_frame, L_FRAME16k ) ) { @@ -806,16 +801,11 @@ void core_switching_pre_enc_ivas_fx( test(); test(); test(); -#ifdef NONBE_1214_PLC_LSF_MEMORY test(); test(); IF( ( ( ( st_fx->core == ACELP_CORE ) || EQ_16( st_fx->core, AMR_WB_CORE ) ) && EQ_16( st_fx->last_core, HQ_CORE ) ) /* EVS and HQ -> ACELP */ || ( ( EQ_16( st_fx->element_mode, IVAS_CPE_DFT ) || EQ_16( st_fx->element_mode, IVAS_CPE_TD ) || ( EQ_16( st_fx->element_mode, IVAS_CPE_MDCT ) && EQ_16( last_element_mode, IVAS_CPE_DFT ) ) ) && EQ_16( active_cnt, 1 ) ) || ( st_fx->core == ACELP_CORE && GT_16( st_fx->last_L_frame, L_FRAME16k ) ) /* TCX @ 25.6/32 kHz -> ACELP */ ) -#else - IF( ( ( ( st_fx->core == ACELP_CORE ) || EQ_16( st_fx->core, AMR_WB_CORE ) ) && EQ_16( st_fx->last_core, HQ_CORE ) ) || - ( ( EQ_16( st_fx->element_mode, IVAS_CPE_DFT ) || EQ_16( st_fx->element_mode, IVAS_CPE_TD ) || ( EQ_16( st_fx->element_mode, IVAS_CPE_MDCT ) && EQ_16( last_element_mode, IVAS_CPE_DFT ) ) ) && EQ_16( active_cnt, 1 ) ) ) -#endif { IF( EQ_16( st_fx->L_frame, L_FRAME16k ) ) { diff --git a/lib_enc/enc_acelp_fx.c b/lib_enc/enc_acelp_fx.c index e9feb81d381af6bf3de9774d81d49f8e0a8c3c61..f1c87722b113848d62d60c2551f3e0d09be515a9 100644 --- a/lib_enc/enc_acelp_fx.c +++ b/lib_enc/enc_acelp_fx.c @@ -563,11 +563,7 @@ Word16 E_ACELP_xy1_corr_fx( Word16 xn[] /*Q15-exp_xn*/, Word16 y1[] /*Q15-exp_xn i = add( exp_xy, 1 - 1 ); /* -1 -> gain in Q14 */ i = sub( i, exp_yy ); BASOP_SATURATE_WARNING_OFF_EVS -#ifdef ISSUE_1796_replace_shl_o gain = shl_sat( gain, i ); /* saturation can occur here */ -#else - gain = shl_o( gain, i, &Overflow ); /* saturation can occur here */ -#endif BASOP_SATURATE_WARNING_ON_EVS /* gain = s_max(0, gain); */ /* see above xy < 0. */ @@ -1071,11 +1067,7 @@ void E_ACELP_corrmatrix_fx( Word16 h[] /*Q12*/, Word16 sign[] /*Q0*/, Word16 vec return; } -#ifndef REUSE_EVS_BE_ACELP_4T64 -void E_ACELP_4tsearch_fx( Word16 dn[] /*Qdn*/, const Word16 cn[] /*Q_xn*/, const Word16 H[] /*Q12*/, Word16 code[] /*Q9*/, const PulseConfig *config, Word16 ind[] /*Q0*/, Word16 y[] /*Qy*/ ) -#else void E_ACELP_4tsearch_fx( Word16 dn[] /*Qdn*/, const Word16 cn[] /*Q_xn*/, const Word16 H[] /*Q12*/, Word16 code[] /*Q9*/, const PulseConfig *config, Word16 ind[] /*Q0*/, Word16 y[] /*Qy*/, const Word16 element_mode ) -#endif { Word16 sign[L_SUBFR], vec[L_SUBFR]; Word16 cor_x[16], cor_y[16], h_buf[4 * L_SUBFR]; @@ -1151,14 +1143,12 @@ void E_ACELP_4tsearch_fx( Word16 dn[] /*Qdn*/, const Word16 cn[] /*Q_xn*/, const scale = -2; move16(); } -#ifdef REUSE_EVS_BE_ACELP_4T64 /* To be verified if it affects BE on 26.444, if yes, just a condition for IVAS here*/ test(); if ( EQ_16( val, 32767 ) && element_mode > EVS_MONO ) { scale = -3; move16(); } -#endif Copy_Scale_sig( H, h, L_SUBFR, scale ); /*Q12+scale*/ E_ACELP_vec_neg_fx( h, h_inv, L_SUBFR ); @@ -1401,332 +1391,6 @@ void E_ACELP_4tsearch_fx( Word16 dn[] /*Qdn*/, const Word16 cn[] /*Q_xn*/, const } return; } -#ifndef REUSE_EVS_BE_ACELP_4T64 -void E_ACELP_4tsearch_ivas_fx( Word16 dn[] /*Qdn*/, const Word16 cn[] /*Q_xn*/, const Word16 H[] /*Q12*/, Word16 code[] /*Q9*/, const PulseConfig *config, Word16 ind[] /*Q0*/, Word16 y[] /*Qy*/ ) -{ - Word16 sign[L_SUBFR], vec[L_SUBFR]; - Word16 cor_x[16], cor_y[16], h_buf[4 * L_SUBFR]; - Word16 rrixix[4][16]; - Word16 rrixiy[4][256]; - Word16 dn2[L_SUBFR]; - Word16 psk, ps, alpk, alp = 0; - Word16 codvec[NB_PULSE_MAX]; - Word16 pos_max[4]; - Word16 dn2_pos[8 * 4]; - UWord8 ipos[NB_PULSE_MAX]; - Word16 *p0, *p1, *p2, *p3; - Word16 *h, *h_inv; - Word16 i, j, k, l, st, pos; - Word16 val, tmp, scale; - Word32 s, L_tmp; - Word16 nb_pulse, nb_pulse_m2; - Word16 check = 0; /* debug code not instrumented */ -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif - - - alp = config->alp; /* Q13 */ /* initial value for energy of all fixed pulses */ - move16(); - nb_pulse = config->nb_pulse; - move16(); - nb_pulse_m2 = sub( nb_pulse, 2 ); - - set16_fx( codvec, 0, nb_pulse ); - - /* - * Find sign for each pulse position. - */ - - E_ACELP_pulsesign( cn, dn, dn2, sign, vec, alp, 0x7fff, L_SUBFR ); - - /* - * Select the most important 8 position per track according to dn2[]. - */ - E_ACELP_findcandidates( dn2, dn2_pos, pos_max ); - - /* - * Compute h_inv[i]. - */ - set16_fx( h_buf, 0, L_SUBFR ); - - set16_fx( h_buf + ( 2 * L_SUBFR ), 0, L_SUBFR ); - - h = h_buf + L_SUBFR; - h_inv = h_buf + ( 3 * L_SUBFR ); - - /*Check the energy if it is too high then scale to prevent an overflow*/ - scale = 0; - move16(); - L_tmp = L_deposit_l( 0 ); - BASOP_SATURATE_WARNING_OFF_EVS - FOR( i = 0; i < L_SUBFR; i++ ) - { - L_tmp = L_mac_o( L_tmp, H[i], H[i], &Overflow ); /*Q25*/ - } - val = extract_h( L_tmp ); /*Q9*/ - BASOP_SATURATE_WARNING_ON_EVS - - if ( GT_16( val, 0x2000 ) ) - { - scale = -1; - move16(); - } - if ( GT_16( val, 0x7000 ) ) - { - scale = -2; - move16(); - } - if ( EQ_16( val, 32767 ) ) - { - scale = -3; - move16(); - } - - Copy_Scale_sig( H, h, L_SUBFR, scale ); /*Q12+scale*/ - - E_ACELP_vec_neg_fx( h, h_inv, L_SUBFR ); - - - /* - * Compute correlation matrices needed for the codebook search. - */ - E_ACELP_corrmatrix_fx( h, sign, vec, rrixix, rrixiy ); - - - /* - * Deep first search: - * ------------------ - * 20 bits (4p): 4 iter x ((4x16)+(8x16)) = 768 tests - * 36 bits (8p): 4 iter x ((1x1)+(4x16)+(8x16)+(8x16)) = 1280 tests - * 52 bits (12p): 3 iter x ((1x1)+(1x1)+(4x16)+(6x16) - * +(8x16)+(8x16)) = 1248 tests - * 64 bits (16p): 2 iter x ((1x1)+(1x1)+(4x16)+(6x16) - * +(6x16)+(8x16)+(8x16)+(8x16)) = 1280 tests - */ - psk = -1; - move16(); - alpk = 1; - move16(); - - /*Number of iterations*/ - FOR( k = 0; k < config->nbiter; k++ ) - { - E_ACELP_setup_pulse_search_pos( config, k, ipos ); - - /* format of alp changes to Q(15-ALP2_E) */ - - pos = config->fixedpulses; - move16(); - - IF( config->fixedpulses == 0 ) /* 1100, 11, 1110, 1111, 2211 */ - { - ps = 0; - move16(); - alp = 0; - move16(); - set16_fx( vec, 0, L_SUBFR ); - } - ELSE IF( EQ_16( config->fixedpulses, 2 ) ) /* 2222 and 3322 */ - { - /* first stage: fix 2 pulses */ - ind[0] = pos_max[ipos[0]]; - move16(); - ind[1] = pos_max[ipos[1]]; - move16(); - ps = add( dn[ind[0]], dn[ind[1]] ); - - /*alp = rrixix[ipos[0]][ind[0] >> 2] + rrixix[ipos[1]][ind[1] >> 2] + - rrixiy[ipos[0]][((ind[0] >> 2) << 4) + (ind[1] >> 2)];*/ - - i = shr( ind[0], 2 ); - j = shr( ind[1], 2 ); - l = add( shl( i, 4 ), j ); - s = L_mult( rrixix[ipos[0]][i], _1_ ); /* Q9+Q12+1 */ - s = L_mac( s, rrixix[ipos[1]][j], _1_ ); /* Q9+Q12+1 */ - alp = mac_r( s, rrixiy[ipos[0]][l], _1_ ); /* Q9+Q12+1-16 */ - - p0 = h - ind[0]; /*Q12+scale*/ - IF( sign[ind[0]] < 0 ) - { - p0 = h_inv - ind[0]; /*Q12+scale*/ - } - - p1 = h - ind[1]; /*Q12+scale*/ - IF( sign[ind[1]] < 0 ) - { - p1 = h_inv - ind[1]; /*Q12+scale*/ - } - - FOR( i = 0; i < L_SUBFR; i++ ) - { - vec[i] = add( *p0++, *p1++ ); /*Q12+scale*/ - move16(); - } - } - ELSE /* 3333 and above */ - { - /* first stage: fix 4 pulses */ - - ind[0] = pos_max[ipos[0]]; /*Q0*/ - move16(); - ind[1] = pos_max[ipos[1]]; /*Q0*/ - move16(); - ind[2] = pos_max[ipos[2]]; /*Q0*/ - move16(); - ind[3] = pos_max[ipos[3]]; /*Q0*/ - move16(); - - /*ps = dn[ind[0]] + dn[ind[1]] + dn[ind[2]] + dn[ind[3]];*/ - ps = add( add( add( dn[ind[0]], dn[ind[1]] ), dn[ind[2]] ), dn[ind[3]] ); - - p0 = h - ind[0]; /*Q12+scale*/ - IF( sign[ind[0]] < 0 ) - { - p0 = h_inv - ind[0]; /*Q12+scale*/ - } - - p1 = h - ind[1]; /*Q12+scale*/ - IF( sign[ind[1]] < 0 ) - { - p1 = h_inv - ind[1]; /*Q12+scale*/ - } - - p2 = h - ind[2]; /*Q12+scale*/ - IF( sign[ind[2]] < 0 ) - { - p2 = h_inv - ind[2]; /*Q12+scale*/ - } - - p3 = h - ind[3]; /*Q12+scale*/ - IF( sign[ind[3]] < 0 ) - { - p3 = h_inv - ind[3]; /*Q12+scale*/ - } - - FOR( i = 0; i < L_SUBFR; i++ ) - { - vec[i] = add( add( add( *p0++, *p1++ ), *p2++ ), *p3++ ); /*Q12+scale*/ - move16(); - } - - L_tmp = L_mult( vec[0], vec[0] ); /*Q25+2*scale*/ - FOR( i = 1; i < L_SUBFR; i++ ) - L_tmp = L_mac_o( L_tmp, vec[i], vec[i], &Overflow ); /*Q25+2*scale*/ - - alp = round_fx( L_shr( L_tmp, 3 ) ); /*Q6+2*scale*/ - - /*alp *= 0.5F; */ - } - - /* other stages of 2 pulses */ - st = 0; - move16(); - FOR( j = pos; j < nb_pulse; j += 2 ) - { - IF( GE_16( nb_pulse_m2, j ) ) /* pair-wise search */ - { - /* - * Calculate correlation of all possible positions - * of the next 2 pulses with previous fixed pulses. - * Each pulse can have 16 possible positions. - */ - E_ACELP_h_vec_corr1_fx( h, vec, ipos[j], sign, rrixix, cor_x, dn2_pos, config->nbpos[st] ); - - E_ACELP_h_vec_corr2_fx( h, vec, ipos[j + 1], sign, rrixix, cor_y ); - - /* - * Find best positions of 2 pulses. - */ - E_ACELP_2pulse_search( config->nbpos[st], ipos[j], ipos[j + 1], &ps, &alp, - &ind[j], &ind[j + 1], dn, dn2_pos, cor_x, cor_y, rrixiy ); - } - ELSE /* single pulse search */ - { - E_ACELP_h_vec_corr2_fx( h, vec, ipos[j], sign, rrixix, cor_x ); - - E_ACELP_h_vec_corr2_fx( h, vec, ipos[j + 1], sign, rrixix, cor_y ); - - E_ACELP_1pulse_search( &ipos[j], &ps, &alp, - &ind[j], dn, cor_x, cor_y ); - } - - IF( GT_16( nb_pulse_m2, j ) ) - { - p0 = h - ind[j]; /*Q12+scale*/ - IF( sign[ind[j]] < 0 ) - { - p0 = h_inv - ind[j]; /*Q12+scale*/ - } - - p1 = h - ind[j + 1]; /*Q12+scale*/ - IF( sign[ind[j + 1]] < 0 ) - { - p1 = h_inv - ind[j + 1]; /*Q12+scale*/ - } - - - FOR( i = 0; i < L_SUBFR; i++ ) - { - tmp = add( *p0++, *p1++ ); - vec[i] = add_o( vec[i], tmp, &Overflow ); /* can saturate here. */ - move16(); - } - } - st = add( st, 1 ); - } - - /* memorise the best codevector */ - - /*ps = ps * ps; MULT(1);*/ - ps = mult( ps, ps ); - /*s = (alpk * ps) - (psk * alp); MULT(2);ADD(1);*/ - s = L_msu( L_mult( alpk, ps ), psk, alp ); /*Q9+Q6+1=Q16*/ - - if ( psk < 0 ) - { - s = 1; - move32(); - } - IF( s > 0 ) - { - psk = ps; - move16(); - alpk = alp; - move16(); - Copy( ind, codvec, nb_pulse ); /*Q0*/ - check = 1; /* debug code not instrumented */ - } - } - - assert( check ); /* debug code not instrumented */ - - /* - * Build the codeword, the filtered codeword and index of codevector, as well as store weighted correlations. - */ - - E_ACELP_build_code( nb_pulse, codvec, sign, code, ind ); - - set16_fx( y, 0, L_SUBFR ); - FOR( k = 0; k < nb_pulse; ++k ) - { - i = codvec[k]; /*Q0*/ - move16(); - p0 = h_inv - i; /*Q12+scale*/ - IF( sign[i] > 0 ) - { - p0 -= 2 * L_SUBFR; - } - FOR( i = 0; i < L_SUBFR; i++ ) - { - y[i] = add_o( y[i], *p0++, &Overflow ); /*Q12+scale*/ - move16(); - } - } - return; -} -#endif /* * E_ACELP_4t_fx * @@ -1775,10 +1439,8 @@ void E_ACELP_4t_fx( const Word32 total_brate, /*Q0*/ const Word16 i_subfr, /*Q0*/ const Word16 cmpl_flag /*Q0*/ -#ifdef REUSE_EVS_BE_ACELP_4T64 , const Word16 element_mode /*Q0*/ -#endif ) { PulseConfig config; @@ -1819,88 +1481,15 @@ void E_ACELP_4t_fx( IF( acelpautoc ) { -#ifndef REUSE_EVS_BE_ACELP_4T64 - E_ACELP_4tsearchx_fx( dn, cn, R, code, &config, ind ); -#else E_ACELP_4tsearchx_fx( dn, cn, R, code, &config, ind, element_mode ); -#endif } ELSE { -#ifndef REUSE_EVS_BE_ACELP_4T64 - E_ACELP_4tsearch_fx( dn, cn, H, code, &config, ind, y ); -#else E_ACELP_4tsearch_fx( dn, cn, H, code, &config, ind, y, element_mode ); -#endif } E_ACELP_indexing_fx( code, &config, NB_TRACK_FCB_4T, _index ); return; } -#ifndef REUSE_EVS_BE_ACELP_4T64 -void E_ACELP_4t_ivas_fx( - Word16 dn[], /*Qdn*/ - Word16 cn[] /* Q_xn */, - Word16 H[], /*Q12*/ - Word16 R[], /*Qx*/ - Word8 acelpautoc, /*Q0*/ - Word16 code[], /*Q9*/ - Word16 cdk_index, /*Q0*/ - Word16 _index[], /*Q0*/ - const Word16 L_frame, /*Q0*/ - const Word16 last_L_frame, /*Q0*/ - const Word32 total_brate, /*Q0*/ - const Word16 i_subfr, /*Q0*/ - const Word16 cmpl_flag, /*Q0*/ - Word16 element_mode /*Q0*/ ) -{ - PulseConfig config; - Word16 ind[NPMAXPT * 4]; - Word16 y[L_SUBFR]; - - move16(); - move16(); - move16(); - move16(); - move16(); - move16(); - move16(); - move16(); - move16(); - move16(); - move16(); - move16(); - move16(); - move16(); - move16(); - move16(); - memcpy( &config, &PulseConfTable[cdk_index], sizeof( PulseConfTable[cdk_index] ) ); - - - if ( cmpl_flag > 0 ) - { - config.nbiter = cmpl_flag; - move16(); - } - test(); - test(); - IF( NE_16( L_frame, last_L_frame ) && EQ_32( total_brate, ACELP_24k40 ) && LT_32( i_subfr, 5 * L_SUBFR ) ) - { - config.nbiter = sub( config.nbiter, 1 ); - config.nbiter = s_max( config.nbiter, 1 ); - } - - IF( acelpautoc ) - { - E_ACELP_4tsearchx_ivas_fx( dn, cn, R, code, &config, ind, element_mode ); - } - ELSE - { - E_ACELP_4tsearch_ivas_fx( dn, cn, H, code, &config, ind, y ); - } - E_ACELP_indexing_fx( code, &config, NB_TRACK_FCB_4T, _index ); - return; -} -#endif static void E_ACELP_indexing_shift( Word16 wordcnt, /* i: 16-bit word count including the newly shifted-in bits Q0*/ Word16 shift_bits, /* i: number of bits to shift in from the lsb Q0*/ @@ -2323,11 +1912,7 @@ void E_ACELP_innovative_codebook_fx( /* Innovative codebook search */ assert( acelp_cfg->fixed_cdk_index[idx] < ACELP_FIXED_CDK_NB ); -#ifdef REUSE_EVS_BE_ACELP_4T64 E_ACELP_4t_fx( dn, cn2, h2, Rw2, acelpautoc, code, acelp_cfg->fixed_cdk_index[idx], *pt_indice, L_frame, last_L_frame, total_brate, i_subfr, 0, 0 ); -#else - E_ACELP_4t_fx( dn, cn2, h2, Rw2, acelpautoc, code, acelp_cfg->fixed_cdk_index[idx], *pt_indice, L_frame, last_L_frame, total_brate, i_subfr, 0 ); -#endif *pt_indice += 8; /* Generate weighted code */ diff --git a/lib_enc/enc_acelpx_fx.c b/lib_enc/enc_acelpx_fx.c index cde026fb3b3045942741dd2a8f71740a678455bb..3d095934115a5fdfaf92371f213de30c94dff048 100644 --- a/lib_enc/enc_acelpx_fx.c +++ b/lib_enc/enc_acelpx_fx.c @@ -368,11 +368,8 @@ void E_ACELP_4tsearchx_fx( Word16 code[], /*Q9*/ const PulseConfig *config, Word16 ind[] /*Q0*/ -#ifdef REUSE_EVS_BE_ACELP_4T64 , - const Word16 element_mode -#endif -) + const Word16 element_mode ) { Word16 sign[L_SUBFR], vec[L_SUBFR]; Word16 cor[L_SUBFR]; @@ -388,11 +385,9 @@ void E_ACELP_4tsearchx_fx( Word16 scale; Word16 sign_val_1, sign_val_2; Word16 nb_pulse, nb_pulse_m2; -#ifdef REUSE_EVS_BE_ACELP_4T64 Word16 psk = 0; Word16 val, index, track; move16(); -#endif move16(); move16(); @@ -408,9 +403,7 @@ void E_ACELP_4tsearchx_fx( nb_pulse_m2 = sub( nb_pulse, 2 ); /* Init to avoid crash when the search does not find a solution */ -#ifdef REUSE_EVS_BE_ACELP_4T64 IF( EQ_16( element_mode, EVS_MONO ) ) -#endif { FOR( k = 0; k < nb_pulse; k++ ) { @@ -418,7 +411,6 @@ void E_ACELP_4tsearchx_fx( move16(); } } -#ifdef REUSE_EVS_BE_ACELP_4T64 ELSE { FOR( k = 0; k < nb_pulse; k++ ) @@ -427,7 +419,6 @@ void E_ACELP_4tsearchx_fx( move16(); } } -#endif scale = 0; move16(); s = L_mult0( Rw[0], Rw[0] ); /*Q18*/ @@ -577,7 +568,6 @@ void E_ACELP_4tsearchx_fx( &ind[j], dn, cor, sign, sign_val_1 ); } -#ifdef REUSE_EVS_BE_ACELP_4T64 test(); IF( GT_16( alp, ONE_IN_Q14 ) && ( element_mode > EVS_MONO ) ) { @@ -586,7 +576,6 @@ void E_ACELP_4tsearchx_fx( Scale_sig( R_buf, 2 * L_SUBFR - 1, -1 ); /*Q8+scale*/ Scale_sig( dn, L_SUBFR, -1 ); /*Qdn-1*/ } -#endif st = add( st, 1 ); } @@ -601,10 +590,8 @@ void E_ACELP_4tsearchx_fx( { ps2k = ps2; move16(); -#ifdef REUSE_EVS_BE_ACELP_4T64 psk = ps; move16(); -#endif alpk = alp; move16(); Copy( ind, codvec, nb_pulse ); /* Q0 */ @@ -612,286 +599,6 @@ void E_ACELP_4tsearchx_fx( } - /* - * Store weighted energy of code, build the codeword and index of codevector. - */ -#ifdef REUSE_EVS_BE_ACELP_4T64 - IF( EQ_16( element_mode, EVS_MONO ) ) -#endif - { - E_ACELP_build_code( nb_pulse, codvec, sign, code, ind ); - } -#ifdef REUSE_EVS_BE_ACELP_4T64 - ELSE - { - /* Store weighted energy of code, build the codeword and index of codevector. */ - set16_fx( code, 0, L_SUBFR ); - set16_fx( ind, -1, NPMAXPT * 4 ); - - FOR( k = 0; k < config->nb_pulse; k++ ) - { - i = codvec[k]; /* read pulse position Q0*/ - move16(); - val = sign[i]; /* read sign Q13*/ - move16(); - - index = shr( i, 2 ); /* pos of pulse (0..15) */ - // track = i % 4; - track = s_and( i, 3 ); - IF( L_mult0( val, psk ) > 0 ) - { - code[i] = add( code[i], ONE_IN_Q9 /*1.0f*/ ); /* Q9 */ - move16(); - codvec[k] = add( codvec[k], 2 * L_SUBFR ); /* Q0 */ - move16(); - } - ELSE - { - code[i] = sub( code[i], ONE_IN_Q9 /*1.0f*/ ); /* Q9 */ - move16(); - index = add( index, 16 ); /* Q0 */ - } - - i = imult1616( track, NPMAXPT ); - WHILE( ind[i] >= 0 ) - { - i++; - } - - ind[i] = index; - move16(); - } - } -#endif -} -#ifndef REUSE_EVS_BE_ACELP_4T64 -void E_ACELP_4tsearchx_ivas_fx( - Word16 dn[], /*Qdn*/ - const Word16 cn[], /*Q_new*/ - Word16 Rw[], /*Q9*/ - Word16 code[], /*Q9*/ - const PulseConfig *config, - Word16 ind[], /*Q0*/ - Word16 element_mode ) -{ - Word16 sign[L_SUBFR], vec[L_SUBFR]; - Word16 cor[L_SUBFR]; - Word16 R_buf[2 * L_SUBFR - 1], *R; - Word16 dn2[L_SUBFR]; - Word16 ps2k, ps /* same format as dn[] */, ps2, alpk, alp = 0 /* Q13 and later Q_Rw*Q_signval=Q_cor*Q_signval */; - Word32 s; - Word16 codvec[NB_PULSE_MAX]; - Word16 pos_max[4]; - Word16 dn2_pos[8 * 4]; - UWord8 ipos[NB_PULSE_MAX]; - Word16 i, j, k, st, pos = 0; - Word16 scale; - Word16 sign_val_1, sign_val_2; - Word16 nb_pulse, nb_pulse_m2; - Word16 psk; - Word16 val, index, track; - move16(); - move16(); - - psk = ps = 0; /* to avoid compilation warnings */ - move16(); - move16(); - - - alp = config->alp; /* Q13 */ - move16(); - nb_pulse = config->nb_pulse; - move16(); - nb_pulse_m2 = sub( nb_pulse, 2 ); - - /* Init to avoid crash when the search does not find a solution */ - FOR( k = 0; k < nb_pulse; k++ ) - { - codvec[k] = s_and( k, 3 ); - move16(); - } - - scale = 0; - move16(); - s = L_mult0( Rw[0], Rw[0] ); /* Q18 */ - FOR( i = 1; i < L_SUBFR; i++ ) - { - s = L_mac0( s, Rw[i], Rw[i] ); /* Q18 */ - } - if ( s_and( (Word16) GE_16( nb_pulse, 9 ), (Word16) GT_32( s, 0x800000 ) ) ) - { - scale = -1; - move16(); - } - if ( s_and( (Word16) GE_16( nb_pulse, 13 ), (Word16) GT_32( s, 0x4000000 ) ) ) - { - scale = -2; - move16(); - } - IF( GE_16( nb_pulse, 18 ) ) - { - if ( GT_32( s, 0x200000 ) ) - { - scale = -1; - move16(); - } - if ( GT_32( s, 0x400000 ) ) - { - scale = -2; - move16(); - } - if ( GT_32( s, 0x4000000 ) ) - { - scale = -3; - move16(); - } - } - if ( s_and( (Word16) GE_16( nb_pulse, 28 ), (Word16) GT_32( s, 0x800000 ) ) ) - { - scale = -3; - move16(); - } - if ( s_and( (Word16) GE_16( nb_pulse, 36 ), (Word16) GT_32( s, 0x4000000 ) ) ) - { - scale = -4; - move16(); - } - - /* Set up autocorrelation vector */ - R = R_buf + L_SUBFR - 1; - Copy_Scale_sig( Rw, R, L_SUBFR, scale ); /* Q9 + scale */ - FOR( k = 1; k < L_SUBFR; k++ ) - { - R[-k] = R[k]; - move16(); - } - - /* Sign value */ - sign_val_2 = 0x2000; /* Q15 */ - move16(); - if ( GE_16( nb_pulse, 24 ) ) - { - sign_val_2 = shr( sign_val_2, 1 ); /* Q15 */ - } - sign_val_1 = shr( sign_val_2, 1 ); /* Q15 */ - - /* - * Find sign for each pulse position. - */ - E_ACELP_pulsesign( cn, dn, dn2, sign, vec, alp, sign_val_2, L_SUBFR ); - - /* - * Select the most important 8 position per track according to dn2[]. - */ - E_ACELP_findcandidates( dn2, dn2_pos, pos_max ); - - /* - * Deep first search: - */ - - /* Ensure that in the loop below s > 0 in the first iteration, the actual values do not matter. */ - ps2k = -1; - move16(); - alpk = 1; - move16(); - - /* Number of iterations */ - FOR( k = 0; k < config->nbiter; k++ ) - { - E_ACELP_setup_pulse_search_pos( config, k, ipos ); - - /* index to first non-fixed position */ - pos = config->fixedpulses; /* Q0 */ - move16(); - - IF( config->fixedpulses == 0 ) /* 1100, 11, 1110, 1111, 2211 */ - { - ps = 0; - move16(); - alp = 0; - move16(); - set16_fx( cor, 0, L_SUBFR ); - } - ELSE - { - assert( config->fixedpulses == 2 || config->fixedpulses == 4 ); - - /* set fixed positions */ - FOR( i = 0; i < pos; ++i ) - { - ind[i] = pos_max[ipos[i]]; /* Q0 */ - move16(); - } - - /* multiplication of autocorrelation with signed fixed pulses */ - E_ACELP_update_cor_fx( ind, config->fixedpulses, sign, R, NULL, cor ); - - /* normalisation contribution of fixed part */ - s = L_mult0( cor[ind[0]], sign[ind[0]] ); /* Q22 */ - ps = dn[ind[0]]; /* Qdn */ - move16(); - FOR( i = 1; i < pos; ++i ) - { - s = L_mac0( s, cor[ind[i]], sign[ind[i]] ); /*Q12+Q9+1=Q22 */ - ps = add( ps, dn[ind[i]] ); - } - alp = round_fx( s ); /*mac0 >>1 sign = 2 Q6*/ - } - - /* other stages of 2 pulses */ - st = 0; - move16(); - FOR( j = pos; j < nb_pulse; j += 2 ) - { - IF( GE_16( nb_pulse_m2, j ) ) /* pair-wise search */ - { - /* - * Calculate correlation of all possible positions - * of the next 2 pulses with previous fixed pulses. - * Each pulse can have 16 possible positions. - */ - - E_ACELP_2pulse_searchx_fx( config->nbpos[st], ipos[j], ipos[j + 1], R, &ps, &alp, - &ind[j], &ind[j + 1], dn, dn2_pos, cor, sign, sign_val_2 ); - } - ELSE /* single pulse search */ - { - E_ACELP_1pulse_searchx_fx( &ipos[j], R, &ps, &alp, - &ind[j], dn, cor, sign, sign_val_1 ); - } - - IF( GT_16( alp, ONE_IN_Q14 ) ) - { - alp = shr( alp, 1 ); - Scale_sig( cor, L_SUBFR, -1 ); /*Q8*/ - Scale_sig( R_buf, 2 * L_SUBFR - 1, -1 ); /*Q8+scale*/ - Scale_sig( dn, L_SUBFR, -1 ); /*Qdn-1*/ - } - - - st = add( st, 1 ); - } - - /* memorise the best codevector */ - /*ps2 = ps * ps; MULT(1);*/ - ps2 = mult( ps, ps ); /* 2*Qdn+1 */ - - /*s = (alpk * ps2) - (ps2k * alp); MULT(2);ADD(1);*/ - s = L_msu( L_mult( alpk, ps2 ), ps2k, alp ); /* 2*Qdn+8 */ - - IF( s > 0 ) - { - ps2k = ps2; - move16(); - psk = ps; - move16(); - alpk = alp; - move16(); - Copy( ind, codvec, nb_pulse ); /*Q0*/ - } - } - - /* * Store weighted energy of code, build the codeword and index of codevector. */ @@ -940,4 +647,3 @@ void E_ACELP_4tsearchx_ivas_fx( } } } -#endif diff --git a/lib_enc/enc_amr_wb_fx.c b/lib_enc/enc_amr_wb_fx.c index d9048ac69245bd8fb7928c129b2593615368da9e..395d95bdf224d9e5fe5453b8d0bad7c05dae61a4 100644 --- a/lib_enc/enc_amr_wb_fx.c +++ b/lib_enc/enc_amr_wb_fx.c @@ -147,7 +147,7 @@ void encod_amr_wb_fx( *pt_pitch = pit_encode_fx( hBstr, st->acelp_cfg.pitch_bits, st->core_brate, 1, L_FRAME, -1, &pitch_limit_flag, i_subfr, exc, L_SUBFR, T_op, &T0_min, &T0_max, &T0, &T0_frac, h1, xn, 0 /*hStereoTD->tdm_Pitch_reuse_flag*/, NULL /*hStereoTD->tdm_Pri_pitch_buf*/ -#if defined REUSE_EVS_BE_ACELP_PITCH && !defined REUSE_EVS_ACELP_PITCH_NORM_CORR +#if !defined REUSE_EVS_ACELP_PITCH_NORM_CORR , 0, Q_new #endif diff --git a/lib_enc/enc_gen_voic_fx.c b/lib_enc/enc_gen_voic_fx.c index 26b8ec31e1b810798f7241eebad9973833921a59..dba7113308f6b02b8b7d4515e0f029f631cdac2d 100644 --- a/lib_enc/enc_gen_voic_fx.c +++ b/lib_enc/enc_gen_voic_fx.c @@ -10,7 +10,6 @@ #include "prot_fx_enc.h" /* Function prototypes */ -#ifdef FIX_1766_TCX2ACELP_BWE_ISSUE /*-------------------------------------------------------------------* * rem_offset() * @@ -41,7 +40,6 @@ static void rem_offset( return; } -#endif /*======================================================================*/ @@ -247,7 +245,7 @@ void encod_gen_voic_fx( *pt_pitch_fx = pit_encode_fx( hBstr, st_fx->acelp_cfg.pitch_bits, st_fx->core_brate, 0, L_frame, st_fx->coder_type, &pitch_limit_flag, i_subfr_fx, exc_fx, L_SUBFR, st_fx->pitch, &T0_min_fx, &T0_max_fx, &T0_fx, &T0_frac_fx, h1_fx, xn_fx, tdm_Pitch_reuse_flag, tdm_Pri_pitch_buf -#if defined REUSE_EVS_BE_ACELP_PITCH && !defined REUSE_EVS_ACELP_PITCH_NORM_CORR +#if !defined REUSE_EVS_ACELP_PITCH_NORM_CORR , st_fx->element_mode, Q_new #endif @@ -314,12 +312,8 @@ void encod_gen_voic_fx( IF( LE_32( st_fx->core_brate, ACELP_8k00 ) ) { gain_enc_lbr_fx( hBstr, st_fx->acelp_cfg.gains_mode, st_fx->coder_type, i_subfr_fx, xn_fx, y1_fx, shift_wsp, y2_fx, code_fx, - &gain_pit_fx, &gain_code_fx, &gain_inov_fx, &norm_gain_code_fx, g_corr_fx, gc_mem, gp_mem, clip_gain_fx, L_SUBFR -#ifdef REUSE_EVS_BE_GAINQ_LBR - , - st_fx->element_mode -#endif - ); + &gain_pit_fx, &gain_code_fx, &gain_inov_fx, &norm_gain_code_fx, g_corr_fx, gc_mem, gp_mem, clip_gain_fx, L_SUBFR, + st_fx->element_mode ); } ELSE IF( GT_32( st_fx->core_brate, ACELP_32k ) ) { @@ -613,7 +607,6 @@ void encod_gen_voic_ivas_fx( Scale_sig( h1_fx, L_SUBFR, sub( 14, q_h1 ) ); /* set h1[] in Q14 with scaling for convolution Q14*/ /* scaling of xn[] to limit dynamic at 12 bits */ Scale_sig( xn_fx, L_SUBFR, shift ); -#ifdef FIX_1766_TCX2ACELP_BWE_ISSUE test(); test(); IF( Es_pred_fx < 0 && LE_16( i_subfr_fx, L_SUBFR ) && NE_16( st_fx->last_core, ACELP_CORE ) ) @@ -622,24 +615,18 @@ void encod_gen_voic_ivas_fx( rem_offset( xn_fx, xn_fx, L_SUBFR ); rem_offset( cn_fx, cn_fx, L_SUBFR ); } -#endif /*----------------------------------------------------------------* * Close-loop pitch search and quantization *----------------------------------------------------------------*/ -#ifndef REUSE_EVS_BE_ACELP_PITCH - *pt_pitch_fx = pit_encode_ivas_fx( hBstr, st_fx->acelp_cfg.pitch_bits, st_fx->core_brate, 0, L_frame, st_fx->coder_type, &pitch_limit_flag, i_subfr_fx, exc_fx, - L_SUBFR, st_fx->pitch, &T0_min_fx, &T0_max_fx, &T0_fx, &T0_frac_fx, h1_fx, xn_fx, tdm_Pitch_reuse_flag, tdm_Pri_pitch_buf, Q_new ); /* Q6 */ -#else *pt_pitch_fx = pit_encode_fx( hBstr, st_fx->acelp_cfg.pitch_bits, st_fx->core_brate, 0, L_frame, st_fx->coder_type, &pitch_limit_flag, i_subfr_fx, exc_fx, L_SUBFR, st_fx->pitch, &T0_min_fx, &T0_max_fx, &T0_fx, &T0_frac_fx, h1_fx, xn_fx, tdm_Pitch_reuse_flag, tdm_Pri_pitch_buf -#if defined REUSE_EVS_BE_ACELP_PITCH && !defined REUSE_EVS_ACELP_PITCH_NORM_CORR +#if !defined REUSE_EVS_ACELP_PITCH_NORM_CORR , st_fx->element_mode, Q_new #endif ); /* Q6 */ -#endif move16(); tbe_celp_exc_ivas( st_fx->element_mode, st_fx->idchan, L_frame, L_SUBFR, i_subfr_fx, T0_fx, T0_frac_fx, &error_fx, bwe_exc_fx, st_fx->tdm_LRTD_flag ); @@ -666,13 +653,8 @@ void encod_gen_voic_ivas_fx( /*-----------------------------------------------------------------* * LP filtering of the adaptive excitation, codebook target computation *-----------------------------------------------------------------*/ -#ifndef REUSE_EVS_BE_ACELP_LP_FILT - lp_select = lp_filt_exc_enc_ivas_fx( MODE1, st_fx->coder_type, i_subfr_fx, exc_fx, h1_fx, - xn_fx, y1_fx, xn2_fx, L_SUBFR, L_frame, g_corr_fx, clip_gain_fx, &gain_pit_fx, &lp_flag ); -#else lp_select = lp_filt_exc_enc_fx( MODE1, st_fx->coder_type, i_subfr_fx, exc_fx, h1_fx, xn_fx, y1_fx, xn2_fx, L_SUBFR, L_frame, g_corr_fx, clip_gain_fx, &gain_pit_fx, &lp_flag ); -#endif IF( EQ_16( lp_flag, NORMAL_OPERATION ) ) { @@ -701,37 +683,11 @@ void encod_gen_voic_ivas_fx( /*-----------------------------------------------------------------* * Gain encoding *-----------------------------------------------------------------*/ -#ifndef REUSE_EVS_BE_GAINQ IF( LE_32( st_fx->core_brate, ACELP_8k00 ) ) { - gain_enc_lbr_ivas_fx( hBstr, st_fx->acelp_cfg.gains_mode, st_fx->coder_type, i_subfr_fx, xn_fx, y1_fx, shift_wsp, y2_fx, code_fx, - &gain_pit_fx, &gain_code_fx, &gain_inov_fx, &norm_gain_code_fx, g_corr_fx, gc_mem, gp_mem, clip_gain_fx, L_SUBFR ); - } - ELSE IF( GT_32( st_fx->core_brate, ACELP_32k ) ) - { - gain_enc_SQ_ivas_fx( hBstr, st_fx->acelp_cfg.gains_mode, i_subfr_fx, xn_fx, y1_fx, y2_fx, code_fx, Es_pred_fx, - &gain_pit_fx, &gain_code_fx, &gain_inov_fx, &norm_gain_code_fx, g_corr_fx, clip_gain_fx, shift_wsp ); - } - ELSE - { - gain_enc_mless_ivas_fx( hBstr, st_fx->acelp_cfg.gains_mode, st_fx->element_mode, L_frame, i_subfr_fx, -1, xn_fx, y1_fx, shift_wsp, y2_fx, code_fx, Es_pred_fx, - &gain_pit_fx, &gain_code_fx, &gain_inov_fx, &norm_gain_code_fx, g_corr_fx, clip_gain_fx ); - } -#else - IF( LE_32( st_fx->core_brate, ACELP_8k00 ) ) - { -#ifndef REUSE_EVS_BE_GAINQ_LBR - gain_enc_lbr_ivas_fx( hBstr, st_fx->acelp_cfg.gains_mode, st_fx->coder_type, i_subfr_fx, xn_fx, y1_fx, shift_wsp, y2_fx, code_fx, - &gain_pit_fx, &gain_code_fx, &gain_inov_fx, &norm_gain_code_fx, g_corr_fx, gc_mem, gp_mem, clip_gain_fx, L_SUBFR ); -#else gain_enc_lbr_fx( hBstr, st_fx->acelp_cfg.gains_mode, st_fx->coder_type, i_subfr_fx, xn_fx, y1_fx, shift_wsp, y2_fx, code_fx, - &gain_pit_fx, &gain_code_fx, &gain_inov_fx, &norm_gain_code_fx, g_corr_fx, gc_mem, gp_mem, clip_gain_fx, L_SUBFR -#ifdef REUSE_EVS_BE_GAINQ_LBR - , - st_fx->element_mode -#endif - ); -#endif + &gain_pit_fx, &gain_code_fx, &gain_inov_fx, &norm_gain_code_fx, g_corr_fx, gc_mem, gp_mem, clip_gain_fx, L_SUBFR, + st_fx->element_mode ); } ELSE IF( GT_32( st_fx->core_brate, ACELP_32k ) ) { @@ -743,7 +699,6 @@ void encod_gen_voic_ivas_fx( gain_enc_mless_fx( hBstr, st_fx->acelp_cfg.gains_mode, st_fx->element_mode, L_frame, i_subfr_fx, -1, xn_fx, y1_fx, shift_wsp, y2_fx, code_fx, Es_pred_fx, &gain_pit_fx, &gain_code_fx, &gain_inov_fx, &norm_gain_code_fx, g_corr_fx, clip_gain_fx ); } -#endif IF( st_fx->Opt_SC_VBR ) { if ( EQ_16( hSC_VBR->last_ppp_mode, 1 ) ) diff --git a/lib_enc/enc_higher_acelp_fx.c b/lib_enc/enc_higher_acelp_fx.c index 986bdde0bcaff2a50c6e61f8951fea7b2fe86ac1..2a0b0e7b10437d8209305578dde2e02c7d176fab 100644 --- a/lib_enc/enc_higher_acelp_fx.c +++ b/lib_enc/enc_higher_acelp_fx.c @@ -287,11 +287,7 @@ void transf_cdbk_enc_fx( FOR( i = 0; i < Nsv * WIDTH_BAND; i++ ) { -#ifdef ISSUE_1796_replace_shl_o x_tran[i] = shl_sat( x_norm[i], Q_AVQ_OUT_DEC ); -#else - x_tran[i] = shl_o( x_norm[i], Q_AVQ_OUT_DEC, &Overflow ); -#endif move16(); } @@ -616,11 +612,7 @@ void transf_cdbk_enc_ivas_fx( move16(); move16(); } -#ifndef REUSE_EVS_BE_ACELP_AVQ - AVQ_encmux_ivas_fx( st_fx->hBstr, -1, x_norm, &nBits, Nsv, nq, avq_bit_sFlag, trgtSvPos ); -#else AVQ_encmux_fx( st_fx->hBstr, -1, x_norm, &nBits, Nsv, nq, avq_bit_sFlag, trgtSvPos ); -#endif /* save # of AVQ unused bits for next subframe */ *unbits = nBits; move16(); @@ -645,11 +637,7 @@ void transf_cdbk_enc_ivas_fx( FOR( i = 0; i < Nsv * WIDTH_BAND; i++ ) { -#ifdef ISSUE_1796_replace_shl_o x_tran[i] = shl_sat( x_norm[i], Q_AVQ_OUT_DEC ); -#else - x_tran[i] = shl_o( x_norm[i], Q_AVQ_OUT_DEC, &Overflow ); -#endif move16(); } diff --git a/lib_enc/enc_pit_exc_fx.c b/lib_enc/enc_pit_exc_fx.c index 395f7da93fb1e0ba33e47cea8575e36c542fbd4f..b44592307d0088c6b5391a2a2818b3941f1fc5fd 100644 --- a/lib_enc/enc_pit_exc_fx.c +++ b/lib_enc/enc_pit_exc_fx.c @@ -264,7 +264,7 @@ void enc_pit_exc_fx( *----------------------------------------------------------------*/ *pt_pitch = pit_encode_fx( hBstr, st_fx->acelp_cfg.pitch_bits, Pitch_BR, 0, st_fx->L_frame, Pitch_CT, &pitch_limit_flag, i_subfr, exc, L_subfr, st_fx->pitch, &T0_min, &T0_max, T0, T0_frac, h1, xn, tdm_Pitch_reuse_flag, tdm_Pri_pitch_buf -#if defined REUSE_EVS_BE_ACELP_PITCH && !defined REUSE_EVS_ACELP_PITCH_NORM_CORR +#if !defined REUSE_EVS_ACELP_PITCH_NORM_CORR , st_fx->element_mode, Q_new #endif @@ -333,12 +333,8 @@ void enc_pit_exc_fx( * Gain encoding *-----------------------------------------------------------------*/ - gain_enc_lbr_fx( st_fx->hBstr, st_fx->acelp_cfg.gains_mode, GENERIC, i_subfr, xn, y1, shift_wsp, y2, code, &gain_pit, &gain_code, &gain_inov, &norm_gain_code, g_corr, gc_mem, gp_mem, clip_gain, 2 * L_SUBFR -#ifdef REUSE_EVS_BE_GAINQ_LBR - , - st_fx->element_mode -#endif - ); + gain_enc_lbr_fx( st_fx->hBstr, st_fx->acelp_cfg.gains_mode, GENERIC, i_subfr, xn, y1, shift_wsp, y2, code, &gain_pit, &gain_code, &gain_inov, &norm_gain_code, g_corr, gc_mem, gp_mem, clip_gain, 2 * L_SUBFR, + st_fx->element_mode ); } ELSE { @@ -527,11 +523,7 @@ void enc_pit_exc_fx( } } -#ifdef ISSUE_1796_replace_shl_o - cum_gpit = shl_sat( cum_gpit, 1 ); /*Q15*/ -#else - cum_gpit = shl_o( cum_gpit, 1, &Overflow ); /*Q15*/ -#endif + cum_gpit = shl_sat( cum_gpit, 1 ); /*Q15*/ *gpit = round_fx( L_mac( L_mult( 3277, *gpit ), 29491, cum_gpit ) ); /*Q15*/ } @@ -748,19 +740,13 @@ void enc_pit_exc_ivas_fx( * Close-loop pitch search and quantization * Adaptive exc. construction *----------------------------------------------------------------*/ -#ifndef REUSE_EVS_BE_ACELP_PITCH - *pt_pitch = pit_encode_ivas_fx( hBstr, st_fx->acelp_cfg.pitch_bits, Pitch_BR, 0, st_fx->L_frame, Pitch_CT, &pitch_limit_flag, i_subfr, exc, - L_subfr, st_fx->pitch, &T0_min, &T0_max, T0, T0_frac, h1, xn, tdm_Pitch_reuse_flag, tdm_Pri_pitch_buf, Q_new ); /* Q6 */ - move16(); -#else *pt_pitch = pit_encode_fx( hBstr, st_fx->acelp_cfg.pitch_bits, Pitch_BR, 0, st_fx->L_frame, Pitch_CT, &pitch_limit_flag, i_subfr, exc, L_subfr, st_fx->pitch, &T0_min, &T0_max, T0, T0_frac, h1, xn, tdm_Pitch_reuse_flag, tdm_Pri_pitch_buf -#if defined REUSE_EVS_BE_ACELP_PITCH && !defined REUSE_EVS_ACELP_PITCH_NORM_CORR +#if !defined REUSE_EVS_ACELP_PITCH_NORM_CORR , st_fx->element_mode, Q_new #endif - ); /* Q6 */ -#endif + ); /* Q6 */ Scale_sig( h1, L_subfr, sub( 14, q_h1 ) ); /* set h1[] in Q14 with scaling for convolution Q14*/ /*-----------------------------------------------------------------* @@ -779,13 +765,8 @@ void enc_pit_exc_ivas_fx( * Codebook target computation * (No LP filtering of the adaptive excitation) *-----------------------------------------------------------------*/ -#ifndef REUSE_EVS_BE_ACELP_LP_FILT - lp_select = lp_filt_exc_enc_ivas_fx( MODE1, AUDIO, i_subfr, exc, h1, - xn, y1, xn2, L_subfr, st_fx->L_frame, g_corr, clip_gain, &gain_pit, &lp_flag ); /* Q0 */ -#else lp_select = lp_filt_exc_enc_fx( MODE1, AUDIO, i_subfr, exc, h1, xn, y1, xn2, L_subfr, st_fx->L_frame, g_corr, clip_gain, &gain_pit, &lp_flag ); /* Q0 */ -#endif IF( EQ_16( lp_flag, NORMAL_OPERATION ) ) { push_indice( hBstr, IND_LP_FILT_SELECT, lp_select, 1 ); @@ -829,16 +810,8 @@ void enc_pit_exc_ivas_fx( * Gain encoding *-----------------------------------------------------------------*/ -#ifndef REUSE_EVS_BE_GAINQ_LBR - gain_enc_lbr_ivas_fx( st_fx->hBstr, st_fx->acelp_cfg.gains_mode, GENERIC, i_subfr, xn, y1, sub( shift_wsp, 1 ), y2, code, &gain_pit, &gain_code, &gain_inov, &norm_gain_code, g_corr, gc_mem, gp_mem, clip_gain, 2 * L_SUBFR ); -#else - gain_enc_lbr_fx( st_fx->hBstr, st_fx->acelp_cfg.gains_mode, GENERIC, i_subfr, xn, y1, sub( shift_wsp, 1 ), y2, code, &gain_pit, &gain_code, &gain_inov, &norm_gain_code, g_corr, gc_mem, gp_mem, clip_gain, 2 * L_SUBFR -#ifdef REUSE_EVS_BE_GAINQ_LBR - , - st_fx->element_mode -#endif - ); -#endif + gain_enc_lbr_fx( st_fx->hBstr, st_fx->acelp_cfg.gains_mode, GENERIC, i_subfr, xn, y1, sub( shift_wsp, 1 ), y2, code, &gain_pit, &gain_code, &gain_inov, &norm_gain_code, g_corr, gc_mem, gp_mem, clip_gain, 2 * L_SUBFR, + st_fx->element_mode ); } ELSE { @@ -851,13 +824,8 @@ void enc_pit_exc_ivas_fx( /*-----------------------------------------------------------------* * Gain encoding *-----------------------------------------------------------------*/ -#ifndef REUSE_EVS_BE_GAINQ - gain_enc_mless_ivas_fx( hBstr, st_fx->acelp_cfg.gains_mode, st_fx->element_mode, st_fx->L_frame, i_subfr, -1, xn, y1, sub( shift_wsp, 1 ), y2, code, Es_pred, - &gain_pit, &gain_code, &gain_inov, &norm_gain_code, g_corr, clip_gain ); -#else gain_enc_mless_fx( hBstr, st_fx->acelp_cfg.gains_mode, st_fx->element_mode, st_fx->L_frame, i_subfr, -1, xn, y1, sub( shift_wsp, 1 ), y2, code, Es_pred, &gain_pit, &gain_code, &gain_inov, &norm_gain_code, g_corr, clip_gain ); -#endif } gp_clip_test_gain_pit_fx( st_fx->element_mode, st_fx->core_brate, gain_pit, st_fx->clip_var_fx ); @@ -1031,10 +999,6 @@ void enc_pit_exc_ivas_fx( } } -#ifdef ISSUE_1796_replace_shl_o - cum_gpit = shl_sat( cum_gpit, 1 ); /*Q15*/ -#else - cum_gpit = shl_o( cum_gpit, 1, &Overflow ); /*Q15*/ -#endif + cum_gpit = shl_sat( cum_gpit, 1 ); /*Q15*/ *gpit = round_fx( L_mac( L_mult( 3277, *gpit ), 29491, cum_gpit ) ); /*Q15*/ } diff --git a/lib_enc/enc_tran_fx.c b/lib_enc/enc_tran_fx.c index 23f1377aa89361247018aeff3097701bf9158283..3e15713702a394a6542a14cc302b582dada09086 100644 --- a/lib_enc/enc_tran_fx.c +++ b/lib_enc/enc_tran_fx.c @@ -587,29 +587,6 @@ Word16 encod_tran_ivas_fx( * Test quantized gain of pitch for pitch clipping algorithm * Update tilt of code: 0.0 (unvoiced) to 0.5 (voiced) *-----------------------------------------------------------------*/ -#ifndef REUSE_EVS_BE_GAINQ - IF( Jopt_flag == 0 ) - { - /* SQ gain_code */ - gain_enc_tc_ivas_fx( hBstr, st_fx->acelp_cfg.gains_mode, i_subfr, xn, y2, code, Es_pred_fx, - &gain_pit, &gain_code, &gain_inov, &norm_gain_code, shift_wsp ); - } - ELSE - { - IF( GT_32( st_fx->core_brate, ACELP_32k ) ) - { - /* SQ gain_pit and gain_code */ - gain_enc_SQ_ivas_fx( hBstr, st_fx->acelp_cfg.gains_mode, i_subfr, xn, y1, y2, code, Es_pred_fx, - &gain_pit, &gain_code, &gain_inov, &norm_gain_code, g_corr, clip_gain, shift_wsp ); - } - ELSE - { - /* VQ gain_pit and gain_code */ - gain_enc_mless_ivas_fx( hBstr, st_fx->acelp_cfg.gains_mode, st_fx->element_mode, L_frame_fx, i_subfr, tc_subfr, xn, y1, shift_wsp, y2, code, Es_pred_fx, - &gain_pit, &gain_code, &gain_inov, &norm_gain_code, g_corr, clip_gain ); - } - } -#else IF( Jopt_flag == 0 ) { /* SQ gain_code */ @@ -631,7 +608,6 @@ Word16 encod_tran_ivas_fx( &gain_pit, &gain_code, &gain_inov, &norm_gain_code, g_corr, clip_gain ); } } -#endif gp_clip_test_gain_pit_fx( st_fx->element_mode, st_fx->core_brate, gain_pit, st_fx->clip_var_fx ); Lgcode = L_shl_o( gain_code, Q_new, &Overflow ); /* scaled gain_code with Qnew -> Q16*/ diff --git a/lib_enc/enc_uv_fx.c b/lib_enc/enc_uv_fx.c index 8600c0043ce82a64a071a37e169b4163ee28ab57..28c79a9685515706fc1314278f47efd228229791 100644 --- a/lib_enc/enc_uv_fx.c +++ b/lib_enc/enc_uv_fx.c @@ -331,15 +331,9 @@ void encod_unvoiced_ivas_fx( *----------------------------------------------------------------*/ IF( !uc_two_stage_flag ) { -#ifndef REUSE_EVS_BE_GAUSS - *pt_pitch_fx = gaus_encode_ivas_fx( st_fx, i_subfr, h1_fx, xn_fx, exc_fx, &hLPDmem->mem_w0, st_fx->clip_var_fx, - &hLPDmem->tilt_code, code_fx, &L_gain_code_fx, y2_fx, &gain_inov_fx, - &voice_fac_fx, &gain_pit_fx, Q_new, shift, &norm_gain_code_fx ); /* Q0 */ -#else *pt_pitch_fx = gaus_encode_fx( st_fx, i_subfr, h1_fx, xn_fx, exc_fx, &hLPDmem->mem_w0, st_fx->clip_var_fx, &hLPDmem->tilt_code, code_fx, &L_gain_code_fx, y2_fx, &gain_inov_fx, &voice_fac_fx, &gain_pit_fx, Q_new, shift, &norm_gain_code_fx ); /* Q0 */ -#endif move16(); } ELSE diff --git a/lib_enc/gain_enc_fx.c b/lib_enc/gain_enc_fx.c index ca93207c70480697320a94339ba46040d7c59561..9468fff6017c9c9c08aacb8f5cb33fc62d763bcf 100644 --- a/lib_enc/gain_enc_fx.c +++ b/lib_enc/gain_enc_fx.c @@ -275,7 +275,6 @@ void gain_enc_mless_fx( /* gain_inov = 1.0f / sqrt((dot_product(code, code, L_SUBFR) + 0.01) / L_SUBFR) */ L_tmp = Dot_product12( code, code, L_SUBFR, &exp_code ); exp_inov = sub( exp_code, 18 + 6 ); -#ifdef FIX_1959_assert_in_gain_enc_mless_fx // To avoid crash in case code value is 0, test(); IF( EQ_16( BASOP_Util_Cmp_Mant32Exp( L_tmp, exp_inov, 21474836, 0 ), -1 ) && element_mode > EVS_MONO ) @@ -287,7 +286,6 @@ void gain_enc_mless_fx( move16(); } ELSE -#endif { exp_code = sub( exp_code, 30 ); @@ -302,10 +300,6 @@ void gain_enc_mless_fx( tmp = add( 30 - 18 - 6 - 1, sub( exp_code, tmp ) ); /* exp: -18 (code in Q9), -6 (/L_SUBFR) */ L_tmp1 = Mpy_32_16( tmp, frac, 12330 ); /* Q13 */ Ei = round_fx( L_shl( L_tmp1, 11 ) ); /* Q8 */ -#ifndef FIX_1959_assert_in_gain_enc_mless_fx - /* predicted codebook gain */ - gcode0 = sub( Es_pred, Ei ); /* Q8 */ -#endif /*---------------------------------------------------------------* * Decode codebook gain and the adaptive excitation low-pass * filtering factor (Finalize computation ) @@ -315,10 +309,8 @@ void gain_enc_mless_fx( *gain_inov = extract_h( L_shl( L_tmp, sub( exp_inov, 3 ) ) ); /* gain_inov in Q12 */ move16(); } -#ifdef FIX_1959_assert_in_gain_enc_mless_fx /* predicted codebook gain */ gcode0 = sub( Es_pred, Ei ); /* Q8 */ -#endif /* gcode0 = pow(10, 0.05 * (Es_pred - Ei)) */ /*----------------------------------------------------------------* * gcode0 = pow(10.0, gcode0/20) @@ -358,18 +350,10 @@ void gain_enc_mless_fx( = ((-0.5*g_corr[3]*g_corr[0]) - (-0.25*g_corr[1]*g_corr[4]))/tmp1; = ((0.25*g_corr[1]*g_corr[4]) - (0.5*g_corr[0]*g_corr[3]))/tmp1; */ -#ifdef FIX_1959_assert_in_gain_enc_mless_fx L_tmp1 = L_mult_sat( coeff[0], coeff[2] ); /*Q31*/ -#else - L_tmp1 = L_mult( coeff[0], coeff[2] ); /*Q31*/ -#endif exp1 = add( exp_coeff[0], exp_coeff[2] ); -#ifdef FIX_1959_assert_in_gain_enc_mless_fx L_tmp2 = L_shr( L_mult_sat( coeff[4], coeff[4] ), 2 ); /*Q31*/ -#else - L_tmp2 = L_shr( L_mult( coeff[4], coeff[4] ), 2 ); /*Q31*/ -#endif exp2 = add( exp_coeff[4], exp_coeff[4] ); IF( GT_16( exp1, exp2 ) ) @@ -491,12 +475,10 @@ void gain_enc_mless_fx( case 6: { qua_table = gain_qua_mless_6b_fx; -#ifdef REUSE_EVS_BE_GAINQ if ( element_mode > EVS_MONO ) { qua_table = gain_qua_mless_6b_stereo_fx; } -#endif move16(); if ( EQ_16( clip_gain, 1 ) ) { @@ -551,17 +533,23 @@ void gain_enc_mless_fx( return; } -#ifndef REUSE_EVS_BE_GAINQ -void gain_enc_mless_ivas_fx( +/*---------------------------------------------------------------------* + * gain_enc_SQ() + * + * Scalar Quantization of pitch and codebook gains without prediction + * - an initial predicted gain, gcode0, is first determined based on + * the predicted scaled innovation energy + * - a correction factor gamma = g_code / gcode0 is then vector quantized + * along with gain_pit + * - the mean-squared weighted error criterion is used for codebook search + *---------------------------------------------------------------------*/ + +void gain_enc_SQ_fx( BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ const Word16 gains_mode[], /* i : gain bits Q0*/ - const Word16 element_mode, /* i : element mode Q0*/ - const Word16 L_frame, /* i : length of the frame Q0*/ const Word16 i_subfr, /* i : subframe index Q0*/ - const Word16 tc_subfr, /* i : TC subframe index Q0*/ const Word16 *xn, /* i : target vector Q_xn*/ - const Word16 *y1, /* i : zero-memory filtered adaptive excitation Q_xn*/ - const Word16 Q_xn, /* i : xn and y1 scaling */ + const Word16 *yy1, /* i : zero-memory filtered adaptive excitation Q_xn*/ const Word16 *y2, /* i : zero-memory filtered algebraic codebook excitation Q9*/ const Word16 *code, /* i : algebraic excitation Q9*/ const Word16 Es_pred, /* i : predicted scaled innovation energy Q8*/ @@ -569,16 +557,16 @@ void gain_enc_mless_ivas_fx( Word32 *gain_code, /* o : quantized codebook gain Q16*/ Word16 *gain_inov, /* o : gain of the innovation (used for normalization) Q12*/ Word32 *norm_gain_code, /* o : norm. gain of the codebook excitation Q16*/ - Word16 *g_corr, /* i/o: correlations , -2,, -2 and 2 Qx*/ - const Word16 clip_gain /* i : gain pitch clipping flag (1 = clipping) Q0*/ + Word16 *g_corr, /* i/o: correlations , ,, -2 and 2 Qx*/ + const Word16 clip_gain, /* i : gain pitch clipping flag (1 = clipping) Q0*/ + const Word16 Q_xn /* i : xn and y1 scaling */ ) { - - Word16 index, size, nBits, nBits2; + Word16 index, nBits_pitch, nBits_code; Word16 gcode0, Ei, gain_code16; - const Word16 *qua_table; Word16 coeff[5], exp_coeff[5]; Word16 exp, exp_code, exp_inov, exp_gcode0, frac, tmp; + Word32 L_tmp, L_tmp1, L_tmp2; Word16 tmp1, expg; Word16 exp1, exp2; @@ -593,77 +581,71 @@ void gain_enc_mless_ivas_fx( * calculate the rest of the correlation coefficients * c2 = , c3 = -2, c4 = 2 *-----------------------------------------------------------------*/ + /*g_corr[1] *= -0.5;*/ + /*g_corr[2] = dotp( y2, y2, L_SUBFR ) + 0.01f;*/ + /*g_corr[3] = dotp( xn, y2, L_SUBFR ) - 0.02f;*/ + /*g_corr[4] = dotp( yy1, y2, L_SUBFR ) + 0.02f;*/ coeff[0] = g_corr[0]; move16(); exp_coeff[0] = g_corr[1]; move16(); - coeff[1] = negate( g_corr[2] ); - move16(); /* coeff[1] = -2 xn yy1 */ - exp_coeff[1] = add( g_corr[3], 1 ); + coeff[1] = g_corr[2]; + move16(); /* coeff[1] = xn yy1 */ + exp_coeff[1] = g_corr[3]; move16(); /* Compute scalar product */ coeff[2] = extract_h( Dot_product12( y2, y2, L_SUBFR, &exp ) ); + move16(); exp_coeff[2] = add( sub( exp, 18 ), shl( Q_xn, 1 ) ); move16(); /* -18 (y2 Q9) */ - /* Compute scalar product -2* */ - coeff[3] = extract_h( L_negate( Dot_product12( xn, y2, L_SUBFR, &exp ) ) ); - exp_coeff[3] = add( sub( exp, 9 - 1 ), Q_xn ); - move16(); /* -9 (y2 Q9), +1 (2 xn y2) */ + /* Compute scalar product */ + coeff[3] = extract_h( Dot_product12( xn, y2, L_SUBFR, &exp ) ); + move16(); + exp_coeff[3] = add( sub( exp, 9 ), Q_xn ); + move16(); /* -9 (y2 Q9), (xn y2) */ - /* Compute scalar product 2* */ - coeff[4] = extract_h( Dot_product12( y1, y2, L_SUBFR, &exp ) ); - exp_coeff[4] = add( sub( exp, 9 - 1 ), Q_xn ); - move16(); /* -9 (y2 Q9), +1 (2 y1 y2) */ + /* Compute scalar product */ + coeff[4] = extract_h( Dot_product12( yy1, y2, L_SUBFR, &exp ) ); + move16(); + exp_coeff[4] = add( sub( exp, 9 ), Q_xn ); + move16(); /* -9 (y2 Q9), (y1 y2) */ /*-----------------------------------------------------------------* * calculate the unscaled innovation energy * calculate the predicted gain code + * calculate optimal gains *-----------------------------------------------------------------*/ + /*Ecode = (dotp( code, code, L_SUBFR) + 0.01f) / L_SUBFR;*/ + /**gain_inov = 1.0f / (float)sqrt( Ecode );*/ - /* gain_inov = 1.0f / sqrt((dot_product(code, code, L_SUBFR) + 0.01) / L_SUBFR) */ L_tmp = Dot_product12( code, code, L_SUBFR, &exp_code ); exp_inov = sub( exp_code, 18 + 6 ); + exp_code = sub( exp_code, 30 ); - // To avoid crash in case code value is 0, - IF( EQ_16( BASOP_Util_Cmp_Mant32Exp( L_tmp, exp_inov, 21474836, 0 ), -1 ) ) - { - // setting values to avoid extra computation - *gain_inov = 32767; /*8(max value gain_inov can hold) in Q12*/ - Ei = -9743; /* -38 in Q8*/ - move16(); - move16(); - } - ELSE - { - exp_code = sub( exp_code, 30 ); - - /*Ei = 10 * log10((dot_product(code, code, L_SUBFR) + 0.01) / L_SUBFR) */ - - /*----------------------------------------------------------------* - * calculate the predicted gain code - *----------------------------------------------------------------*/ - tmp = norm_l( L_tmp ); - frac = Log2_norm_lc( L_shl( L_tmp, tmp ) ); - tmp = add( 30 - 18 - 6 - 1, sub( exp_code, tmp ) ); /* exp: -18 (code in Q9), -6 (/L_SUBFR) */ - L_tmp1 = Mpy_32_16( tmp, frac, 12330 ); /* Q13 */ - Ei = round_fx( L_shl( L_tmp1, 11 ) ); /* Q8 */ - - /*---------------------------------------------------------------* - * Decode codebook gain and the adaptive excitation low-pass - * filtering factor (Finalize computation ) - *---------------------------------------------------------------*/ - /* gain_inov = 1.0f / sqrt((dot_product(code, code, L_SUBFR) + 0.01) / L_SUBFR) */ - L_tmp = Isqrt_lc( L_tmp, &exp_inov ); - *gain_inov = extract_h( L_shl( L_tmp, sub( exp_inov, 3 ) ) ); /* gain_inov in Q12 */ - move16(); - } + /*Ei = 10 * log10((dot_product(code, code, L_SUBFR) + 0.01) / L_SUBFR) */ + /*----------------------------------------------------------------* + * calculate the predicted gain code + *----------------------------------------------------------------*/ + tmp = norm_l( L_tmp ); + frac = Log2_norm_lc( L_shl( L_tmp, tmp ) ); + tmp = add( 30 - 18 - 6 - 1, sub( exp_code, tmp ) ); /* exp: -18 (code in Q9), -6 (/L_SUBFR) */ + L_tmp1 = Mpy_32_16( tmp, frac, 12330 ); /* Q13 */ + Ei = round_fx( L_shl( L_tmp1, 11 ) ); /* Q8 */ /* predicted codebook gain */ gcode0 = sub( Es_pred, Ei ); /* Q8 */ + /*---------------------------------------------------------------* + * Decode codebook gain and the adaptive excitation low-pass + * filtering factor (Finalize computation ) + *---------------------------------------------------------------*/ + /* gain_inov = 1.0f / sqrt((dot_product(code, code, L_SUBFR) + 0.01) / L_SUBFR) */ + L_tmp = Isqrt_lc( L_tmp, &exp_inov ); + *gain_inov = extract_h( L_shl( L_tmp, sub( exp_inov, 3 ) ) ); /* gain_inov in Q12 */ + /* gcode0 = pow(10, 0.05 * (Es_pred - Ei)) */ /*----------------------------------------------------------------* * gcode0 = pow(10.0, gcode0/20) @@ -680,197 +662,151 @@ void gain_enc_mless_ivas_fx( /* 16384 < Pow2() <= 32767 */ exp_gcode0 = sub( exp_gcode0, 14 ); - /*-----------------------------------------------------------------* - * select the codebook, size and number of bits - * set the gains searching range - *-----------------------------------------------------------------*/ - nBits = gains_mode[i_subfr >> 6]; - move16(); - - test(); - test(); - test(); - test(); - test(); - IF( ( EQ_16( tc_subfr, 3 * L_SUBFR ) && EQ_16( i_subfr, 3 * L_SUBFR ) && EQ_16( L_frame, L_FRAME ) ) || - ( EQ_16( tc_subfr, 4 * L_SUBFR ) && EQ_16( i_subfr, 4 * L_SUBFR ) && EQ_16( L_frame, L_FRAME16k ) ) ) - { - /* *gain_pit = (g_corr[2]*tmp2) - (0.5f*g_corr[4]*tmp3); - = ((-0.5f*g_corr[1]*g_corr[2]) - (-0.25*g_corr[3]*g_corr[4]))/tmp1; - = ((0.25*g_corr[3]*g_corr[4]) - (0.5*g_corr[1]*g_corr[2]))/tmp1; */ - /* *gain_code = (g_corr[0]*tmp3) - (0.5f*g_corr[4]*tmp2); - = ((-0.5*g_corr[3]*g_corr[0]) - (-0.25*g_corr[1]*g_corr[4]))/tmp1; - = ((0.25*g_corr[1]*g_corr[4]) - (0.5*g_corr[0]*g_corr[3]))/tmp1; */ + /*tmp1 = (g_corr[0]*g_corr[2]) - (g_corr[4]*g_corr[4]); + tmp2 = g_corr[1]/tmp1; + tmp1 = g_corr[3]/tmp1; - L_tmp1 = L_mult_sat( coeff[0], coeff[2] ); /*Q31 added saturation for -32768*-32768*/ - exp1 = add( exp_coeff[0], exp_coeff[2] ); + *gain_pit = (g_corr[2]*tmp2) - (g_corr[4]*tmp1); + *gain_code = (g_corr[0]*tmp1) - (g_corr[4]*tmp2);*/ - L_tmp2 = L_shr( L_mult_sat( coeff[4], coeff[4] ), 2 ); /*Q31 added saturation for -32768*-32768*/ - exp2 = add( exp_coeff[4], exp_coeff[4] ); + /* *gain_pit = (g_corr[2]*tmp2) - (g_corr[4]*tmp3); + = ((g_corr[1]*g_corr[2]) - (g_corr[3]*g_corr[4]))/tmp1;*/ - IF( GT_16( exp1, exp2 ) ) - { - L_tmp2 = L_shr( L_tmp2, sub( exp1, exp2 ) ); /*Q31*/ - exp_den = exp1; - move16(); - } - ELSE - { - L_tmp1 = L_shr( L_tmp1, sub( exp2, exp1 ) ); /*Q31*/ - exp_den = exp2; - move16(); - } - L_frac_den = L_sub( L_tmp1, L_tmp2 ); /*Q31*/ + /* *gain_code = (g_corr[0]*tmp3) - (g_corr[4]*tmp2); + = ((g_corr[3]*g_corr[0]) - (g_corr[1]*g_corr[4]))/tmp1;*/ - frac_den = extract_h( L_frac_den ); /* Q15 */ - frac_den = s_max( frac_den, 1 ); /* Q15 */ - L_frac_den = L_max( L_frac_den, 1 ); /* Q31 */ - exp = norm_l( L_frac_den ); - tmp = div_s( shl( 1, sub( 14, exp ) ), frac_den ); /*Q(14-exp)*/ + L_tmp1 = L_mult( coeff[0], coeff[2] ); /*Q31*/ + exp1 = add( exp_coeff[0], exp_coeff[2] ); - L_tmp1 = L_shr( L_mult( coeff[3], coeff[4] ), 2 ); /*Q31*/ - exp1 = add( exp_coeff[3], exp_coeff[4] ); + L_tmp2 = L_mult_o( coeff[4], coeff[4], &Overflow ); /*Q31*/ + exp2 = add( exp_coeff[4], exp_coeff[4] ); - L_tmp2 = L_shr( L_mult( coeff[1], coeff[2] ), 1 ); /*Q31*/ - exp2 = add( exp_coeff[1], exp_coeff[2] ); + IF( GT_16( exp1, exp2 ) ) + { + L_tmp2 = L_shr( L_tmp2, sub( exp1, exp2 ) ); /*Q31*/ + exp_den = exp1; + move16(); + } + ELSE + { + L_tmp1 = L_shr( L_tmp1, sub( exp2, exp1 ) ); /*Q31*/ + exp_den = exp2; + move16(); + } + L_frac_den = L_sub( L_tmp1, L_tmp2 ); /*Q31*/ - IF( GT_16( exp1, exp2 ) ) - { - L_tmp2 = L_shr( L_tmp2, sub( exp1, exp2 ) ); /*Q31*/ - exp_num = exp1; - move16(); - } - ELSE - { - L_tmp1 = L_shr( L_tmp1, sub( exp2, exp1 ) ); /*Q31*/ - exp_num = exp2; - move16(); - } - L_frac_num = L_sub( L_tmp1, L_tmp2 ); /*Q31*/ + frac_den = extract_h( L_frac_den ); /* Q15 */ + frac_den = s_max( frac_den, 1 ); /* Q15 */ + L_frac_den = L_max( L_frac_den, 1 ); /* Q31 */ + exp = norm_l( L_frac_den ); + tmp = div_s( shl( 1, sub( 14, exp ) ), frac_den ); /*Q(14-exp)*/ - L_div = Mult_32_16( L_frac_num, tmp ); /*Q(30-exp)*/ - exp_div = sub( exp_num, exp_den ); - *gain_pit = round_fx_o( L_shl_o( L_div, add( exp, exp_div ), &Overflow ), &Overflow ); /*Q14*/ + L_tmp1 = L_mult( coeff[3], coeff[4] ); /*Q31*/ + exp1 = add( exp_coeff[3], exp_coeff[4] ); - L_tmp1 = L_shr( L_mult( coeff[1], coeff[4] ), 2 ); /*Q31*/ - exp1 = add( exp_coeff[1], exp_coeff[4] ); + L_tmp2 = L_mult( coeff[1], coeff[2] ); /*Q31*/ + exp2 = add( exp_coeff[1], exp_coeff[2] ); - L_tmp2 = L_shr( L_mult( coeff[0], coeff[3] ), 1 ); /*Q31*/ - exp2 = add( exp_coeff[0], exp_coeff[3] ); + IF( GT_16( exp1, exp2 ) ) + { + L_tmp2 = L_shr( L_tmp2, sub( exp1, exp2 ) ); /*Q31*/ + exp_num = exp1; + move16(); + } + ELSE + { + L_tmp1 = L_shr( L_tmp1, sub( exp2, exp1 ) ); /*Q31*/ + exp_num = exp2; + move16(); + } + L_frac_num = L_sub_o( L_tmp2, L_tmp1, &Overflow ); /*Q31*/ - IF( GT_16( exp1, exp2 ) ) - { - L_tmp2 = L_shr( L_tmp2, sub( exp1, exp2 ) ); /*Q31*/ - exp_num = exp1; - move16(); - } - ELSE - { - L_tmp1 = L_shr( L_tmp1, sub( exp2, exp1 ) ); /*Q31*/ - exp_num = exp2; - move16(); - } - L_frac_num = L_sub( L_tmp1, L_tmp2 ); /*Q31*/ + L_div = Mult_32_16( L_frac_num, tmp ); /*Q(30-exp)*/ + exp_div = sub( exp_num, exp_den ); - L_div = Mult_32_16( L_frac_num, tmp ); /*Q(30-exp)*/ - exp_div = sub( exp_num, exp_den ); + *gain_pit = round_fx_o( L_shl_o( L_div, add( exp, exp_div ), &Overflow ), &Overflow ); /*Q14*/ - *gain_code = L_shl_o( L_div, sub( add( exp, exp_div ), 14 ), &Overflow ); - move32(); /*Q16*/ + L_tmp1 = L_mult( coeff[1], coeff[4] ); /*Q31*/ + exp1 = add( exp_coeff[1], exp_coeff[4] ); - *gain_pit = s_max( G_PITCH_MIN_TC192_Q14, s_min( *gain_pit, G_PITCH_MAX_TC192_Q14 ) ); + L_tmp2 = L_mult( coeff[0], coeff[3] ); /*Q31*/ + exp2 = add( exp_coeff[0], exp_coeff[3] ); - /* set number of bits for two SQs */ - nBits2 = shr( add( nBits, 1 ), 1 ); - nBits = shr( nBits, 1 ); + IF( GT_16( exp1, exp2 ) ) + { + L_tmp2 = L_shr( L_tmp2, sub( exp1, exp2 ) ); /*Q31*/ + exp_num = exp1; + move16(); + } + ELSE + { + L_tmp1 = L_shr( L_tmp1, sub( exp2, exp1 ) ); /*Q31*/ + exp_num = exp2; + move16(); + } + L_frac_num = L_sub_o( L_tmp2, L_tmp1, &Overflow ); /*Q31*/ - /* gain_pit Q */ + L_div = Mult_32_16( L_frac_num, tmp ); /*Q(30-exp)*/ + exp_div = sub( exp_num, exp_den ); - tmp1 = mult_r( G_PITCH_MAX_MINUS_MIN_TC192_Q13, div_s( 1, sub( shl( 1, nBits ), 1 ) ) ); /*Q13*/ /* set quantization step */ - index = usquant_fx( *gain_pit, gain_pit, G_PITCH_MIN_TC192_Q14, tmp1, shl( 1, nBits ) ); - move16(); - push_indice( hBstr, IND_GAIN_PIT, index, nBits ); + *gain_code = L_shl_sat( L_div, s_max( -31, sub( add( exp, exp_div ), 14 ) ) ); + move32(); /*Q16*/ - /* gain_code Q */ - /**gain_code /= gcode0;*/ - IF( gcode0 != 0 ) - { - tmp = div_s( 16384, gcode0 ); /*Q15*/ - L_tmp = Mult_32_16( *gain_code, tmp ); /*Q16*/ - *gain_code = L_shr( L_tmp, add( 14, exp_gcode0 ) ); /*Q16*/ - move32(); - } + *gain_pit = s_max( G_PITCH_MIN_Q14, s_min( *gain_pit, G_PITCH_MAX_Q14 ) ); - index = gain_quant_fx( gain_code, &gain_code16, LG10_G_CODE_MIN_TC192_Q14, LG10_G_CODE_MAX_TC192_Q13, nBits2, &expg ); - push_indice( hBstr, IND_GAIN_CODE, index, nBits2 ); - L_tmp = L_mult( gain_code16, gcode0 ); /*Q0*Q0 -> Q1*/ - *gain_code = L_shl_o( L_tmp, add( add( expg, exp_gcode0 ), 15 ), &Overflow ); /*Q16*/ + /*-----------------------------------------------------------------* + * limit the pitch gain searching range (if indicated by clip_gain) + *-----------------------------------------------------------------*/ + + test(); + test(); + IF( EQ_16( clip_gain, 1 ) && GT_16( *gain_pit, 15565 /* 0.95 in Q14 */ ) ) + { + *gain_pit = 15565; /* 0.95 in Q14 */ + move16(); } - ELSE + ELSE IF( EQ_16( clip_gain, 2 ) && GT_16( *gain_pit, 10650 /* 0.65 in Q14 */ ) ) { - size = shl( 1, nBits ); + *gain_pit = 10650; /* 0.65 in Q14 */ + move16(); + } - SWITCH( nBits ) - { - case 7: - { - qua_table = gain_qua_mless_7b_fx; // Q14 - if ( EQ_16( clip_gain, 1 ) ) - { - size = sub( size, 30 ); - } - BREAK; - } - case 6: - { - qua_table = gain_qua_mless_6b_fx; // Q14 - if ( element_mode > EVS_MONO ) - { - qua_table = gain_qua_mless_6b_stereo_fx; - } - if ( EQ_16( clip_gain, 1 ) ) - { - size = sub( size, 14 ); - } - BREAK; - } - case 5: - { - qua_table = gain_qua_mless_5b_fx; // Q14 - if ( EQ_16( clip_gain, 1 ) ) - { - size = sub( size, 6 ); - } - BREAK; - } - default: - { - qua_table = gain_qua_mless_6b_fx; // Q14 - if ( EQ_16( clip_gain, 1 ) ) - { - size = sub( size, 14 ); - } - BREAK; - } - } + /*-----------------------------------------------------------------* + * search for the best quantized values + *-----------------------------------------------------------------*/ - /* in case of AVQ inactive, limit the gain_pit to 0.65 */ - test(); - IF( EQ_16( clip_gain, 2 ) && EQ_16( nBits, 6 ) ) - { - size = sub( size, 36 ); - nBits = sub( nBits, 1 ); - } + nBits_pitch = gains_mode[i_subfr >> 6]; + move16(); - /*-----------------------------------------------------------------* - * search for the best quantizer - *-----------------------------------------------------------------*/ - index = Find_Opt_gainQ_fx( coeff, exp_coeff, gain_pit, gain_code, gcode0, exp_gcode0, qua_table, size ); - push_indice( hBstr, IND_GAIN, index, nBits ); + /* set number of bits for two SQs */ + nBits_code = shr( add( nBits_pitch, 1 ), 1 ); + nBits_pitch = shr( nBits_pitch, 1 ); + + /* gain_pit Q */ + /*tmp1 = (G_PITCH_MAX - G_PITCH_MIN) / ((1 << nBits_pitch) - 1);*/ /* set quantization step */ + tmp1 = mult_r( G_PITCH_MAX_Q13, div_s( 1, sub( shl( 1, nBits_pitch ), 1 ) ) ); /*Q13*/ /* set quantization step */ + + index = usquant_fx( *gain_pit, gain_pit, G_PITCH_MIN_Q14, tmp1, shl( 1, nBits_pitch ) ); // Q0 + push_indice( hBstr, IND_GAIN_PIT, index, nBits_pitch ); + + /* gain_code Q */ + /* *gain_code /= gcode0; */ + IF( gcode0 != 0 ) + { + tmp = div_s( 16384, gcode0 ); /*Q15*/ + L_tmp = Mult_32_16( *gain_code, tmp ); /*Q16*/ + *gain_code = L_shr( L_tmp, add( 14, exp_gcode0 ) ); /*Q16*/ + move32(); } + index = gain_quant_fx( gain_code, &gain_code16, LG10_G_CODE_MIN_Q14, LG10_G_CODE_MAX_Q13, nBits_code, &expg ); + push_indice( hBstr, IND_GAIN_CODE, index, nBits_code ); + L_tmp = L_mult( gain_code16, gcode0 ); /*Q0*Q0 -> Q1*/ + *gain_code = L_shl_sat( L_tmp, add( add( expg, exp_gcode0 ), 15 ) ); + move32(); /*Q16*/ + /* *norm_gain_code = *gain_code / *gain_inov; */ exp = sub( norm_s( *gain_inov ), 1 ); exp = s_max( exp, 0 ); @@ -881,1624 +817,410 @@ void gain_enc_mless_ivas_fx( return; } -#endif -/*---------------------------------------------------------------------* - * gain_enc_SQ() +/*-------------------------------------------------------------------* + * gain_enc_gaus() * - * Scalar Quantization of pitch and codebook gains without prediction - * - an initial predicted gain, gcode0, is first determined based on - * the predicted scaled innovation energy - * - a correction factor gamma = g_code / gcode0 is then vector quantized - * along with gain_pit - * - the mean-squared weighted error criterion is used for codebook search - *---------------------------------------------------------------------*/ - -void gain_enc_SQ_fx( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - const Word16 gains_mode[], /* i : gain bits Q0*/ - const Word16 i_subfr, /* i : subframe index Q0*/ - const Word16 *xn, /* i : target vector Q_xn*/ - const Word16 *yy1, /* i : zero-memory filtered adaptive excitation Q_xn*/ - const Word16 *y2, /* i : zero-memory filtered algebraic codebook excitation Q9*/ - const Word16 *code, /* i : algebraic excitation Q9*/ - const Word16 Es_pred, /* i : predicted scaled innovation energy Q8*/ - Word16 *gain_pit, /* o : quantized pitch gain Q14*/ - Word32 *gain_code, /* o : quantized codebook gain Q16*/ - Word16 *gain_inov, /* o : gain of the innovation (used for normalization) Q12*/ - Word32 *norm_gain_code, /* o : norm. gain of the codebook excitation Q16*/ - Word16 *g_corr, /* i/o: correlations , ,, -2 and 2 Qx*/ - const Word16 clip_gain, /* i : gain pitch clipping flag (1 = clipping) Q0*/ - const Word16 Q_xn /* i : xn and y1 scaling */ + * Quantization of gain for Gaussian codebook + *-------------------------------------------------------------------*/ +Word16 gain_enc_gaus_fx( /* o : Return index of quantization */ + Word32 *gain, /* i/o: Code gain to quantize Q16*/ + const Word16 bits, /* i : number of bits to quantize Q0*/ + const Word16 lowBound, /* i : lower bound of quantizer (dB) Q8*/ + const Word16 stepSize, /* i : Step size choice Q14*/ + const Word16 inv_stepSize /* i : Step size choice Q15*/ ) { - Word16 index, nBits_pitch, nBits_code; - Word16 gcode0, Ei, gain_code16; - Word16 coeff[5], exp_coeff[5]; - Word16 exp, exp_code, exp_inov, exp_gcode0, frac, tmp; - - Word32 L_tmp, L_tmp1, L_tmp2; - Word16 tmp1, expg; - Word16 exp1, exp2; - Word16 exp_num, exp_den, exp_div, frac_den; - Word32 L_frac_num, L_frac_den, L_div; + Word16 index, exp_gain, frac_gain, wtmp; + Word16 enr_q, wenr; + Word32 Ltmp, enr; #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif + /*enr = 20.0 * log10(*gain + 0.001) codebook gain in dB */ + exp_gain = norm_l( *gain ); + frac_gain = Log2_norm_lc( L_shl( *gain, exp_gain ) ); + exp_gain = sub( 30 - 16, exp_gain ); - /*-----------------------------------------------------------------* - * calculate the rest of the correlation coefficients - * c2 = , c3 = -2, c4 = 2 - *-----------------------------------------------------------------*/ - /*g_corr[1] *= -0.5;*/ - /*g_corr[2] = dotp( y2, y2, L_SUBFR ) + 0.01f;*/ - /*g_corr[3] = dotp( xn, y2, L_SUBFR ) - 0.02f;*/ - /*g_corr[4] = dotp( yy1, y2, L_SUBFR ) + 0.02f;*/ + enr = Mpy_32_16( exp_gain, frac_gain, LG10 ); /* Output in Q13 */ + wenr = extract_h( L_shl( enr, 8 + 3 ) ); - coeff[0] = g_corr[0]; - move16(); - exp_coeff[0] = g_corr[1]; - move16(); - coeff[1] = g_corr[2]; - move16(); /* coeff[1] = xn yy1 */ - exp_coeff[1] = g_corr[3]; - move16(); + /*----------------------------------------------------------------* + * Quantize linearly the log E + *----------------------------------------------------------------*/ - /* Compute scalar product */ - coeff[2] = extract_h( Dot_product12( y2, y2, L_SUBFR, &exp ) ); - move16(); - exp_coeff[2] = add( sub( exp, 18 ), shl( Q_xn, 1 ) ); - move16(); /* -18 (y2 Q9) */ + wtmp = sub( wenr, lowBound ); /* Q8 */ - /* Compute scalar product */ - coeff[3] = extract_h( Dot_product12( xn, y2, L_SUBFR, &exp ) ); - move16(); - exp_coeff[3] = add( sub( exp, 9 ), Q_xn ); - move16(); /* -9 (y2 Q9), (xn y2) */ + index = extract_l( L_shr( L_mac( 8388608, wtmp, inv_stepSize ), 16 + 8 ) ); // Q0 - /* Compute scalar product */ - coeff[4] = extract_h( Dot_product12( yy1, y2, L_SUBFR, &exp ) ); - move16(); - exp_coeff[4] = add( sub( exp, 9 ), Q_xn ); - move16(); /* -9 (y2 Q9), (y1 y2) */ + /* index [0 (1< Q26 */ + enr = L_shr( enr, 10 ); /*Q26->Q16*/ + frac_gain = L_Extract_lc( enr, &exp_gain ); - /*Ei = 10 * log10((dot_product(code, code, L_SUBFR) + 0.01) / L_SUBFR) */ - /*----------------------------------------------------------------* - * calculate the predicted gain code - *----------------------------------------------------------------*/ - tmp = norm_l( L_tmp ); - frac = Log2_norm_lc( L_shl( L_tmp, tmp ) ); - tmp = add( 30 - 18 - 6 - 1, sub( exp_code, tmp ) ); /* exp: -18 (code in Q9), -6 (/L_SUBFR) */ - L_tmp1 = Mpy_32_16( tmp, frac, 12330 ); /* Q13 */ - Ei = round_fx( L_shl( L_tmp1, 11 ) ); /* Q8 */ - - /* predicted codebook gain */ - gcode0 = sub( Es_pred, Ei ); /* Q8 */ + Ltmp = Pow2( 14, frac_gain ); /* Put 14 as exponent */ + exp_gain = sub( exp_gain, 14 ); /* Retreive exponent of wtmp */ + *gain = L_shl_o( Ltmp, add( 16, exp_gain ), &Overflow ); + move32(); /*Q16*/ - /*---------------------------------------------------------------* - * Decode codebook gain and the adaptive excitation low-pass - * filtering factor (Finalize computation ) - *---------------------------------------------------------------*/ - /* gain_inov = 1.0f / sqrt((dot_product(code, code, L_SUBFR) + 0.01) / L_SUBFR) */ - L_tmp = Isqrt_lc( L_tmp, &exp_inov ); - *gain_inov = extract_h( L_shl( L_tmp, sub( exp_inov, 3 ) ) ); /* gain_inov in Q12 */ + return index; +} +/*-----------------------------------------------------------------* + * gain_enc_tc() + * + * Search and quantization of gain_code for subframes (in the + * beginning of frame) without pulses in TC - 3b coding. + * In this case: + * - gain_pit = 0 + * - gain_code - scalar quantization (no prediciton history used) + *-----------------------------------------------------------------*/ +void gain_enc_tc_fx( + BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ + const Word16 gains_mode[], /* i : gain bits Q0*/ + const Word16 i_subfr, /* i : subframe index Q0*/ + const Word16 xn_fx[], /* i : target vector Q_xn*/ + const Word16 y2_fx[], /* i : zero-memory filtered algebraic codebook excitation Q_xn*/ + const Word16 code_fx[], /* i : algebraic excitation Q9*/ + const Word16 Es_pred_fx, /* i : predicted scaled innovation energy Q8*/ + Word16 *gain_pit_fx, /* o : Pitch gain / Quantized pitch gain Q14*/ + Word32 *gain_code_fx, /* o : quantized codebook gain Q16*/ + Word16 *gain_inov_fx, /* o : innovation gain Q12*/ + Word32 *norm_gain_code_fx, /* o : norm. gain of the codebook excitation Q16*/ + const Word16 Q_xn /* i : xn and y1 scaling */ +) +{ + Word16 i, index = 0, nBits, num, den, exp_num, exp_den; + Word16 Ei_fx, g_code_fx, gcode0_fx; + Word16 expg, expg2, e_tmp, f_tmp, exp_gcode0, tmp_fx, frac, tmp16; + Word32 L_tmp, L_tmp1; + Word16 wgain_code = 0, gain_code16; + *gain_pit_fx = 0; + move16(); + move16(); + move16(); - /* gcode0 = pow(10, 0.05 * (Es_pred - Ei)) */ /*----------------------------------------------------------------* - * gcode0 = pow(10.0, gcode0/20) - * = pow(2, 3.321928*gcode0/20) - * = pow(2, 0.166096*gcode0) + * get number of bits for gain quantization *----------------------------------------------------------------*/ + nBits = gains_mode[shr( i_subfr, 6 )]; - L_tmp = L_mult( gcode0, 21771 ); /* *0.166096 in Q17 -> Q26 */ - L_tmp = L_shr( L_tmp, 10 ); /* From Q26 to Q16 */ - frac = L_Extract_lc( L_tmp, &exp_gcode0 ); /* Extract exponent of gcode0 */ - - gcode0 = extract_l( Pow2( 14, frac ) ); /* Put 14 as exponent so that */ - /* output of Pow2() will be: */ - /* 16384 < Pow2() <= 32767 */ - exp_gcode0 = sub( exp_gcode0, 14 ); - - - /*tmp1 = (g_corr[0]*g_corr[2]) - (g_corr[4]*g_corr[4]); - tmp2 = g_corr[1]/tmp1; - tmp1 = g_corr[3]/tmp1; + /*----------------------------------------------------------------* + * find the code pitch (for current subframe) + *----------------------------------------------------------------*/ - *gain_pit = (g_corr[2]*tmp2) - (g_corr[4]*tmp1); - *gain_code = (g_corr[0]*tmp1) - (g_corr[4]*tmp2);*/ + /**gain_code = dotp( xn, y2, L_SUBFR )/( dotp( y2, y2, L_SUBFR ) + 0.01f );*/ + /* Compute scalar product */ + L_tmp = Dot_product( y2_fx, y2_fx, L_SUBFR ); /* -18 (y2 Q9) */ + exp_den = norm_l( L_tmp ); + den = extract_h( L_shl( L_tmp, exp_den ) ); + exp_den = sub( add( exp_den, 18 ), shl( Q_xn, 1 ) ); - /* *gain_pit = (g_corr[2]*tmp2) - (g_corr[4]*tmp3); - = ((g_corr[1]*g_corr[2]) - (g_corr[3]*g_corr[4]))/tmp1;*/ + /* Compute scalar product */ + L_tmp1 = Dot_product( xn_fx, y2_fx, L_SUBFR ); /* -9 (y2 Q9) */ + exp_num = sub( norm_l( L_tmp1 ), 1 ); + num = extract_h( L_shl( L_tmp1, exp_num ) ); + exp_num = sub( add( exp_num, 8 ), Q_xn ); - /* *gain_code = (g_corr[0]*tmp3) - (g_corr[4]*tmp2); - = ((g_corr[3]*g_corr[0]) - (g_corr[1]*g_corr[4]))/tmp1;*/ + tmp16 = s_or( shr( num, 16 ), 1 ); /* extract sign if num < 0 tmp16 = -1 else tmp16 = 1 */ + num = abs_s( num ); - L_tmp1 = L_mult( coeff[0], coeff[2] ); /*Q31*/ - exp1 = add( exp_coeff[0], exp_coeff[2] ); + /*----------------------------------------------------------------* + * compute gain = xy/yy + *----------------------------------------------------------------*/ + g_code_fx = div_s( num, den ); - L_tmp2 = L_mult_o( coeff[4], coeff[4], &Overflow ); /*Q31*/ - exp2 = add( exp_coeff[4], exp_coeff[4] ); + i = sub( exp_num, exp_den ); /* Gain_trans in Q7 */ + g_code_fx = i_mult2( g_code_fx, tmp16 ); /* apply sign */ + *gain_code_fx = L_shr_sat( L_deposit_l( g_code_fx ), i ); + move32(); - IF( GT_16( exp1, exp2 ) ) - { - L_tmp2 = L_shr( L_tmp2, sub( exp1, exp2 ) ); /*Q31*/ - exp_den = exp1; - move16(); - } - ELSE - { - L_tmp1 = L_shr( L_tmp1, sub( exp2, exp1 ) ); /*Q31*/ - exp_den = exp2; - move16(); - } - L_frac_den = L_sub( L_tmp1, L_tmp2 ); /*Q31*/ + /*----------------------------------------------------------------* + * calculate the predicted gain code + * decode codebook gain + *----------------------------------------------------------------*/ - frac_den = extract_h( L_frac_den ); /* Q15 */ - frac_den = s_max( frac_den, 1 ); /* Q15 */ - L_frac_den = L_max( L_frac_den, 1 ); /* Q31 */ - exp = norm_l( L_frac_den ); - tmp = div_s( shl( 1, sub( 14, exp ) ), frac_den ); /*Q(14-exp)*/ + *gain_pit_fx = 0; + move16(); + /*Ecode = (dotp( code, code, L_SUBFR) + 0.01f) / L_SUBFR; + *gain_inov = 1.0f / (float)sqrt( Ecode );*/ - L_tmp1 = L_mult( coeff[3], coeff[4] ); /*Q31*/ - exp1 = add( exp_coeff[3], exp_coeff[4] ); + L_tmp = Dot_product12( code_fx, code_fx, L_SUBFR, &expg ); + expg = sub( expg, 18 + 6 ); /* exp: -18 (code in Q9), -6 (/L_SUBFR) */ + expg2 = expg; + move16(); + L_tmp1 = L_tmp; /* sets to 'L_tmp' in 1 clock */ + move32(); + L_tmp = Isqrt_lc( L_tmp, &expg ); - L_tmp2 = L_mult( coeff[1], coeff[2] ); /*Q31*/ - exp2 = add( exp_coeff[1], exp_coeff[2] ); + *gain_inov_fx = extract_h( L_shl( L_tmp, sub( expg, 3 ) ) ); + move16(); /* gain_inov in Q12 */ - IF( GT_16( exp1, exp2 ) ) - { - L_tmp2 = L_shr( L_tmp2, sub( exp1, exp2 ) ); /*Q31*/ - exp_num = exp1; - move16(); - } - ELSE + /*Ei = 10 * (float)log10( Ecode );*/ + e_tmp = norm_l( L_tmp1 ); + f_tmp = Log2_norm_lc( L_shl( L_tmp1, e_tmp ) ); + e_tmp = sub( expg2, add( 1, e_tmp ) ); + L_tmp1 = Mpy_32_16( e_tmp, f_tmp, 12330 ); /* Q13 */ /* 10*log10(2) in Q12*/ + Ei_fx = round_fx( L_shl( L_tmp1, 11 ) ); /* Q8 */ + /*gcode0 = (float) pow(10, 0.05 * (Es_pred - Ei));*/ + gcode0_fx = sub( Es_pred_fx, Ei_fx ); /* Q8 */ + /*-----------------------------------------------------------------* + * gcode0 = pow(10.0, gcode0/20) + * = pow(2, 3.321928*gcode0/20) + * = pow(2, 0.166096*gcode0) + *-----------------------------------------------------------------*/ + L_tmp = L_mult( gcode0_fx, 21771 ); /* *0.166096 in Q17 -> Q26 */ + L_tmp = L_shr( L_tmp, 10 ); /* From Q26 to Q16 */ + frac = L_Extract_lc( L_tmp, &exp_gcode0 ); /* Extract exponent of gcode0 */ + gcode0_fx = extract_l( Pow2( 14, frac ) ); /* Put 14 as exponent so that */ + exp_gcode0 = sub( exp_gcode0, 14 ); + IF( GT_16( nBits, 3 ) ) { - L_tmp1 = L_shr( L_tmp1, sub( exp2, exp1 ) ); /*Q31*/ - exp_num = exp2; - move16(); - } - L_frac_num = L_sub_o( L_tmp2, L_tmp1, &Overflow ); /*Q31*/ - - L_div = Mult_32_16( L_frac_num, tmp ); /*Q(30-exp)*/ - exp_div = sub( exp_num, exp_den ); - - *gain_pit = round_fx_o( L_shl_o( L_div, add( exp, exp_div ), &Overflow ), &Overflow ); /*Q14*/ + /*g_code = *gain_code / gcode0;*/ + IF( gcode0_fx != 0 ) + { + tmp16 = div_s( 16384, gcode0_fx ); /*Q15*/ + L_tmp = Mult_32_16( *gain_code_fx, tmp16 ); /*Q16*/ + *gain_code_fx = L_shr( L_tmp, add( 14, exp_gcode0 ) ); /*Q16*/ + move32(); + } + ELSE + { + *gain_code_fx = MAX_32; + move32(); + } - L_tmp1 = L_mult( coeff[1], coeff[4] ); /*Q31*/ - exp1 = add( exp_coeff[1], exp_coeff[4] ); + /*index = gain_quant( &g_code, G_CODE_MIN, G_CODE_MAX, nBits );*/ + index = gain_quant_fx( gain_code_fx, &gain_code16, LG10_G_CODE_MIN_TC_Q14, LG10_G_CODE_MAX_TC_Q13, nBits, &expg ); - L_tmp2 = L_mult( coeff[0], coeff[3] ); /*Q31*/ - exp2 = add( exp_coeff[0], exp_coeff[3] ); + /**gain_code = g_code * gcode0;*/ + L_tmp = L_mult( gain_code16, gcode0_fx ); /*Q0*Q0 -> Q1*/ + *gain_code_fx = L_shl( L_tmp, add( add( expg, exp_gcode0 ), 15 ) ); /*Q16*/ + move32(); - IF( GT_16( exp1, exp2 ) ) - { - L_tmp2 = L_shr( L_tmp2, sub( exp1, exp2 ) ); /*Q31*/ - exp_num = exp1; - move16(); + push_indice( hBstr, IND_GAIN_CODE, index, nBits ); } ELSE { - L_tmp1 = L_shr( L_tmp1, sub( exp2, exp1 ) ); /*Q31*/ - exp_num = exp2; + index = N_GAIN_CODE_TC - 1; move16(); - } - L_frac_num = L_sub_o( L_tmp2, L_tmp1, &Overflow ); /*Q31*/ - - L_div = Mult_32_16( L_frac_num, tmp ); /*Q(30-exp)*/ - exp_div = sub( exp_num, exp_den ); - - *gain_code = L_shl_sat( L_div, s_max( -31, sub( add( exp, exp_div ), 14 ) ) ); - move32(); /*Q16*/ + FOR( i = 0; i < N_GAIN_CODE_TC - 1; i++ ) + { + L_tmp = L_mult( tbl_gain_code_tc_quant_mean[i], gcode0_fx ); /* Q13*Q0 -> Q14 */ + L_tmp = L_shl( L_tmp, add( exp_gcode0, 2 ) ); /* Q14 -> Q16 */ - *gain_pit = s_max( G_PITCH_MIN_Q14, s_min( *gain_pit, G_PITCH_MAX_Q14 ) ); + IF( LT_32( *gain_code_fx, L_tmp ) ) + { + index = i; + move16(); + BREAK; + } + } + /*----------------------------------------------------------------* + * 3-bit -> 2-bit encoding + *----------------------------------------------------------------*/ + IF( EQ_16( nBits, 2 ) ) + { + /* 2-bit -> 3-bit decoding */ + index = shr( index, 1 ); + wgain_code = tbl_gain_code_tc_fx[shl( index, 1 )]; + move16(); + /**gain_code *= gcode0;*/ + L_tmp = L_mult( wgain_code, gcode0_fx ); /* Q13*Q0 -> Q14 */ + *gain_code_fx = L_shl( L_tmp, add( exp_gcode0, 2 ) ); + move32(); /* Q14 -> Q16 */ + push_indice( hBstr, IND_GAIN_CODE, index, nBits ); + } + ELSE /* nBits == 3 */ + { + wgain_code = tbl_gain_code_tc_fx[index]; + move16(); + /**gain_code *= gcode0;*/ + L_tmp = L_mult( wgain_code, gcode0_fx ); /* Q13*Q0 -> Q14 */ + *gain_code_fx = L_shl_sat( L_tmp, add( exp_gcode0, 2 ) ); + move32(); /* Q14 -> Q16 */ + push_indice( hBstr, IND_GAIN_CODE, index, nBits ); + } + } /*-----------------------------------------------------------------* - * limit the pitch gain searching range (if indicated by clip_gain) - *-----------------------------------------------------------------*/ - - test(); - test(); - IF( EQ_16( clip_gain, 1 ) && GT_16( *gain_pit, 15565 /* 0.95 in Q14 */ ) ) - { - *gain_pit = 15565; /* 0.95 in Q14 */ - move16(); - } - ELSE IF( EQ_16( clip_gain, 2 ) && GT_16( *gain_pit, 10650 /* 0.65 in Q14 */ ) ) - { - *gain_pit = 10650; /* 0.65 in Q14 */ - move16(); - } - - /*-----------------------------------------------------------------* - * search for the best quantized values + * decode normalized codebook gain *-----------------------------------------------------------------*/ + /**norm_gain_code = *gain_code / *gain_inov;*/ + expg = sub( norm_s( *gain_inov_fx ), 1 ); + expg = s_max( expg, 0 ); - nBits_pitch = gains_mode[i_subfr >> 6]; - move16(); - - /* set number of bits for two SQs */ - nBits_code = shr( add( nBits_pitch, 1 ), 1 ); - nBits_pitch = shr( nBits_pitch, 1 ); - - /* gain_pit Q */ - /*tmp1 = (G_PITCH_MAX - G_PITCH_MIN) / ((1 << nBits_pitch) - 1);*/ /* set quantization step */ - tmp1 = mult_r( G_PITCH_MAX_Q13, div_s( 1, sub( shl( 1, nBits_pitch ), 1 ) ) ); /*Q13*/ /* set quantization step */ - - index = usquant_fx( *gain_pit, gain_pit, G_PITCH_MIN_Q14, tmp1, shl( 1, nBits_pitch ) ); // Q0 - push_indice( hBstr, IND_GAIN_PIT, index, nBits_pitch ); - - /* gain_code Q */ - /* *gain_code /= gcode0; */ - IF( gcode0 != 0 ) - { - tmp = div_s( 16384, gcode0 ); /*Q15*/ - L_tmp = Mult_32_16( *gain_code, tmp ); /*Q16*/ - *gain_code = L_shr( L_tmp, add( 14, exp_gcode0 ) ); /*Q16*/ - move32(); - } - - index = gain_quant_fx( gain_code, &gain_code16, LG10_G_CODE_MIN_Q14, LG10_G_CODE_MAX_Q13, nBits_code, &expg ); - push_indice( hBstr, IND_GAIN_CODE, index, nBits_code ); - L_tmp = L_mult( gain_code16, gcode0 ); /*Q0*Q0 -> Q1*/ - *gain_code = L_shl_sat( L_tmp, add( add( expg, exp_gcode0 ), 15 ) ); - move32(); /*Q16*/ - - /* *norm_gain_code = *gain_code / *gain_inov; */ - exp = sub( norm_s( *gain_inov ), 1 ); - exp = s_max( exp, 0 ); - - tmp = div_s( shr( 8192, exp ), *gain_inov ); - *norm_gain_code = L_shr( Mult_32_16( *gain_code, tmp ), sub( 1, exp ) ); // Q16 + tmp_fx = div_s( shr( 8192, expg ), *gain_inov_fx ); + *norm_gain_code_fx = L_shr( Mult_32_16( *gain_code_fx, tmp_fx ), sub( 1, expg ) ); // Q16 move32(); - return; } -#ifndef REUSE_EVS_BE_GAINQ -void gain_enc_SQ_ivas_fx( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - const Word16 gains_mode[], /* i : gain bits Q0*/ - const Word16 i_subfr, /* i : subframe index Q0*/ - const Word16 *xn, /* i : target vector Q_xn*/ - const Word16 *yy1, /* i : zero-memory filtered adaptive excitation Q_xn*/ - const Word16 *y2, /* i : zero-memory filtered algebraic codebook excitation Q9*/ - const Word16 *code, /* i : algebraic excitation Q9*/ - const Word16 Es_pred, /* i : predicted scaled innovation energy Q8*/ - Word16 *gain_pit, /* o : quantized pitch gain Q14*/ - Word32 *gain_code, /* o : quantized codebook gain Q16*/ - Word16 *gain_inov, /* o : gain of the innovation (used for normalization) Q12*/ - Word32 *norm_gain_code, /* o : norm. gain of the codebook excitation Q16*/ - Word16 *g_corr, /* i/o: correlations , ,, -2 and 2 Qx*/ - const Word16 clip_gain, /* i : gain pitch clipping flag (1 = clipping) Q0*/ - const Word16 Q_xn /* i : xn and y1 scaling */ +/*-----------------------------------------------------------------* + * Find_Opt_gainQ_fx() + * + * Find the best quantizer + *-----------------------------------------------------------------*/ +static Word16 Find_Opt_gainQ_fx( + Word16 *coeff, /* exp(exp_coeff) */ + Word16 *exp_coeff, + Word16 *gain_pit, /* Q14 */ + Word32 *gain_code, /* Q16 */ + Word16 gcode0, /* exp(exp_gcode0) */ + Word16 exp_gcode0, + const Word16 *cdbk, /* i : Codebook used Q14*/ + const Word16 size /* i : size of Codebook used Q0*/ ) { - Word16 index, nBits_pitch, nBits_code; - Word16 gcode0, Ei, gain_code16; - Word16 coeff[5], exp_coeff[5]; - Word16 exp, exp_code, exp_inov, exp_gcode0, frac, tmp; - - Word32 L_tmp, L_tmp1, L_tmp2; - Word16 tmp1, expg; - Word16 exp1, exp2; - Word16 exp_num, exp_den, exp_div, frac_den; - Word32 L_frac_num, L_frac_den, L_div; + Word16 index, i, j; + const Word16 *p; + Word16 g_pitch, g2_pitch, g_code, g_pit_cod, g2_code, g2_code_lo; + Word32 dist_min; + Word16 coeff_lo[5]; + Word16 exp_max[5]; + Word16 exp_code, e_max; + Word32 L_tmp, L_tmp1; #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif - /*-----------------------------------------------------------------* - * calculate the rest of the correlation coefficients - * c2 = , c3 = -2, c4 = 2 - *-----------------------------------------------------------------*/ - /*g_corr[1] *= -0.5;*/ - /*g_corr[2] = dotp( y2, y2, L_SUBFR ) + 0.01f;*/ - /*g_corr[3] = dotp( xn, y2, L_SUBFR ) - 0.02f;*/ - /*g_corr[4] = dotp( yy1, y2, L_SUBFR ) + 0.02f;*/ - - coeff[0] = g_corr[0]; - move16(); - exp_coeff[0] = g_corr[1]; - move16(); - coeff[1] = g_corr[2]; - move16(); /* coeff[1] = xn yy1 */ - exp_coeff[1] = g_corr[3]; - move16(); - - /* Compute scalar product */ - coeff[2] = extract_h( Dot_product12( y2, y2, L_SUBFR, &exp ) ); - move16(); - exp_coeff[2] = add( sub( exp, 18 ), shl( Q_xn, 1 ) ); - move16(); /* -18 (y2 Q9) */ - - /* Compute scalar product */ - coeff[3] = extract_h( Dot_product12( xn, y2, L_SUBFR, &exp ) ); - move16(); - exp_coeff[3] = add( sub( exp, 9 ), Q_xn ); - move16(); /* -9 (y2 Q9), (xn y2) */ - - /* Compute scalar product */ - coeff[4] = extract_h( Dot_product12( yy1, y2, L_SUBFR, &exp ) ); - move16(); - exp_coeff[4] = add( sub( exp, 9 ), Q_xn ); - move16(); /* -9 (y2 Q9), (y1 y2) */ - - /*-----------------------------------------------------------------* - * calculate the unscaled innovation energy - * calculate the predicted gain code - * calculate optimal gains - *-----------------------------------------------------------------*/ - /*Ecode = (dotp( code, code, L_SUBFR) + 0.01f) / L_SUBFR;*/ - /**gain_inov = 1.0f / (float)sqrt( Ecode );*/ - - L_tmp = Dot_product12( code, code, L_SUBFR, &exp_code ); - exp_inov = sub( exp_code, 18 + 6 ); - exp_code = sub( exp_code, 30 ); - - /*Ei = 10 * log10((dot_product(code, code, L_SUBFR) + 0.01) / L_SUBFR) */ - /*----------------------------------------------------------------* - * calculate the predicted gain code - *----------------------------------------------------------------*/ - tmp = norm_l( L_tmp ); - frac = Log2_norm_lc( L_shl( L_tmp, tmp ) ); - tmp = add( 30 - 18 - 6 - 1, sub( exp_code, tmp ) ); /* exp: -18 (code in Q9), -6 (/L_SUBFR) */ - L_tmp1 = Mpy_32_16( tmp, frac, 12330 ); /* Q13 */ - Ei = round_fx( L_shl( L_tmp1, 11 ) ); /* Q8 */ - - /* predicted codebook gain */ - gcode0 = sub( Es_pred, Ei ); /* Q8 */ - - /*---------------------------------------------------------------* - * Decode codebook gain and the adaptive excitation low-pass - * filtering factor (Finalize computation ) - *---------------------------------------------------------------*/ - /* gain_inov = 1.0f / sqrt((dot_product(code, code, L_SUBFR) + 0.01) / L_SUBFR) */ - L_tmp = Isqrt_lc( L_tmp, &exp_inov ); - *gain_inov = extract_h( L_shl( L_tmp, sub( exp_inov, 3 ) ) ); /* gain_inov in Q12 */ - /* gcode0 = pow(10, 0.05 * (Es_pred - Ei)) */ /*----------------------------------------------------------------* - * gcode0 = pow(10.0, gcode0/20) - * = pow(2, 3.321928*gcode0/20) - * = pow(2, 0.166096*gcode0) - *----------------------------------------------------------------*/ - - L_tmp = L_mult( gcode0, 21771 ); /* *0.166096 in Q17 -> Q26 */ - L_tmp = L_shr( L_tmp, 10 ); /* From Q26 to Q16 */ - frac = L_Extract_lc( L_tmp, &exp_gcode0 ); /* Extract exponent of gcode0 */ - - gcode0 = extract_l( Pow2( 14, frac ) ); /* Put 14 as exponent so that */ - /* output of Pow2() will be: */ - /* 16384 < Pow2() <= 32767 */ - exp_gcode0 = sub( exp_gcode0, 14 ); - - - /*tmp1 = (g_corr[0]*g_corr[2]) - (g_corr[4]*g_corr[4]); - tmp2 = g_corr[1]/tmp1; - tmp1 = g_corr[3]/tmp1; - - *gain_pit = (g_corr[2]*tmp2) - (g_corr[4]*tmp1); - *gain_code = (g_corr[0]*tmp1) - (g_corr[4]*tmp2);*/ - - /* *gain_pit = (g_corr[2]*tmp2) - (g_corr[4]*tmp3); - = ((g_corr[1]*g_corr[2]) - (g_corr[3]*g_corr[4]))/tmp1;*/ - - /* *gain_code = (g_corr[0]*tmp3) - (g_corr[4]*tmp2); - = ((g_corr[3]*g_corr[0]) - (g_corr[1]*g_corr[4]))/tmp1;*/ - - L_tmp1 = L_mult( coeff[0], coeff[2] ); /*Q31*/ - exp1 = add( exp_coeff[0], exp_coeff[2] ); - - L_tmp2 = L_mult_o( coeff[4], coeff[4], &Overflow ); /*Q31*/ - exp2 = add( exp_coeff[4], exp_coeff[4] ); - - IF( GT_16( exp1, exp2 ) ) - { - L_tmp2 = L_shr( L_tmp2, sub( exp1, exp2 ) ); /*Q31*/ - exp_den = exp1; - move16(); - } - ELSE - { - L_tmp1 = L_shr( L_tmp1, sub( exp2, exp1 ) ); /*Q31*/ - exp_den = exp2; - move16(); - } - L_frac_den = L_sub( L_tmp1, L_tmp2 ); /*Q31*/ - - frac_den = extract_h( L_frac_den ); /* Q15 */ - frac_den = s_max( frac_den, 1 ); /* Q15 */ - L_frac_den = L_max( L_frac_den, 1 ); /* Q31 */ - exp = norm_l( L_frac_den ); - tmp = div_s( shl( 1, sub( 14, exp ) ), frac_den ); /*Q(14-exp)*/ - - - L_tmp1 = L_mult( coeff[3], coeff[4] ); /*Q31*/ - exp1 = add( exp_coeff[3], exp_coeff[4] ); - - L_tmp2 = L_mult( coeff[1], coeff[2] ); /*Q31*/ - exp2 = add( exp_coeff[1], exp_coeff[2] ); - - IF( GT_16( exp1, exp2 ) ) - { - L_tmp2 = L_shr( L_tmp2, sub( exp1, exp2 ) ); /*Q31*/ - exp_num = exp1; - move16(); - } - ELSE - { - L_tmp1 = L_shr( L_tmp1, sub( exp2, exp1 ) ); /*Q31*/ - exp_num = exp2; - move16(); - } - L_frac_num = L_sub_o( L_tmp2, L_tmp1, &Overflow ); /*Q31*/ - - L_div = Mult_32_16( L_frac_num, tmp ); /*Q(30-exp)*/ - exp_div = sub( exp_num, exp_den ); - - *gain_pit = round_fx_o( L_shl_o( L_div, add( exp, exp_div ), &Overflow ), &Overflow ); /*Q14*/ - move16(); - - // To be checked - L_tmp1 = L_mult_o( coeff[1], coeff[4], &Overflow ); /*Q31*/ - exp1 = add( exp_coeff[1], exp_coeff[4] ); - - L_tmp2 = L_mult( coeff[0], coeff[3] ); /*Q31*/ - exp2 = add( exp_coeff[0], exp_coeff[3] ); - - IF( GT_16( exp1, exp2 ) ) - { - L_tmp2 = L_shr( L_tmp2, sub( exp1, exp2 ) ); /*Q31*/ - exp_num = exp1; - move16(); - } - ELSE - { - L_tmp1 = L_shr( L_tmp1, sub( exp2, exp1 ) ); /*Q31*/ - exp_num = exp2; - move16(); - } - L_frac_num = L_sub_o( L_tmp2, L_tmp1, &Overflow ); /*Q31*/ - - L_div = Mult_32_16( L_frac_num, tmp ); /*Q(30-exp)*/ - exp_div = sub( exp_num, exp_den ); - - *gain_code = L_shl_sat( L_div, s_max( -31, sub( add( exp, exp_div ), 14 ) ) ); - move32(); /*Q16*/ - - *gain_pit = s_max( G_PITCH_MIN_Q14, s_min( *gain_pit, G_PITCH_MAX_Q14 ) ); - - /*-----------------------------------------------------------------* - * limit the pitch gain searching range (if indicated by clip_gain) - *-----------------------------------------------------------------*/ - - test(); - test(); - IF( EQ_16( clip_gain, 1 ) && GT_16( *gain_pit, 15565 /* 0.95 in Q14 */ ) ) - { - *gain_pit = 15565; /* 0.95 in Q14 */ - move16(); - } - ELSE IF( EQ_16( clip_gain, 2 ) && GT_16( *gain_pit, 10650 /* 0.65 in Q14 */ ) ) - { - *gain_pit = 10650; /* 0.65 in Q14 */ - move16(); - } - - /*-----------------------------------------------------------------* - * search for the best quantized values - *-----------------------------------------------------------------*/ - - nBits_pitch = gains_mode[i_subfr >> 6]; - move16(); - - /* set number of bits for two SQs */ - nBits_code = shr( add( nBits_pitch, 1 ), 1 ); - nBits_pitch = shr( nBits_pitch, 1 ); - - /* gain_pit Q */ - /*tmp1 = (G_PITCH_MAX - G_PITCH_MIN) / ((1 << nBits_pitch) - 1);*/ /* set quantization step */ - tmp1 = mult_r( G_PITCH_MAX_Q13, div_s( 1, sub( shl( 1, nBits_pitch ), 1 ) ) ); /*Q13*/ /* set quantization step */ - - index = usquant_fx( *gain_pit, gain_pit, G_PITCH_MIN_Q14, tmp1, shl( 1, nBits_pitch ) ); - push_indice( hBstr, IND_GAIN_PIT, index, nBits_pitch ); - - /* gain_code Q */ - /* *gain_code /= gcode0; */ - IF( gcode0 != 0 ) - { - tmp = div_s( 16384, gcode0 ); /*Q15*/ - L_tmp = Mult_32_16( *gain_code, tmp ); /*Q16*/ - *gain_code = L_shr( L_tmp, add( 14, exp_gcode0 ) ); /*Q16*/ - move32(); - } - - index = gain_quant_fx( gain_code, &gain_code16, LG10_G_CODE_MIN_Q14, LG10_G_CODE_MAX_Q13, nBits_code, &expg ); - push_indice( hBstr, IND_GAIN_CODE, index, nBits_code ); - L_tmp = L_mult( gain_code16, gcode0 ); /*Q0*Q0 -> Q1*/ - *gain_code = L_shl_sat( L_tmp, add( add( expg, exp_gcode0 ), 15 ) ); - move32(); /*Q16*/ - - /* *norm_gain_code = *gain_code / *gain_inov; */ - exp = sub( norm_s( *gain_inov ), 1 ); - exp = s_max( exp, 0 ); - - tmp = div_s( shr( 8192, exp ), *gain_inov ); - *norm_gain_code = L_shr( Mult_32_16( *gain_code, tmp ), sub( 1, exp ) ); // Q16 - move32(); - - return; -} -#endif -/*-------------------------------------------------------------------* - * gain_enc_gaus() - * - * Quantization of gain for Gaussian codebook - *-------------------------------------------------------------------*/ -Word16 gain_enc_gaus_fx( /* o : Return index of quantization */ - Word32 *gain, /* i/o: Code gain to quantize Q16*/ - const Word16 bits, /* i : number of bits to quantize Q0*/ - const Word16 lowBound, /* i : lower bound of quantizer (dB) Q8*/ - const Word16 stepSize, /* i : Step size choice Q14*/ - const Word16 inv_stepSize /* i : Step size choice Q15*/ -) -{ - Word16 index, exp_gain, frac_gain, wtmp; - Word16 enr_q, wenr; - Word32 Ltmp, enr; -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif - /*enr = 20.0 * log10(*gain + 0.001) codebook gain in dB */ - exp_gain = norm_l( *gain ); - frac_gain = Log2_norm_lc( L_shl( *gain, exp_gain ) ); - exp_gain = sub( 30 - 16, exp_gain ); - - enr = Mpy_32_16( exp_gain, frac_gain, LG10 ); /* Output in Q13 */ - wenr = extract_h( L_shl( enr, 8 + 3 ) ); - - /*----------------------------------------------------------------* - * Quantize linearly the log E - *----------------------------------------------------------------*/ - - wtmp = sub( wenr, lowBound ); /* Q8 */ - - index = extract_l( L_shr( L_mac( 8388608, wtmp, inv_stepSize ), 16 + 8 ) ); // Q0 - - /* index [0 (1< Q26 */ - enr = L_shr( enr, 10 ); /*Q26->Q16*/ - frac_gain = L_Extract_lc( enr, &exp_gain ); - - Ltmp = Pow2( 14, frac_gain ); /* Put 14 as exponent */ - exp_gain = sub( exp_gain, 14 ); /* Retreive exponent of wtmp */ - *gain = L_shl_o( Ltmp, add( 16, exp_gain ), &Overflow ); - move32(); /*Q16*/ - - return index; -} -/*-----------------------------------------------------------------* - * gain_enc_tc() - * - * Search and quantization of gain_code for subframes (in the - * beginning of frame) without pulses in TC - 3b coding. - * In this case: - * - gain_pit = 0 - * - gain_code - scalar quantization (no prediciton history used) - *-----------------------------------------------------------------*/ -void gain_enc_tc_fx( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - const Word16 gains_mode[], /* i : gain bits Q0*/ - const Word16 i_subfr, /* i : subframe index Q0*/ - const Word16 xn_fx[], /* i : target vector Q_xn*/ - const Word16 y2_fx[], /* i : zero-memory filtered algebraic codebook excitation Q_xn*/ - const Word16 code_fx[], /* i : algebraic excitation Q9*/ - const Word16 Es_pred_fx, /* i : predicted scaled innovation energy Q8*/ - Word16 *gain_pit_fx, /* o : Pitch gain / Quantized pitch gain Q14*/ - Word32 *gain_code_fx, /* o : quantized codebook gain Q16*/ - Word16 *gain_inov_fx, /* o : innovation gain Q12*/ - Word32 *norm_gain_code_fx, /* o : norm. gain of the codebook excitation Q16*/ - const Word16 Q_xn /* i : xn and y1 scaling */ -) -{ - Word16 i, index = 0, nBits, num, den, exp_num, exp_den; - Word16 Ei_fx, g_code_fx, gcode0_fx; - Word16 expg, expg2, e_tmp, f_tmp, exp_gcode0, tmp_fx, frac, tmp16; - Word32 L_tmp, L_tmp1; - Word16 wgain_code = 0, gain_code16; - *gain_pit_fx = 0; - move16(); - move16(); - move16(); - - /*----------------------------------------------------------------* - * get number of bits for gain quantization - *----------------------------------------------------------------*/ - nBits = gains_mode[shr( i_subfr, 6 )]; - - /*----------------------------------------------------------------* - * find the code pitch (for current subframe) - *----------------------------------------------------------------*/ - - /**gain_code = dotp( xn, y2, L_SUBFR )/( dotp( y2, y2, L_SUBFR ) + 0.01f );*/ - /* Compute scalar product */ - L_tmp = Dot_product( y2_fx, y2_fx, L_SUBFR ); /* -18 (y2 Q9) */ - exp_den = norm_l( L_tmp ); - den = extract_h( L_shl( L_tmp, exp_den ) ); - exp_den = sub( add( exp_den, 18 ), shl( Q_xn, 1 ) ); - - /* Compute scalar product */ - L_tmp1 = Dot_product( xn_fx, y2_fx, L_SUBFR ); /* -9 (y2 Q9) */ - exp_num = sub( norm_l( L_tmp1 ), 1 ); - num = extract_h( L_shl( L_tmp1, exp_num ) ); - exp_num = sub( add( exp_num, 8 ), Q_xn ); - - tmp16 = s_or( shr( num, 16 ), 1 ); /* extract sign if num < 0 tmp16 = -1 else tmp16 = 1 */ - num = abs_s( num ); - - /*----------------------------------------------------------------* - * compute gain = xy/yy - *----------------------------------------------------------------*/ - g_code_fx = div_s( num, den ); - - i = sub( exp_num, exp_den ); /* Gain_trans in Q7 */ - g_code_fx = i_mult2( g_code_fx, tmp16 ); /* apply sign */ - *gain_code_fx = L_shr_sat( L_deposit_l( g_code_fx ), i ); - move32(); - - /*----------------------------------------------------------------* - * calculate the predicted gain code - * decode codebook gain - *----------------------------------------------------------------*/ - - *gain_pit_fx = 0; - move16(); - - /*Ecode = (dotp( code, code, L_SUBFR) + 0.01f) / L_SUBFR; - *gain_inov = 1.0f / (float)sqrt( Ecode );*/ - - L_tmp = Dot_product12( code_fx, code_fx, L_SUBFR, &expg ); - expg = sub( expg, 18 + 6 ); /* exp: -18 (code in Q9), -6 (/L_SUBFR) */ - expg2 = expg; - move16(); - L_tmp1 = L_tmp; /* sets to 'L_tmp' in 1 clock */ - move32(); - L_tmp = Isqrt_lc( L_tmp, &expg ); - - *gain_inov_fx = extract_h( L_shl( L_tmp, sub( expg, 3 ) ) ); - move16(); /* gain_inov in Q12 */ - - /*Ei = 10 * (float)log10( Ecode );*/ - e_tmp = norm_l( L_tmp1 ); - f_tmp = Log2_norm_lc( L_shl( L_tmp1, e_tmp ) ); - e_tmp = sub( expg2, add( 1, e_tmp ) ); - L_tmp1 = Mpy_32_16( e_tmp, f_tmp, 12330 ); /* Q13 */ /* 10*log10(2) in Q12*/ - Ei_fx = round_fx( L_shl( L_tmp1, 11 ) ); /* Q8 */ - /*gcode0 = (float) pow(10, 0.05 * (Es_pred - Ei));*/ - gcode0_fx = sub( Es_pred_fx, Ei_fx ); /* Q8 */ - /*-----------------------------------------------------------------* - * gcode0 = pow(10.0, gcode0/20) - * = pow(2, 3.321928*gcode0/20) - * = pow(2, 0.166096*gcode0) - *-----------------------------------------------------------------*/ - L_tmp = L_mult( gcode0_fx, 21771 ); /* *0.166096 in Q17 -> Q26 */ - L_tmp = L_shr( L_tmp, 10 ); /* From Q26 to Q16 */ - frac = L_Extract_lc( L_tmp, &exp_gcode0 ); /* Extract exponent of gcode0 */ - gcode0_fx = extract_l( Pow2( 14, frac ) ); /* Put 14 as exponent so that */ - exp_gcode0 = sub( exp_gcode0, 14 ); - IF( GT_16( nBits, 3 ) ) - { - /*g_code = *gain_code / gcode0;*/ - IF( gcode0_fx != 0 ) - { - tmp16 = div_s( 16384, gcode0_fx ); /*Q15*/ - L_tmp = Mult_32_16( *gain_code_fx, tmp16 ); /*Q16*/ - *gain_code_fx = L_shr( L_tmp, add( 14, exp_gcode0 ) ); /*Q16*/ - move32(); - } - ELSE - { - *gain_code_fx = MAX_32; - move32(); - } - - /*index = gain_quant( &g_code, G_CODE_MIN, G_CODE_MAX, nBits );*/ - index = gain_quant_fx( gain_code_fx, &gain_code16, LG10_G_CODE_MIN_TC_Q14, LG10_G_CODE_MAX_TC_Q13, nBits, &expg ); - - /**gain_code = g_code * gcode0;*/ - L_tmp = L_mult( gain_code16, gcode0_fx ); /*Q0*Q0 -> Q1*/ - *gain_code_fx = L_shl( L_tmp, add( add( expg, exp_gcode0 ), 15 ) ); /*Q16*/ - move32(); - - push_indice( hBstr, IND_GAIN_CODE, index, nBits ); - } - ELSE - { - index = N_GAIN_CODE_TC - 1; - move16(); - FOR( i = 0; i < N_GAIN_CODE_TC - 1; i++ ) - { - L_tmp = L_mult( tbl_gain_code_tc_quant_mean[i], gcode0_fx ); /* Q13*Q0 -> Q14 */ - L_tmp = L_shl( L_tmp, add( exp_gcode0, 2 ) ); /* Q14 -> Q16 */ - - IF( LT_32( *gain_code_fx, L_tmp ) ) - { - index = i; - move16(); - BREAK; - } - } - /*----------------------------------------------------------------* - * 3-bit -> 2-bit encoding - *----------------------------------------------------------------*/ - IF( EQ_16( nBits, 2 ) ) - { - /* 2-bit -> 3-bit decoding */ - index = shr( index, 1 ); - wgain_code = tbl_gain_code_tc_fx[shl( index, 1 )]; - move16(); - /**gain_code *= gcode0;*/ - L_tmp = L_mult( wgain_code, gcode0_fx ); /* Q13*Q0 -> Q14 */ - *gain_code_fx = L_shl( L_tmp, add( exp_gcode0, 2 ) ); - move32(); /* Q14 -> Q16 */ - push_indice( hBstr, IND_GAIN_CODE, index, nBits ); - } - ELSE /* nBits == 3 */ - { - wgain_code = tbl_gain_code_tc_fx[index]; - move16(); - /**gain_code *= gcode0;*/ - L_tmp = L_mult( wgain_code, gcode0_fx ); /* Q13*Q0 -> Q14 */ - *gain_code_fx = L_shl_sat( L_tmp, add( exp_gcode0, 2 ) ); - move32(); /* Q14 -> Q16 */ - push_indice( hBstr, IND_GAIN_CODE, index, nBits ); - } - } - - /*-----------------------------------------------------------------* - * decode normalized codebook gain - *-----------------------------------------------------------------*/ - /**norm_gain_code = *gain_code / *gain_inov;*/ - expg = sub( norm_s( *gain_inov_fx ), 1 ); - expg = s_max( expg, 0 ); - - tmp_fx = div_s( shr( 8192, expg ), *gain_inov_fx ); - *norm_gain_code_fx = L_shr( Mult_32_16( *gain_code_fx, tmp_fx ), sub( 1, expg ) ); // Q16 - move32(); - return; -} -#ifndef REUSE_EVS_BE_GAINQ -void gain_enc_tc_ivas_fx( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - const Word16 gains_mode[], /* i : gain bits Q0*/ - const Word16 i_subfr, /* i : subframe index Q0*/ - const Word16 xn_fx[], /* i : target vector Q_xn*/ - const Word16 y2_fx[], /* i : zero-memory filtered algebraic codebook excitation Q_xn*/ - const Word16 code_fx[], /* i : algebraic excitation Q9*/ - const Word16 Es_pred_fx, /* i : predicted scaled innovation energy Q8*/ - Word16 *gain_pit_fx, /* o : Pitch gain / Quantized pitch gain Q14*/ - Word32 *gain_code_fx, /* o : quantized codebook gain Q16*/ - Word16 *gain_inov_fx, /* o : innovation gain Q12*/ - Word32 *norm_gain_code_fx, /* o : norm. gain of the codebook excitation Q6*/ - const Word16 Q_xn /* i : xn and y1 scaling */ -) -{ - Word16 i, index = 0, nBits, num, den, exp_num, exp_den; - Word16 Ei_fx, g_code_fx, gcode0_fx; - Word16 expg, expg2, e_tmp, f_tmp, exp_gcode0, tmp_fx, frac, tmp16; - Word32 L_tmp, L_tmp1; - Word16 wgain_code = 0, gain_code16; - *gain_pit_fx = 0; - move16(); - move16(); - move16(); - - /*----------------------------------------------------------------* - * get number of bits for gain quantization - *----------------------------------------------------------------*/ - nBits = gains_mode[i_subfr >> 6]; // Q0 - move16(); - - /*----------------------------------------------------------------* - * find the code pitch (for current subframe) - *----------------------------------------------------------------*/ - - /**gain_code = dotp( xn, y2, L_SUBFR )/( dotp( y2, y2, L_SUBFR ) + 0.01f );*/ - /* Compute scalar product */ - L_tmp = Dot_product( y2_fx, y2_fx, L_SUBFR ); /* -18 (y2 Q9) */ - exp_den = norm_l( L_tmp ); - den = extract_h( L_shl( L_tmp, exp_den ) ); - exp_den = sub( add( exp_den, 18 ), shl( Q_xn, 1 ) ); - - /* Compute scalar product */ - L_tmp1 = Dot_product( xn_fx, y2_fx, L_SUBFR ); /* -9 (y2 Q9) */ - exp_num = sub( norm_l( L_tmp1 ), 1 ); - num = extract_h( L_shl( L_tmp1, exp_num ) ); - exp_num = sub( add( exp_num, 8 ), Q_xn ); - - tmp16 = s_or( shr( num, 16 ), 1 ); /* extract sign if num < 0 tmp16 = -1 else tmp16 = 1 */ - num = abs_s( num ); - - /*----------------------------------------------------------------* - * compute gain = xy/yy - *----------------------------------------------------------------*/ - g_code_fx = div_s( num, den ); - - i = sub( exp_num, exp_den ); /* Gain_trans in Q7 */ - g_code_fx = i_mult2( g_code_fx, tmp16 ); /* apply sign */ - *gain_code_fx = L_shr_sat( L_deposit_l( g_code_fx ), i ); /* Q16 */ - move32(); - - /*----------------------------------------------------------------* - * calculate the predicted gain code - * decode codebook gain - *----------------------------------------------------------------*/ - - *gain_pit_fx = 0; - move16(); - - /*Ecode = (dotp( code, code, L_SUBFR) + 0.01f) / L_SUBFR; - *gain_inov = 1.0f / (float)sqrt( Ecode );*/ - - L_tmp = Dot_product12( code_fx, code_fx, L_SUBFR, &expg ); - expg = sub( expg, 18 + 6 ); /* exp: -18 (code in Q9), -6 (/L_SUBFR) */ - expg2 = expg; - move16(); - L_tmp1 = L_tmp; /* sets to 'L_tmp' in 1 clock */ - move32(); - L_tmp = Isqrt_lc( L_tmp, &expg ); - - *gain_inov_fx = extract_h( L_shl( L_tmp, sub( expg, 3 ) ) ); - move16(); /* gain_inov in Q12 */ - - /*Ei = 10 * (float)log10( Ecode );*/ - e_tmp = norm_l( L_tmp1 ); - f_tmp = Log2_norm_lc( L_shl( L_tmp1, e_tmp ) ); - e_tmp = sub( expg2, add( 1, e_tmp ) ); - L_tmp1 = Mpy_32_16( e_tmp, f_tmp, 12330 ); /* Q13 */ /* 10*log10(2) in Q12*/ - Ei_fx = round_fx( L_shl( L_tmp1, 11 ) ); /* Q8 */ - /*gcode0 = (float) pow(10, 0.05 * (Es_pred - Ei));*/ - gcode0_fx = sub( Es_pred_fx, Ei_fx ); /* Q8 */ - /*-----------------------------------------------------------------* - * gcode0 = pow(10.0, gcode0/20) - * = pow(2, 3.321928*gcode0/20) - * = pow(2, 0.166096*gcode0) - *-----------------------------------------------------------------*/ - L_tmp = L_mult( gcode0_fx, 21771 ); /* *0.166096 in Q17 -> Q26 */ - L_tmp = L_shr( L_tmp, 10 ); /* From Q26 to Q16 */ - frac = L_Extract_lc( L_tmp, &exp_gcode0 ); /* Extract exponent of gcode0 */ - gcode0_fx = extract_l( Pow2( 14, frac ) ); /* Put 14 as exponent so that */ - exp_gcode0 = sub( exp_gcode0, 14 ); - IF( GT_16( nBits, 3 ) ) - { - /*g_code = *gain_code / gcode0;*/ - IF( gcode0_fx != 0 ) - { - tmp16 = div_s( 16384, gcode0_fx ); /*Q15*/ - L_tmp = Mult_32_16( *gain_code_fx, tmp16 ); /*Q16*/ - *gain_code_fx = L_shr( L_tmp, add( 14, exp_gcode0 ) ); /*Q16*/ - move32(); - } - ELSE - { - *gain_code_fx = MAX_32; - move32(); - } - - /*index = gain_quant( &g_code, G_CODE_MIN, G_CODE_MAX, nBits );*/ - index = gain_quant_fx( gain_code_fx, &gain_code16, LG10_G_CODE_MIN_TC_Q14, LG10_G_CODE_MAX_TC_Q13, nBits, &expg ); - - /**gain_code = g_code * gcode0;*/ - L_tmp = L_mult( gain_code16, gcode0_fx ); /*Q0*Q0 -> Q1*/ - *gain_code_fx = L_shl( L_tmp, add( add( expg, exp_gcode0 ), 15 ) ); /*Q16*/ - move32(); - - push_indice( hBstr, IND_GAIN_CODE, index, nBits ); - } - ELSE - { - index = N_GAIN_CODE_TC - 1; - move16(); - FOR( i = 0; i < N_GAIN_CODE_TC - 1; i++ ) - { - L_tmp = L_mult( tbl_gain_code_tc_quant_mean[i], gcode0_fx ); /* Q13*Q0 -> Q14 */ - L_tmp = L_shl( L_tmp, add( exp_gcode0, 2 ) ); /* Q14 -> Q16 */ - - IF( LT_32( *gain_code_fx, L_tmp ) ) - { - index = i; - move16(); - BREAK; - } - } - /*----------------------------------------------------------------* - * 3-bit -> 2-bit encoding - *----------------------------------------------------------------*/ - IF( EQ_16( nBits, 2 ) ) - { - /* 2-bit -> 3-bit decoding */ - index = shr( index, 1 ); - wgain_code = tbl_gain_code_tc_fx[index * 2]; // Q13 - move16(); - /**gain_code *= gcode0;*/ - L_tmp = L_mult( wgain_code, gcode0_fx ); /* Q13*Q0 -> Q14 */ - *gain_code_fx = L_shl( L_tmp, add( exp_gcode0, 2 ) ); - move32(); /* Q14 -> Q16 */ - push_indice( hBstr, IND_GAIN_CODE, index, nBits ); - } - ELSE /* nBits == 3 */ - { - wgain_code = tbl_gain_code_tc_fx[index]; // Q13 - move16(); - /**gain_code *= gcode0;*/ - L_tmp = L_mult( wgain_code, gcode0_fx ); /* Q13*Q0 -> Q14 */ - *gain_code_fx = L_shl_sat( L_tmp, add( exp_gcode0, 2 ) ); - move32(); /* Q14 -> Q16 */ - push_indice( hBstr, IND_GAIN_CODE, index, nBits ); - } - } - - /*-----------------------------------------------------------------* - * decode normalized codebook gain - *-----------------------------------------------------------------*/ - /**norm_gain_code = *gain_code / *gain_inov;*/ - expg = sub( norm_s( *gain_inov_fx ), 1 ); - expg = s_max( expg, 0 ); - - tmp_fx = div_s( shr( 8192, expg ), *gain_inov_fx ); - *norm_gain_code_fx = L_shr( Mult_32_16( *gain_code_fx, tmp_fx ), sub( 1, expg ) ); // Q6 - move32(); - return; -} -#endif -/*-----------------------------------------------------------------* - * Find_Opt_gainQ_fx() - * - * Find the best quantizer - *-----------------------------------------------------------------*/ -static Word16 Find_Opt_gainQ_fx( - Word16 *coeff, /* exp(exp_coeff) */ - Word16 *exp_coeff, - Word16 *gain_pit, /* Q14 */ - Word32 *gain_code, /* Q16 */ - Word16 gcode0, /* exp(exp_gcode0) */ - Word16 exp_gcode0, - const Word16 *cdbk, /* i : Codebook used Q14*/ - const Word16 size /* i : size of Codebook used Q0*/ -) -{ - Word16 index, i, j; - const Word16 *p; - Word16 g_pitch, g2_pitch, g_code, g_pit_cod, g2_code, g2_code_lo; - Word32 dist_min; - Word16 coeff_lo[5]; - Word16 exp_max[5]; - Word16 exp_code, e_max; - Word32 L_tmp, L_tmp1; -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif - - - /*----------------------------------------------------------------* - * Find the best quantizer - * ~~~~~~~~~~~~~~~~~~~~~~~ - * Before doing the computation we need to align exponents of coeff[] - * to be sure to have the maximum precision. - * - * In the table the pitch gains are in Q14, the code gains are in Q9 and - * are multiply by gcode0 which have been multiply by 2^exp_gcode0. - * Also when we compute g_pitch*g_pitch, g_code*g_code and g_pitch*g_code - * we divide by 2^15. - * Considering all the scaling above we have: - * - * exp_code = exp_gcode0-9+15 = exp_gcode0+6 - * - * g_pitch*g_pitch = -14-14+15 - * g_pitch = -14 - * g_code*g_code = (2*exp_code)+15 - * g_code = exp_code - * g_pitch*g_code = -14 + exp_code +15 - * - * g_pitch*g_pitch * coeff[0] ;exp_max0 = exp_coeff[0] - 13 - * g_pitch * coeff[1] ;exp_max1 = exp_coeff[1] - 14 - * g_code*g_code * coeff[2] ;exp_max2 = exp_coeff[2] +15+(2*exp_code) - * g_code * coeff[3] ;exp_max3 = exp_coeff[3] + exp_code - * g_pitch*g_code * coeff[4] ;exp_max4 = exp_coeff[4] + 1 + exp_code - *----------------------------------------------------------------*/ - - exp_code = add( exp_gcode0, 6 ); - - exp_max[0] = sub( exp_coeff[0], 13 ); - move16(); - exp_max[1] = sub( exp_coeff[1], 14 ); - move16(); - exp_max[2] = add( exp_coeff[2], add( 15, shl( exp_code, 1 ) ) ); - move16(); - exp_max[3] = add( exp_coeff[3], exp_code ); - move16(); - exp_max[4] = add( exp_coeff[4], add( 1, exp_code ) ); - move16(); - - /* Find maximum exponant */ - e_max = exp_max[0]; - move16(); - FOR( i = 1; i < 5; i++ ) - { - e_max = s_max( exp_max[i], e_max ); - } - - /* align coeff[] and save in special 32 bit double precision */ - FOR( i = 0; i < 5; i++ ) - { - j = add( sub( e_max, exp_max[i] ), 2 ); /* /4 to avoid overflow */ - L_tmp = L_deposit_h( coeff[i] ); - L_tmp = L_shr( L_tmp, j ); - L_Extract( L_tmp, &coeff[i], &coeff_lo[i] ); - coeff_lo[i] = shr( coeff_lo[i], 3 ); /* lo >> 3 */ - move16(); - } - - /* searching of codebook */ - p = cdbk; // Q14 - move16(); - dist_min = L_deposit_h( MAX_16 ); - index = 0; - move16(); - FOR( i = 0; i < size; i++ ) - { - g_pitch = *p++; - move16(); - g_code = *p++; - move16(); - - g_code = mult_r( g_code, gcode0 ); // exp_gcode - 1 - g2_pitch = mult_r( g_pitch, g_pitch ); // Q13 - g_pit_cod = mult_r( g_code, g_pitch ); - L_tmp = L_mult( g_code, g_code ); - g2_code_lo = L_Extract_lc( L_tmp, &g2_code ); - - L_tmp = L_mult( coeff[2], g2_code_lo ); - L_tmp = L_shr( L_tmp, 3 ); - L_tmp = L_mac( L_tmp, coeff_lo[0], g2_pitch ); - L_tmp = L_mac( L_tmp, coeff_lo[1], g_pitch ); - L_tmp = L_mac( L_tmp, coeff_lo[2], g2_code ); - L_tmp = L_mac( L_tmp, coeff_lo[3], g_code ); - L_tmp = L_mac( L_tmp, coeff_lo[4], g_pit_cod ); - L_tmp = L_shr( L_tmp, 12 ); - L_tmp = L_mac( L_tmp, coeff[0], g2_pitch ); /* 15 - coeff_exp + 13 - 1 */ - L_tmp = L_mac( L_tmp, coeff[1], g_pitch ); /* 15 - coeff_exp + 13 - 1 */ - L_tmp = L_mac( L_tmp, coeff[2], g2_code ); /* 15 - coeff_exp + 13 - 1 */ - L_tmp = L_mac( L_tmp, coeff[3], g_code ); /* 15 - coeff_exp + 13 - 1 */ - L_tmp = L_mac( L_tmp, coeff[4], g_pit_cod ); /* 15 - coeff_exp + 13 - 1 */ - - L_tmp1 = L_sub_o( L_tmp, dist_min, &Overflow ); - if ( L_tmp1 < 0 ) - { - index = i; - move16(); - } - dist_min = L_min( L_tmp, dist_min ); - } - - p = &cdbk[add( index, index )]; // Q14 - move16(); - - *gain_pit = *p++; /* selected pitch gain in Q14 */ - move16(); - g_code = *p++; /* selected code gain in Q9 */ - move16(); - - L_tmp = L_mult( g_code, gcode0 ); /* Q9*Q0 -> Q10 */ - L_tmp = L_shl_sat( L_tmp, add( exp_gcode0, 6 ) ); /* Q10 -> Q16 */ - *gain_code = L_tmp; /* gain of code in Q16 */ - move16(); - return index; -} -/*---------------------------------------------------------------------* - * gain_enc_lbr() - * - * Quantization of pitch and codebook gains without prediction (memory-less) - * in ACELP at 6.6 and 7.5 kbps - * - the gain codebooks and gain estimation constants are different in each subframe - * - the estimated gain, gcode0, is first determined based on - * classification and/or previous quantized gains (from previous subframes in the current frame) - * - a correction factor gamma = g_code / gcode0 is then vector quantized - * along with gain_pit - * - the mean-squared error criterion is used for codebook search - *---------------------------------------------------------------------*/ - -void gain_enc_lbr_fx( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - const Word16 gains_mode[], /* i : gain bits Q0*/ - const Word16 coder_type, /* i : coding type Q0*/ - const Word16 i_subfr, /* i : subframe index Q0*/ - const Word16 *xn, /* i : target vector Q_xn*/ - const Word16 *y1, /* i : zero-memory filtered adaptive excitation Q_xn*/ - const Word16 Q_xn, /* i : xn and y1 format */ - const Word16 *y2, /* i : zero-memory filtered algebraic codebook excitation Q9*/ - const Word16 *code, /* i : algebraic excitation Q9*/ - Word16 *gain_pit, /* o : quantized pitch gain Q14*/ - Word32 *gain_code, /* o : quantized codebook gain Q16*/ - Word16 *gain_inov, /* o : gain of the innovation (used for normalization) Q12*/ - Word32 *norm_gain_code, /* o : norm. gain of the codebook excitation Q16*/ - Word16 *g_corr, /* i/o: correlations , -2,, -2 and 2 mant/exp*/ - Word32 gc_mem[], /* i/o: gain_code from previous subframes Q16*/ - Word16 gp_mem[], /* i/o: gain_pitch from previous subframes Q14*/ - const Word16 clip_gain, /* i : gain pitch clipping flag (1 = clipping) Q0*/ - const Word16 L_subfr /* i : subframe length Q0*/ -#ifdef REUSE_EVS_BE_GAINQ_LBR - , - const Word16 element_mode /* i : mode element Q0*/ -#endif -) -{ - - Word16 index = 0, size, nBits, n_pred, ctype; - const Word16 *b, *cdbk = 0; - Word16 gcode0, aux[10]; - Word16 coeff[5], exp_coeff[5]; - Word16 exp, exp_code, exp_inov, exp_gcode0, frac, tmp, L_subfr_sf; - Word32 L_tmp, L_tmp1, L_inov; - move16(); - move16(); - - L_subfr_sf = 6; - move16(); - if ( GT_16( L_subfr, L_SUBFR ) ) - { - L_subfr_sf = 7; - move16(); - } - /*-----------------------------------------------------------------* - * calculate the rest of the correlation coefficients - * c2 = , c3 = -2, c4 = 2, c5* = - * c5* - not necessary to calculate - *-----------------------------------------------------------------*/ - - coeff[0] = g_corr[0]; - move16(); - exp_coeff[0] = g_corr[1]; - move16(); - coeff[1] = negate( g_corr[2] ); - move16(); /* coeff[1] = -2 xn yy1 */ - exp_coeff[1] = add( g_corr[3], 1 ); - move16(); - - /* Compute scalar product */ - coeff[2] = extract_h( Dot_product12( y2, y2, L_subfr, &exp ) ); - move16(); - exp_coeff[2] = add( sub( exp, 18 ), shl( Q_xn, 1 ) ); /* -18 (y2 Q9) */ - move16(); - - /* Compute scalar product -2* */ - - coeff[3] = extract_h( L_negate( Dot_product12( xn, y2, L_subfr, &exp ) ) ); - move16(); - exp_coeff[3] = add( sub( exp, 9 - 1 ), Q_xn ); /* -9 (y2 Q9), +1 (2 xn y2) */ - move16(); - - /* Compute scalar product 2* */ - - coeff[4] = extract_h( Dot_product12( y1, y2, L_subfr, &exp ) ); - move16(); - exp_coeff[4] = add( sub( exp, 9 - 1 ), Q_xn ); /* -9 (y2 Q9), +1 (2 yy1 y2) */ - move16(); - - /*g_corr[2] += 0.01F; g_corr[3] -= 0.02F; g_corr[4] += 0.02F;*/ - - /*Ecode = ( dotp( code, code, L_SUBFR ) + 0.01f ) / L_SUBFR; - *gain_inov = 1.0f / (float)sqrt(Ecode);*/ - L_tmp = Dot_product12( code, code, L_subfr, &exp_code ); - L_inov = L_tmp; /* sets to 'L_tmp' in 1 clock */ - move32(); - /* exp_code: -18 (code in Q9), -6 (/L_SUBFR), -31 (L_tmp Q31->Q0) */ - /* output gain_inov*/ - exp_inov = sub( exp_code, add( 18, L_subfr_sf ) ); - L_inov = Isqrt_lc( L_inov, &exp_inov ); -#ifdef REUSE_EVS_BE_GAINQ - *gain_inov = extract_h( L_shl_sat( L_inov, sub( exp_inov, 3 ) ) ); /* gain_inov in Q12 */ -#else - *gain_inov = extract_h( L_shl( L_inov, sub( exp_inov, 3 ) ) ); /* gain_inov in Q12 */ -#endif - move16(); - - - /*-----------------------------------------------------------------* - * select the codebook, size and number of bits - * set the gains searching range - *-----------------------------------------------------------------*/ - - nBits = gains_mode[shr( i_subfr, L_subfr_sf )]; - move16(); - size = shl( 1, nBits ); - - ctype = shl( sub( coder_type, 1 ), 1 ); - - /*-----------------------------------------------------------------* - * calculate prediction of gcode - * search for the best codeword - *-----------------------------------------------------------------*/ - test(); - IF( i_subfr == 0 ) - { - b = b_1sfr_fx; // Q12 - move16(); - n_pred = 2; - move16(); - - SWITCH( nBits ) - { - case 8: - { - cdbk = gp_gamma_1sfr_8b_fx; /* Q14 / Q9 */ - if ( EQ_16( clip_gain, 1 ) ) - { - size = sub( size, 60 ); - } - BREAK; - } - case 7: - { - cdbk = gp_gamma_1sfr_7b_fx; /* Q14 / Q9 */ - if ( EQ_16( clip_gain, 1 ) ) - { - size = sub( size, 27 ); - } - BREAK; - } - case 6: - { - cdbk = gp_gamma_1sfr_6b_fx; /* Q14 / Q9 */ - if ( EQ_16( clip_gain, 1 ) ) - { - size = sub( size, 10 ); - } - BREAK; - } - } - - /* calculate predicted gain */ - aux[0] = 4096; /* 1 in Q12 */ - move16(); - aux[1] = shl( ctype, 12 ); - move16(); - - /* gcode0 = (float)pow(10, dotp(b, aux, n_pred) - 0.5f * (float)log10(Ecode)); - gcode0 = (float)pow(10, dotp(b, aux, n_pred) - 0.05f * 10 * (float)log10(Ecode)); - gcode0 = (float)pow(10, 0.05(20 * dotp(b, aux, n_pred) - 10 * (float)log10(Ecode))); */ - -#ifdef REUSE_EVS_BE_GAINQ_LBR - IF( element_mode > EVS_MONO ) - { - // Ecode = (Ecode / L_subfr) - L_tmp = L_shr( L_tmp, L_subfr_sf ); // Q19 + (Q30-exp_code) - /* Calculation for log10(Ecode) exponent for applying log10 = Q31 - q = Q31 - Q19 - Q30 + exp_code = exp_code - Q18*/ - L_tmp = BASOP_Util_Log10( L_tmp, sub( exp_code, 18 ) ); // new q = Q25 - exp = norm_l( L_tmp ); - L_tmp = L_shl( L_tmp, exp ); // Q25 + exp - // 10 in Q27 , ( 10 * log10( Ecode ) ) - L_tmp1 = Mpy_32_32( L_tmp, 1342177280 ); // Q25 + exp + 1 + Q27 - 32 = Q21 + exp - L_tmp1 = L_shr( L_tmp1, add( 7, exp ) ); // Q21 + exp - 7 - exp = Q14 - } - ELSE -#endif - { - exp_code = sub( exp_code, 18 + 6 + 1 ); - exp = norm_l( L_tmp ); - frac = Log2_norm_lc( L_shl( L_tmp, exp ) ); - exp = sub( exp_code, exp ); - L_tmp1 = Mpy_32_16( exp, frac, 24660 ); /* Q14 */ /* 10*log10(2) in Q13*/ - } - L_tmp = Dot_product( b, aux, n_pred ); /*Q25*/ - L_tmp = Mult_32_16( L_tmp, 320 ); /*Q14, 20 in Q4*/ - L_tmp = L_sub( L_tmp, L_tmp1 ); /*Q14*/ - - gcode0 = round_fx( L_shl( L_tmp, 10 ) ); /* Q8 */ - - /*-----------------------------------------------------------------* - * gcode0 = pow(10.0, gcode0/20) - * = pow(2, 3.321928*gcode0/20) - * = pow(2, 0.166096*gcode0) - *-----------------------------------------------------------------*/ - - L_tmp = L_mult( gcode0, 21771 ); /* *0.166096 in Q17 -> Q26 */ - L_tmp = L_shr( L_tmp, 10 ); /* From Q26 to Q16 */ - frac = L_Extract_lc( L_tmp, &exp_gcode0 ); /* Extract exponent of gcode0 */ - - gcode0 = extract_l( Pow2( 14, frac ) ); /* Put 14 as exponent so that */ - /* output of Pow2() will be: */ - /* 16384 < Pow2() <= 32767 */ - exp_gcode0 = sub( exp_gcode0, 14 ); - index = Find_Opt_gainQ_fx( coeff, exp_coeff, gain_pit, gain_code, gcode0, exp_gcode0, cdbk, size ); // Q0 - - gc_mem[0] = *gain_code; - move16(); /*Q16*/ - gp_mem[0] = *gain_pit; - move16(); /*Q14*/ - } - ELSE IF( EQ_16( i_subfr, L_SUBFR ) || EQ_16( L_subfr, 2 * L_SUBFR ) ) - { - b = b_2sfr_fx; - move16(); - n_pred = 4; - move16(); - - switch ( nBits ) - { - case 7: - { - cdbk = gp_gamma_2sfr_7b_fx; /* Q14/Q9 */ - if ( EQ_16( clip_gain, 1 ) ) - { - size = sub( size, 30 ); - } - BREAK; - } - case 6: - { - cdbk = gp_gamma_2sfr_6b_fx; /* Q14/Q9 */ - if ( EQ_16( clip_gain, 1 ) ) - { - size = sub( size, 12 ); - } - BREAK; - } - } - - /* calculate predicted gain */ - aux[0] = 4096; /* 1 in Q12 */ - move16(); - aux[1] = shl( ctype, 12 ); - move16(); - - /*aux[2] = (float)log10(gc_mem[0]); - = log2(gc_mem[0])*log10(2);*/ - exp = norm_l( gc_mem[0] ); - frac = Log2_norm_lc( L_shl( gc_mem[0], exp ) ); - exp = sub( sub( 30, exp ), 16 ); /*Q_format(gc_1sfr_fx)=16*/ - L_tmp1 = Mpy_32_16( exp, frac, 9864 ); - move16(); /* Q16 */ - aux[2] = round_fx( L_shl( L_tmp1, 12 ) ); /* Q12 */ - move16(); - - aux[3] = shr( gp_mem[0], 2 ); - move16(); /*Q12*/ - - /*-----------------------------------------------------------------* - * gcode0 = pow(10.0, dotp(b, aux, n_pred) - * = pow(2, 3.321928*dotp(b, aux, n_pred) - *-----------------------------------------------------------------*/ - L_tmp = Dot_product( b, aux, n_pred ); /*Q25*/ - L_tmp = Mult_32_16( L_tmp, 27213 ); /* *3.321928 in Q13 -> Q23 */ - L_tmp = L_shr( L_tmp, 7 ); /* From Q23 to Q16 */ - frac = L_Extract_lc( L_tmp, &exp_gcode0 ); /* Extract exponent of gcode0 */ - - gcode0 = extract_l( Pow2( 14, frac ) ); /* Put 14 as exponent so that */ - /* output of Pow2() will be: */ - /* 16384 < Pow2() <= 32767 */ - exp_gcode0 = sub( exp_gcode0, 14 ); - - index = Find_Opt_gainQ_fx( coeff, exp_coeff, gain_pit, gain_code, gcode0, exp_gcode0, cdbk, size ); // Q0 - gc_mem[1] = *gain_code; // Q16 - move32(); - gp_mem[1] = *gain_pit; // Q14 - move16(); - } - ELSE IF( EQ_16( i_subfr, 2 * L_SUBFR ) ) - { - b = b_3sfr_fx; // Q12 - move16(); - n_pred = 6; - move16(); - IF( EQ_16( nBits, 7 ) ) - { - cdbk = gp_gamma_3sfr_7b_fx; - if ( clip_gain == 1 ) - { - size -= 28; - } - } - ELSE - { - cdbk = gp_gamma_3sfr_6b_fx; /* Q14 / Q9 */ - if ( EQ_16( clip_gain, 1 ) ) - { - size = sub( size, 11 ); - } - } - /* calculate predicted gain */ - aux[0] = 4096; /* 1 in Q12 */ - move16(); - aux[1] = shl( ctype, 12 ); - move16(); - - /*aux[2] = (float)log10(gc_mem[0]); - = log2(gc_mem[0])*log10(2);*/ - exp = norm_l( gc_mem[0] ); - frac = Log2_norm_lc( L_shl( gc_mem[0], exp ) ); - exp = sub( sub( 30, exp ), 16 ); /*Q_format(gc_mem[0])=16*/ - L_tmp1 = Mpy_32_16( exp, frac, 9864 ); /* Q16 */ - aux[2] = round_fx( L_shl( L_tmp1, 12 ) ); /* Q12 */ - move16(); - - /*aux[3] = (float)log10(gc_mem[1]); - = log2(gc_mem[1])*log10(2);*/ - exp = norm_l( gc_mem[1] ); - frac = Log2_norm_lc( L_shl( gc_mem[1], exp ) ); - exp = sub( sub( 30, exp ), 16 ); /*Q_format(gc_mem[1])=16*/ - L_tmp1 = Mpy_32_16( exp, frac, 9864 ); /* Q16 */ - aux[3] = round_fx( L_shl( L_tmp1, 12 ) ); /* Q12 */ - move16(); - - aux[4] = shr( gp_mem[0], 2 ); - move16(); /*Q12*/ - aux[5] = shr( gp_mem[1], 2 ); - move16(); /*Q12*/ - - /*-----------------------------------------------------------------* - * gcode0 = pow(10.0, dotp(b, aux, n_pred) - * = pow(2, 3.321928*dotp(b, aux, n_pred) - *-----------------------------------------------------------------*/ - L_tmp = Dot_product( b, aux, n_pred ); /*Q25*/ - L_tmp = Mult_32_16( L_tmp, 27213 ); /* *3.321928 in Q13 -> Q23 */ - L_tmp = L_shr( L_tmp, 7 ); /* From Q23 to Q16 */ - frac = L_Extract_lc( L_tmp, &exp_gcode0 ); /* Extract exponent of gcode0 */ - - gcode0 = extract_l( Pow2( 14, frac ) ); /* Put 14 as exponent so that */ - /* output of Pow2() will be: */ - /* 16384 < Pow2() <= 32767 */ - exp_gcode0 = sub( exp_gcode0, 14 ); - - /*----------------------------------------------------------------* - * Find the best quantizer - * ~~~~~~~~~~~~~~~~~~~~~~~ - * Before doing the computation we need to align exponents of coeff[] - * to be sure to have the maximum precision. - * - * In the table the pitch gains are in Q14, the code gains are in Q9 and - * are multiply by gcode0 which have been multiply by 2^exp_gcode0. - * Also when we compute g_pitch*g_pitch, g_code*g_code and g_pitch*g_code - * we divide by 2^15. - * Considering all the scaling above we have: - * - * exp_code = exp_gcode0-9+15 = exp_gcode0+6 - * - * g_pitch*g_pitch = -14-14+15 - * g_pitch = -14 - * g_code*g_code = (2*exp_code)+15 - * g_code = exp_code - * g_pitch*g_code = -14 + exp_code +15 - * - * g_pitch*g_pitch * coeff[0] ;exp_max0 = exp_coeff[0] - 13 - * g_pitch * coeff[1] ;exp_max1 = exp_coeff[1] - 14 - * g_code*g_code * coeff[2] ;exp_max2 = exp_coeff[2] +15+(2*exp_code) - * g_code * coeff[3] ;exp_max3 = exp_coeff[3] + exp_code - * g_pitch*g_code * coeff[4] ;exp_max4 = exp_coeff[4] + 1 + exp_code - *----------------------------------------------------------------*/ + * Find the best quantizer + * ~~~~~~~~~~~~~~~~~~~~~~~ + * Before doing the computation we need to align exponents of coeff[] + * to be sure to have the maximum precision. + * + * In the table the pitch gains are in Q14, the code gains are in Q9 and + * are multiply by gcode0 which have been multiply by 2^exp_gcode0. + * Also when we compute g_pitch*g_pitch, g_code*g_code and g_pitch*g_code + * we divide by 2^15. + * Considering all the scaling above we have: + * + * exp_code = exp_gcode0-9+15 = exp_gcode0+6 + * + * g_pitch*g_pitch = -14-14+15 + * g_pitch = -14 + * g_code*g_code = (2*exp_code)+15 + * g_code = exp_code + * g_pitch*g_code = -14 + exp_code +15 + * + * g_pitch*g_pitch * coeff[0] ;exp_max0 = exp_coeff[0] - 13 + * g_pitch * coeff[1] ;exp_max1 = exp_coeff[1] - 14 + * g_code*g_code * coeff[2] ;exp_max2 = exp_coeff[2] +15+(2*exp_code) + * g_code * coeff[3] ;exp_max3 = exp_coeff[3] + exp_code + * g_pitch*g_code * coeff[4] ;exp_max4 = exp_coeff[4] + 1 + exp_code + *----------------------------------------------------------------*/ - index = Find_Opt_gainQ_fx( coeff, exp_coeff, gain_pit, gain_code, gcode0, exp_gcode0, cdbk, size ); + exp_code = add( exp_gcode0, 6 ); - gc_mem[2] = *gain_code; // Q16 - move32(); - gp_mem[2] = *gain_pit; // Q14 - move16(); - } - ELSE IF( EQ_16( i_subfr, 3 * L_SUBFR ) ) + exp_max[0] = sub( exp_coeff[0], 13 ); + move16(); + exp_max[1] = sub( exp_coeff[1], 14 ); + move16(); + exp_max[2] = add( exp_coeff[2], add( 15, shl( exp_code, 1 ) ) ); + move16(); + exp_max[3] = add( exp_coeff[3], exp_code ); + move16(); + exp_max[4] = add( exp_coeff[4], add( 1, exp_code ) ); + move16(); + + /* Find maximum exponant */ + e_max = exp_max[0]; + move16(); + FOR( i = 1; i < 5; i++ ) { - b = b_4sfr_fx; // Q12 - move16(); - n_pred = 8; - move16(); - IF( EQ_16( nBits, 7 ) ) - { - cdbk = gp_gamma_4sfr_7b_fx; - if ( clip_gain == 1 ) - { - size -= 25; - } - } - ELSE - { - cdbk = gp_gamma_4sfr_6b_fx; /* Q14 / Q9 */ - if ( EQ_16( clip_gain, 1 ) ) - { - size = sub( size, 11 ); - } - } - /* calculate predicted gain */ - aux[0] = 4096; /* 1 in Q12 */ - move16(); - aux[1] = shl( ctype, 12 ); - move16(); + e_max = s_max( exp_max[i], e_max ); + } - /*aux[2] = (float)log10(gc_mem[0]); - = log2(gc_mem[0])*log10(2);*/ - exp = norm_l( gc_mem[0] ); - frac = Log2_norm_lc( L_shl( gc_mem[0], exp ) ); - exp = sub( sub( 30, exp ), 16 ); /*Q_format(gc_mem[0])=16*/ - L_tmp1 = Mpy_32_16( exp, frac, 9864 ); /* Q16 */ - aux[2] = round_fx( L_shl( L_tmp1, 12 ) ); /* Q12 */ + /* align coeff[] and save in special 32 bit double precision */ + FOR( i = 0; i < 5; i++ ) + { + j = add( sub( e_max, exp_max[i] ), 2 ); /* /4 to avoid overflow */ + L_tmp = L_deposit_h( coeff[i] ); + L_tmp = L_shr( L_tmp, j ); + L_Extract( L_tmp, &coeff[i], &coeff_lo[i] ); + coeff_lo[i] = shr( coeff_lo[i], 3 ); /* lo >> 3 */ move16(); + } - /*aux[3] = (float)log10(gc_mem[1]); - = log2(gc_mem[1])*log10(2);*/ - exp = norm_l( gc_mem[1] ); - frac = Log2_norm_lc( L_shl( gc_mem[1], exp ) ); - exp = sub( sub( 30, exp ), 16 ); /*Q_format(gc_mem[1])=16*/ - L_tmp1 = Mpy_32_16( exp, frac, 9864 ); /* Q16 */ - aux[3] = round_fx( L_shl( L_tmp1, 12 ) ); /* Q12 */ + /* searching of codebook */ + p = cdbk; // Q14 + move16(); + dist_min = L_deposit_h( MAX_16 ); + index = 0; + move16(); + FOR( i = 0; i < size; i++ ) + { + g_pitch = *p++; move16(); - - - /*aux[4] = (float)log10(gc_mem[2]); - = log2(gc_mem[2])*log10(2);*/ - exp = norm_l( gc_mem[2] ); - frac = Log2_norm_lc( L_shl( gc_mem[2], exp ) ); - exp = sub( sub( 30, exp ), 16 ); /*Q_format(gc_mem[2])=16*/ - L_tmp1 = Mpy_32_16( exp, frac, 9864 ); /* Q16 */ - aux[4] = round_fx( L_shl( L_tmp1, 12 ) ); /* Q12 */ + g_code = *p++; move16(); - aux[5] = shr( gp_mem[0], 2 ); - move16(); /*Q12*/ - aux[6] = shr( gp_mem[1], 2 ); - move16(); /*Q12*/ - aux[7] = shr( gp_mem[2], 2 ); - move16(); /*Q12*/ - /*-----------------------------------------------------------------* - * gcode0 = pow(10.0, dotp(b, aux, n_pred) - * = pow(2, 3.321928*dotp(b, aux, n_pred) - *-----------------------------------------------------------------*/ - L_tmp = Dot_product( b, aux, n_pred ); /*Q25*/ - L_tmp = Mult_32_16( L_tmp, 27213 ); /* *3.321928 in Q13 -> Q23 */ - L_tmp = L_shr( L_tmp, 7 ); /* From Q23 to Q16 */ - frac = L_Extract_lc( L_tmp, &exp_gcode0 ); /* Extract exponent of gcode0 */ + g_code = mult_r( g_code, gcode0 ); // exp_gcode - 1 + g2_pitch = mult_r( g_pitch, g_pitch ); // Q13 + g_pit_cod = mult_r( g_code, g_pitch ); + L_tmp = L_mult( g_code, g_code ); + g2_code_lo = L_Extract_lc( L_tmp, &g2_code ); - gcode0 = extract_l( Pow2( 14, frac ) ); /* Put 14 as exponent so that */ - /* output of Pow2() will be: */ - /* 16384 < Pow2() <= 32767 */ - exp_gcode0 = sub( exp_gcode0, 14 ); + L_tmp = L_mult( coeff[2], g2_code_lo ); + L_tmp = L_shr( L_tmp, 3 ); + L_tmp = L_mac( L_tmp, coeff_lo[0], g2_pitch ); + L_tmp = L_mac( L_tmp, coeff_lo[1], g_pitch ); + L_tmp = L_mac( L_tmp, coeff_lo[2], g2_code ); + L_tmp = L_mac( L_tmp, coeff_lo[3], g_code ); + L_tmp = L_mac( L_tmp, coeff_lo[4], g_pit_cod ); + L_tmp = L_shr( L_tmp, 12 ); + L_tmp = L_mac( L_tmp, coeff[0], g2_pitch ); /* 15 - coeff_exp + 13 - 1 */ + L_tmp = L_mac( L_tmp, coeff[1], g_pitch ); /* 15 - coeff_exp + 13 - 1 */ + L_tmp = L_mac( L_tmp, coeff[2], g2_code ); /* 15 - coeff_exp + 13 - 1 */ + L_tmp = L_mac( L_tmp, coeff[3], g_code ); /* 15 - coeff_exp + 13 - 1 */ + L_tmp = L_mac( L_tmp, coeff[4], g_pit_cod ); /* 15 - coeff_exp + 13 - 1 */ - index = Find_Opt_gainQ_fx( coeff, exp_coeff, gain_pit, gain_code, gcode0, exp_gcode0, cdbk, size ); // Q0 + L_tmp1 = L_sub_o( L_tmp, dist_min, &Overflow ); + if ( L_tmp1 < 0 ) + { + index = i; + move16(); + } + dist_min = L_min( L_tmp, dist_min ); } - /* *norm_gain_code = *gain_code / *gain_inov; */ - exp = sub( norm_s( *gain_inov ), 1 ); - exp = s_max( exp, 0 ); + p = &cdbk[add( index, index )]; // Q14 + move16(); - tmp = div_s( shr( 8192, exp ), *gain_inov ); - *norm_gain_code = L_shr( Mult_32_16( *gain_code, tmp ), sub( 1, exp ) ); // Q16 - move32(); - { - push_indice( hBstr, IND_GAIN, index, nBits ); - } - return; + *gain_pit = *p++; /* selected pitch gain in Q14 */ + move16(); + g_code = *p++; /* selected code gain in Q9 */ + move16(); + + L_tmp = L_mult( g_code, gcode0 ); /* Q9*Q0 -> Q10 */ + L_tmp = L_shl_sat( L_tmp, add( exp_gcode0, 6 ) ); /* Q10 -> Q16 */ + *gain_code = L_tmp; /* gain of code in Q16 */ + move16(); + return index; } -#ifndef REUSE_EVS_BE_GAINQ_LBR -void gain_enc_lbr_ivas_fx( +/*---------------------------------------------------------------------* + * gain_enc_lbr() + * + * Quantization of pitch and codebook gains without prediction (memory-less) + * in ACELP at 6.6 and 7.5 kbps + * - the gain codebooks and gain estimation constants are different in each subframe + * - the estimated gain, gcode0, is first determined based on + * classification and/or previous quantized gains (from previous subframes in the current frame) + * - a correction factor gamma = g_code / gcode0 is then vector quantized + * along with gain_pit + * - the mean-squared error criterion is used for codebook search + *---------------------------------------------------------------------*/ + +void gain_enc_lbr_fx( BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ const Word16 gains_mode[], /* i : gain bits Q0*/ const Word16 coder_type, /* i : coding type Q0*/ @@ -2513,10 +1235,12 @@ void gain_enc_lbr_ivas_fx( Word16 *gain_inov, /* o : gain of the innovation (used for normalization) Q12*/ Word32 *norm_gain_code, /* o : norm. gain of the codebook excitation Q16*/ Word16 *g_corr, /* i/o: correlations , -2,, -2 and 2 mant/exp*/ - Word32 gc_mem[], /* i/o: gain_code from previous subframes Q16*/ - Word16 gp_mem[], /* i/o: gain_pitch from previous subframes Q14*/ - const Word16 clip_gain, /* i : gain pitch clipping flag (1 = clipping) Q0*/ - const Word16 L_subfr /* i : subframe length Q0*/ + Word32 gc_mem[], /* i/o: gain_code from previous subframes Q16*/ + Word16 gp_mem[], /* i/o: gain_pitch from previous subframes Q14*/ + const Word16 clip_gain, /* i : gain pitch clipping flag (1 = clipping) Q0*/ + const Word16 L_subfr /* i : subframe length Q0*/ + , + const Word16 element_mode /* i : mode element Q0*/ ) { @@ -2527,6 +1251,7 @@ void gain_enc_lbr_ivas_fx( Word16 exp, exp_code, exp_inov, exp_gcode0, frac, tmp, L_subfr_sf; Word32 L_tmp, L_tmp1, L_inov; move16(); + move16(); L_subfr_sf = 6; move16(); @@ -2551,12 +1276,6 @@ void gain_enc_lbr_ivas_fx( move16(); /* Compute scalar product */ -#ifdef DEBUG - if ( L_subfr != L_SUBFR ) - { - PMT( "Entire function needs review to accommode for L_subfr > L_SUBFR" ); - } -#endif coeff[2] = extract_h( Dot_product12( y2, y2, L_subfr, &exp ) ); move16(); exp_coeff[2] = add( sub( exp, 18 ), shl( Q_xn, 1 ) ); /* -18 (y2 Q9) */ @@ -2580,8 +1299,8 @@ void gain_enc_lbr_ivas_fx( /*Ecode = ( dotp( code, code, L_SUBFR ) + 0.01f ) / L_SUBFR; *gain_inov = 1.0f / (float)sqrt(Ecode);*/ - L_tmp = Dot_product12( code, code, L_subfr, &exp_code ); /* Q9 + Q9 + 1 + (30-exp_code)*/ - L_inov = L_tmp; /* sets to 'L_tmp' in 1 clock */ + L_tmp = Dot_product12( code, code, L_subfr, &exp_code ); + L_inov = L_tmp; /* sets to 'L_tmp' in 1 clock */ move32(); /* exp_code: -18 (code in Q9), -6 (/L_SUBFR), -31 (L_tmp Q31->Q0) */ /* output gain_inov*/ @@ -2652,18 +1371,29 @@ void gain_enc_lbr_ivas_fx( move16(); /* gcode0 = (float)pow(10, dotp(b, aux, n_pred) - 0.5f * (float)log10(Ecode)); - gcode0 = (float)pow(10, dotp(b, aux, n_pred) - 0.05f * 10 * (float)log10(Ecode)); - gcode0 = (float)pow(10, 0.05(20 * dotp(b, aux, n_pred) - 10 * (float)log10(Ecode))); */ - // Ecode = (Ecode / L_subfr) - L_tmp = L_shr( L_tmp, L_subfr_sf ); // Q19 + (Q30-exp_code) - /* Calculation for log10(Ecode) exponent for applying log10 = Q31 - q = Q31 - Q19 - Q30 + exp_code = exp_code - Q18*/ - L_tmp = BASOP_Util_Log10( L_tmp, sub( exp_code, 18 ) ); // new q = Q25 - exp = norm_l( L_tmp ); - L_tmp = L_shl( L_tmp, exp ); // Q25 + exp - // 10 in Q27 , ( 10 * log10( Ecode ) ) - L_tmp1 = Mpy_32_32( L_tmp, 1342177280 ); // Q25 + exp + 1 + Q27 - 32 = Q21 + exp - L_tmp1 = L_shr( L_tmp1, add( 7, exp ) ); // Q21 + exp - 7 - exp = Q14 + gcode0 = (float)pow(10, dotp(b, aux, n_pred) - 0.05f * 10 * (float)log10(Ecode)); + gcode0 = (float)pow(10, 0.05(20 * dotp(b, aux, n_pred) - 10 * (float)log10(Ecode))); */ + IF( element_mode > EVS_MONO ) + { + // Ecode = (Ecode / L_subfr) + L_tmp = L_shr( L_tmp, L_subfr_sf ); // Q19 + (Q30-exp_code) + /* Calculation for log10(Ecode) exponent for applying log10 = Q31 - q = Q31 - Q19 - Q30 + exp_code = exp_code - Q18*/ + L_tmp = BASOP_Util_Log10( L_tmp, sub( exp_code, 18 ) ); // new q = Q25 + exp = norm_l( L_tmp ); + L_tmp = L_shl( L_tmp, exp ); // Q25 + exp + // 10 in Q27 , ( 10 * log10( Ecode ) ) + L_tmp1 = Mpy_32_32( L_tmp, 1342177280 ); // Q25 + exp + 1 + Q27 - 32 = Q21 + exp + L_tmp1 = L_shr( L_tmp1, add( 7, exp ) ); // Q21 + exp - 7 - exp = Q14 + } + ELSE + { + exp_code = sub( exp_code, 18 + 6 + 1 ); + exp = norm_l( L_tmp ); + frac = Log2_norm_lc( L_shl( L_tmp, exp ) ); + exp = sub( exp_code, exp ); + L_tmp1 = Mpy_32_16( exp, frac, 24660 ); /* Q14 */ /* 10*log10(2) in Q13*/ + } L_tmp = Dot_product( b, aux, n_pred ); /*Q25*/ L_tmp = Mult_32_16( L_tmp, 320 ); /*Q14, 20 in Q4*/ L_tmp = L_sub( L_tmp, L_tmp1 ); /*Q14*/ @@ -2681,10 +1411,10 @@ void gain_enc_lbr_ivas_fx( frac = L_Extract_lc( L_tmp, &exp_gcode0 ); /* Extract exponent of gcode0 */ gcode0 = extract_l( Pow2( 14, frac ) ); /* Put 14 as exponent so that */ - /* output of Pow2() will be: */ - /* 16384 < Pow2() <= 32767 */ + /* output of Pow2() will be: */ + /* 16384 < Pow2() <= 32767 */ exp_gcode0 = sub( exp_gcode0, 14 ); - index = Find_Opt_gainQ_fx( coeff, exp_coeff, gain_pit, gain_code, gcode0, exp_gcode0, cdbk, size ); + index = Find_Opt_gainQ_fx( coeff, exp_coeff, gain_pit, gain_code, gcode0, exp_gcode0, cdbk, size ); // Q0 gc_mem[0] = *gain_code; move16(); /*Q16*/ @@ -2693,7 +1423,7 @@ void gain_enc_lbr_ivas_fx( } ELSE IF( EQ_16( i_subfr, L_SUBFR ) || EQ_16( L_subfr, 2 * L_SUBFR ) ) { - b = b_2sfr_fx; // Q12 + b = b_2sfr_fx; move16(); n_pred = 4; move16(); @@ -2702,7 +1432,7 @@ void gain_enc_lbr_ivas_fx( { case 7: { - cdbk = gp_gamma_2sfr_7b_fx; /* Q14 / Q9 */ + cdbk = gp_gamma_2sfr_7b_fx; /* Q14/Q9 */ if ( EQ_16( clip_gain, 1 ) ) { size = sub( size, 30 ); @@ -2711,7 +1441,7 @@ void gain_enc_lbr_ivas_fx( } case 6: { - cdbk = gp_gamma_2sfr_6b_fx; /* Q14 / Q9 */ + cdbk = gp_gamma_2sfr_6b_fx; /* Q14/Q9 */ if ( EQ_16( clip_gain, 1 ) ) { size = sub( size, 12 ); @@ -2727,11 +1457,12 @@ void gain_enc_lbr_ivas_fx( move16(); /*aux[2] = (float)log10(gc_mem[0]); - = log2(gc_mem[0])*log10(2);*/ + = log2(gc_mem[0])*log10(2);*/ exp = norm_l( gc_mem[0] ); frac = Log2_norm_lc( L_shl( gc_mem[0], exp ) ); - exp = sub( sub( 30, exp ), 16 ); /*Q_format(gc_1sfr_fx)=16*/ - L_tmp1 = Mpy_32_16( exp, frac, 9864 ); /* Q16 */ + exp = sub( sub( 30, exp ), 16 ); /*Q_format(gc_1sfr_fx)=16*/ + L_tmp1 = Mpy_32_16( exp, frac, 9864 ); + move16(); /* Q16 */ aux[2] = round_fx( L_shl( L_tmp1, 12 ) ); /* Q12 */ move16(); @@ -2748,8 +1479,8 @@ void gain_enc_lbr_ivas_fx( frac = L_Extract_lc( L_tmp, &exp_gcode0 ); /* Extract exponent of gcode0 */ gcode0 = extract_l( Pow2( 14, frac ) ); /* Put 14 as exponent so that */ - /* output of Pow2() will be: */ - /* 16384 < Pow2() <= 32767 */ + /* output of Pow2() will be: */ + /* 16384 < Pow2() <= 32767 */ exp_gcode0 = sub( exp_gcode0, 14 ); index = Find_Opt_gainQ_fx( coeff, exp_coeff, gain_pit, gain_code, gcode0, exp_gcode0, cdbk, size ); // Q0 @@ -2766,10 +1497,10 @@ void gain_enc_lbr_ivas_fx( move16(); IF( EQ_16( nBits, 7 ) ) { - cdbk = gp_gamma_3sfr_7b_fx; /* Q14 / Q9 */ - if ( EQ_16( clip_gain, 1 ) ) + cdbk = gp_gamma_3sfr_7b_fx; + if ( clip_gain == 1 ) { - size = sub( size, 28 ); + size -= 28; } } ELSE @@ -2781,13 +1512,13 @@ void gain_enc_lbr_ivas_fx( } } /* calculate predicted gain */ - aux[0] = 4096; // Q12 + aux[0] = 4096; /* 1 in Q12 */ move16(); aux[1] = shl( ctype, 12 ); move16(); /*aux[2] = (float)log10(gc_mem[0]); - = log2(gc_mem[0])*log10(2);*/ + = log2(gc_mem[0])*log10(2);*/ exp = norm_l( gc_mem[0] ); frac = Log2_norm_lc( L_shl( gc_mem[0], exp ) ); exp = sub( sub( 30, exp ), 16 ); /*Q_format(gc_mem[0])=16*/ @@ -2796,7 +1527,7 @@ void gain_enc_lbr_ivas_fx( move16(); /*aux[3] = (float)log10(gc_mem[1]); - = log2(gc_mem[1])*log10(2);*/ + = log2(gc_mem[1])*log10(2);*/ exp = norm_l( gc_mem[1] ); frac = Log2_norm_lc( L_shl( gc_mem[1], exp ) ); exp = sub( sub( 30, exp ), 16 ); /*Q_format(gc_mem[1])=16*/ @@ -2819,8 +1550,8 @@ void gain_enc_lbr_ivas_fx( frac = L_Extract_lc( L_tmp, &exp_gcode0 ); /* Extract exponent of gcode0 */ gcode0 = extract_l( Pow2( 14, frac ) ); /* Put 14 as exponent so that */ - /* output of Pow2() will be: */ - /* 16384 < Pow2() <= 32767 */ + /* output of Pow2() will be: */ + /* 16384 < Pow2() <= 32767 */ exp_gcode0 = sub( exp_gcode0, 14 ); /*----------------------------------------------------------------* @@ -2852,23 +1583,23 @@ void gain_enc_lbr_ivas_fx( index = Find_Opt_gainQ_fx( coeff, exp_coeff, gain_pit, gain_code, gcode0, exp_gcode0, cdbk, size ); - gc_mem[2] = *gain_code; /* Q16 */ + gc_mem[2] = *gain_code; // Q16 move32(); - gp_mem[2] = *gain_pit; /* Q14 */ + gp_mem[2] = *gain_pit; // Q14 move16(); } ELSE IF( EQ_16( i_subfr, 3 * L_SUBFR ) ) { - b = b_4sfr_fx; /* Q12 */ + b = b_4sfr_fx; // Q12 move16(); n_pred = 8; move16(); IF( EQ_16( nBits, 7 ) ) { - cdbk = gp_gamma_4sfr_7b_fx; /* Q14 / Q9 */ - if ( EQ_16( clip_gain, 1 ) ) + cdbk = gp_gamma_4sfr_7b_fx; + if ( clip_gain == 1 ) { - size = sub( size, 25 ); + size -= 25; } } ELSE @@ -2880,13 +1611,13 @@ void gain_enc_lbr_ivas_fx( } } /* calculate predicted gain */ - aux[0] = 4096; // Q12 + aux[0] = 4096; /* 1 in Q12 */ move16(); aux[1] = shl( ctype, 12 ); move16(); /*aux[2] = (float)log10(gc_mem[0]); - = log2(gc_mem[0])*log10(2);*/ + = log2(gc_mem[0])*log10(2);*/ exp = norm_l( gc_mem[0] ); frac = Log2_norm_lc( L_shl( gc_mem[0], exp ) ); exp = sub( sub( 30, exp ), 16 ); /*Q_format(gc_mem[0])=16*/ @@ -2895,7 +1626,7 @@ void gain_enc_lbr_ivas_fx( move16(); /*aux[3] = (float)log10(gc_mem[1]); - = log2(gc_mem[1])*log10(2);*/ + = log2(gc_mem[1])*log10(2);*/ exp = norm_l( gc_mem[1] ); frac = Log2_norm_lc( L_shl( gc_mem[1], exp ) ); exp = sub( sub( 30, exp ), 16 ); /*Q_format(gc_mem[1])=16*/ @@ -2903,8 +1634,9 @@ void gain_enc_lbr_ivas_fx( aux[3] = round_fx( L_shl( L_tmp1, 12 ) ); /* Q12 */ move16(); + /*aux[4] = (float)log10(gc_mem[2]); - = log2(gc_mem[2])*log10(2);*/ + = log2(gc_mem[2])*log10(2);*/ exp = norm_l( gc_mem[2] ); frac = Log2_norm_lc( L_shl( gc_mem[2], exp ) ); exp = sub( sub( 30, exp ), 16 ); /*Q_format(gc_mem[2])=16*/ @@ -2917,19 +1649,19 @@ void gain_enc_lbr_ivas_fx( aux[6] = shr( gp_mem[1], 2 ); move16(); /*Q12*/ aux[7] = shr( gp_mem[2], 2 ); - move16(); /*Q12*/ - /*-----------------------------------------------------------------* - * gcode0 = pow(10.0, dotp(b, aux, n_pred) - * = pow(2, 3.321928*dotp(b, aux, n_pred) - *-----------------------------------------------------------------*/ + move16(); /*Q12*/ + /*-----------------------------------------------------------------* + * gcode0 = pow(10.0, dotp(b, aux, n_pred) + * = pow(2, 3.321928*dotp(b, aux, n_pred) + *-----------------------------------------------------------------*/ L_tmp = Dot_product( b, aux, n_pred ); /*Q25*/ L_tmp = Mult_32_16( L_tmp, 27213 ); /* *3.321928 in Q13 -> Q23 */ L_tmp = L_shr( L_tmp, 7 ); /* From Q23 to Q16 */ frac = L_Extract_lc( L_tmp, &exp_gcode0 ); /* Extract exponent of gcode0 */ gcode0 = extract_l( Pow2( 14, frac ) ); /* Put 14 as exponent so that */ - /* output of Pow2() will be: */ - /* 16384 < Pow2() <= 32767 */ + /* output of Pow2() will be: */ + /* 16384 < Pow2() <= 32767 */ exp_gcode0 = sub( exp_gcode0, 14 ); index = Find_Opt_gainQ_fx( coeff, exp_coeff, gain_pit, gain_code, gcode0, exp_gcode0, cdbk, size ); // Q0 @@ -2947,7 +1679,6 @@ void gain_enc_lbr_ivas_fx( } return; } -#endif /*-------------------------------------------------------------------* * gain_enc_amr_wb() diff --git a/lib_enc/gaus_enc_fx.c b/lib_enc/gaus_enc_fx.c index 986f15bbc0e5d304b5457b96902d0488e07acf76..a19bc4439bf877cb28ca6658806929d5b7221d12 100644 --- a/lib_enc/gaus_enc_fx.c +++ b/lib_enc/gaus_enc_fx.c @@ -26,9 +26,6 @@ static Word16 cod_2pos_fx( const Word16 ind1, const Word16 ind2, const Word16 sign1, const Word16 sign2, const Word16 n ); static void gauss2v_fx( BSTR_ENC_HANDLE hBstr, const Word16 h[], const Word16 xn[], const Word16 dn[], Word16 code[], Word16 y1[], Word32 *gain, const Word16 lg, const Word16 shift, const Word16 Q_new, const Word16 nb_bits ); -#ifndef REUSE_EVS_BE_GAUSS -static void gauss2v_ivas_fx( BSTR_ENC_HANDLE hBstr, const Word16 h[], const Word16 xn[], const Word16 dn[], Word16 code[], Word16 y1[], Word32 *gain, const Word16 lg, const Word16 shift, const Word16 Q_new, const Word16 nb_bits ); -#endif /*-------------------------------------------------------------------* * Gaus_encode * @@ -134,107 +131,6 @@ Word16 gaus_encode_fx( return ( L_SUBFR << 6 ); } -#ifndef REUSE_EVS_BE_GAUSS -Word16 gaus_encode_ivas_fx( - Encoder_State *st_fx, /* i/o: encoder state structure */ - const Word16 i_subfr, /* i : subframe index Q0*/ - const Word16 *h1, /* i : weighted filter input response Q14*/ - const Word16 *xn, /* i : target vector Q12*/ - Word16 *exc, /* o : pointer to excitation signal frame Q_new*/ - Word16 *mem_w0, /* o : weighting filter denominator memory Q_new*/ - Word16 *clip_gain, /* o : memory of gain of pitch clipping algorithm [2.56x,Q14,Q8,Q0,Q14,Q14]*/ - Word16 *tilt_code, /* o : synthesis excitation spectrum tilt Q15*/ - Word16 *code, /* o : algebraic excitation Q9*/ - Word32 *gain_code, /* o : Code gain. Q16*/ - Word16 *y2, /* o : zero-memory filtered adaptive excitation Q9*/ - Word16 *gain_inov, /* o : innovation gain Q12*/ - Word16 *voice_fac, /* o : voicing factor Q15*/ - Word16 *gain_pit, /* o : adaptive excitation gain Q14*/ - const Word16 Q_new, /* i : scaling factor */ - const Word16 shift, /* i : scaling factor */ - Word32 *norm_gain_code /* o : normalized innovative cb. gain Q16*/ -) -{ - Word16 nb_bits, idx; - Word16 i = 0; - move16(); - Word32 Ltmp; - Word16 dn[L_SUBFR], exp_code, gcode; /* Correlation between xn and h1 */ - Word16 exp, tmp, tmp_idx; -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif - - /*----------------------------------------------------------------* - * Encode gaussian excitation - *----------------------------------------------------------------*/ - - /* Correlation between target xn2[] and impulse response h1[] */ - corr_xh_fx( xn, dn, h1 ); - - tmp_idx = shr( i_subfr, 6 ); - nb_bits = st_fx->acelp_cfg.fixed_cdk_index[tmp_idx]; /* Q0 */ - move16(); -#ifndef REUSE_EVS_BE_GAUSS - gauss2v_ivas_fx( st_fx->hBstr, h1, xn, dn, code, y2, gain_code, L_SUBFR, shift, Q_new, shr( nb_bits, 1 ) ); -#else - gauss2v_fx( st_fx->hBstr, h1, xn, dn, code, y2, gain_code, L_SUBFR, shift, Q_new, shr( nb_bits, 1 ) ); -#endif - /*----------------------------------------------------------------* - * Encode gaussian gain - *----------------------------------------------------------------*/ - - /* codeword energy computation */ - Ltmp = Dot_product12( code, code, L_SUBFR, &exp_code ); - - exp_code = sub( exp_code, 18 + 6 ); /* exp: -18 (code in Q9), -6 (L_subfr = 64) */ - Ltmp = Isqrt_lc( Ltmp, &exp_code ); - *gain_inov = extract_h( L_shl( Ltmp, sub( exp_code, 3 ) ) ); /* g_code_inov in Q12 */ - - nb_bits = st_fx->acelp_cfg.gains_mode[tmp_idx]; /* Q0 */ - move16(); - /* low bound = -30; stepSize = 1.71875; inv_stepSize = 0.5818181 */ - idx = gain_enc_gaus_fx( gain_code, nb_bits, -7680, 28160, 19065 ); /* Q0 */ - push_indice( st_fx->hBstr, IND_GAIN, idx, nb_bits ); - - /*----------------------------------------------------------------* - * Total excitation for Unvoiced coders - *----------------------------------------------------------------*/ - gcode = round_fx_o( L_shl_o( *gain_code, Q_new, &Overflow ), &Overflow ); /* scaled gain_code with Qnew */ - FOR( i = 0; i < L_SUBFR; i++ ) - { - exc[i + i_subfr] = round_fx( L_shl( L_mult( gcode, code[i] ), 15 - 9 ) ); /* Q_new */ - } - - /*----------------------------------------------------------------* - * Updates: last value of new target is stored in mem_w0 - *----------------------------------------------------------------*/ - - Ltmp = L_mult( gcode, y2[L_SUBFR - 1] ); /* Q_new + 10 */ - Ltmp = L_shl( Ltmp, add( 5, shift ) ); /* Q_new + 15 + shift */ - Ltmp = L_negate( Ltmp ); - Ltmp = L_mac( Ltmp, xn[L_SUBFR - 1], 16384 ); /* Q_new + 15 + shift */ - Ltmp = L_shl_sat( Ltmp, sub( 1, shift ) ); /* Q_new + 16 */ - *mem_w0 = round_fx_sat( Ltmp ); /* Q_new */ - move16(); - init_gp_clip_fx( clip_gain ); /* reset pitch clipping parameters */ - - *gain_pit = 0; - *tilt_code = 0; - move16(); /* purely unvoiced */ - *voice_fac = -32768; /* -1 in Q15 */ - move16(); /* purely unvoiced */ - exp = sub( norm_s( *gain_inov ), 1 ); - exp = s_max( exp, 0 ); - - tmp = div_s( shr( 8192, exp ), *gain_inov ); - *norm_gain_code = L_shr( Mult_32_16( *gain_code, tmp ), sub( 1, exp ) ); /* Q16 */ - move16(); - - return ( L_SUBFR << 6 ); -} -#endif /*-------------------------------------------------------------------* * gauss2v() * @@ -703,468 +599,6 @@ void gauss2v_fx( return; } -#ifndef REUSE_EVS_BE_GAUSS -void gauss2v_ivas_fx( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder state structure */ - const Word16 h[], /* i : weighted LP filter impulse response Q15 */ - const Word16 xn[], /* i : target signal Q12 */ - const Word16 dn[], /* i : backward filtered target Q12 */ - Word16 code[], /* o : gaussian excitation Q9 */ - Word16 y1[], /* o : zero-memory filtered gauss. excitation Q8 */ - Word32 *gain, /* o : excitation gain. 32-bit number in Q16 */ - const Word16 lg, /* i : subframe size Q0 */ - const Word16 shift, /* i : Scaling factor Q0 */ - const Word16 Q_new, /* i : Scaling factor Q0 */ - const Word16 nb_bits /* i : nb ob bits per track (max 6) */ -) -{ - Word16 i, j, ind1, ind2; - Word16 nvec, step; - Word32 cor, cora, dotprod; - Word16 enerw; - Word32 eneri, cor2; - Word32 enerw32, cor2w32; - Word16 *cpt1; - Word16 *pt1, *pt2; - Word32 max_val[NMAX + 1]; - Word16 *pos[NMAX + 1]; - Word32 sign[NMAX + 1]; - Word32 ener[NMAX + 1], corr[NMAX + 1], ener1; - Word16 dico2[L_SUBFR * NMAX]; - Word16 exp_num; - Word16 exp_den; - Word16 Num; - Word16 Den; - Word32 GainPortion1; - Word32 GainPortion2; - Word32 cor_abs; - Word16 cor_neg; - Word16 div_result; - Word32 ener_sqrt; - Word32 Portion; - Word16 sign1, sign2; - Word16 enerw_norm, enerw_mantissa; - Word16 cor2w_norm, cor2w_mantissa; - Word16 eneri_norm, eneri_mantissa; - Word16 cor2_norm, cor2_mantissa; - Word16 difference_norm; - Word32 cor32; /* 32-bit intermediate value*/ - Word16 hi1, lo1; - Word16 update_best; - Word16 idx; - Word32 Lc0, Lc1, Lnum, Lden; - Word16 gxx, gcc, index_delta, delta, m_sign, inv_delta; - Word16 hg[190], Gaus_dico2[190]; - Word16 shiftP3; -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif - - /*----------------------------------------------------------------* - * Encode the tilt of gaussian excitation - *----------------------------------------------------------------*/ - - /* Compute spectral tilt of target */ - Lc0 = L_mult( xn[1], xn[1] ); - Lc1 = L_mult( xn[1], xn[0] ); - FOR( i = 2; i < L_SUBFR; i++ ) - { - /* fc0 += xn[i]*xn[i] */ - /* fc1 += xn[i]*xn[i-1] */ - Lc0 = L_mac_sat( Lc0, xn[i], xn[i] ); - Lc1 = L_mac_sat( Lc1, xn[i], xn[i - 1] ); - } - /* fgxx = fc1/fc0 */ - exp_num = sub( norm_l( Lc1 ), 1 ); - Num = extract_h( L_shl( Lc1, exp_num ) ); - m_sign = s_or( shr( Num, 16 ), 1 ); /* Remove sign */ - Num = abs_s( Num ); - Lc0 = L_max( Lc0, 1 ); - exp_den = norm_l( Lc0 ); - Den = extract_h( L_shl( Lc0, exp_den ) ); - gxx = shr( div_s( Num, Den ), sub( exp_num, sub( exp_den, 2 ) ) ); /* Q13 */ - gxx = i_mult2( gxx, m_sign ); /* Apply sign */ - - set16_fx( hg, 0, 190 ); /* Compute spectral tilt of filtered codebook */ - Copy( h, hg, L_SUBFR ); - conv_fx( gaus_dico_fx, hg, Gaus_dico2, 190 ); - - Lc0 = L_mult( Gaus_dico2[1], Gaus_dico2[1] ); - Lc1 = L_mult( Gaus_dico2[1], Gaus_dico2[0] ); - FOR( i = 2; i < 190; i++ ) - { - /* fc0 += fgaus_dico2[i]*fgaus_dico2[i] */ - /* fc1 += fgaus_dico2[i]*fgaus_dico2[i-1] */ - Lc0 = L_mac( Lc0, Gaus_dico2[i], Gaus_dico2[i] ); - Lc1 = L_mac( Lc1, Gaus_dico2[i], Gaus_dico2[i - 1] ); - } - - /* fgcc = fc1/fc0 */ - - exp_num = sub( norm_l( Lc1 ), 1 ); - Num = extract_h( L_shl( Lc1, exp_num ) ); - m_sign = s_or( shr( Num, 16 ), 1 ); /* Remove sign */ - Num = abs_s( Num ); - - Lc0 = L_max( Lc0, 1 ); - exp_den = norm_l( Lc0 ); - Den = extract_h( L_shl( Lc0, exp_den ) ); - gcc = shr( div_s( Num, Den ), sub( exp_num, sub( exp_den, 2 ) ) ); /* Q13 */ - gcc = i_mult2( gcc, m_sign ); /* Apply sign */ - - /* fdelta = (1-fgcc*fgxx) / (2*fgcc+fgxx) Compute and quantize spectral tilt modification factor */ - Lnum = L_sub( 134217728L, L_mult( gcc, gxx ) ); /* Q30 */ - Lden = L_mac( L_mult( gxx, 8192 ), gcc, 16384 ); /* Q30 */ - - exp_num = sub( norm_l( Lnum ), 1 ); - Num = extract_h( L_shl( Lnum, exp_num ) ); - m_sign = s_or( shr( Num, 16 ), 1 ); /* Remove sign */ - Num = abs_s( Num ); - - Lden = L_max( Lden, 1 ); - exp_den = norm_l( Lden ); - Den = extract_h( L_shl( Lden, exp_den ) ); - - delta = shr_sat( div_s( Num, Den ), sub( exp_num, exp_den ) ); /* Q15 */ - delta = i_mult2( delta, m_sign ); /* Apply sign */ - /* index_delta = (short)(FAC_DELTA * fdelta) */ - index_delta = shr( delta, SFAC_DELTA ); - - /* index_delta [0,7] */ - index_delta = s_max( index_delta, 0 ); - index_delta = s_min( index_delta, 7 ); - - /* fdelta = STEP_DELTA * (float)index_delta */ - delta = shl( index_delta, 11 ); /* delta in Q15 */ - - IF( delta > 0 ) /* Adapt spectral tilt of initial codebook */ - { - /* Computation of 1 / (1+fdelta*fdelta) */ - inv_delta = inv_delta_tab[sub( index_delta, 1 )]; - move16(); /* Q15 */ - - /* fgaus_dico2[0] = gaus_dico[0] */ - Gaus_dico2[0] = gaus_dico_fx[0]; - move16(); - FOR( i = 1; i < 190; i++ ) - { - /* fgaus_dico2[i] = (gaus_dico[i] - fdelta*gaus_dico[i-1]) / (1 + fdelta*fdelta) */ - Lnum = L_msu( L_deposit_h( gaus_dico_fx[i] ), delta, gaus_dico_fx[i - 1] ); - Gaus_dico2[i] = round_fx( Mpy_32_16_1( Lnum, inv_delta ) ); - move16(); - } - } - ELSE - { - FOR( i = 0; i < 190; i++ ) - { - /* fgaus_dico2[i] = gaus_dico[i] */ - Gaus_dico2[i] = gaus_dico_fx[i]; - move16(); - } - } - - /*----------------------------------------------------------------* - * Initializations - *----------------------------------------------------------------*/ - - ind1 = 0; - move16(); - ind2 = 0; - move16(); - - nvec = shl( 1, nb_bits ); - step = shr( 0x80, nb_bits ); - - /*----------------------------------------------------------------* - * dot product between dn and gaussian codevectors, - * keep NMAX best vectors - *----------------------------------------------------------------*/ - - set32_fx( max_val, 0, NMAX + 1 ); - set32_fx( sign, 0, NMAX + 1 ); - - FOR( i = 0; i < NMAX + 1; i++ ) - { - pos[i] = (Word16 *) Gaus_dico2; - } - - cpt1 = Gaus_dico2; - move16(); - - FOR( i = 0; i < nvec; i++ ) - { - /* Dot product without normalization, because values are compared with each other afterwards. */ - cor = Dot_product( cpt1, dn, lg ); /* Q12 * Q12 * length of 64 + 1 left shift ==> Q31*/ - cora = L_abs( cor ); - j = NMAX - 1; - move16(); - - DO - { - IF( GE_32( cora, max_val[j] ) ) - { - max_val[j + 1] = max_val[j]; - move32(); /*Q31*/ - pos[j + 1] = pos[j]; - move16(); /*Pointer*/ - sign[j + 1] = sign[j]; - move32(); /*Q31*/ - max_val[j] = cora; - move32(); /*Q31*/ - pos[j] = cpt1; - move16(); /*Pointer*/ - sign[j] = cor; - move32(); /*Q31*/ - } - j--; - } - WHILE( j >= 0 ); - cpt1 += step; - } - - /*----------------------------------------------------------------* - * filter selected vectors - * put sign - * compute energy - *----------------------------------------------------------------*/ - - pt1 = dico2; - move16(); - FOR( i = 0; i < NMAX; i++ ) - { - /* Input vector (pos) Q12, filter coefs in Q15, result in same format as input vector (Q12) */ - conv_fx( pos[i], h, pt1, lg ); - - /* put sign and compute energy */ - IF( sign[i] < 0 ) - { - FOR( j = 0; j < lg; j++ ) - { - pt1[j] = negate( pt1[j] ); - move16(); /*Store into dico2*/ - } - } - ener[i] = Dot_product( pt1, pt1, lg ); /* pt1 points to filtered vector in dico2, in Q12 */ - move32(); /* Result is for Q12 * Q12 with length of 64 (6 bits) + 1 left shift => Q31 */ - corr[i] = Dot_product( pt1, xn, lg ); /* must be equal to sign[i] !! */ - move32(); /* pt1 points into dico2, in Q12. xn is in Q12 */ - /* Result is for Q12 * Q12 with length of 64 (6 bits) + 1 left shift => Q31 */ - pt1 += L_SUBFR; - } - - /*------------------------------------------------------------------------* - * try all combinations of NMAX best vectors - *------------------------------------------------------------------------*/ - - pt1 = dico2; - move16(); - - /* Initial values for search algorithm */ - enerw32 = L_deposit_h( 0x80 ); - cor2w32 = L_deposit_l( -2 ); - enerw_norm = norm_l( enerw32 ); - cor2w_norm = norm_l( cor2w32 ); - cor2w_mantissa = round_fx( L_shl( cor2w32, cor2w_norm ) ); - enerw_mantissa = round_fx( L_shl( enerw32, enerw_norm ) ); - - FOR( i = 0; i < NMAX; i++ ) - { - pt2 = pt1; - move16(); - FOR( j = i; j < NMAX; j++ ) - { - cor32 = L_add( corr[i], corr[j] ); /* Q31 */ - - dotprod = Dot_product( pt1, pt2, lg ); /* Q12 * Q12 * length of 64 + 1 left shift ==> Q31 */ - - /* eneri = round_fx(ener[i]) + round_fx(ener[j]) + 2*round_fx(dotprod) */ - /* Use ScalingShift to stay aligned with ener[] */ - eneri = L_shl( dotprod, 1 ); /* One left shift added for factor of 2 */ - eneri = L_add_sat( ener[i], eneri ); - eneri = L_add_sat( ener[j], eneri ); /* Q31 */ - lo1 = L_Extract_lc( cor32, &hi1 ); - cor2 = Sad_32( 0, hi1, lo1 ); /* Square + Add */ - - cor2_norm = norm_l( cor2 ); - eneri_norm = norm_l( eneri ); - cor2_mantissa = round_fx_o( L_shl_o( cor2, cor2_norm, &Overflow ), &Overflow ); - eneri_mantissa = round_fx_o( L_shl_o( eneri, eneri_norm, &Overflow ), &Overflow ); - difference_norm = sub( add( cor2_norm, enerw_norm ), add( cor2w_norm, eneri_norm ) ); - - update_best = 0; - move16(); - - IF( difference_norm > 0 ) - { - if ( GT_32( L_shr( L_mult( cor2_mantissa, enerw_mantissa ), difference_norm ), - L_mult( cor2w_mantissa, eneri_mantissa ) ) ) - { - update_best = 1; - move16(); - } - } - ELSE - { - if ( L_msu_sat( L_shl( L_mult( cor2w_mantissa, eneri_mantissa ), difference_norm ), cor2_mantissa, enerw_mantissa ) < 0 ) // Saturation to be revisited - { - update_best = 1; - move16(); - } - } - IF( update_best != 0 ) - { - cor2w_mantissa = cor2_mantissa; - move16(); - cor2w_norm = cor2_norm; - move16(); - enerw_mantissa = eneri_mantissa; - move16(); - enerw_norm = eneri_norm; - move16(); - ind1 = i; - move16(); - ind2 = j; - move16(); - } - pt2 += L_SUBFR; - } - pt1 += L_SUBFR; - } - - enerw = round_fx( L_shr( L_deposit_h( enerw_mantissa ), enerw_norm ) ); - - /*----------------------------------------------------------------* - * Compute zero-memory filtered gauss. excitation y - *----------------------------------------------------------------*/ - - pt1 = dico2 + ind1 * L_SUBFR; - move16(); /*Pointer arithmetic*/ - pt2 = dico2 + ind2 * L_SUBFR; - move16(); - - shiftP3 = add( shift, 3 ); - FOR( i = 0; i < lg; i++ ) - { - /* Sum of 2 Q12 values, must give a Q1.8 */ - y1[i] = shr( add( pt1[i], pt2[i] ), shiftP3 ); - move16(); /* Compensate for "shift" */ - } - - /*----------------------------------------------------------------* - * signs of vectors - *----------------------------------------------------------------*/ - - sign1 = ( -32768 ); - move16(); - if ( sign[ind1] >= 0 ) - { - sign1 = 32767; - move16(); - } - - sign2 = ( -32768 ); - move16(); - if ( sign[ind2] >= 0 ) - { - sign2 = 32767; - move16(); - } - - /*----------------------------------------------------------------* - * Compute code - *----------------------------------------------------------------*/ - - pt1 = pos[ind1]; - move16(); /* Points to gaussian vector (gaus_dico_fx) in Q12 */ - pt2 = pos[ind2]; - move16(); /* Points to gaussian vector (gaus_dico_fx) in Q12 */ - - /* sign[ind1] and sign[ind2] */ - FOR( i = 0; i < lg; i++ ) - { - /* code[i]=(pt1[i]*sign1 + pt2[i]*sign2) /8 */ - /* Division by 8 (shift by 3) is for scaling (Q12 to Q0.9 output) */ - code[i] = shr( add( mult( pt1[i], sign1 ), mult( pt2[i], sign2 ) ), 3 ); - move16(); - } - - cor = L_add( corr[ind1], corr[ind2] ); - - /*----------------------------------------------------------------* - * Compute index - *----------------------------------------------------------------*/ - - i = (Word16) ( ( pos[ind1] - Gaus_dico2 ) / step ); /* Division by step can be replaced by shift. Pointer arithmetic */ - j = (Word16) ( ( pos[ind2] - Gaus_dico2 ) / step ); /* Division by step can be replaced by shift. Pointer arithmetic */ - - idx = cod_2pos_fx( i, j, sign1, sign2, nvec ); - move16(); - - push_indice( hBstr, IND_GAUS_CDBK_INDEX, idx, 2 * nb_bits + 1 ); - push_indice( hBstr, IND_TILT_FACTOR, index_delta, 3 ); - - /*----------------------------------------------------------------* - * Find quantized gain - *----------------------------------------------------------------*/ - - /* Divide cor/enerw: intermediate result stored into GainPortion1 */ - cor_neg = 0; - move16(); - if ( cor < 0 ) /* Make Num positive. */ - { - cor_neg = 1; - move16(); - } - cor_abs = L_abs( cor ); - - exp_num = sub( norm_l( cor_abs ), 1 ); - exp_den = norm_s( enerw ); - Num = round_fx( L_shl( cor_abs, exp_num ) ); - Den = shl( enerw, exp_den ); - - GainPortion1 = L_deposit_l( 0 ); /* Unexpected division by zero. Eliminate this gain contribution */ - IF( Den != 0 ) /* Protection against division by zero */ - { - div_result = div_s( Num, Den ); /* Q15 */ - IF( cor_neg != 0 ) - { - div_result = negate( div_result ); /* Retrieve sign */ - } - /* Re-scale to compensate for normalization*/ - GainPortion1 = L_shr( L_deposit_l( div_result ), sub( exp_num, exp_den ) ); - } - - ener1 = Dot_product( xn, xn, lg ); /* Q12 * Q12 * length of 64 + 1 left shift ==> Q31 */ - - exp_num = sub( norm_s( enerw ), 1 ); - exp_den = norm_l( ener1 ); - Num = shl( enerw, exp_num ); - Den = round_fx_sat( L_shl_sat( ener1, exp_den ) ); - GainPortion2 = L_deposit_l( 0 ); /* Unexpected division by zero. Eliminate this gain contribution */ - IF( Den != 0 ) /* Protection against division by zero */ - { - div_result = div_s( Num, Den ); /* Q15 */ - - /* Re-scale to compensate for normalization*/ - GainPortion2 = L_shr_sat( L_deposit_l( div_result ), sub( exp_num, exp_den ) ); - } - - ener_sqrt = Isqrt( L_shl_sat( GainPortion2, 1 ) ); /* Make value a Q16 prior to division (align on power of 4) */ - ener_sqrt = L_shr( ener_sqrt, 8 ); /* Left-shift Q23 result to make a Q15 result */ - - Portion = Mult_32_16( GainPortion1, 19661 ); /* Performs GainPortion1*.6 */ - Portion = Madd_32_16( Portion, ener_sqrt, 13107 ); /* Performs ener_sqrt*.4 */ - - /* Gain must be output in a 32-bit variable as a Q16 */ - /* Compensate for Q_new */ - *gain = L_shl_o( Portion, sub( 13, Q_new ), &Overflow ); - move32(); - - return; -} -#endif /*---------------------------------------------------------------------* * Put selected codevector positions and signs into quantization index *---------------------------------------------------------------------*/ diff --git a/lib_enc/hvq_enc_fx.c b/lib_enc/hvq_enc_fx.c index 55dbe0bf45c54cfa99377b5dc5877edd6419045b..1c0af21213bbab385cc9d409102abcd8aa2daf9c 100644 --- a/lib_enc/hvq_enc_fx.c +++ b/lib_enc/hvq_enc_fx.c @@ -183,11 +183,7 @@ Word16 hvq_enc_ivas_fx( /*o : Consumed bits lb_nfpe = 16384; move16(); } -#ifdef ISSUE_1796_replace_shl_o Mpy_32_16_ss( nf_gains[i], shl_sat( lb_nfpe, 1 ), &nf_gains[i], &dontCare ); /* nf_gains[] in Q12 */ -#else - Mpy_32_16_ss( nf_gains[i], shl_o( lb_nfpe, 1, &Overflow ), &nf_gains[i], &dontCare ); /* nf_gains[] in Q12 */ -#endif } ELSE { @@ -364,11 +360,7 @@ Word16 hvq_enc_fx( /*o : Consumed bits lb_nfpe = 16384; move16(); } -#ifdef ISSUE_1796_replace_shl_o Mpy_32_16_ss( nf_gains[i], shl_sat( lb_nfpe, 1 ), &nf_gains[i], &dontCare ); /* nf_gains[] in Q12 */ -#else - Mpy_32_16_ss( nf_gains[i], shl_o( lb_nfpe, 1, &Overflow ), &nf_gains[i], &dontCare ); /* nf_gains[] in Q12 */ -#endif } ELSE { diff --git a/lib_enc/inov_enc_fx.c b/lib_enc/inov_enc_fx.c index 86200cb43b972873e64c1605b3ee9d82b33b0f7d..b7358df5f5a11c1355fa28c09d4c84d258a42eaa 100644 --- a/lib_enc/inov_enc_fx.c +++ b/lib_enc/inov_enc_fx.c @@ -289,11 +289,7 @@ Word16 inov_encode_fx( } ELSE { -#ifndef REUSE_EVS_BE_ACELP_4T64 - *unbits = add( *unbits, acelp_4t64_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, nBits, cmpl_flag, Opt_AMR_WB ) ); -#else *unbits = add( *unbits, acelp_4t64_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, nBits, cmpl_flag, Opt_AMR_WB, st_fx->element_mode ) ); -#endif move16(); } } @@ -306,67 +302,35 @@ Word16 inov_encode_fx( } ELSE IF( ( EQ_32( core_brate, ACELP_8k85 ) ) ) { -#ifndef REUSE_EVS_BE_ACELP_4T64 - acelp_4t64_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, 20, cmpl_flag, Opt_AMR_WB ); -#else acelp_4t64_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, 20, cmpl_flag, Opt_AMR_WB, st_fx->element_mode ); -#endif } ELSE IF( EQ_32( core_brate, ACELP_12k65 ) ) { -#ifndef REUSE_EVS_BE_ACELP_4T64 - acelp_4t64_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, 36, cmpl_flag, Opt_AMR_WB ); -#else acelp_4t64_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, 36, cmpl_flag, Opt_AMR_WB, st_fx->element_mode ); -#endif } ELSE IF( EQ_32( core_brate, ACELP_14k25 ) ) { -#ifndef REUSE_EVS_BE_ACELP_4T64 - acelp_4t64_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, 44, cmpl_flag, Opt_AMR_WB ); -#else acelp_4t64_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, 44, cmpl_flag, Opt_AMR_WB, st_fx->element_mode ); -#endif } ELSE IF( EQ_32( core_brate, ACELP_15k85 ) ) { -#ifndef REUSE_EVS_BE_ACELP_4T64 - acelp_4t64_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, 52, cmpl_flag, Opt_AMR_WB ); -#else acelp_4t64_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, 52, cmpl_flag, Opt_AMR_WB, st_fx->element_mode ); -#endif } ELSE IF( EQ_32( core_brate, ACELP_18k25 ) ) { -#ifndef REUSE_EVS_BE_ACELP_4T64 - acelp_4t64_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, 64, cmpl_flag, Opt_AMR_WB ); -#else acelp_4t64_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, 64, cmpl_flag, Opt_AMR_WB, st_fx->element_mode ); -#endif } ELSE IF( EQ_32( core_brate, ACELP_19k85 ) ) { -#ifndef REUSE_EVS_BE_ACELP_4T64 - acelp_4t64_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, 72, cmpl_flag, Opt_AMR_WB ); -#else acelp_4t64_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, 72, cmpl_flag, Opt_AMR_WB, st_fx->element_mode ); -#endif } ELSE IF( EQ_32( core_brate, ACELP_23k05 ) ) { -#ifndef REUSE_EVS_BE_ACELP_4T64 - acelp_4t64_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, 88, cmpl_flag, Opt_AMR_WB ); -#else acelp_4t64_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, 88, cmpl_flag, Opt_AMR_WB, st_fx->element_mode ); -#endif } ELSE IF( EQ_32( core_brate, ACELP_23k85 ) ) { -#ifndef REUSE_EVS_BE_ACELP_4T64 - acelp_4t64_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, 88, 1, Opt_AMR_WB ); -#else acelp_4t64_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, 88, 1, Opt_AMR_WB, st_fx->element_mode ); -#endif } } @@ -656,11 +620,7 @@ Word16 inov_encode_ivas_fx( IF( EQ_16( nBits, 8 ) ) { -#ifndef REUSE_EVS_BE_ACELP_1t64 - acelp_1t64_ivas_fx( hBstr, dn, h2, code, y2, L_subfr ); -#else acelp_1t64_fx( hBstr, dn, h2, code, y2, L_subfr ); -#endif } ELSE { @@ -671,11 +631,7 @@ Word16 inov_encode_ivas_fx( { IF( st_fx->acelp_cfg.fixed_cdk_index[i_subfr / L_SUBFR] == 0 ) { -#ifndef REUSE_EVS_BE_ACELP_1t64 - acelp_1t64_ivas_fx( hBstr, dn, h2, code, y2, L_subfr ); -#else acelp_1t64_fx( hBstr, dn, h2, code, y2, L_subfr ); -#endif } ELSE { @@ -684,11 +640,7 @@ Word16 inov_encode_ivas_fx( } ELSE { -#ifndef REUSE_EVS_BE_ACELP_4T64 - E_ACELP_4t_ivas_fx( dn, cn, h2, Rw, (Word8) acelpautoc, code, st_fx->acelp_cfg.fixed_cdk_index[idx2], prm, L_frame, last_L_frame, st_fx->total_brate, i_subfr, cmpl_flag, st_fx->element_mode ); -#else E_ACELP_4t_fx( dn, cn, h2, Rw, (Word8) acelpautoc, code, st_fx->acelp_cfg.fixed_cdk_index[idx2], prm, L_frame, last_L_frame, st_fx->total_brate, i_subfr, cmpl_flag, st_fx->element_mode ); -#endif wordcnt = shr( ACELP_FIXED_CDK_BITS( st_fx->acelp_cfg.fixed_cdk_index[idx2] ), 4 ); bitcnt = s_and( ACELP_FIXED_CDK_BITS( st_fx->acelp_cfg.fixed_cdk_index[idx2] ), 15 ); @@ -739,27 +691,15 @@ Word16 inov_encode_ivas_fx( IF( EQ_16( nBits, 7 ) ) { -#ifndef REUSE_EVS_BE_ACELP_1t64 - acelp_1t64_ivas_fx( hBstr, dn, h2, code, y2, L_SUBFR ); -#else acelp_1t64_fx( hBstr, dn, h2, code, y2, L_SUBFR ); -#endif } ELSE IF( EQ_16( nBits, 12 ) ) { -#ifndef REUSE_EVS_BE_ACELP_2t32 - acelp_2t32_ivas_fx( hBstr, dn, h2, code, y2 ); -#else acelp_2t32_fx( hBstr, dn, h2, code, y2 ); -#endif } ELSE { -#ifndef REUSE_EVS_BE_ACELP_4T64 - *unbits = add( *unbits, acelp_4t64_ivas_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, nBits, cmpl_flag, Opt_AMR_WB, st_fx->element_mode ) ); -#else *unbits = add( *unbits, acelp_4t64_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, nBits, cmpl_flag, Opt_AMR_WB, st_fx->element_mode ) ); -#endif move16(); } } @@ -768,75 +708,39 @@ Word16 inov_encode_ivas_fx( { IF( EQ_32( core_brate, ACELP_6k60 ) ) { -#ifndef REUSE_EVS_BE_ACELP_2t32 - acelp_2t32_ivas_fx( hBstr, dn, h2, code, y2 ); -#else acelp_2t32_fx( hBstr, dn, h2, code, y2 ); -#endif } ELSE IF( ( EQ_32( core_brate, ACELP_8k85 ) ) ) { -#ifndef REUSE_EVS_BE_ACELP_4T64 - acelp_4t64_ivas_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, 20, cmpl_flag, Opt_AMR_WB, st_fx->element_mode ); -#else acelp_4t64_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, 20, cmpl_flag, Opt_AMR_WB, st_fx->element_mode ); -#endif } ELSE IF( EQ_32( core_brate, ACELP_12k65 ) ) { -#ifndef REUSE_EVS_BE_ACELP_4T64 - acelp_4t64_ivas_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, 36, cmpl_flag, Opt_AMR_WB, st_fx->element_mode ); -#else acelp_4t64_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, 36, cmpl_flag, Opt_AMR_WB, st_fx->element_mode ); -#endif } ELSE IF( EQ_32( core_brate, ACELP_14k25 ) ) { -#ifndef REUSE_EVS_BE_ACELP_4T64 - acelp_4t64_ivas_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, 44, cmpl_flag, Opt_AMR_WB, st_fx->element_mode ); -#else acelp_4t64_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, 44, cmpl_flag, Opt_AMR_WB, st_fx->element_mode ); -#endif } ELSE IF( EQ_32( core_brate, ACELP_15k85 ) ) { -#ifndef REUSE_EVS_BE_ACELP_4T64 - acelp_4t64_ivas_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, 52, cmpl_flag, Opt_AMR_WB, st_fx->element_mode ); -#else acelp_4t64_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, 52, cmpl_flag, Opt_AMR_WB, st_fx->element_mode ); -#endif } ELSE IF( EQ_32( core_brate, ACELP_18k25 ) ) { -#ifndef REUSE_EVS_BE_ACELP_4T64 - acelp_4t64_ivas_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, 64, cmpl_flag, Opt_AMR_WB, st_fx->element_mode ); -#else acelp_4t64_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, 64, cmpl_flag, Opt_AMR_WB, st_fx->element_mode ); -#endif } ELSE IF( EQ_32( core_brate, ACELP_19k85 ) ) { -#ifndef REUSE_EVS_BE_ACELP_4T64 - acelp_4t64_ivas_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, 72, cmpl_flag, Opt_AMR_WB, st_fx->element_mode ); -#else acelp_4t64_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, 72, cmpl_flag, Opt_AMR_WB, st_fx->element_mode ); -#endif } ELSE IF( EQ_32( core_brate, ACELP_23k05 ) ) { -#ifndef REUSE_EVS_BE_ACELP_4T64 - acelp_4t64_ivas_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, 88, cmpl_flag, Opt_AMR_WB, st_fx->element_mode ); -#else acelp_4t64_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, 88, cmpl_flag, Opt_AMR_WB, st_fx->element_mode ); -#endif } ELSE IF( EQ_32( core_brate, ACELP_23k85 ) ) { -#ifndef REUSE_EVS_BE_ACELP_4T64 - acelp_4t64_ivas_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, 88, 1, Opt_AMR_WB, st_fx->element_mode ); -#else acelp_4t64_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, 88, 1, Opt_AMR_WB, st_fx->element_mode ); -#endif } } diff --git a/lib_enc/ivas_core_enc_fx.c b/lib_enc/ivas_core_enc_fx.c index 6d6c55ae0328bef9cbd554c6a5ba845080b9c42f..a387d8811869cccbd523fff43702a8ab1570f26f 100644 --- a/lib_enc/ivas_core_enc_fx.c +++ b/lib_enc/ivas_core_enc_fx.c @@ -94,19 +94,11 @@ ivas_error ivas_core_enc_fx( Word32 shb_speech_fx32[L_FRAME16k]; Word32 *new_swb_speech_fx; Word16 *inp_fx[CPE_CHANNELS]; -#ifdef FIX_1298_MEMORY_OPT_IVAS_CORE_ENC Word16 *shb_speech_fx; -#else - Word16 shb_speech_fx[L_FRAME16k]; // Q_shb_spch -#endif Word16 Q_shb_spch; Word32 new_swb_speech_buffer_fx[L_FRAME48k + STEREO_DFT_OVL_MAX]; Word16 new_inp_resamp16k_fx[CPE_CHANNELS][L_FRAME16k]; /* new input signal @16kHz, non pre-emphasised, used by the WB TBE/BWE */ -#ifdef FIX_1298_MEMORY_OPT_IVAS_CORE_ENC Word16 *hb_speech_fx; -#else - Word16 hb_speech_fx[L_FRAME16k / 4]; -#endif Word32 bwe_exc_extended_fx[CPE_CHANNELS][L_FRAME32k + NL_BUFF_OFFSET]; /* 2 * Q_new */ Word16 old_syn_12k8_16k_fx[CPE_CHANNELS][L_FRAME16k]; /* ACELP core synthesis at 12.8kHz or 16kHz to be used by the SWB BWE */ Word16 *new_swb_speech_fx_16; @@ -114,11 +106,7 @@ ivas_error ivas_core_enc_fx( Word16 Voicing_flag[CPE_CHANNELS]; Word16 pitch_buf_fx[CPE_CHANNELS][NB_SUBFR16k]; /* Q6 */ Word16 unbits[CPE_CHANNELS]; -#ifdef FIX_1111_TDM_LSP_BUFFER Word16 tdm_lsfQ_PCh_fx[M]; /* Q2.56 */ -#else - Word16 tdm_lspQ_PCh_fx[M], tdm_lsfQ_PCh_fx[M]; /* 1 : Q15, 2 : Q2.56 */ -#endif Word16 last_element_mode, tdm_Pitch_reuse_flag; Word32 element_brate, last_element_brate, input_Fs; Word16 diff_nBits; @@ -127,18 +115,12 @@ ivas_error ivas_core_enc_fx( Word16 i, shift, Q_min; set32_fx( new_swb_speech_buffer_fx, 0, L_FRAME48k + STEREO_DFT_OVL_MAX ); -#ifndef FIX_1298_MEMORY_OPT_IVAS_CORE_ENC - set16_fx( new_swb_speech_buffer_fx_16, 0, L_FRAME48k + STEREO_DFT_OVL_MAX ); -#endif FOR( i = 0; i < CPE_CHANNELS; i++ ) { set_zero_fx( bwe_exc_extended_fx[i], L_FRAME32k + NL_BUFF_OFFSET ); set16_fx( old_syn_12k8_16k_fx[i], 0, L_FRAME16k ); } -#ifndef FIX_1298_MEMORY_OPT_IVAS_CORE_ENC - set16_fx( shb_speech_fx, 0, L_FRAME16k ); -#endif push_wmops( "ivas_core_enc" ); @@ -431,15 +413,7 @@ ivas_error ivas_core_enc_fx( test(); IF( EQ_16( st->element_mode, IVAS_CPE_TD ) && n == 0 ) { -#ifdef FIX_1111_TDM_LSP_BUFFER -#ifdef NONBE_1325_TD_STEREO_QUANT_LSF_SEC td_stereo_param_updt_fx( st->lsp_old_fx, st->lsf_old_fx, pitch_buf_fx[0], tdm_lsfQ_PCh_fx, hStereoTD->tdm_Pri_pitch_buf_fx, st->flag_ACELP16k, hStereoTD->tdm_use_IAWB_Ave_lpc ); -#else - td_stereo_param_updt_fx( st->lsp_old_fx, st->lsf_old_fx, pitch_buf_fx[0], NULL, tdm_lsfQ_PCh_fx, hStereoTD->tdm_Pri_pitch_buf_fx, st->flag_ACELP16k, hStereoTD->tdm_use_IAWB_Ave_lpc ); -#endif -#else - td_stereo_param_updt_fx( st->lsp_old_fx, st->lsf_old_fx, pitch_buf_fx[0], tdm_lspQ_PCh_fx, tdm_lsfQ_PCh_fx, hStereoTD->tdm_Pri_pitch_buf_fx, st->flag_ACELP16k, hStereoTD->tdm_use_IAWB_Ave_lpc ); -#endif } } @@ -684,9 +658,7 @@ ivas_error ivas_core_enc_fx( * WB BWE encoding *---------------------------------------------------------------------*/ -#ifdef FIX_1298_MEMORY_OPT_IVAS_CORE_ENC hb_speech_fx = new_swb_speech_buffer_fx_16; /* reuse existing buffer: hb_speech[L_FRAME16k/4]; */ -#endif test(); test(); @@ -716,10 +688,8 @@ ivas_error ivas_core_enc_fx( new_swb_speech_fx = new_swb_speech_buffer_fx + STEREO_DFT_OVL_MAX; new_swb_speech_fx_16 = new_swb_speech_buffer_fx_16 + STEREO_DFT_OVL_MAX; -#ifdef FIX_1298_MEMORY_OPT_IVAS_CORE_ENC set16_fx( new_swb_speech_buffer_fx_16, 0, L_FRAME48k + STEREO_DFT_OVL_MAX ); shb_speech_fx = new_inp_resamp16k_fx[n]; /* reuse existing buffer: shb_speech[L_FRAME16k] */ -#endif test(); test(); diff --git a/lib_enc/ivas_corecoder_enc_reconfig_fx.c b/lib_enc/ivas_corecoder_enc_reconfig_fx.c index eb58276fcbf9e16dc643258b7d92fe52fb496f59..019361561b527f2a72eb22c1044df820d56e0067 100644 --- a/lib_enc/ivas_corecoder_enc_reconfig_fx.c +++ b/lib_enc/ivas_corecoder_enc_reconfig_fx.c @@ -695,11 +695,7 @@ ivas_error ivas_corecoder_enc_reconfig_fx( } ELSE IF( st_ivas->hMCT != NULL && GT_16( st_ivas->nCPE, 1 ) ) { -#ifdef NONBE_FIX_ISM_XOVER_BR IF( ( error = mct_enc_reconfigure_fx( st_ivas, (UWord16) NE_16( nchan_transport_old_real, nchan_transport_real ) ) ) != IVAS_ERR_OK ) -#else - IF( ( error = mct_enc_reconfigure_fx( st_ivas, st_ivas->nchan_transport != nchan_transport_old ) ) != IVAS_ERR_OK ) -#endif { return error; } diff --git a/lib_enc/ivas_cpe_enc_fx.c b/lib_enc/ivas_cpe_enc_fx.c index cab884050a9b3a5d9dd947a9e01e1c0168e1234c..493cb55cdd63e96b7c0d2e528494db6357387f60 100644 --- a/lib_enc/ivas_cpe_enc_fx.c +++ b/lib_enc/ivas_cpe_enc_fx.c @@ -1083,21 +1083,7 @@ ivas_error ivas_cpe_enc_fx( IF( EQ_32( sts[0]->core_brate, SID_2k40 ) ) { -#ifdef NONBE_FIX_1052_SBA_EXT_FIX ivas_write_format_sid_fx( ivas_format, hCPE->element_mode, sts[0]->hBstr, hEncoderConfig->sba_order, hEncoderConfig->sba_planar ); -#else - ivas_write_format_sid_fx( ivas_format, hCPE->element_mode, sts[0]->hBstr ); -#ifdef NONBE_FIX_1052_SBA_EXT - IF( EQ_32( ivas_format, SBA_FORMAT ) ) - { - /* Write SBA planar flag */ - push_indice( sts[0]->hBstr, IND_SMODE, st_ivas->hEncoderConfig->sba_planar, SBA_PLANAR_BITS ); - - /* Write SBA order */ - push_indice( sts[0]->hBstr, IND_SMODE, st_ivas->hEncoderConfig->sba_order, SBA_ORDER_BITS ); - } -#endif -#endif } /*----------------------------------------------------------------* diff --git a/lib_enc/ivas_decision_matrix_enc_fx.c b/lib_enc/ivas_decision_matrix_enc_fx.c index d01af3b23e40d4e98e23df6ee9b2f86663fc0d00..3d1084b1d4cd3909ce7dee575609d4768e9b3e98 100644 --- a/lib_enc/ivas_decision_matrix_enc_fx.c +++ b/lib_enc/ivas_decision_matrix_enc_fx.c @@ -223,12 +223,8 @@ void ivas_decision_matrix_enc_fx( /* sanity check: highest bitrates in ISM */ test(); -#ifdef NONBE_1240_FIX_CORE_SELECTION_ISM_SW test(); if ( st->is_ism_format && st->tcxonly && GT_32( st->total_brate, MAX_ACELP_BRATE_ISM ) ) -#else - if ( st->is_ism_format && st->tcxonly ) -#endif { st->core = TCX_20_CORE; move16(); diff --git a/lib_enc/ivas_dirac_enc_fx.c b/lib_enc/ivas_dirac_enc_fx.c index bc1f65c9557fa47f8fb06bc383054cd3b716d536..4551282964ed86c3d6509465fa652dff5a0a53c4 100644 --- a/lib_enc/ivas_dirac_enc_fx.c +++ b/lib_enc/ivas_dirac_enc_fx.c @@ -321,10 +321,8 @@ ivas_error ivas_dirac_enc_fx( const Word16 input_frame, /* i : input frame length Q0*/ const Word16 dtx_vad, /* i : DTX vad flag Q0*/ const IVAS_FORMAT ivas_format, /* i : ivas format */ -#ifdef NONBE_FIX_1052_SBA_EXT - const Word16 nchan_transport, /* i : number of transport channels */ -#endif - const Word16 hodirac_flag, /* i : hodirac flag Q0*/ + const Word16 nchan_transport, /* i : number of transport channels */ + const Word16 hodirac_flag, /* i : hodirac flag Q0*/ const Word16 shift ) { Word16 orig_dirac_bands; @@ -464,11 +462,7 @@ ivas_error ivas_dirac_enc_fx( push_next_indice( hMetaData, 1, 1 ); /* encode SID parameters */ -#ifdef NONBE_FIX_1052_SBA_EXT ivas_qmetadata_enc_sid_encode_fx( hMetaData, hQMetaData, -1, nchan_transport, SBA_FORMAT ); -#else - ivas_qmetadata_enc_sid_encode_fx( hMetaData, hQMetaData, -1, SBA_FORMAT ); -#endif } Word16 len = 0; diff --git a/lib_enc/ivas_init_enc_fx.c b/lib_enc/ivas_init_enc_fx.c index c4a917c23a3ad657d4147ff8556f952e84b69546..5a3592ad2bf0cf154f080bfc5e3c358378f814d5 100644 --- a/lib_enc/ivas_init_enc_fx.c +++ b/lib_enc/ivas_init_enc_fx.c @@ -153,13 +153,9 @@ void ivas_write_format_fx( void ivas_write_format_sid_fx( const IVAS_FORMAT ivas_format, /* i : IVAS format */ const Word16 element_mode, /* i : element bitrate Q0*/ -#ifdef NONBE_FIX_1052_SBA_EXT_FIX - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - const Word16 sba_order, /* i : Ambisonic (SBA) order */ - const Word16 sba_planar /* i : SBA planar flag */ -#else - BSTR_ENC_HANDLE hBstr /* i/o: encoder bitstream handle */ -#endif + BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ + const Word16 sba_order, /* i : Ambisonic (SBA) order */ + const Word16 sba_planar /* i : SBA planar flag */ ) { Word16 ind = 0; /* to avoid compilation warning */ @@ -187,12 +183,6 @@ void ivas_write_format_sid_fx( ind = SID_ISM; move16(); BREAK; -#ifndef FIX_1209_SID_SIGNALING - case MC_FORMAT: - ind = SID_MULTICHANNEL; - move16(); - BREAK; -#endif case SBA_FORMAT: SWITCH( element_mode ) { @@ -228,7 +218,6 @@ void ivas_write_format_sid_fx( push_indice( hBstr, IND_IVAS_FORMAT, ind, SID_FORMAT_NBITS ); -#ifdef NONBE_FIX_1052_SBA_EXT_FIX IF( EQ_32( ivas_format, SBA_FORMAT ) ) { /* Write SBA planar flag */ @@ -237,7 +226,6 @@ void ivas_write_format_sid_fx( /* Write SBA order */ push_indice( hBstr, IND_SMODE, sba_order, SBA_ORDER_BITS ); } -#endif return; } @@ -788,15 +776,7 @@ ivas_error ivas_init_encoder_fx( st_ivas->ism_mode = ISM_MODE_NONE; move16(); -#ifdef NONBE_FIX_ISM_XOVER_BR st_ivas->ism_mode = ivas_osba_ism_mode_select( ivas_total_brate, st_ivas->hEncoderConfig->nchan_ism ); -#else - IF( GE_32( ivas_total_brate, IVAS_256k ) ) - { - st_ivas->ism_mode = ISM_SBA_MODE_DISC; - move16(); - } -#endif IF( ( error = ivas_ism_metadata_enc_create_fx( st_ivas, hEncoderConfig->nchan_ism, element_brate_tmp ) ) != IVAS_ERR_OK ) { @@ -853,16 +833,12 @@ ivas_error ivas_init_encoder_fx( ELSE { /* allocate and initialize MCT core coder */ -#ifdef NONBE_FIX_ISM_XOVER_BR { int16_t n_all; n_all = add( st_ivas->nchan_transport, st_ivas->hEncoderConfig->nchan_ism ); st_ivas->nCPE = shr_r( n_all, 1 ); } -#else - st_ivas->nCPE = add( st_ivas->nCPE, shr( add( st_ivas->hEncoderConfig->nchan_ism, 1 ), 1 ) ); /* Q0 */ -#endif FOR( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) { diff --git a/lib_enc/ivas_ism_enc_fx.c b/lib_enc/ivas_ism_enc_fx.c index 506f9ee395711378cb10907749b0dfcffb00af8e..dc41c784dd77f9a7d402e949bf786b3a9967559e 100644 --- a/lib_enc/ivas_ism_enc_fx.c +++ b/lib_enc/ivas_ism_enc_fx.c @@ -384,11 +384,7 @@ ivas_error ivas_ism_enc_fx( IF( sid_flag ) { -#ifdef NONBE_FIX_1052_SBA_EXT_FIX ivas_write_format_sid_fx( st_ivas->hEncoderConfig->ivas_format, IVAS_SCE, st->hBstr, -1, -1 ); -#else - ivas_write_format_sid_fx( st_ivas->hEncoderConfig->ivas_format, IVAS_SCE, st->hBstr ); -#endif } /*only metadata encoding is needed for this case*/ diff --git a/lib_enc/ivas_masa_enc_fx.c b/lib_enc/ivas_masa_enc_fx.c index 334feb7c5d0c7a78f8ddc8984b085cb1b4a243e1..2f765fe058b6debab7c39d7da857f622f3d25a5a 100644 --- a/lib_enc/ivas_masa_enc_fx.c +++ b/lib_enc/ivas_masa_enc_fx.c @@ -224,7 +224,6 @@ ivas_error ivas_masa_enc_open_fx( hOmasaData->omasa_stereo_sw_cnt = OMASA_STEREO_SW_CNT_MAX; move16(); -#ifdef FIX_1161_REDUCE_OMASA_HEAP IF( NE_32( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) ) { IF( ( hOmasaData->hOmasaEnergy = (OMASA_ENCODER_ENERGY_HANDLE) malloc( sizeof( OMASA_ENCODER_ENERGY_STATE ) ) ) == NULL ) @@ -242,13 +241,6 @@ ivas_error ivas_masa_enc_open_fx( { hOmasaData->hOmasaEnergy = NULL; } -#else - FOR( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) - { - set_zero_fx( hOmasaData->energy_ism_fx[i], MASA_FREQUENCY_BANDS ); // hOmasaData->energy_ism_fx_e - set16_fx( hOmasaData->energy_ism_fx_e[i], 0, MASA_FREQUENCY_BANDS ); - } -#endif hMasa->data.hOmasaData = hOmasaData; } @@ -288,14 +280,12 @@ void ivas_masa_enc_close_fx( IF( ( *hMasa )->data.hOmasaData != NULL ) { -#ifdef FIX_1161_REDUCE_OMASA_HEAP IF( ( *hMasa )->data.hOmasaData->hOmasaEnergy != NULL ) { free( ( *hMasa )->data.hOmasaData->hOmasaEnergy ); ( *hMasa )->data.hOmasaData->hOmasaEnergy = NULL; } -#endif free( ( *hMasa )->data.hOmasaData ); ( *hMasa )->data.hOmasaData = NULL; } @@ -565,11 +555,9 @@ ivas_error ivas_masa_encode_fx( } ELSE { -#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT test(); IF( EQ_32( ivas_format, MASA_ISM_FORMAT ) && EQ_32( ism_mode, ISM_MODE_NONE ) ) { -#ifdef NONBE_FIX_1074_NOBJ_SIGNAL_OMASA_LBR /* use the MASA number of transport channels bit to signal if there are 1 or 2 objects */ test(); IF( EQ_16( nchan_ism, 1 ) || EQ_16( nchan_ism, 2 ) ) @@ -581,26 +569,12 @@ ivas_error ivas_masa_encode_fx( /* for 3 or 4 objects write already the number of MASA directions */ push_next_indice( hMetaData, sub( hQMetaData->no_directions, 1 ), MASA_TRANSP_BITS ); } -#else - /* use the MASA number of transport channels bit to signal if there are 3 or 4 objects */ - IF( EQ_16( nchan_ism, 4 ) ) - { - push_next_indice( hMetaData, 1, MASA_TRANSP_BITS ); - } - ELSE - { - push_next_indice( hMetaData, 0, MASA_TRANSP_BITS ); - } -#endif } ELSE { -#endif /* write the number of MASA transport channels */ push_next_indice( hMetaData, sub( nchan_transport, 1 ), MASA_TRANSP_BITS ); -#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT } -#endif hQMetaData->metadata_max_bits = sub( hQMetaData->metadata_max_bits, MASA_TRANSP_BITS ); move16(); } @@ -608,8 +582,6 @@ ivas_error ivas_masa_encode_fx( test(); IF( EQ_32( ivas_format, MASA_ISM_FORMAT ) && EQ_32( ism_mode, ISM_MODE_NONE ) ) { -#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT -#ifdef NONBE_FIX_1074_NOBJ_SIGNAL_OMASA_LBR IF( GE_16( nchan_ism, 3 ) ) /* if 3 or 4 objects */ { push_next_indice( hMetaData, sub( 5, nchan_ism ), MASA_HEADER_BITS ); @@ -618,26 +590,8 @@ ivas_error ivas_masa_encode_fx( { push_next_indice( hMetaData, 3, MASA_HEADER_BITS ); } -#else - IF( LE_16( nchan_ism, 3 ) ) - { - push_next_indice( hMetaData, nchan_ism, MASA_HEADER_BITS ); - } - ELSE - { - push_next_indice( hMetaData, sub( nchan_ism, 1 ), MASA_HEADER_BITS ); - } -#endif - hQMetaData->metadata_max_bits = sub( hQMetaData->metadata_max_bits, MASA_HEADER_BITS ); - move16(); -#else - /* signal MASA_ISM_FORMAT to decoder */ - push_next_indice( hMetaData, 1, 1 ); - /* write reserved bit */ - push_next_indice( hMetaData, 0, MASA_HEADER_BITS - 1 ); hQMetaData->metadata_max_bits = sub( hQMetaData->metadata_max_bits, MASA_HEADER_BITS ); move16(); -#endif } ELSE { @@ -647,20 +601,16 @@ ivas_error ivas_masa_encode_fx( hQMetaData->metadata_max_bits = sub( hQMetaData->metadata_max_bits, MASA_HEADER_BITS ); move16(); } -#ifdef NONBE_FIX_1074_NOBJ_SIGNAL_OMASA_LBR test(); test(); test(); IF( !( EQ_32( ivas_format, MASA_ISM_FORMAT ) && EQ_32( ism_mode, ISM_MODE_NONE ) && GT_16( nchan_ism, 2 ) ) ) { -#endif /* write number of directions */ push_next_indice( hMetaData, sub( hQMetaData->no_directions, 1 ), 1 ); hQMetaData->metadata_max_bits = sub( hQMetaData->metadata_max_bits, 1 ); move16(); -#ifdef NONBE_FIX_1074_NOBJ_SIGNAL_OMASA_LBR } -#endif /* write subframe mode */ IF( EQ_16( hQMetaData->q_direction[0].cfg.nblocks, 1 ) ) @@ -843,11 +793,7 @@ ivas_error ivas_masa_encode_fx( free( h_orig_metadata ); -#ifdef NONBE_FIX_1052_SBA_EXT ivas_qmetadata_enc_sid_encode_fx( hMetaData, hQMetaData, masa_sid_descriptor, 0, ivas_format ); -#else - ivas_qmetadata_enc_sid_encode_fx( hMetaData, hQMetaData, masa_sid_descriptor, ivas_format ); -#endif /* restore old values */ hMasa->config.numCodingBands = numCodingBands; @@ -2704,16 +2650,8 @@ static void reduce_metadata_further_fx( /* Copy spread coherence to the rest of subframes for the coherence coding algorithm. */ FOR( sf = 1; sf < MAX_PARAM_SPATIAL_SUBFRAMES; sf++ ) { -#ifdef NONBE_FIX_1174_MCMASA_LBR_LOOP_ERROR hqmetadata->q_direction[0].coherence_band_data[band].spread_coherence[sf] = hqmetadata->q_direction[0].coherence_band_data[band].spread_coherence[0]; // Q0 move16(); -#else - FOR( band = 0; band < numCodingBands; band++ ) - { - hqmetadata->q_direction[0].coherence_band_data[band].spread_coherence[sf] = hqmetadata->q_direction[0].coherence_band_data[band].spread_coherence[0]; // Q0 - move16(); - } -#endif } /* Surround coherence is already merged through time */ @@ -3884,9 +3822,7 @@ void ivas_merge_masa_metadata_fx( Word32 eneBand_fx; /*eneBand_e*/ Word16 eneBand_e; Word32 energyMerged_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; /*energyMerged_e*/ -#ifdef FIX_1161_REDUCE_OMASA_HEAP OMASA_ENCODER_ENERGY_HANDLE hOmasaEnergy = hMasa->data.hOmasaData->hOmasaEnergy; -#endif Word32 temp1 /*temp1_e*/, temp2 /*temp2_e*/; Word16 temp1_e, temp2_e; @@ -3930,11 +3866,7 @@ void ivas_merge_masa_metadata_fx( eneBand_e = hMasa->data.energy_e[sf][band]; move32(); move16(); -#ifdef FIX_1161_REDUCE_OMASA_HEAP energyMerged_fx[sf][band] = BASOP_Util_Add_Mant32Exp( eneBand_fx, eneBand_e, hOmasaEnergy->energy_ism_fx[sf][band], hOmasaEnergy->energy_ism_fx_e[sf][band], &energyMerged_e[sf][band] ); -#else - energyMerged_fx[sf][band] = BASOP_Util_Add_Mant32Exp( eneBand_fx, eneBand_e, hMasa->data.hOmasaData->energy_ism_fx[sf][band], hMasa->data.hOmasaData->energy_ism_fx_e[sf][band], &energyMerged_e[sf][band] ); -#endif move32(); /* Compute weights */ @@ -3960,12 +3892,8 @@ void ivas_merge_masa_metadata_fx( total_diff_nrg_e = add( eneBand_e, 1 ); /* criterion is mean of ISM ratio and new ratio */ -#ifdef FIX_1161_REDUCE_OMASA_HEAP temp1 = BASOP_Util_Add_Mant32Exp( L_add( EPSILON_FX, eneBand_fx ), eneBand_e, hOmasaEnergy->energy_ism_fx[sf][band], hOmasaEnergy->energy_ism_fx_e[sf][band], &temp1_e ); /* EPSILON + eneBand + hMasa->data.hOmasaData->energy_ism[sf][band]*/ -#else - temp1 = BASOP_Util_Add_Mant32Exp( L_add( EPSILON_FX, eneBand_fx ), eneBand_e, hMasa->data.hOmasaData->energy_ism_fx[sf][band], hMasa->data.hOmasaData->energy_ism_fx_e[sf][band], &temp1_e ); /* EPSILON + eneBand + hMasa->data.hOmasaData->energy_ism[sf][band]*/ -#endif - temp2 = L_deposit_h( BASOP_Util_Divide3232_Scale( total_diff_nrg_fx, temp1, &temp2_e ) ); /*temp2_e*/ /*total_diff_nrg / ( EPSILON + eneBand + hMasa->data.hOmasaData->energy_ism[sf][band] )*/ + temp2 = L_deposit_h( BASOP_Util_Divide3232_Scale( total_diff_nrg_fx, temp1, &temp2_e ) ); /*temp2_e*/ /*total_diff_nrg / ( EPSILON + eneBand + hMasa->data.hOmasaData->energy_ism[sf][band] )*/ temp2_e = add( temp2_e, sub( total_diff_nrg_e, temp1_e ) ); IF( temp2_e < 0 ) { @@ -3975,13 +3903,8 @@ void ivas_merge_masa_metadata_fx( } temp2 = L_sub( L_shl_sat( 1, sub( 31, temp2_e ) ), temp2 ); /*( 1.0f - total_diff_nrg / ( EPSILON + eneBand + hOmasaEnergy->energy_ism[sf][band] ) )*/ temp2 = BASOP_Util_Add_Mant32Exp( hOMasaMeta->directional_meta[0].energy_ratio_fx[sf][band], 1, temp2, temp2_e, &temp2_e ); /*( 1.0f - total_diff_nrg / ( EPSILON + eneBand + hOmasaEnergy->energy_ism[sf][band] ) )*/ -#ifdef FIX_1161_REDUCE_OMASA_HEAP - energyTimesRatioISM_fx = Mpy_32_32( L_shr( temp2, 1 ), hOmasaEnergy->energy_ism_fx[sf][band] ); /*energyTimesRatioISM_e*/ + energyTimesRatioISM_fx = Mpy_32_32( L_shr( temp2, 1 ), hOmasaEnergy->energy_ism_fx[sf][band] ); /*energyTimesRatioISM_e*/ energyTimesRatioISM_e = add( temp2_e, hOmasaEnergy->energy_ism_fx_e[sf][band] ); -#else - energyTimesRatioISM_fx = Mpy_32_32( L_shr( temp2, 1 ), hMasa->data.hOmasaData->energy_ism_fx[sf][band] ); /*energyTimesRatioISM_e*/ - energyTimesRatioISM_e = add( temp2_e, hMasa->data.hOmasaData->energy_ism_fx_e[sf][band] ); -#endif /*energyTimesRatioISM = ( hOMasaMeta->directional_meta[0].energy_ratio[sf][band] + ( 1.0f - total_diff_nrg / ( EPSILON + eneBand + hOmasaEnergy->energy_ism[sf][band] ) ) ) / 2.0f * hOmasaEnergy->energy_ism[sf][band];*/ /* Determine combined metadata based on the weights */ @@ -4839,9 +4762,7 @@ static void ivas_encode_masaism_metadata_fx( Word16 tmp, rotate, energy_ism_e, energy_ism_ind_e[MAX_NUM_OBJECTS]; Word16 n_ism_tmp, i; OMASA_ENCODER_DATA_HANDLE hOmasaData = hMasa->data.hOmasaData; -#ifdef FIX_1161_REDUCE_OMASA_HEAP OMASA_ENCODER_ENERGY_HANDLE hOmasaEnergy = hOmasaData->hOmasaEnergy; -#endif Word16 nbands_work; Word32 L_tmp; Word16 L_tmp_e; @@ -4862,11 +4783,7 @@ static void ivas_encode_masaism_metadata_fx( move16(); FOR( i = 0; i < omasa_nbands; i++ ) { -#ifdef FIX_1161_REDUCE_OMASA_HEAP L_tmp = BASOP_Util_Add_Mant32Exp( L_tmp, L_tmp_e, hOmasaEnergy->energy_ism_fx[sf][i], hOmasaEnergy->energy_ism_fx_e[sf][i], &L_tmp_e ); -#else - L_tmp = BASOP_Util_Add_Mant32Exp( L_tmp, L_tmp_e, hOmasaData->energy_ism_fx[sf][i], hOmasaData->energy_ism_fx_e[sf][i], &L_tmp_e ); -#endif } /* if ( sum_f( hOmasaEnergy->energy_ism[sf], omasa_nbands ) == 0.0f ) */ @@ -4905,11 +4822,7 @@ static void ivas_encode_masaism_metadata_fx( FOR( band = 0; band < omasa_nbands; band++ ) { -#ifdef FIX_1161_REDUCE_OMASA_HEAP energy_ism = BASOP_Util_Add_Mant32Exp( energy_ism, energy_ism_e, hOmasaEnergy->energy_ism_fx[sf][band], hOmasaEnergy->energy_ism_fx_e[sf][band], &energy_ism_e ); -#else - energy_ism = BASOP_Util_Add_Mant32Exp( energy_ism, energy_ism_e, hOmasaData->energy_ism_fx[sf][band], hOmasaData->energy_ism_fx_e[sf][band], &energy_ism_e ); -#endif FOR( obj = 0; obj < nchan_ism; obj++ ) { @@ -4921,19 +4834,11 @@ static void ivas_encode_masaism_metadata_fx( FOR( obj = 0; obj < nchan_ism; obj++ ) { -#ifdef FIX_1161_REDUCE_OMASA_HEAP hOmasaEnergy->energy_ratio_ism_fx[sf][0][obj] = BASOP_Util_Divide3232_Scale_newton( energy_ism_ind[obj], energy_ism, &L_tmp_e ); -#else - hOmasaData->energy_ratio_ism_fx[sf][0][obj] = BASOP_Util_Divide3232_Scale_newton( energy_ism_ind[obj], energy_ism, &L_tmp_e ); -#endif move32(); L_tmp_e = add( L_tmp_e, sub( energy_ism_ind_e[obj], energy_ism_e ) ); /* Scaling to Q30 */ -#ifdef FIX_1161_REDUCE_OMASA_HEAP hOmasaEnergy->energy_ratio_ism_fx[sf][0][obj] = L_shl( hOmasaEnergy->energy_ratio_ism_fx[sf][0][obj], sub( L_tmp_e, 1 ) ); // Q30 -#else - hOmasaData->energy_ratio_ism_fx[sf][0][obj] = L_shl( hOmasaData->energy_ratio_ism_fx[sf][0][obj], sub( L_tmp_e, 1 ) ); // Q30 -#endif move32(); } L_tmp = BASOP_Util_Add_Mant32Exp( eneBand32, eneBand_exp, energy_ism, energy_ism_e, &L_tmp_e ); @@ -4971,21 +4876,12 @@ static void ivas_encode_masaism_metadata_fx( } FOR( sf = 0; sf < omasa_nblocks; sf++ ) { -#ifdef FIX_1161_REDUCE_OMASA_HEAP energy_ism = BASOP_Util_Add_Mant32Exp( energy_ism, energy_ism_e, hOmasaEnergy->energy_ism_fx[sf][band], hOmasaEnergy->energy_ism_fx_e[sf][band], &energy_ism_e ); -#else - energy_ism = BASOP_Util_Add_Mant32Exp( energy_ism, energy_ism_e, hOmasaData->energy_ism_fx[sf][band], hOmasaData->energy_ism_fx_e[sf][band], &energy_ism_e ); -#endif FOR( obj = 0; obj < nchan_ism; obj++ ) { -#ifdef FIX_1161_REDUCE_OMASA_HEAP L_tmp = Mpy_32_32( hOmasaEnergy->energy_ism_fx[sf][band], hOmasaEnergy->energy_ratio_ism_fx[sf][band][obj] ); // Q = (31 - hOmasaEnergy->energy_ism_fx_e[sf][band]) + Q30 - 31 L_tmp_e = add( 1, hOmasaEnergy->energy_ism_fx_e[sf][band] ); -#else - L_tmp = Mpy_32_32( hOmasaData->energy_ism_fx[sf][band], hOmasaData->energy_ratio_ism_fx[sf][band][obj] ); // Q = (31 - hOmasaEnergy->energy_ism_fx_e[sf][band]) + Q30 - 31 - L_tmp_e = add( 1, hOmasaData->energy_ism_fx_e[sf][band] ); -#endif energy_ism_ind[obj] = BASOP_Util_Add_Mant32Exp( energy_ism_ind[obj], energy_ism_ind_e[obj], L_tmp, L_tmp_e, &energy_ism_ind_e[obj] ); move32(); } @@ -5000,19 +4896,11 @@ static void ivas_encode_masaism_metadata_fx( { FOR( obj = 0; obj < nchan_ism; obj++ ) { -#ifdef FIX_1161_REDUCE_OMASA_HEAP hOmasaEnergy->energy_ratio_ism_fx[0][band][obj] = BASOP_Util_Divide3232_Scale_newton( energy_ism_ind[obj], energy_ism, &L_tmp_e ); -#else - hOmasaData->energy_ratio_ism_fx[0][band][obj] = BASOP_Util_Divide3232_Scale_newton( energy_ism_ind[obj], energy_ism, &L_tmp_e ); -#endif move32(); L_tmp_e = add( L_tmp_e, sub( energy_ism_ind_e[obj], energy_ism_e ) ); /* Scaling to Q30 */ -#ifdef FIX_1161_REDUCE_OMASA_HEAP hOmasaEnergy->energy_ratio_ism_fx[0][band][obj] = L_shl( hOmasaEnergy->energy_ratio_ism_fx[0][band][obj], sub( L_tmp_e, 1 ) ); // Q30 -#else - hOmasaData->energy_ratio_ism_fx[0][band][obj] = L_shl( hOmasaData->energy_ratio_ism_fx[0][band][obj], sub( L_tmp_e, 1 ) ); // Q30 -#endif move32(); } brange[0] = hMasa->data.band_mapping[band]; @@ -5057,11 +4945,7 @@ static void ivas_encode_masaism_metadata_fx( FOR( obj = 0; obj < nchan_ism; obj++ ) { -#ifdef FIX_1161_REDUCE_OMASA_HEAP hOmasaEnergy->energy_ratio_ism_fx[0][band][obj] = hOmasaEnergy->energy_ratio_ism_fx[0][nbands_work - 1][obj]; -#else - hOmasaData->energy_ratio_ism_fx[0][band][obj] = hOmasaData->energy_ratio_ism_fx[0][nbands_work - 1][obj]; -#endif move32(); } } @@ -5072,11 +4956,7 @@ static void ivas_encode_masaism_metadata_fx( { FOR( band = 0; band < nbands_work; band++ ) { -#ifdef FIX_1161_REDUCE_OMASA_HEAP IF( hOmasaEnergy->energy_ism_fx[sf][band] == 0 ) -#else - IF( hOmasaData->energy_ism_fx[sf][band] == 0 ) -#endif { hOmasaData->masa_to_total_energy_ratio_fx[sf][band] = ONE_IN_Q30; move32(); @@ -5098,11 +4978,7 @@ static void ivas_encode_masaism_metadata_fx( eneBand32 = W_extract_h( W_shl( eneBand, shift ) ); eneBand_exp = sub( 63, add( add( hMasa->data.q_energy, 1 ), shift ) ); -#ifdef FIX_1161_REDUCE_OMASA_HEAP L_tmp = BASOP_Util_Add_Mant32Exp( eneBand32, eneBand_exp, hOmasaEnergy->energy_ism_fx[sf][band], hOmasaEnergy->energy_ism_fx_e[sf][band], &L_tmp_e ); -#else - L_tmp = BASOP_Util_Add_Mant32Exp( eneBand32, eneBand_exp, hOmasaData->energy_ism_fx[sf][band], hOmasaData->energy_ism_fx_e[sf][band], &L_tmp_e ); -#endif IF( L_tmp != 0 ) { hOmasaData->masa_to_total_energy_ratio_fx[sf][band] = BASOP_Util_Divide3232_Scale_newton( eneBand32, L_tmp, &tmp ); @@ -5126,11 +5002,7 @@ static void ivas_encode_masaism_metadata_fx( FOR( obj = 0; obj < nchan_ism; obj++ ) { -#ifdef FIX_1161_REDUCE_OMASA_HEAP hOmasaEnergy->energy_ratio_ism_fx[sf][band][obj] = hOmasaEnergy->energy_ratio_ism_fx[sf][nbands_work - 1][obj]; -#else - hOmasaData->energy_ratio_ism_fx[sf][band][obj] = hOmasaData->energy_ratio_ism_fx[sf][nbands_work - 1][obj]; -#endif move32(); } } @@ -5153,13 +5025,8 @@ static void ivas_encode_masaism_metadata_fx( { FOR( obj = 0; obj < nchan_ism; obj++ ) { -#ifdef FIX_1161_REDUCE_OMASA_HEAP assert( ( hOmasaEnergy->energy_ratio_ism_fx[sf][band][obj] >= 0 ) && ( hOmasaEnergy->energy_ratio_ism_fx[sf][band][obj] <= ONE_IN_Q30 ) ); ratio_ism_fx[band][obj] = extract_h( hOmasaEnergy->energy_ratio_ism_fx[sf][band][obj] ); // Q14 -#else - assert( ( hOmasaData->energy_ratio_ism_fx[sf][band][obj] >= 0 ) && ( hOmasaData->energy_ratio_ism_fx[sf][band][obj] <= ONE_IN_Q30 ) ); - ratio_ism_fx[band][obj] = extract_h( hOmasaData->energy_ratio_ism_fx[sf][band][obj] ); // Q14 -#endif move16(); } @@ -5191,11 +5058,7 @@ static void ivas_encode_masaism_metadata_fx( } /* reconstructed values */ -#ifdef FIX_1161_REDUCE_OMASA_HEAP reconstruct_ism_ratios_fx( ratio_ism_idx[band], nchan_ism, STEP_PARAM_ISM_POW_RATIO_NBITS_Q31, hOmasaEnergy->q_energy_ratio_ism_fx[sf][band] ); -#else - reconstruct_ism_ratios_fx( ratio_ism_idx[band], nchan_ism, STEP_PARAM_ISM_POW_RATIO_NBITS_Q31, hMasa->data.hOmasaData->q_energy_ratio_ism_fx[sf][band] ); -#endif } test(); @@ -5281,11 +5144,7 @@ static void ivas_encode_masaism_metadata_fx( } } -#ifdef FIX_1161_REDUCE_OMASA_HEAP calculate_nbits_meta_fx( nchan_ism, hOmasaEnergy->q_energy_ratio_ism_fx, hOmasaData->masa_to_total_energy_ratio_fx, numSf, numCodingBands, bits_ism, idx_separated_object, ism_imp ); -#else - calculate_nbits_meta_fx( nchan_ism, hOmasaData->q_energy_ratio_ism_fx, hOmasaData->masa_to_total_energy_ratio_fx, numSf, numCodingBands, bits_ism, idx_separated_object, ism_imp ); -#endif /* quantize directions */ FOR( obj = 0; obj < nchan_ism; obj++ ) diff --git a/lib_enc/ivas_mct_core_enc_fx.c b/lib_enc/ivas_mct_core_enc_fx.c index 12edd647a5b39813299281393f98b13f46321bf1..c616bfd30392a9ec5aefce1148c5b23c170dfb14 100644 --- a/lib_enc/ivas_mct_core_enc_fx.c +++ b/lib_enc/ivas_mct_core_enc_fx.c @@ -233,39 +233,23 @@ void ivas_mct_core_enc_fx( Word16 i, cpe_id, n, nAvailBits; Word16 nCPE; Word32 *orig_spectrum_fx[MCT_MAX_CHANNELS][2]; /* Pointers to MDCT output for a short block (L/R) */ -#ifdef NONBE_FIX_1097_SBA_DTX_BRATE_SWITCHING_ENC Word32 powerSpecMsInv_long_cpe0_fx[CPE_CHANNELS][L_FRAME_PLUS]; Word32 inv_spectrum_long_cpe0_fx[CPE_CHANNELS][L_FRAME_PLUS]; Word32 powerSpec_long_cpe0_fx[CPE_CHANNELS][L_FRAME_PLUS]; Word32 powerSpec_long_fx[MCT_MAX_CHANNELS - CPE_CHANNELS][L_FRAME48k]; Word32 inv_spectrum_long_fx[MCT_MAX_CHANNELS - CPE_CHANNELS][L_FRAME48k]; /* quantized MDCT spectrum, inv ms mask mdst spectrum, scratch for MS spectra in the MS decision */ Word32 powerSpecMsInv_long_fx[MCT_MAX_CHANNELS - CPE_CHANNELS][L_FRAME48k]; /* MS inv power spectrum, also inverse MDST spectrum */ -#else - Word32 powerSpec_fx[MCT_MAX_CHANNELS][L_FRAME48k]; -#endif Word16 exp_powerSpec[MCT_MAX_CHANNELS][N_MAX + L_MDCT_OVLP_MAX]; Word32 mdst_fx; -#ifndef NONBE_FIX_1097_SBA_DTX_BRATE_SWITCHING_ENC - Word32 powerSpecMsInv_long_fx[MCT_MAX_CHANNELS][L_FRAME48k]; /* MS inv power spectrum, also inverse MDST spectrum */ -#endif -#ifdef NONBE_FIX_1097_SBA_DTX_BRATE_SWITCHING_ENC Word32 *powerSpec_fx[MCT_MAX_CHANNELS]; -#endif Word32 *powerSpecMsInv_fx[MCT_MAX_CHANNELS][2]; Word32 *inv_mdst_spectrum_fx[MCT_MAX_CHANNELS][2]; Word32 *inv_spectrum_fx[MCT_MAX_CHANNELS][2]; Word32 *mdst_spectrum_fx[MCT_MAX_CHANNELS][2] = { { NULL } }; -#ifndef NONBE_FIX_1097_SBA_DTX_BRATE_SWITCHING_ENC - Word32 inv_spectrum_long_fx[MCT_MAX_CHANNELS][L_FRAME48k]; /* quantized MDCT spectrum, inv ms mask mdst spectrum, scratch for MS spectra in the MS decision */ -#endif Word16 total_side_bits; Word16 chBitRatios[MCT_MAX_CHANNELS]; Word16 q_powSpec[MCT_MAX_CHANNELS], q_spec, q_origSpec, tmp_s; -#ifdef NONBE_FIX_1097_SBA_DTX_BRATE_SWITCHING_ENC Word16 tmp_q_powSpec[L_FRAME_PLUS], tmp_q_powSpecInv[MCT_MAX_CHANNELS][L_FRAME_PLUS], *tmp_q_psi[MCT_MAX_CHANNELS][2]; -#else - Word16 tmp_q_powSpec[L_FRAME48k], tmp_q_powSpecInv[MCT_MAX_CHANNELS][L_FRAME48k], *tmp_q_psi[MCT_MAX_CHANNELS][2]; -#endif Word64 W_tmp; Encoder_State *sts[MCT_MAX_CHANNELS]; Encoder_State *st; @@ -290,7 +274,6 @@ void ivas_mct_core_enc_fx( nCPE = add( nCPE, 1 ); } -#ifdef NONBE_FIX_1097_SBA_DTX_BRATE_SWITCHING_ENC /* point first CPE channels to longer buffers where switching from ACELP to TCX may occur in SBA with DTX (total memory saving)*/ FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) { @@ -344,33 +327,6 @@ void ivas_mct_core_enc_fx( } set16_fx( tmp_q_powSpec, 63, L_FRAME_PLUS ); -#else - FOR( ch = 0; ch < MCT_MAX_CHANNELS; ch++ ) - { - set32_fx( powerSpecMsInv_long_fx[ch], 0, L_FRAME48k ); - q_powSpec[ch] = 0; - move16(); - set16_fx( exp_powerSpec[ch], 0, N_MAX + L_MDCT_OVLP_MAX ); - } - FOR( ch = 0; ch < nChannels; ch++ ) - { - set32_fx( inv_spectrum_long_fx[ch], 0, L_FRAME48k ); - set32_fx( powerSpec_fx[ch], 0, L_FRAME48k ); // tmp_q_powSpec - set32_fx( powerSpecMsInv_long_fx[ch], 0, L_FRAME48k ); // tmp_q_powSpecInv - - inv_mdst_spectrum_fx[ch][0] = powerSpecMsInv_fx[ch][0] = powerSpecMsInv_long_fx[ch]; - inv_mdst_spectrum_fx[ch][1] = powerSpecMsInv_fx[ch][1] = powerSpecMsInv_long_fx[ch] + N_TCX10_MAX; - set16_fx( tmp_q_powSpecInv[ch], 63, L_FRAME48k ); - - tmp_q_psi[ch][0] = tmp_q_powSpecInv[ch]; - tmp_q_psi[ch][1] = &tmp_q_powSpecInv[ch][N_TCX10_MAX]; - - inv_spectrum_fx[ch][0] = inv_spectrum_long_fx[ch]; - inv_spectrum_fx[ch][1] = inv_spectrum_long_fx[ch] + N_TCX10_MAX; - } - - set16_fx( tmp_q_powSpec, 63, L_FRAME48k ); -#endif FOR( ( cpe_id = 0, i = 0 ); cpe_id < nCPE; cpe_id++ ) { diff --git a/lib_enc/ivas_mct_enc_mct_fx.c b/lib_enc/ivas_mct_enc_mct_fx.c index 6403d90ada186c6984dd0e5ebd1a91c42fdd1a39..0918c51d24cde78794b32dba5e23234010be407b 100644 --- a/lib_enc/ivas_mct_enc_mct_fx.c +++ b/lib_enc/ivas_mct_enc_mct_fx.c @@ -979,15 +979,11 @@ void write_mct_bitstream_fx( * IGF analysis of channels after MCT processing *--------------------------------------------------------------------*/ void mctStereoIGF_enc_fx( - MCT_ENC_HANDLE hMCT, /* i/o: MCT encoder structure */ - Encoder_State **sts, /* i/o: encoder state structure */ - Word32 *orig_spectrum_fx[MCT_MAX_CHANNELS][2], /* i : MDCT spectrum for ITF */ - Word16 q_origSpec, /* i : Q for MDCT spectrum */ -#ifdef NONBE_FIX_1097_SBA_DTX_BRATE_SWITCHING_ENC - Word32 *powerSpec_fx[MCT_MAX_CHANNELS], /* i/o: MDCT^2 + MDST^2 spectrum,or estimate */ -#else - Word32 powerSpec_fx[MCT_MAX_CHANNELS][L_FRAME48k], /* i/o: MDCT^2 + MDST^2 spectrum,or estimate */ -#endif + MCT_ENC_HANDLE hMCT, /* i/o: MCT encoder structure */ + Encoder_State **sts, /* i/o: encoder state structure */ + Word32 *orig_spectrum_fx[MCT_MAX_CHANNELS][2], /* i : MDCT spectrum for ITF */ + Word16 q_origSpec, /* i : Q for MDCT spectrum */ + Word32 *powerSpec_fx[MCT_MAX_CHANNELS], /* i/o: MDCT^2 + MDST^2 spectrum,or estimate */ Word16 q_powerSpec[MCT_MAX_CHANNELS], /* i : Q for powSpec_fx */ Word32 *powerSpecMsInv_fx[MCT_MAX_CHANNELS][NB_DIV], /* i : same as powerSpec_fx but for inverse spect.*/ Word16 *q_powerSpecMsInv[MCT_MAX_CHANNELS][NB_DIV], /* i : Q for powSpecMsInv_fx */ diff --git a/lib_enc/ivas_mdct_core_enc_fx.c b/lib_enc/ivas_mdct_core_enc_fx.c index e3da229c3abd5eb296653987f3766a589a54ae9b..86ea8ebe919149397275a57349d1472ac931e4ca 100644 --- a/lib_enc/ivas_mdct_core_enc_fx.c +++ b/lib_enc/ivas_mdct_core_enc_fx.c @@ -1964,11 +1964,7 @@ void ivas_mdct_core_whitening_enc_fx( move64(); FOR( i = 0; i < NB_DIV; i++ ) { -#ifdef FIX_ISSUE_1811_EXCEEDING_W_SHIFTS chE_tot_fx = W_add( W_shr( chE_fx[i], s_min( 63, sub( chE_q[i], q ) ) ), chE_tot_fx ); -#else - chE_tot_fx = W_add( W_shr( chE_fx[i], sub( chE_q[i], q ) ), chE_tot_fx ); -#endif } IF( GT_16( q, Q24 ) ) { diff --git a/lib_enc/ivas_omasa_enc_fx.c b/lib_enc/ivas_omasa_enc_fx.c index 838ca194495f05bb0a74061edf46dae9bb76d092..26485b29f271c521135a3e9f321da2d3779089da 100644 --- a/lib_enc/ivas_omasa_enc_fx.c +++ b/lib_enc/ivas_omasa_enc_fx.c @@ -378,7 +378,6 @@ ivas_error ivas_omasa_enc_config_fx( st_ivas->hOMasa = NULL; } -#ifdef FIX_1161_REDUCE_OMASA_HEAP /* OMASA energy handle */ test(); test(); @@ -395,7 +394,6 @@ ivas_error ivas_omasa_enc_config_fx( st_ivas->hMasa->data.hOmasaData->hOmasaEnergy = NULL; } -#endif st_ivas->hCPE[0]->element_brate = L_sub( ivas_total_brate, ism_total_brate ); move32(); @@ -1098,9 +1096,7 @@ static void ivas_omasa_param_est_enc_fx( Word32 temp; Word16 temp_e; Word16 q_intensity_real_fx[MASA_FREQUENCY_BANDS], q_reference_power_fx[CLDFB_NO_CHANNELS_MAX]; -#ifdef FIX_1161_REDUCE_OMASA_HEAP OMASA_ENCODER_ENERGY_HANDLE hOmasaEnergy = hOmasaData->hOmasaEnergy; -#endif ref_exp = 0; norm_buff = MAX16B; @@ -1167,13 +1163,8 @@ static void ivas_omasa_param_est_enc_fx( move16(); move16(); } -#ifdef FIX_1161_REDUCE_OMASA_HEAP set_zero_fx( hOmasaEnergy->energy_ism_fx[block_m_idx], num_freq_bands ); set16_fx( hOmasaEnergy->energy_ism_fx_e[block_m_idx], 0, num_freq_bands ); -#else - set_zero_fx( hOmasaData->energy_ism_fx[block_m_idx], num_freq_bands ); - set16_fx( hOmasaData->energy_ism_fx_e[block_m_idx], 0, num_freq_bands ); -#endif FOR( ts = mrange[0]; ts < mrange[1]; ts++ ) { @@ -1214,11 +1205,7 @@ static void ivas_omasa_param_est_enc_fx( { temp = L_add( Mpy_32_32( Chnl_RealBuffer_fx[k][j], Chnl_RealBuffer_fx[k][j] ), Mpy_32_32( Chnl_ImagBuffer_fx[k][j], Chnl_ImagBuffer_fx[k][j] ) ); temp_e = sub( 62, shl( q, 1 ) ); -#ifdef FIX_1161_REDUCE_OMASA_HEAP hOmasaEnergy->energy_ism_fx[block_m_idx][i] = BASOP_Util_Add_Mant32Exp( hOmasaEnergy->energy_ism_fx[block_m_idx][i], hOmasaEnergy->energy_ism_fx_e[block_m_idx][i], temp, temp_e, &hOmasaEnergy->energy_ism_fx_e[block_m_idx][i] ); /*2q-31*/ -#else - hOmasaData->energy_ism_fx[block_m_idx][i] = BASOP_Util_Add_Mant32Exp( hOmasaData->energy_ism_fx[block_m_idx][i], hOmasaData->energy_ism_fx_e[block_m_idx][i], temp, temp_e, &hOmasaData->energy_ism_fx_e[block_m_idx][i] ); /*2q-31*/ -#endif move32(); } } @@ -1407,9 +1394,7 @@ static void ivas_omasa_energy_and_ratio_est_fx( Word16 norm_Chnl; Word16 temp_e; /* to store temporary exp*/ Word16 energy_ratio_ism_e[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS]; /*q30*/ -#ifdef FIX_1161_REDUCE_OMASA_HEAP OMASA_ENCODER_ENERGY_HANDLE hOmasaEnergy = hOmasaData->hOmasaEnergy; -#endif num_freq_bands = hOMasa->nbands; l_ts = shr( input_frame, 4 ); /*input_frame / CLDFB_NO_COL_MAX*/ @@ -1430,20 +1415,11 @@ static void ivas_omasa_energy_and_ratio_est_fx( /* Reset variable */ FOR( i = 0; i < hOMasa->nbands; i++ ) { -#ifdef FIX_1161_REDUCE_OMASA_HEAP set_zero_fx( hOmasaEnergy->energy_ratio_ism_fx[block_m_idx][i], nchan_ism ); -#else - set_zero_fx( hOmasaData->energy_ratio_ism_fx[block_m_idx][i], nchan_ism ); -#endif set16_fx( energy_ratio_ism_e[block_m_idx][i], 0, nchan_ism ); } -#ifdef FIX_1161_REDUCE_OMASA_HEAP set_zero_fx( hOmasaEnergy->energy_ism_fx[block_m_idx], num_freq_bands ); set16_fx( hOmasaEnergy->energy_ism_fx_e[block_m_idx], 0, num_freq_bands ); -#else - set_zero_fx( hOmasaData->energy_ism_fx[block_m_idx], num_freq_bands ); - set16_fx( hOmasaData->energy_ism_fx_e[block_m_idx], 0, num_freq_bands ); -#endif /* Compute CLDFB */ FOR( ts = mrange[0]; ts < mrange[1]; ts++ ) @@ -1489,13 +1465,8 @@ static void ivas_omasa_energy_and_ratio_est_fx( tmp64 = W_shl( tmp64, tmpNorm ); tftile_energy_fx = W_extract_h( tmp64 ); tftile_energy_e = sub( tftile_energy_e, tmpNorm ); -#ifdef FIX_1161_REDUCE_OMASA_HEAP hOmasaEnergy->energy_ism_fx[block_m_idx][i] = BASOP_Util_Add_Mant32Exp( hOmasaEnergy->energy_ism_fx[block_m_idx][i], hOmasaEnergy->energy_ism_fx_e[block_m_idx][i], tftile_energy_fx, tftile_energy_e, &hOmasaEnergy->energy_ism_fx_e[block_m_idx][i] ); hOmasaEnergy->energy_ratio_ism_fx[block_m_idx][i][k] = BASOP_Util_Add_Mant32Exp( hOmasaEnergy->energy_ratio_ism_fx[block_m_idx][i][k], energy_ratio_ism_e[block_m_idx][i][k], tftile_energy_fx, tftile_energy_e, &energy_ratio_ism_e[block_m_idx][i][k] ); -#else - hOmasaData->energy_ism_fx[block_m_idx][i] = BASOP_Util_Add_Mant32Exp( hOmasaData->energy_ism_fx[block_m_idx][i], hOmasaData->energy_ism_fx_e[block_m_idx][i], tftile_energy_fx, tftile_energy_e, &hOmasaData->energy_ism_fx_e[block_m_idx][i] ); - hOmasaData->energy_ratio_ism_fx[block_m_idx][i][k] = BASOP_Util_Add_Mant32Exp( hOmasaData->energy_ratio_ism_fx[block_m_idx][i][k], energy_ratio_ism_e[block_m_idx][i][k], tftile_energy_fx, tftile_energy_e, &energy_ratio_ism_e[block_m_idx][i][k] ); -#endif move32(); move32(); } @@ -1510,7 +1481,6 @@ static void ivas_omasa_energy_and_ratio_est_fx( move64(); FOR( j = 0; j < nchan_ism; j++ ) { -#ifdef FIX_1161_REDUCE_OMASA_HEAP hOmasaEnergy->energy_ratio_ism_fx[block_m_idx][i][j] = L_deposit_h( BASOP_Util_Divide3232_Scale( hOmasaEnergy->energy_ratio_ism_fx[block_m_idx][i][j], L_add( hOmasaEnergy->energy_ism_fx[block_m_idx][i], EPSILON_FX ), &temp_e ) ); move32(); temp_e = add( temp_e, sub( energy_ratio_ism_e[block_m_idx][i][j], hOmasaEnergy->energy_ism_fx_e[block_m_idx][i] ) ); @@ -1518,26 +1488,13 @@ static void ivas_omasa_energy_and_ratio_est_fx( hOmasaEnergy->energy_ratio_ism_fx[block_m_idx][i][j] = L_shl( hOmasaEnergy->energy_ratio_ism_fx[block_m_idx][i][j], sub( temp_e, 1 ) ); /* scaling to q30 */ move32(); ism_ratio_sum_fx = W_add( ism_ratio_sum_fx, hOmasaEnergy->energy_ratio_ism_fx[block_m_idx][i][j] ); -#else - hOmasaData->energy_ratio_ism_fx[block_m_idx][i][j] = L_deposit_h( BASOP_Util_Divide3232_Scale( hOmasaData->energy_ratio_ism_fx[block_m_idx][i][j], L_add( hOmasaData->energy_ism_fx[block_m_idx][i], EPSILON_FX ), &temp_e ) ); - move32(); - temp_e = add( temp_e, sub( energy_ratio_ism_e[block_m_idx][i][j], hOmasaData->energy_ism_fx_e[block_m_idx][i] ) ); - - hOmasaData->energy_ratio_ism_fx[block_m_idx][i][j] = L_shl( hOmasaData->energy_ratio_ism_fx[block_m_idx][i][j], sub( temp_e, 1 ) ); /* scaling to q30 */ - move32(); - ism_ratio_sum_fx = W_add( ism_ratio_sum_fx, hOmasaData->energy_ratio_ism_fx[block_m_idx][i][j] ); -#endif } IF( ism_ratio_sum_fx == 0 ) { Word16 temp_ism_ratio = BASOP_Util_Divide1616_Scale( 1, nchan_ism, &temp_e ); FOR( j = 0; j < nchan_ism; j++ ) { -#ifdef FIX_1161_REDUCE_OMASA_HEAP hOmasaEnergy->energy_ratio_ism_fx[block_m_idx][i][j] = L_shl( temp_ism_ratio, add( temp_e, 15 ) ); /*scaling to q30*/ -#else - hOmasaData->energy_ratio_ism_fx[block_m_idx][i][j] = L_shl( temp_ism_ratio, add( temp_e, 15 ) ); /*scaling to q30*/ -#endif move32(); } } diff --git a/lib_enc/ivas_osba_enc_fx.c b/lib_enc/ivas_osba_enc_fx.c index 66231d6f75b90d023302a2eb930eb1743f99e091..5ab29f617e527fd1fdf35a7533cf9a1ae08b0e2a 100644 --- a/lib_enc/ivas_osba_enc_fx.c +++ b/lib_enc/ivas_osba_enc_fx.c @@ -188,9 +188,7 @@ ivas_error ivas_osba_enc_reconfig( hEncoderConfig = st_ivas->hEncoderConfig; ivas_total_brate = hEncoderConfig->ivas_total_brate; move32(); -#ifdef NONBE_FIX_ISM_XOVER_BR Word16 nchan_transport; -#endif IF( NE_32( ivas_total_brate, hEncoderConfig->last_ivas_total_brate ) ) { @@ -205,20 +203,7 @@ ivas_error ivas_osba_enc_reconfig( move16(); old_ism_mode = st_ivas->ism_mode; move32(); -#ifdef NONBE_FIX_ISM_XOVER_BR st_ivas->ism_mode = ivas_osba_ism_mode_select( ivas_total_brate, st_ivas->hEncoderConfig->nchan_ism ); -#else - IF( GE_32( ivas_total_brate, IVAS_256k ) ) - { - st_ivas->ism_mode = ISM_SBA_MODE_DISC; - move32(); - } - ELSE - { - st_ivas->ism_mode = ISM_MODE_NONE; - move32(); - } -#endif nchan_transport_old = st_ivas->nchan_transport; nCPE_old = st_ivas->nCPE; nSCE_old = st_ivas->nSCE; @@ -368,47 +353,28 @@ ivas_error ivas_osba_enc_reconfig( /*-----------------------------------------------------------------* * Allocate, initialize, and configure SCE/CPE/MCT handles *-----------------------------------------------------------------*/ -#ifdef NONBE_FIX_ISM_XOVER_BR nchan_transport = st_ivas->nchan_transport; -#endif test(); test(); IF( old_ism_mode == ISM_MODE_NONE && EQ_32( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) ) { -#ifdef NONBE_FIX_ISM_XOVER_BR { nchan_transport = add( st_ivas->nchan_transport, st_ivas->hEncoderConfig->nchan_ism ); st_ivas->nCPE = shr_r( nchan_transport, 1 ); } -#else - st_ivas->nCPE = add( st_ivas->nCPE, shr( add( st_ivas->hEncoderConfig->nchan_ism, 1 ), 1 ) ); - move16(); -#endif } ELSE IF( EQ_32( old_ism_mode, ISM_SBA_MODE_DISC ) && st_ivas->ism_mode == ISM_MODE_NONE ) { nchan_transport_old = add( nchan_transport_old, st_ivas->hEncoderConfig->nchan_ism ); -#ifdef NONBE_FIX_ISM_XOVER_BR nchan_transport = st_ivas->nchan_transport; -#endif } ELSE IF( EQ_32( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) ) { -#ifdef NONBE_FIX_ISM_XOVER_BR nchan_transport_old = add( nchan_transport_old, st_ivas->hEncoderConfig->nchan_ism ); nchan_transport = add( st_ivas->nchan_transport, st_ivas->hEncoderConfig->nchan_ism ); st_ivas->nCPE = shr_r( nchan_transport, 1 ); -#else - st_ivas->nCPE = add( st_ivas->nCPE, shr( add( st_ivas->hEncoderConfig->nchan_ism, 1 ), 1 ) ); - move16(); - nCPE_old = st_ivas->nCPE; - move16(); - nchan_transport_old = st_ivas->nchan_transport; - move16(); - nchan_transport_old = add( nchan_transport_old, st_ivas->hEncoderConfig->nchan_ism ); -#endif } Word16 tmp_e; Word32 bitrate_per_chan = L_deposit_h( BASOP_Util_Divide3216_Scale( ivas_total_brate, st_ivas->nchan_transport, &tmp_e ) ); diff --git a/lib_enc/ivas_qmetadata_enc_fx.c b/lib_enc/ivas_qmetadata_enc_fx.c index ba658b31acc7fee19605bb817c7595d080e36499..6b56b36a380bc2822b361881bdeda9a2976eedb8 100644 --- a/lib_enc/ivas_qmetadata_enc_fx.c +++ b/lib_enc/ivas_qmetadata_enc_fx.c @@ -867,10 +867,8 @@ void ivas_qmetadata_enc_sid_encode_fx( BSTR_ENC_HANDLE hMetaData, /* i/o: metadata bitstream handle */ IVAS_QMETADATA *q_metadata, /* i/o: metadata handle */ const Word16 masa_sid_descriptor, /* i : description of MASA SID coding structure */ -#ifdef NONBE_FIX_1052_SBA_EXT - const Word16 nchan_transport, /* i : number of transport channels */ -#endif - const Word16 ivas_format /* i : IVAS format */ + const Word16 nchan_transport, /* i : number of transport channels */ + const Word16 ivas_format /* i : IVAS format */ ) { Word16 b, m; @@ -883,21 +881,14 @@ void ivas_qmetadata_enc_sid_encode_fx( Word32 avg_azimuth_fx[MASA_MAXIMUM_CODING_SUBBANDS]; Word16 bits_dir, bits_diff, bits_delta; Word16 metadata_sid_bits; /* bits allocated to SID for metadata */ -#ifdef NONBE_FIX_1052_SBA_EXT Word16 sba_spar_bitlen; -#endif IF( EQ_16( ivas_format, SBA_FORMAT ) ) { -#ifdef NONBE_FIX_1052_SBA_EXT sba_spar_bitlen = ivas_sba_spar_sid_bitlen_fx( nchan_transport ); metadata_sid_bits = (int16_t) ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS - SBA_ORDER_BITS - SBA_PLANAR_BITS - 1; /* -1 for inactive mode header bit*/ metadata_sid_bits = sub( metadata_sid_bits, sba_spar_bitlen ); -#else - metadata_sid_bits = (Word16) ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - ( SPAR_DTX_BANDS * SPAR_SID_BITS_TAR_PER_BAND ) - 2 - SID_FORMAT_NBITS; /* -1 for inactive mode header bit*/ - move16(); -#endif } ELSE { @@ -1175,12 +1166,7 @@ void reset_metadata_spatial_fx( { hMetaData->ind_list[0].value = 1; move16(); -#ifdef NONBE_FIX_1052_SBA_EXT metadata_sid_bits = (int16_t) ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS - SBA_PLANAR_BITS - SBA_ORDER_BITS; -#else - metadata_sid_bits = (Word16) ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS; - move16(); -#endif WHILE( ( hMetaData->nb_bits_tot < metadata_sid_bits ) ) { diff --git a/lib_enc/ivas_sce_enc_fx.c b/lib_enc/ivas_sce_enc_fx.c index 873af3fa388977679d780fd44100bbd024f30255..180e175ec52e6ee362ee380904ebea9eabe6ea4d 100644 --- a/lib_enc/ivas_sce_enc_fx.c +++ b/lib_enc/ivas_sce_enc_fx.c @@ -309,21 +309,7 @@ ivas_error ivas_sce_enc_fx( IF( EQ_32( st->core_brate, SID_2k40 ) ) { -#ifdef NONBE_FIX_1052_SBA_EXT_FIX ivas_write_format_sid_fx( ivas_format, IVAS_SCE, st->hBstr, st_ivas->hEncoderConfig->sba_order, st_ivas->hEncoderConfig->sba_planar ); -#else - ivas_write_format_sid_fx( ivas_format, IVAS_SCE, st->hBstr ); -#ifdef NONBE_FIX_1052_SBA_EXT - IF( EQ_32( ivas_format, SBA_FORMAT ) ) - { - /* Write SBA planar flag */ - push_indice( st->hBstr, IND_SMODE, st_ivas->hEncoderConfig->sba_planar, SBA_PLANAR_BITS ); - - /* Write SBA order */ - push_indice( st->hBstr, IND_SMODE, st_ivas->hEncoderConfig->sba_order, SBA_ORDER_BITS ); - } -#endif -#endif } /*----------------------------------------------------------------* diff --git a/lib_enc/ivas_spar_encoder_fx.c b/lib_enc/ivas_spar_encoder_fx.c index 12e9d1510ebf7239aeffff498471235b86bf9f7a..04b4049a7eefa7d12d9752309c5cdbc10ad741df 100644 --- a/lib_enc/ivas_spar_encoder_fx.c +++ b/lib_enc/ivas_spar_encoder_fx.c @@ -864,17 +864,10 @@ static ivas_error ivas_spar_enc_process_fx( } pp_fr_q = add( FR_q, pp_fr_q ); -#ifdef NONBE_FIX_1052_SBA_EXT IF( NE_32( ( error = ivas_dirac_enc_fx( st_ivas->hDirAC, hQMetaData, hMetaData, data_fx, ppIn_FR_real_fx, ppIn_FR_imag_fx, pp_fr_q, input_frame, dtx_vad, hEncoderConfig->ivas_format, nchan_transport, hodirac_flag, shift ) ), IVAS_ERR_OK ) ) { return error; } -#else - IF( NE_32( ( error = ivas_dirac_enc_fx( st_ivas->hDirAC, hQMetaData, hMetaData, data_fx, ppIn_FR_real_fx, ppIn_FR_imag_fx, pp_fr_q, input_frame, dtx_vad, hEncoderConfig->ivas_format, hodirac_flag, shift ) ), IVAS_ERR_OK ) ) - { - return error; - } -#endif /* Set Energy Ratio to 0.0 if the mono flag has been set */ IF( hQMetaData->dirac_mono_flag ) diff --git a/lib_enc/ivas_spar_md_enc_fx.c b/lib_enc/ivas_spar_md_enc_fx.c index 14f8acba6673d6d5e2113b0b064a090096f462fe..33a02669ef1e3aa915f900fe9a1da6ebeaf72b43 100644 --- a/lib_enc/ivas_spar_md_enc_fx.c +++ b/lib_enc/ivas_spar_md_enc_fx.c @@ -1712,9 +1712,7 @@ static void ivas_write_parameter_bitstream_dtx_fx( Word16 idx; Word32 pr_min_max[2]; Word16 zero_pad_bits, sid_bits_len; -#ifdef NONBE_FIX_1052_SBA_EXT Word16 sba_spar_bitlen; -#endif sid_bits_len = hMetaData->nb_bits_tot; move16(); @@ -1791,12 +1789,8 @@ static void ivas_write_parameter_bitstream_dtx_fx( } sid_bits_len = sub( hMetaData->nb_bits_tot, sid_bits_len ); -#ifdef NONBE_FIX_1052_SBA_EXT sba_spar_bitlen = ivas_sba_spar_sid_bitlen_fx( num_dmx[0] ); zero_pad_bits = sub( sba_spar_bitlen, sid_bits_len ); -#else - zero_pad_bits = sub( i_mult( SPAR_DTX_BANDS, SPAR_SID_BITS_TAR_PER_BAND ), sid_bits_len ); -#endif assert( zero_pad_bits >= 0 ); IF( EQ_16( num_dmx[0], 2 ) ) diff --git a/lib_enc/ivas_stat_enc.h b/lib_enc/ivas_stat_enc.h index 428ed19e17544f101e80596a183f80e85502b1c8..e3f40478e62734ddc9d4aa687999ef97080b18b0 100644 --- a/lib_enc/ivas_stat_enc.h +++ b/lib_enc/ivas_stat_enc.h @@ -877,7 +877,6 @@ typedef struct ivas_omasa_enc_state_structure } OMASA_ENC_STATE, *OMASA_ENC_HANDLE; -#ifdef FIX_1161_REDUCE_OMASA_HEAP typedef struct ivas_omasa_encoder_energy_struct { Word32 energy_ism_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; @@ -887,17 +886,9 @@ typedef struct ivas_omasa_encoder_energy_struct } OMASA_ENCODER_ENERGY_STATE, *OMASA_ENCODER_ENERGY_HANDLE; -#endif typedef struct ivas_omasa_encoder_data_struct { -#ifdef FIX_1161_REDUCE_OMASA_HEAP OMASA_ENCODER_ENERGY_HANDLE hOmasaEnergy; -#else - Word32 energy_ism_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; - Word16 energy_ism_fx_e[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; - Word32 energy_ratio_ism_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS]; /*q30*/ - Word32 q_energy_ratio_ism_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS]; /* Q30 */ -#endif Word32 masa_to_total_energy_ratio_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; /* Q30 */ Word16 lp_noise_CPE_fx; /* LP filtered total noise estimation Q8 */ diff --git a/lib_enc/ivas_stereo_mdct_stereo_enc_fx.c b/lib_enc/ivas_stereo_mdct_stereo_enc_fx.c index db634379ac4a5701c22b99babd6ccf07c6d1f456..23094eb22427e41b2be53d56139a77e49d07cf22 100644 --- a/lib_enc/ivas_stereo_mdct_stereo_enc_fx.c +++ b/lib_enc/ivas_stereo_mdct_stereo_enc_fx.c @@ -472,7 +472,6 @@ void stereo_coder_tcx_fx( nAvailBitsMS[k] = idiv1616( nAvailBitsMS[k], nSubframes ); /* Q0 */ move16(); -#ifdef NONBE_1329_FIX_OSBA_CRASH test(); IF( mct_on && LE_16( nAvailBitsMS[k], 0 ) ) /*Force M/S when bit-budget is low for MCT*/ { @@ -484,7 +483,6 @@ void stereo_coder_tcx_fx( } ELSE { -#endif MsStereoDecision_fx( sfbConf, sts[0]->hTcxEnc->spectrum_fx[k], sts[1]->hTcxEnc->spectrum_fx[k], inv_spectrum_fx[0][k], inv_spectrum_fx[1][k], sub( Q31, exp_spec ), &hStereoMdct->mdct_stereo_mode[k], &ms_mask[k][0], nAvailBitsMS[k] ); IF( sts[0]->igf ) @@ -497,9 +495,7 @@ void stereo_coder_tcx_fx( hStereoMdct->IGFStereoMode[k] = hStereoMdct->mdct_stereo_mode[k]; move16(); } -#ifdef NONBE_1329_FIX_OSBA_CRASH } -#endif IF( NE_16( hStereoMdct->mdct_stereo_mode[k], SMDCT_DUAL_MONO ) || NE_16( hStereoMdct->IGFStereoMode[k], SMDCT_DUAL_MONO ) ) { diff --git a/lib_enc/ivas_stereo_switching_enc_fx.c b/lib_enc/ivas_stereo_switching_enc_fx.c index 5663a4f4f0665d7997894dc6003a9204229a5621..469bf211aa443e9fe034f37021355f840f627d34 100644 --- a/lib_enc/ivas_stereo_switching_enc_fx.c +++ b/lib_enc/ivas_stereo_switching_enc_fx.c @@ -906,10 +906,8 @@ void stereo_switching_enc_fx( Copy( sts[0]->lsf_old1_fx, sts[1]->lsf_old1_fx, M ); /* Qlog2(2.56) */ Copy( sts[0]->lsp_old1_fx, sts[1]->lsp_old1_fx, M ); /* Q15 */ -#ifdef NONBE_FIX_1110_STEREO_DTX_BRATE_SWITCHING sts[1]->last_core_brate = sts[0]->last_core_brate; move16(); -#endif sts[1]->GSC_noisy_speech = 0; move16(); diff --git a/lib_enc/ivas_td_low_rate_enc_fx.c b/lib_enc/ivas_td_low_rate_enc_fx.c index d25e222f2b467ccdf8e2abd1b407947e6680cf74..71b31130ac2a29cc7574e167fd8258606e19ab42 100644 --- a/lib_enc/ivas_td_low_rate_enc_fx.c +++ b/lib_enc/ivas_td_low_rate_enc_fx.c @@ -274,16 +274,12 @@ void encod_gen_2sbfr( * Close-loop pitch search on the 1st and 3rd subfr only and quantization * Adaptive exc. construction *------------------------------------------------------------------------*/ -#ifndef REUSE_EVS_BE_ACELP_PITCH - *pt_pitch = pit_encode_ivas_fx( st->hBstr, st->acelp_cfg.pitch_bits, st->core_brate, 0, L_frame, coder_type, &pitch_limit_flag, i_subfr, exc, 2 * L_SUBFR, st->pitch, &T0_min, &T0_max, &T0, &T0_frac, h1, xn, tdm_Pitch_reuse_flag, tdm_Pri_pitch_buf, Q_new ); -#else *pt_pitch = pit_encode_fx( st->hBstr, st->acelp_cfg.pitch_bits, st->core_brate, 0, L_frame, coder_type, &pitch_limit_flag, i_subfr, exc, 2 * L_SUBFR, st->pitch, &T0_min, &T0_max, &T0, &T0_frac, h1, xn, tdm_Pitch_reuse_flag, tdm_Pri_pitch_buf -#if defined REUSE_EVS_BE_ACELP_PITCH && !defined REUSE_EVS_ACELP_PITCH_NORM_CORR +#if !defined REUSE_EVS_ACELP_PITCH_NORM_CORR , st->element_mode, Q_new #endif ); -#endif move16(); Scale_sig( h1, 2 * L_SUBFR, sub( 13, q_h1 ) ); // Q13 @@ -306,11 +302,7 @@ void encod_gen_2sbfr( *-----------------------------------------------------------------*/ Scale_sig( h1, 2 * L_SUBFR, add( 1, shift ) ); /* set h1[] in Q14 with scaling for convolution */ -#ifndef REUSE_EVS_BE_ACELP_LP_FILT - lp_filt_exc_enc_ivas_fx( MODE1, coder_type, i_subfr, exc, h1, xn, y1, xn2, 2 * L_SUBFR, L_frame, g_corr, clip_gain, &gain_pit, &st->acelp_cfg.ltf_mode ); -#else lp_filt_exc_enc_fx( MODE1, coder_type, i_subfr, exc, h1, xn, y1, xn2, 2 * L_SUBFR, L_frame, g_corr, clip_gain, &gain_pit, &st->acelp_cfg.ltf_mode ); -#endif /* update long-term pitch gain for speech/music classifier */ st->hSpMusClas->lowrate_pitchGain = add( mult( 29491, st->hSpMusClas->lowrate_pitchGain ), mult( 3277 /*Q15*/, gain_pit ) ); // Q14 move16(); @@ -325,16 +317,8 @@ void encod_gen_2sbfr( * Gain encoding *-----------------------------------------------------------------*/ -#ifndef REUSE_EVS_BE_GAINQ_LBR - gain_enc_lbr_ivas_fx( st->hBstr, st->acelp_cfg.gains_mode, coder_type, i_subfr, xn, y1, add( sub( Q_new, 1 ), shift ), y2, code, &gain_pit, &gain_code, &gain_inov, &norm_gain_code, g_corr, gc_mem, gp_mem, clip_gain, 2 * L_SUBFR ); -#else - gain_enc_lbr_fx( st->hBstr, st->acelp_cfg.gains_mode, coder_type, i_subfr, xn, y1, add( sub( Q_new, 1 ), shift ), y2, code, &gain_pit, &gain_code, &gain_inov, &norm_gain_code, g_corr, gc_mem, gp_mem, clip_gain, 2 * L_SUBFR -#ifdef REUSE_EVS_BE_GAINQ_LBR - , - st->element_mode -#endif - ); -#endif + gain_enc_lbr_fx( st->hBstr, st->acelp_cfg.gains_mode, coder_type, i_subfr, xn, y1, add( sub( Q_new, 1 ), shift ), y2, code, &gain_pit, &gain_code, &gain_inov, &norm_gain_code, g_corr, gc_mem, gp_mem, clip_gain, 2 * L_SUBFR, + st->element_mode ); IF( st->Opt_SC_VBR ) { if ( EQ_16( st->hSC_VBR->last_ppp_mode, 1 ) ) diff --git a/lib_enc/lp_exc_e_fx.c b/lib_enc/lp_exc_e_fx.c index 4172f5bcace767aded76924fcfc739c2d6540432..3b77bf3cd4697c528d9248c1aadf575422f1cf9a 100644 --- a/lib_enc/lp_exc_e_fx.c +++ b/lib_enc/lp_exc_e_fx.c @@ -173,164 +173,6 @@ Word16 lp_filt_exc_enc_fx( return select; } -#ifndef REUSE_EVS_BE_ACELP_LP_FILT - -Word16 lp_filt_exc_enc_ivas_fx( - const Word16 codec_mode, /* i : MODE1 or MODE2 Q0 */ - const Word16 coder_type, /* i : coding type Q0 */ - const Word16 i_subfr, /* i : subframe index Q0 */ - Word16 *exc, /* i/o: pointer to excitation signal frame Q_new */ - const Word16 *h1, /* i : weighted filter input response Q(15) */ - const Word16 *xn, /* i : target vector Q_new-1+shift */ - Word16 *y1, /* o : zero-memory filtered adaptive excitation Q_new-1+shift */ - Word16 *xn2, /* o : target vector for innovation search Q_new-1+shift */ - const Word16 L_subfr, /* i : length of vectors for gain quantization Q0 */ - const Word16 L_frame, /* i : frame size Q0 */ - Word16 *g_corr, /* o : ACELP correlation values mant/exp */ - const Word16 clip_gain, /* i : adaptive gain clipping flag Q0 */ - Word16 *gain_pit, /* o : adaptive excitation gain Q14 */ - Word16 *lp_flag /* i/o: mode selection Q0 */ -) -{ - Word16 gain1, gain2, g_corr2[4], exc_tmp[5 * L_SUBFR], xn2_tmp[5 * L_SUBFR]; - Word16 y1_tmp[5 * L_SUBFR]; - Word16 select, i, exp_ener, exp_ener1; - Word16 wtmp, wtmp1; - Word32 Ltmp; - - Word16 use_prev_sf_pit_gain = 0; // Q0 - move16(); - - gain1 = 0; - move16(); - gain2 = 0; - move16(); - - /*----------------------------------------------------------------* - * Find the target energy if the adaptive exc. is not filtered - *----------------------------------------------------------------*/ - test(); - IF( EQ_16( codec_mode, MODE2 ) && EQ_16( coder_type, 100 ) ) - { - use_prev_sf_pit_gain = 1; // Q0 - move16(); - } - exp_ener = 0; - move16(); - wtmp = 0; - move16(); - test(); - IF( EQ_16( *lp_flag, FULL_BAND ) || EQ_16( *lp_flag, NORMAL_OPERATION ) ) - { - IF( EQ_16( use_prev_sf_pit_gain, 1 ) ) - { - wtmp = adpt_enr_fx( codec_mode, &exc[i_subfr], h1, y1, L_subfr, gain_pit, g_corr, clip_gain, xn, xn2, &exp_ener, use_prev_sf_pit_gain ); // exp_ener - } - ELSE - { - wtmp = adpt_enr_fx( codec_mode, &exc[i_subfr], h1, y1, L_subfr, &gain1, g_corr, clip_gain, xn, xn2, &exp_ener, use_prev_sf_pit_gain ); // exp_ener - } - } - - /*----------------------------------------------------------------* - * Filter the adaptive excitation - * Find the target energy if the adapt. exc. is filtered - *----------------------------------------------------------------*/ - - exp_ener1 = 0; - move16(); - wtmp1 = 0; - move16(); - test(); - IF( ( ( *lp_flag == LOW_PASS ) ) || ( EQ_16( *lp_flag, NORMAL_OPERATION ) ) ) - { - test(); - IF( EQ_16( codec_mode, MODE2 ) && EQ_16( L_frame, L_FRAME16k ) ) - { - FOR( i = 0; i < L_subfr; i++ ) - { - Ltmp = L_mult( 6881, exc[i - 1 + i_subfr] ); /* constants in Q15 */ - Ltmp = L_mac( Ltmp, 19005, exc[i + i_subfr] ); - Ltmp = L_mac( Ltmp, 6881, exc[i + 1 + i_subfr] ); - exc_tmp[i] = round_fx( Ltmp ); - move16(); - } - } - ELSE - { - FOR( i = 0; i < L_subfr; i++ ) - { - Ltmp = L_mult( 5898, exc[i - 1 + i_subfr] ); /* constants in Q15 */ - Ltmp = L_mac( Ltmp, 20972, exc[i + i_subfr] ); - Ltmp = L_mac( Ltmp, 5898, exc[i + 1 + i_subfr] ); - exc_tmp[i] = round_fx( Ltmp ); - move16(); - } - } - IF( EQ_16( use_prev_sf_pit_gain, 1 ) ) - { - wtmp1 = adpt_enr_fx( codec_mode, exc_tmp, h1, y1_tmp, L_subfr, gain_pit, g_corr2, clip_gain, xn, xn2_tmp, &exp_ener1, use_prev_sf_pit_gain ); // exp_ener1 - } - ELSE - { - wtmp1 = adpt_enr_fx( codec_mode, exc_tmp, h1, y1_tmp, L_subfr, &gain2, g_corr2, clip_gain, xn, xn2_tmp, &exp_ener1, use_prev_sf_pit_gain ); // exp_ener1 - } - } - - if ( LT_16( exp_ener, exp_ener1 ) ) - { - wtmp = shr( wtmp, 1 ); - } - - if ( GT_16( exp_ener, exp_ener1 ) ) - { - wtmp1 = shr( wtmp1, 1 ); - } - - /*-----------------------------------------------------------------* - * use the best prediction (minimize quadratic error) - *-----------------------------------------------------------------*/ - - test(); - test(); - IF( ( ( LT_16( wtmp1, wtmp ) ) && ( EQ_16( *lp_flag, NORMAL_OPERATION ) ) ) || ( ( *lp_flag == LOW_PASS ) ) ) - { - /* use the LP filter for pitch excitation prediction */ - select = LOW_PASS; - move16(); - Copy( exc_tmp, &exc[i_subfr], L_subfr ); // Q_new - Copy( y1_tmp, y1, L_subfr ); // Q_new-1+shift - Copy( xn2_tmp, xn2, L_subfr ); // Q_new-1+shift - - IF( use_prev_sf_pit_gain == 0 ) - { - *gain_pit = gain2; // Q14 - move16(); - g_corr[0] = g_corr2[0]; - move16(); - g_corr[1] = g_corr2[1]; - move16(); - g_corr[2] = g_corr2[2]; - move16(); - g_corr[3] = g_corr2[3]; - move16(); - } - } - ELSE - { - /* no LP filter used for pitch excitation prediction */ - select = FULL_BAND; - move16(); - IF( use_prev_sf_pit_gain == 0 ) - { - *gain_pit = gain1; // Q14 - move16(); - } - } - - return select; -} -#endif /*-------------------------------------------------------------------* * adpt_enr_fx() * diff --git a/lib_enc/lsf_enc_fx.c b/lib_enc/lsf_enc_fx.c index 8db83c2b9c6cff417d8bdb6e4d298278c7d5fc4a..505114459b9f39d71d0cc62afd1a7713e61e61d6 100644 --- a/lib_enc/lsf_enc_fx.c +++ b/lib_enc/lsf_enc_fx.c @@ -784,11 +784,7 @@ static Word16 qlsf_Mode_Select_fx( { pred_pow2[i] = shl( pred1[i], cs ); move16(); -#ifdef ISSUE_1796_replace_shl_o En = L_mac_o( En, mult( pred_pow2[i], shl_sat( w[i], 2 ) ), pred_pow2[i], &Overflow ); /* 2.56*2.56 at Q-4 */ -#else - En = L_mac_o( En, mult( pred_pow2[i], shl_o( w[i], 2, &Overflow ) ), pred_pow2[i], &Overflow ); /* 2.56*2.56 at Q-4 */ -#endif } cs = shl( cs, 1 ); @@ -2369,11 +2365,6 @@ static Word32 vq_lvq_lsf_enc( Word16 quant[LSFMBEST][M], diff[M], dd[M]; Word16 lat_cv[LSFMBEST][M]; Word16 idx_lead[LSFMBEST][2], idx_scale[LSFMBEST][2]; -#ifndef ISSUE_1796_replace_shl_o -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; -#endif -#endif stagesVQ = sub( stages, 1 ); /* Codebook selection */ @@ -2424,25 +2415,13 @@ static Word32 vq_lvq_lsf_enc( Vr_subt( cand[i], lsf, diff, M ); FOR( j = 0; j < M; j++ ) { -#ifdef ISSUE_1796_replace_shl_o diff[j] = shl_sat( diff[j], 4 ); -#else - diff[j] = shl_o( diff[j], 4, &Overflow ); -#endif move16(); } -#ifdef ISSUE_1796_replace_shl_o L_tmp = L_mult( mult( diff[0], shl_sat( w[0], 1 ) ), diff[0] ); /*(2.56+Q5+ Q10 -Q15) + 2.56+ Q5 + Q1 = 2.56 + 2.56 + Q6 */ -#else - L_tmp = L_mult( mult( diff[0], shl_o( w[0], 1, &Overflow ) ), diff[0] ); /*(2.56+Q5+ Q10 -Q15) + 2.56+ Q5 + Q1 = 2.56 + 2.56 + Q6 */ -#endif FOR( j = 1; j < M; j++ ) { -#ifdef ISSUE_1796_replace_shl_o L_tmp = L_mac( L_tmp, mult( diff[j], shl_sat( w[j], 1 ) ), diff[j] ); /*(2.56+Q5+ Q10 -Q15) + 2.56+ Q5 + Q1 = 2.56 + 2.56 + Q6 */ -#else - L_tmp = L_mac( L_tmp, mult( diff[j], shl_o( w[j], 1, &Overflow ) ), diff[j] ); /*(2.56+Q5+ Q10 -Q15) + 2.56+ Q5 + Q1 = 2.56 + 2.56 + Q6 */ -#endif } e[i] = L_tmp; /*(2.56+Q5+ Q10 -Q15) + 2.56+ Q5 + Q1 = 2.56 + 2.56 + Q6 */ move32(); @@ -2489,11 +2468,6 @@ static Word32 vq_lvq_lsf_enc_ivas_fx( Word16 quant[LSFMBEST][M], diff[M], dd[M]; Word16 lat_cv[LSFMBEST][M]; Word16 idx_lead[LSFMBEST][2], idx_scale[LSFMBEST][2]; -#ifndef ISSUE_1796_replace_shl_o -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; -#endif -#endif stagesVQ = sub( stages, 1 ); /* Codebook selection */ @@ -2561,25 +2535,13 @@ static Word32 vq_lvq_lsf_enc_ivas_fx( Vr_subt( cand[i], lsf, diff, M ); FOR( j = 0; j < M; j++ ) { -#ifdef ISSUE_1796_replace_shl_o diff[j] = shl_sat( diff[j], 4 ); -#else - diff[j] = shl_o( diff[j], 4, &Overflow ); -#endif move16(); } -#ifdef ISSUE_1796_replace_shl_o L_tmp = L_mult( mult( diff[0], shl_sat( w[0], 1 ) ), diff[0] ); /*(2.56+Q5+ Q10 -Q15) + 2.56+ Q5 + Q1 = 2.56 + 2.56 + Q6 */ -#else - L_tmp = L_mult( mult( diff[0], shl_o( w[0], 1, &Overflow ) ), diff[0] ); /*(2.56+Q5+ Q10 -Q15) + 2.56+ Q5 + Q1 = 2.56 + 2.56 + Q6 */ -#endif FOR( j = 1; j < M; j++ ) { -#ifdef ISSUE_1796_replace_shl_o L_tmp = L_mac( L_tmp, mult( diff[j], shl_sat( w[j], 1 ) ), diff[j] ); /*(2.56+Q5+ Q10 -Q15) + 2.56+ Q5 + Q1 = 2.56 + 2.56 + Q6 */ -#else - L_tmp = L_mac( L_tmp, mult( diff[j], shl_o( w[j], 1, &Overflow ) ), diff[j] ); /*(2.56+Q5+ Q10 -Q15) + 2.56+ Q5 + Q1 = 2.56 + 2.56 + Q6 */ -#endif } e[i] = L_tmp; move32(); @@ -3428,11 +3390,7 @@ Word32 qlsf_ARSN_tcvq_Enc_16k_fx( { yy_fx[i] = shl( yy_fx[i], cs ); move16(); -#ifdef ISSUE_1796_replace_shl_o temp_l = L_mac_o( temp_l, mult( yy_fx[i], shl_sat( w_fx[i], 2 ) ), yy_fx[i], &Overflow ); -#else - temp_l = L_mac_o( temp_l, mult( yy_fx[i], shl_o( w_fx[i], 2, &Overflow ) ), yy_fx[i], &Overflow ); -#endif } cs = shl( cs, 1 ); temp_l = L_shr( temp_l, cs ); @@ -3636,17 +3594,9 @@ static void lsf_mid_enc_fx( tmp = sub( lsf[j], qlsf[j] ); /* err += wghts[j] * ftemp * ftemp; */ /* tmp is usually very small, we can have some extra precision with very rare saturation */ -#ifdef ISSUE_1796_replace_shl_o tmp = shl_sat( tmp, 4 ); -#else - tmp = shl_o( tmp, 4, &Overflow ); -#endif tmp = mult_ro( tmp, tmp, &Overflow ); -#ifdef ISSUE_1796_replace_shl_o err = L_mac_o( err, tmp, shl_sat( wghts[j], 2 ), &Overflow ); -#else - err = L_mac_o( err, tmp, shl_o( wghts[j], 2, &Overflow ), &Overflow ); -#endif } /* err = L_shl(err,Wscale); */ err = Mult_32_16( err, LSF_1_OVER_256SQ ); @@ -3830,17 +3780,9 @@ static void lsf_mid_enc_ivas_fx( tmp = sub( lsf[j], qlsf[j] ); /* err += wghts[j] * ftemp * ftemp; */ /* tmp is usually very small, we can have some extra precision with very rare saturation */ -#ifdef ISSUE_1796_replace_shl_o tmp = shl_sat( tmp, 4 ); -#else - tmp = shl_o( tmp, 4, &Overflow ); -#endif tmp = mult_ro( tmp, tmp, &Overflow ); -#ifdef ISSUE_1796_replace_shl_o err = L_mac_o( err, tmp, shl_sat( wghts[j], 2 ), &Overflow ); -#else - err = L_mac_o( err, tmp, shl_o( wghts[j], 2, &Overflow ), &Overflow ); -#endif } /* err = L_shl(err,Wscale); */ err = Mult_32_16( err, LSF_1_OVER_256SQ ); diff --git a/lib_enc/lsf_msvq_ma_enc_fx.c b/lib_enc/lsf_msvq_ma_enc_fx.c index 981c7e51c06cac2b4b196761e84ada582f34549d..8e04e86d9e10435a9bb24017cfeb8c653a41bb5a 100644 --- a/lib_enc/lsf_msvq_ma_enc_fx.c +++ b/lib_enc/lsf_msvq_ma_enc_fx.c @@ -1630,11 +1630,7 @@ void midlsf_enc_fx( tmp = sub( lsf[j], qlsf[j] ); /* err += wghts[j] * ftemp * ftemp; */ /* tmp is usually very small, we can have some extra precision with very rare saturation */ -#ifdef ISSUE_1796_replace_shl_o tmp = shl_sat( tmp, 4 ); -#else - tmp = shl_o( tmp, 4, &Overflow ); -#endif tmp = mult_ro( tmp, tmp, &Overflow ); err = L_mac( err, tmp, wghts[j] ); } diff --git a/lib_enc/nois_est_fx.c b/lib_enc/nois_est_fx.c index ec358200337d542ed7bcd30fc45ca2d5c1f294d4..0446c3078c1273daab3af74fb6065fcfb9bef500 100644 --- a/lib_enc/nois_est_fx.c +++ b/lib_enc/nois_est_fx.c @@ -1211,11 +1211,7 @@ void noise_est_fx( /* calculation of energy in the rest of bands */ Ltmp2 = sum32_fx( &fr_bands[10], sub( st_fx->max_band, 9 ) ); -#ifdef ISSUE_1796_replace_shl_o wtmp = shl_sat( 1, sub( add( Q_new, QSCALE ), 1 ) ); -#else - wtmp = shl_o( 1, sub( add( Q_new, QSCALE ), 1 ), &Overflow ); -#endif test(); IF( L_msu( Ltmp, 100, wtmp ) < 0 || L_msu( Ltmp2, 100, wtmp ) < 0 ) @@ -2472,12 +2468,8 @@ void noise_est_ivas_fx( ExpDen = sub( add( q_fr_bands, exp ), Q16 ); } - num = div_s( num, den ); // Q15+ExpNum-ExpDen -#ifdef FIX_ISSUE_1811_EXCEEDING_W_SHIFTS + num = div_s( num, den ); // Q15+ExpNum-ExpDen w_tmp = W_shl( num, s_min( 63, sub( q_fr_bands, sub( ExpNum, ExpDen ) ) ) ); // q_fr_bands+15 -#else - w_tmp = W_shl( num, sub( q_fr_bands, sub( ExpNum, ExpDen ) ) ); // q_fr_bands+15 -#endif w_sum_num = W_add( w_sum_num, w_tmp ); pt1++; @@ -2556,12 +2548,8 @@ void noise_est_ivas_fx( ELSE { /* ftemp2 /= ftemp */ - num = div_s( extract_h( Ltmp2 ), extract_h( Ltmp ) ); // 15+exp2-exp -#ifdef ISSUE_1796_replace_shl_o + num = div_s( extract_h( Ltmp2 ), extract_h( Ltmp ) ); // 15+exp2-exp noise_chartmp = shl_sat( num, sub( sub( exp, exp2 ), 4 ) ); // 15+exp2-exp1 -> Q11 -#else - noise_chartmp = shl_o( num, sub( sub( exp, exp2 ), 4 ), &Overflow ); // 15+exp2-exp1 -> Q11 -#endif } if ( ncharX != NULL ) diff --git a/lib_enc/pit_enc_fx.c b/lib_enc/pit_enc_fx.c index 510761a63f703a78c7f10063c1a06ae01f1a66b5..c629597995f4f9ef6c002caab243ab8dcbe0a82a 100644 --- a/lib_enc/pit_enc_fx.c +++ b/lib_enc/pit_enc_fx.c @@ -74,7 +74,7 @@ Word16 pit_encode_fx( /* o : Fractional pitc const Word16 *xn, /* i : target vector */ const Word16 tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag */ const Word16 tdm_Pri_pitch_buf[] /* i : primary channel pitch buffer */ -#if defined REUSE_EVS_BE_ACELP_PITCH && !defined REUSE_EVS_ACELP_PITCH_NORM_CORR +#if !defined REUSE_EVS_ACELP_PITCH_NORM_CORR , const Word16 element_mode, /* i : mode element */ const Word16 Q_new /* i : scaling factor */ @@ -85,521 +85,6 @@ Word16 pit_encode_fx( /* o : Fractional pitc Word16 pit_flag, delta, mult_Top, nBits; Word16 L_sufr_sft; Word16 T_op[2]; /* values for two half-frames */ -#ifndef REUSE_EVS_BE_ACELP_PITCH - (void) tdm_Pitch_reuse_flag; -#endif - L_sufr_sft = 6; - move16(); - if ( EQ_16( L_subfr, 2 * L_SUBFR ) ) - { - L_sufr_sft = 7; - move16(); - } - - /*----------------------------------------------------------------* - * convert pitch values to 16kHz domain - *----------------------------------------------------------------*/ - test(); - test(); - IF( EQ_16( L_frame, L_FRAME ) || ( tdm_Pri_pitch_buf != NULL && tdm_Pri_pitch_buf[0] < 0 ) ) - { - Copy( pitch, T_op, 2 ); - } - ELSE /* L_frame == L_FRAME16k */ - { - /*T_op[0] = (int16_t)(pitch[0] * 1.25f + 0.5f); - T_op[1] = (int16_t)(pitch[1] * 1.25f + 0.5f);*/ - T_op[0] = shr( add( round_fx( L_shl( L_mult( 20480, pitch[0] ), 2 ) ), 1 ), 1 ); - move16(); - T_op[1] = shr( add( round_fx( L_shl( L_mult( 20480, pitch[1] ), 2 ) ), 1 ), 1 ); - move16(); - } - - /*----------------------------------------------------------------* - * Set pit_flag to 0 for every subframe with absolute pitch search - *----------------------------------------------------------------*/ - pit_flag = i_subfr; - move16(); - if ( EQ_16( i_subfr, 2 * L_SUBFR ) ) - { - pit_flag = 0; - move16(); - } - - /*-----------------------------------------------------------------* - * Limit range of pitch search - * Fractional pitch search - * Pitch quantization - *-----------------------------------------------------------------*/ - mult_Top = 1; - move16(); - - IF( !Opt_AMR_WB ) - { - /*----------------------------------------------------------------* - * pitch Q: Set limit_flag to 0 for restrained limits, and 1 for extended limits - *----------------------------------------------------------------*/ - test(); - test(); - IF( i_subfr == 0 ) - { - *limit_flag = 1; - move16(); - if ( EQ_16( coder_type, VOICED ) ) - { - *limit_flag = 2; - move16(); /* double-extended limits */ - } - test(); - if ( EQ_16( coder_type, GENERIC ) && EQ_32( core_brate, ACELP_7k20 ) ) - { - *limit_flag = 0; - move16(); - } - } - ELSE IF( EQ_16( i_subfr, 2 * L_SUBFR ) && EQ_16( coder_type, GENERIC ) && LE_32( core_brate, ACELP_13k20 ) ) - { - /*if( *T0 > (PIT_FR1_EXTEND_8b + PIT_MIN)>>1 )*/ - if ( GT_16( *T0, shr( add( PIT_FR1_EXTEND_8b, PIT_MIN ), 1 ) ) ) - { - *limit_flag = 0; - move16(); - } - } - - IF( *limit_flag == 0 ) - { - test(); - test(); - IF( i_subfr == 0 && LT_16( T_op[0], PIT_MIN ) ) - { - mult_Top = 2; - move16(); - } - ELSE IF( EQ_16( i_subfr, 2 * L_SUBFR ) && LT_16( T_op[1], PIT_MIN ) ) - { - mult_Top = 2; - move16(); - } - } - /*-------------------------------------------------------* - * Retrieve the number of Q bits - *-------------------------------------------------------*/ - nBits = 0; - move16(); - IF( NE_16( coder_type, AUDIO ) ) - { - nBits = pitch_bits[i_subfr >> L_sufr_sft]; - move16(); - } - IF( EQ_16( coder_type, AUDIO ) ) - { - /*-------------------------------------------------------* - * Pitch encoding in AUDIO coder type - * (both ACELP@12k8 and ACELP@16k cores) - *-------------------------------------------------------*/ - - delta = 4; - move16(); - test(); - test(); - if ( EQ_16( L_subfr, shr( L_frame, 1 ) ) && i_subfr != 0 && EQ_16( L_frame, L_FRAME ) ) - { - pit_flag = L_SUBFR; - move16(); - } - IF( pit_flag == 0 ) - { - nBits = 10; - move16(); - } - ELSE - { - nBits = 6; - move16(); - } - - /* pitch lag search limitation */ - test(); - IF( i_subfr == 0 ) - { - limit_T0_fx( L_frame, delta, pit_flag, *limit_flag, mult_Top * T_op[0], 0, T0_min, T0_max ); - } - ELSE IF( EQ_16( i_subfr, 2 * L_SUBFR ) && pit_flag == 0 ) - { - limit_T0_fx( L_frame, delta, pit_flag, *limit_flag, mult_Top * T_op[1], 0, T0_min, T0_max ); - } - - /* search and encode the closed loop pitch period */ - *T0 = pitch_fr4_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT_MAX, PIT_MAX, L_FRAME, L_subfr -#if defined REUSE_EVS_BE_ACELP_PITCH && !defined REUSE_EVS_ACELP_PITCH_NORM_CORR - , - element_mode, Q_new -#endif - ); - move16(); - pit_Q_enc_fx( hBstr, 0, nBits, delta, pit_flag, *limit_flag, *T0, *T0_frac, T0_min, T0_max ); - } - ELSE IF( EQ_16( coder_type, VOICED ) ) - { - /*-------------------------------------------------------* - * Pitch encoding in VOICED code type (ACELP@12k8 core only) - *-------------------------------------------------------*/ - - delta = 4; - move16(); - if ( EQ_16( i_subfr, 2 * L_SUBFR ) ) - { - pit_flag = i_subfr; - move16(); - } - - /* pitch lag search limitation */ - IF( i_subfr == 0 ) - { - limit_T0_fx( L_FRAME, delta, pit_flag, *limit_flag, mult_Top * T_op[0], 0, T0_min, T0_max ); - } - - /* search and encode the closed loop pitch period */ - - test(); - IF( EQ_16( nBits, 9 ) || EQ_16( nBits, 5 ) ) - { - *T0 = pitch_fr4_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT_FR2_DOUBLEEXTEND_9b, PIT_FR1_DOUBLEEXTEND_9b, L_FRAME, L_SUBFR -#if defined REUSE_EVS_BE_ACELP_PITCH && !defined REUSE_EVS_ACELP_PITCH_NORM_CORR - , - element_mode, Q_new -#endif - ); - move16(); - } - ELSE IF( EQ_16( nBits, 10 ) ) - { - *T0 = pitch_fr4_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT_MAX, PIT_MAX, L_FRAME, L_SUBFR -#if defined REUSE_EVS_BE_ACELP_PITCH && !defined REUSE_EVS_ACELP_PITCH_NORM_CORR - , - element_mode, Q_new -#endif - - ); - move16(); - } - - pit_Q_enc_fx( hBstr, 0, nBits, delta, pit_flag, *limit_flag, *T0, *T0_frac, T0_min, T0_max ); - } -#ifdef REUSE_EVS_BE_ACELP_PITCH - ELSE IF( EQ_16( tdm_Pitch_reuse_flag, 1 ) || EQ_16( nBits, 4 ) ) - { - /*-------------------------------------------------------* - * Pitch encoding with reusing primary channel information - *-------------------------------------------------------*/ - Word16 loc_T0, loc_frac; - - delta = 4; - move16(); - - pit_flag = L_SUBFR; - move16(); - - Word16 idx1 = shr( i_subfr, L_sufr_sft ); - Word16 idx2 = shr( add( i_subfr, 64 ), L_sufr_sft ); - - IF( EQ_16( L_subfr, 2 * L_SUBFR ) ) - { - loc_T0 = add( shr( tdm_Pri_pitch_buf[idx1], 1 ), shr( tdm_Pri_pitch_buf[idx2], 1 ) ); // Q6 - loc_frac = shr( sub( loc_T0, shl( shr( loc_T0, 6 ), 6 ) ), 4 ); // Q2 - loc_T0 = shr( loc_T0, 6 ); // Q0 - } - ELSE - { - loc_T0 = tdm_Pri_pitch_buf[idx1]; // Q6 - loc_frac = shr( sub( loc_T0, shl( shr( loc_T0, 6 ), 6 ) ), 4 ); // Q2 - loc_T0 = shr( loc_T0, 6 ); // Q0 - } - - /* pitch lag search limitation */ - limit_T0_fx( L_FRAME, delta, pit_flag, *limit_flag, loc_T0, loc_frac, T0_min, T0_max ); - IF( nBits > 0 ) - { - /* search and encode the closed loop pitch period */ - *T0 = pitch_fr4_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT_MIN, PIT_FR1_8b, L_FRAME, L_SUBFR -#if defined REUSE_EVS_BE_ACELP_PITCH && !defined REUSE_EVS_ACELP_PITCH_NORM_CORR - , - element_mode, Q_new -#endif - ); - move16(); - IF( EQ_16( delta, 8 ) ) - { - *T0_frac = 0; - move16(); - } - pit_Q_enc_fx( hBstr, 0, nBits, delta, pit_flag, *limit_flag, *T0, *T0_frac, T0_min, T0_max ); - } - ELSE - { - *T0 = loc_T0; - move16(); - *T0_frac = loc_frac; - move16(); - } - } -#endif - ELSE - { - /*-------------------------------------------------------* - * Pitch encoding in GENERIC coder type - * (both ACELP@12k8 and ACELP@16k cores) - *-------------------------------------------------------*/ - - delta = 8; - move16(); - - /* pitch lag search limitation */ - IF( i_subfr == 0 ) - { - limit_T0_fx( L_frame, delta, pit_flag, *limit_flag, mult_Top * T_op[0], 0, T0_min, T0_max ); - } - ELSE IF( EQ_16( i_subfr, 2 * L_SUBFR ) ) - { - limit_T0_fx( L_frame, delta, pit_flag, *limit_flag, mult_Top * T_op[1], 0, T0_min, T0_max ); - } - - /* search and encode the closed loop pitch period */ - IF( EQ_16( L_frame, L_FRAME ) ) - { - test(); - test(); - IF( EQ_16( nBits, 8 ) || EQ_16( nBits, 5 ) ) - { - IF( *limit_flag == 0 ) - { - *T0 = pitch_fr4_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT_MIN, PIT_FR1_8b, L_FRAME, L_SUBFR -#if defined REUSE_EVS_BE_ACELP_PITCH && !defined REUSE_EVS_ACELP_PITCH_NORM_CORR - , - element_mode, Q_new -#endif - ); - move16(); - } - ELSE - { - *T0 = pitch_fr4_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT_MIN_EXTEND, PIT_FR1_EXTEND_8b, L_FRAME, L_SUBFR -#if defined REUSE_EVS_BE_ACELP_PITCH && !defined REUSE_EVS_ACELP_PITCH_NORM_CORR - , - element_mode, Q_new -#endif - ); - move16(); - } - } - ELSE IF( EQ_16( nBits, 9 ) || EQ_16( nBits, 6 ) ) - { - IF( *limit_flag == 0 ) - { - *T0 = pitch_fr4_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT_FR2_9b, PIT_FR1_9b, L_FRAME, L_SUBFR -#if defined REUSE_EVS_BE_ACELP_PITCH && !defined REUSE_EVS_ACELP_PITCH_NORM_CORR - , - element_mode, Q_new -#endif - ); - move16(); - } - ELSE - { - *T0 = pitch_fr4_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT_FR2_EXTEND_9b, PIT_FR1_EXTEND_9b, L_FRAME, L_SUBFR -#if defined REUSE_EVS_BE_ACELP_PITCH && !defined REUSE_EVS_ACELP_PITCH_NORM_CORR - , - element_mode, Q_new -#endif - ); - move16(); - } - } - ELSE IF( EQ_16( nBits, 10 ) ) - { - *T0 = pitch_fr4_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT_MAX, PIT_MAX, L_FRAME, L_SUBFR -#if defined REUSE_EVS_BE_ACELP_PITCH && !defined REUSE_EVS_ACELP_PITCH_NORM_CORR - , - element_mode, Q_new -#endif - ); - move16(); - } - - pit_Q_enc_fx( hBstr, 0, nBits, delta, pit_flag, *limit_flag, *T0, *T0_frac, T0_min, T0_max ); - } - ELSE /* L_frame == L_FRAME16k */ - { - test(); - IF( EQ_16( nBits, 9 ) || EQ_16( nBits, 6 ) ) - { - *T0 = pitch_fr4_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT16k_FR2_EXTEND_9b, PIT16k_FR1_EXTEND_9b, L_FRAME16k, L_SUBFR -#if defined REUSE_EVS_BE_ACELP_PITCH && !defined REUSE_EVS_ACELP_PITCH_NORM_CORR - , - element_mode, Q_new -#endif - ); - move16(); - } - ELSE IF( EQ_16( nBits, 10 ) ) - { - *T0 = pitch_fr4_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT16k_FR2_EXTEND_10b, PIT16k_MAX, L_FRAME16k, L_SUBFR -#if defined REUSE_EVS_BE_ACELP_PITCH && !defined REUSE_EVS_ACELP_PITCH_NORM_CORR - , - element_mode, Q_new -#endif - ); - move16(); - } - - pit16k_Q_enc_fx( hBstr, nBits, *limit_flag, *T0, *T0_frac, T0_min, T0_max ); - } - } - } - - /*-------------------------------------------------------* - * Pitch encoding in AMR-WB IO mode - *-------------------------------------------------------*/ - - ELSE - { - delta = 8; - move16(); - *limit_flag = 0; - move16(); - - IF( EQ_32( core_brate, ACELP_6k60 ) ) - { - nBits = 5; - move16(); - - /* pitch lag search limitation */ - IF( i_subfr == 0 ) - { - limit_T0_fx( L_FRAME, delta, pit_flag, *limit_flag, i_mult2( mult_Top, T_op[0] ), 0, T0_min, T0_max ); - nBits = 8; - move16(); - } - - if ( EQ_16( i_subfr, 2 * L_SUBFR ) ) - { - /* rewrite pit_flag - it must not be zero */ - pit_flag = i_subfr; - move16(); - } - - /* search and encode the closed loop pitch period */ - *T0 = pitch_fr4_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT_MIN, PIT_FR1_8b, L_FRAME, L_SUBFR -#if defined REUSE_EVS_BE_ACELP_PITCH && !defined REUSE_EVS_ACELP_PITCH_NORM_CORR - , - element_mode, Q_new -#endif - ); - move16(); - } - ELSE IF( EQ_32( core_brate, ACELP_8k85 ) ) - { - nBits = 5; - move16(); - - /* pitch lag search limitation */ - IF( i_subfr == 0 ) - { - limit_T0_fx( L_FRAME, delta, pit_flag, *limit_flag, i_mult2( mult_Top, T_op[0] ), 0, T0_min, T0_max ); - nBits = 8; - move16(); - } - ELSE IF( EQ_16( i_subfr, 2 * L_SUBFR ) ) - { - limit_T0_fx( L_FRAME, delta, pit_flag, *limit_flag, i_mult2( mult_Top, T_op[1] ), 0, T0_min, T0_max ); - nBits = 8; - move16(); - } - - /* search and encode the closed loop pitch period */ - *T0 = pitch_fr4_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT_MIN, PIT_FR1_8b, L_FRAME, L_SUBFR -#if defined REUSE_EVS_BE_ACELP_PITCH && !defined REUSE_EVS_ACELP_PITCH_NORM_CORR - , - element_mode, Q_new -#endif - ); - move16(); - } - ELSE - { - nBits = 6; - move16(); - - /* pitch lag search limitation */ - IF( i_subfr == 0 ) - { - limit_T0_fx( L_FRAME, delta, pit_flag, *limit_flag, i_mult2( mult_Top, T_op[0] ), 0, T0_min, T0_max ); - nBits = 9; - move16(); - } - ELSE IF( EQ_16( i_subfr, 2 * L_SUBFR ) ) - { - limit_T0_fx( L_FRAME, delta, pit_flag, *limit_flag, i_mult2( mult_Top, T_op[1] ), 0, T0_min, T0_max ); - nBits = 9; - move16(); - } - ELSE - { - limit_T0_fx( L_FRAME, delta, pit_flag, 0, *T0, 0, T0_min, T0_max ); /* T0_frac==0 to keep IO with AMR-WB */ - } - - /* search and encode the closed loop pitch period */ - *T0 = pitch_fr4_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT_FR2_9b, PIT_FR1_9b, L_FRAME, L_SUBFR -#if defined REUSE_EVS_BE_ACELP_PITCH && !defined REUSE_EVS_ACELP_PITCH_NORM_CORR - , - element_mode, Q_new -#endif - ); - move16(); - } - - pit_Q_enc_fx( hBstr, 1, nBits, delta, pit_flag, *limit_flag, *T0, *T0_frac, T0_min, T0_max ); - } - - /*-------------------------------------------------------* - * Compute floating pitch output - *-------------------------------------------------------*/ - - /*pitch = (float)(*T0) + (float)(*T0_frac)/4.0f;*/ /* save subframe pitch values */ - pitch_cl = shl( add( shl( *T0, 2 ), *T0_frac ), 4 ); /* save subframe pitch values Q6 */ - - return pitch_cl; -} -#ifndef REUSE_EVS_BE_ACELP_PITCH -Word16 pit_encode_ivas_fx( /* o : Fractional pitch for each subframe */ - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - const Word16 pitch_bits[], /* i : pitch bits */ - const Word32 core_brate, /* i : core bitrate */ - const Word16 Opt_AMR_WB, /* i : flag indicating AMR-WB IO mode */ - const Word16 L_frame, /* i : length of the frame */ - const Word16 coder_type, /* i : coding type */ - Word16 *limit_flag, /* i/o: restrained(0) or extended(1) Q limits */ - const Word16 i_subfr, /* i : subframe index */ - Word16 *exc, /* i/o: pointer to excitation signal frame Q_new */ - const Word16 L_subfr, /* i : subframe length */ - const Word16 *pitch, /* i : open loop pitch estimates in current frame */ - Word16 *T0_min, /* i/o: lower limit for close-loop search */ - Word16 *T0_max, /* i/o: higher limit for close-loop search */ - Word16 *T0, /* i/o: close loop integer pitch */ - Word16 *T0_frac, /* i/o: close loop fractional part of the pitch */ - const Word16 *h1, /* i : weighted filter input response Q(14 - norm_s(h1[0]) */ - const Word16 *xn, /* i : target vector Q_new */ - const Word16 tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag */ - const Word16 tdm_Pri_pitch_buf[], /* i : primary channel pitch buffer */ - Word16 Q_new /* i */ -) -{ - Word16 pitch_cl; - Word16 pit_flag, delta, mult_Top, nBits; - Word16 L_sufr_sft; - Word16 T_op[2]; /* values for two half-frames */ - L_sufr_sft = 6; move16(); if ( EQ_16( L_subfr, 2 * L_SUBFR ) ) @@ -702,8 +187,8 @@ Word16 pit_encode_ivas_fx( /* o : Fractional IF( NE_16( coder_type, AUDIO ) ) { nBits = pitch_bits[i_subfr >> L_sufr_sft]; + move16(); } - test(); IF( EQ_16( coder_type, AUDIO ) ) { /*-------------------------------------------------------* @@ -743,13 +228,14 @@ Word16 pit_encode_ivas_fx( /* o : Fractional } /* search and encode the closed loop pitch period */ - *T0 = pitch_fr4_ivas_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT_MAX, PIT_MAX, L_FRAME, L_subfr, Q_new ); + *T0 = pitch_fr4_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT_MAX, PIT_MAX, L_FRAME, L_subfr +#if !defined REUSE_EVS_ACELP_PITCH_NORM_CORR + , + element_mode, Q_new +#endif + ); move16(); -#ifndef REUSE_EVS_BE_ACELP_PITCH_PIT_Q - pit_Q_enc_ivas_fx( hBstr, 0, nBits, delta, pit_flag, *limit_flag, *T0, *T0_frac, T0_min, T0_max ); -#else pit_Q_enc_fx( hBstr, 0, nBits, delta, pit_flag, *limit_flag, *T0, *T0_frac, T0_min, T0_max ); -#endif } ELSE IF( EQ_16( coder_type, VOICED ) ) { @@ -772,23 +258,31 @@ Word16 pit_encode_ivas_fx( /* o : Fractional } /* search and encode the closed loop pitch period */ + test(); IF( EQ_16( nBits, 9 ) || EQ_16( nBits, 5 ) ) { - *T0 = pitch_fr4_ivas_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT_FR2_DOUBLEEXTEND_9b, PIT_FR1_DOUBLEEXTEND_9b, L_FRAME, L_SUBFR, Q_new ); + *T0 = pitch_fr4_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT_FR2_DOUBLEEXTEND_9b, PIT_FR1_DOUBLEEXTEND_9b, L_FRAME, L_SUBFR +#if !defined REUSE_EVS_ACELP_PITCH_NORM_CORR + , + element_mode, Q_new +#endif + ); move16(); } ELSE IF( EQ_16( nBits, 10 ) ) { - *T0 = pitch_fr4_ivas_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT_MAX, PIT_MAX, L_FRAME, L_SUBFR, Q_new ); + *T0 = pitch_fr4_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT_MAX, PIT_MAX, L_FRAME, L_SUBFR +#if !defined REUSE_EVS_ACELP_PITCH_NORM_CORR + , + element_mode, Q_new +#endif + + ); move16(); } -#ifndef REUSE_EVS_BE_ACELP_PITCH_PIT_Q - pit_Q_enc_ivas_fx( hBstr, 0, nBits, delta, pit_flag, *limit_flag, *T0, *T0_frac, T0_min, T0_max ); -#else pit_Q_enc_fx( hBstr, 0, nBits, delta, pit_flag, *limit_flag, *T0, *T0_frac, T0_min, T0_max ); -#endif } ELSE IF( EQ_16( tdm_Pitch_reuse_flag, 1 ) || EQ_16( nBits, 4 ) ) { @@ -824,18 +318,19 @@ Word16 pit_encode_ivas_fx( /* o : Fractional IF( nBits > 0 ) { /* search and encode the closed loop pitch period */ - *T0 = pitch_fr4_ivas_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT_MIN, PIT_FR1_8b, L_FRAME, L_SUBFR, Q_new ); + *T0 = pitch_fr4_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT_MIN, PIT_FR1_8b, L_FRAME, L_SUBFR +#if !defined REUSE_EVS_ACELP_PITCH_NORM_CORR + , + element_mode, Q_new +#endif + ); move16(); IF( EQ_16( delta, 8 ) ) { *T0_frac = 0; move16(); } -#ifndef REUSE_EVS_BE_ACELP_PITCH_PIT_Q - pit_Q_enc_ivas_fx( hBstr, 0, nBits, delta, pit_flag, *limit_flag, *T0, *T0_frac, T0_min, T0_max ); -#else pit_Q_enc_fx( hBstr, 0, nBits, delta, pit_flag, *limit_flag, *T0, *T0_frac, T0_min, T0_max ); -#endif } ELSE { @@ -874,12 +369,22 @@ Word16 pit_encode_ivas_fx( /* o : Fractional { IF( *limit_flag == 0 ) { - *T0 = pitch_fr4_ivas_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT_MIN, PIT_FR1_8b, L_FRAME, L_SUBFR, Q_new ); + *T0 = pitch_fr4_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT_MIN, PIT_FR1_8b, L_FRAME, L_SUBFR +#if !defined REUSE_EVS_ACELP_PITCH_NORM_CORR + , + element_mode, Q_new +#endif + ); move16(); } ELSE { - *T0 = pitch_fr4_ivas_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT_MIN_EXTEND, PIT_FR1_EXTEND_8b, L_FRAME, L_SUBFR, Q_new ); + *T0 = pitch_fr4_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT_MIN_EXTEND, PIT_FR1_EXTEND_8b, L_FRAME, L_SUBFR +#if !defined REUSE_EVS_ACELP_PITCH_NORM_CORR + , + element_mode, Q_new +#endif + ); move16(); } } @@ -887,45 +392,63 @@ Word16 pit_encode_ivas_fx( /* o : Fractional { IF( *limit_flag == 0 ) { - *T0 = pitch_fr4_ivas_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT_FR2_9b, PIT_FR1_9b, L_FRAME, L_SUBFR, Q_new ); + *T0 = pitch_fr4_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT_FR2_9b, PIT_FR1_9b, L_FRAME, L_SUBFR +#if !defined REUSE_EVS_ACELP_PITCH_NORM_CORR + , + element_mode, Q_new +#endif + ); move16(); } ELSE { - *T0 = pitch_fr4_ivas_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT_FR2_EXTEND_9b, PIT_FR1_EXTEND_9b, L_FRAME, L_SUBFR, Q_new ); + *T0 = pitch_fr4_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT_FR2_EXTEND_9b, PIT_FR1_EXTEND_9b, L_FRAME, L_SUBFR +#if !defined REUSE_EVS_ACELP_PITCH_NORM_CORR + , + element_mode, Q_new +#endif + ); move16(); } } ELSE IF( EQ_16( nBits, 10 ) ) { - *T0 = pitch_fr4_ivas_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT_MAX, PIT_MAX, L_FRAME, L_SUBFR, Q_new ); + *T0 = pitch_fr4_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT_MAX, PIT_MAX, L_FRAME, L_SUBFR +#if !defined REUSE_EVS_ACELP_PITCH_NORM_CORR + , + element_mode, Q_new +#endif + ); + move16(); } -#ifndef REUSE_EVS_BE_ACELP_PITCH_PIT_Q - pit_Q_enc_ivas_fx( hBstr, 0, nBits, delta, pit_flag, *limit_flag, *T0, *T0_frac, T0_min, T0_max ); -#else pit_Q_enc_fx( hBstr, 0, nBits, delta, pit_flag, *limit_flag, *T0, *T0_frac, T0_min, T0_max ); -#endif } ELSE /* L_frame == L_FRAME16k */ { test(); IF( EQ_16( nBits, 9 ) || EQ_16( nBits, 6 ) ) { - *T0 = pitch_fr4_ivas_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT16k_FR2_EXTEND_9b, PIT16k_FR1_EXTEND_9b, L_FRAME16k, L_SUBFR, Q_new ); + *T0 = pitch_fr4_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT16k_FR2_EXTEND_9b, PIT16k_FR1_EXTEND_9b, L_FRAME16k, L_SUBFR +#if !defined REUSE_EVS_ACELP_PITCH_NORM_CORR + , + element_mode, Q_new +#endif + ); move16(); } ELSE IF( EQ_16( nBits, 10 ) ) { - *T0 = pitch_fr4_ivas_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT16k_FR2_EXTEND_10b, PIT16k_MAX, L_FRAME16k, L_SUBFR, Q_new ); + *T0 = pitch_fr4_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT16k_FR2_EXTEND_10b, PIT16k_MAX, L_FRAME16k, L_SUBFR +#if !defined REUSE_EVS_ACELP_PITCH_NORM_CORR + , + element_mode, Q_new +#endif + ); move16(); } -#ifndef REUSE_EVS_BE_ACELP_PITCH_PIT_Q - pit16k_Q_enc_ivas_fx( hBstr, nBits, *limit_flag, *T0, *T0_frac, T0_min, T0_max ); -#else pit16k_Q_enc_fx( hBstr, nBits, *limit_flag, *T0, *T0_frac, T0_min, T0_max ); -#endif } } } @@ -962,7 +485,12 @@ Word16 pit_encode_ivas_fx( /* o : Fractional } /* search and encode the closed loop pitch period */ - *T0 = pitch_fr4_ivas_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT_MIN, PIT_FR1_8b, L_FRAME, L_SUBFR, Q_new ); + *T0 = pitch_fr4_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT_MIN, PIT_FR1_8b, L_FRAME, L_SUBFR +#if !defined REUSE_EVS_ACELP_PITCH_NORM_CORR + , + element_mode, Q_new +#endif + ); move16(); } ELSE IF( EQ_32( core_brate, ACELP_8k85 ) ) @@ -985,7 +513,12 @@ Word16 pit_encode_ivas_fx( /* o : Fractional } /* search and encode the closed loop pitch period */ - *T0 = pitch_fr4_ivas_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT_MIN, PIT_FR1_8b, L_FRAME, L_SUBFR, Q_new ); + *T0 = pitch_fr4_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT_MIN, PIT_FR1_8b, L_FRAME, L_SUBFR +#if !defined REUSE_EVS_ACELP_PITCH_NORM_CORR + , + element_mode, Q_new +#endif + ); move16(); } ELSE @@ -1012,15 +545,16 @@ Word16 pit_encode_ivas_fx( /* o : Fractional } /* search and encode the closed loop pitch period */ - *T0 = pitch_fr4_ivas_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT_FR2_9b, PIT_FR1_9b, L_FRAME, L_SUBFR, Q_new ); + *T0 = pitch_fr4_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT_FR2_9b, PIT_FR1_9b, L_FRAME, L_SUBFR +#if !defined REUSE_EVS_ACELP_PITCH_NORM_CORR + , + element_mode, Q_new +#endif + ); move16(); } -#ifndef REUSE_EVS_BE_ACELP_PITCH_PIT_Q - pit_Q_enc_ivas_fx( hBstr, 1, nBits, delta, pit_flag, *limit_flag, *T0, *T0_frac, T0_min, T0_max ); -#else pit_Q_enc_fx( hBstr, 1, nBits, delta, pit_flag, *limit_flag, *T0, *T0_frac, T0_min, T0_max ); -#endif } /*-------------------------------------------------------* @@ -1032,7 +566,6 @@ Word16 pit_encode_ivas_fx( /* o : Fractional return pitch_cl; } -#endif /*-------------------------------------------------------------------* * abs_pit_enc() * @@ -1211,252 +744,59 @@ Word16 abs_pit_enc_fx( /* o : pitch index } ELSE /* fr_step == 0 */ { - /* not used in the codec */ - pitch_index = 0; - move16(); - } - } - - return pitch_index; -} - - -/*-------------------------------------------------------------------* - * delta_pit_enc: - * - * Encode pitch lag differentially from T0_min to T0_max - * with resolution depending on parameter 'fr_step': - * fr_step = 0: resolusion 1 (frac = 0), or - * fr_step = 2: resolusion 1/2 (frac = 0 or 2), or - * fr_step = 4: resolution 1/4 (frac = 0, 1, 2, or 3) - *-------------------------------------------------------------------*/ - -Word16 delta_pit_enc_fx( /* o : pitch index */ - const Word16 fr_steps, /* i : fractional resolution steps (2 or 4)*/ - const Word16 T0, /* i : integer pitch lag */ - const Word16 T0_frac, /* i : pitch fraction */ - const Word16 T0_min /* i : delta search min */ -) -{ - Word16 pitch_index = 0; - move16(); - - IF( fr_steps == 0 ) - { - pitch_index = sub( T0, T0_min ); - } - ELSE IF( EQ_16( fr_steps, 2 ) ) - { - /* pitch_index = (T0 - T0_min) * 2 + (T0_frac>>1);*/ - pitch_index = add( shl( sub( T0, T0_min ), 1 ), shr( T0_frac, 1 ) ); - } - ELSE IF( EQ_16( fr_steps, 4 ) ) - { - /*pitch_index = (T0 - T0_min) * 4 + T0_frac;*/ - pitch_index = add( shl( sub( T0, T0_min ), 2 ), T0_frac ); - } - - return pitch_index; -} - -/*-------------------------------------------------------------------* - * pitch_fr4() - * - * Find the closed loop pitch period with 1/4 subsample resolution. - *-------------------------------------------------------------------*/ -#ifndef REUSE_EVS_BE_ACELP_PITCH -Word16 pitch_fr4_ivas_fx( /* o : chosen integer pitch lag */ - const Word16 exc[], /* i : excitation buffer Q_new */ - const Word16 xn[], /* i : target signal Q_new-1 */ - const Word16 h[], /* i : weighted synthesis filter impulse response Q(14 - norm_s[h[0]) */ - const Word16 t0_min, /* i : minimum value in the searched range. Q0 */ - const Word16 t0_max, /* i : maximum value in the searched range. Q0 */ - Word16 *pit_frac, /* o : chosen fraction (0, 1, 2 or 3) */ - const Word16 i_subfr, /* i : flag to first subframe */ - const Word16 limit_flag, /* i : flag for limits (0=restrained, 1=extended) */ - const Word16 t0_fr2, /* i : minimum value for resolution 1/2 */ - const Word16 t0_fr1, /* i : minimum value for resolution 1 */ - const Word16 L_frame, /* i : length of the frame */ - const Word16 L_subfr, /* i : size of subframe */ - Word16 Q_new /* i */ -) -{ - Word16 i; - Word16 t_min, t_max; - Word16 max_val, t0, t1, fraction, step, temp; - Word16 *corr; - Word16 corr_v[15 + 2 * L_INTERPOL1 + 1]; /* Total length = t0_max-t0_min+1+2*L_inter */ - Word16 pit_min; - Word16 cor_max; - - /* initialization */ - IF( limit_flag == 0 ) - { - IF( EQ_16( L_frame, L_FRAME ) ) - { - pit_min = PIT_MIN; - move16(); - } - ELSE /* L_frame == L_FRAME16k */ - { - pit_min = PIT16k_MIN; - move16(); - } - } - ELSE - { - IF( EQ_16( L_frame, L_FRAME ) ) - { - pit_min = PIT_MIN_EXTEND; - move16(); - IF( EQ_16( limit_flag, 2 ) ) - { - pit_min = PIT_MIN_DOUBLEEXTEND; - move16(); - } - } - ELSE /* L_frame == L_FRAME16k */ - { - pit_min = PIT16k_MIN_EXTEND; - move16(); - } - } - - /*-----------------------------------------------------------------* - * - Find interval to compute normalized correlation - * - allocate memory to normalized correlation vector - * - Compute normalized correlation between target and filtered - * excitation - *-----------------------------------------------------------------*/ - - t_min = sub( t0_min, L_INTERPOL1 ); - t_max = add( t0_max, L_INTERPOL1 ); - corr = &corr_v[-t_min]; - move16(); - move16(); /* corr[t_min..t_max] */ - - norm_corr_ivas_fx( exc, xn, h, t_min, t_max, corr, L_subfr, Q_new ); - - /*-----------------------------------------------------------------* - * Find integer pitch - *-----------------------------------------------------------------*/ - - max_val = corr[t0_min]; - move16(); - t0 = t0_min; - move16(); - - FOR( i = add( t0_min, 1 ); i <= t0_max; i++ ) - { - if ( GE_16( corr[i], max_val ) ) - { - t0 = i; - move16(); - } - max_val = s_max( corr[i], max_val ); - } - - IF( EQ_16( t0_fr1, pit_min ) ) - { - /* don't search fraction (for 7b/4b quant) */ - test(); - IF( ( i_subfr == 0 ) && ( GE_16( t0, t0_fr2 ) ) ) - { - i = shl( shr( t0, 1 ), 1 ); /* 2 samples resolution */ - if ( GT_16( add( i, 2 ), PIT_MAX ) ) - { - i = sub( i, 2 ); - } - IF( GT_16( corr[i], corr[i + 2] ) ) - { - t0 = i; - move16(); - } - ELSE - { - t0 = add( i, 2 ); - } - } - *pit_frac = 0; - move16(); - - return ( t0 ); - } - - test(); - IF( ( i_subfr == 0 ) && ( GE_16( t0, t0_fr1 ) ) ) - { - *pit_frac = 0; - move16(); - - return ( t0 ); + /* not used in the codec */ + pitch_index = 0; + move16(); + } } - /*------------------------------------------------------------------* - * Search fractionnal pitch with 1/4 subsample resolution. - * search the fractions around t0 and choose the one which maximizes - * the interpolated normalized correlation. - *-----------------------------------------------------------------*/ + return pitch_index; +} - t1 = t0; - move16(); - step = 1; - move16(); /* 1/4 subsample resolution */ - fraction = 1; + +/*-------------------------------------------------------------------* + * delta_pit_enc: + * + * Encode pitch lag differentially from T0_min to T0_max + * with resolution depending on parameter 'fr_step': + * fr_step = 0: resolusion 1 (frac = 0), or + * fr_step = 2: resolusion 1/2 (frac = 0 or 2), or + * fr_step = 4: resolution 1/4 (frac = 0, 1, 2, or 3) + *-------------------------------------------------------------------*/ + +Word16 delta_pit_enc_fx( /* o : pitch index */ + const Word16 fr_steps, /* i : fractional resolution steps (2 or 4)*/ + const Word16 T0, /* i : integer pitch lag */ + const Word16 T0_frac, /* i : pitch fraction */ + const Word16 T0_min /* i : delta search min */ +) +{ + Word16 pitch_index = 0; move16(); - test(); - test(); - IF( ( ( i_subfr == 0 ) && ( GE_16( t0, t0_fr2 ) ) ) || ( EQ_16( t0_fr2, pit_min ) ) ) - { - step = 2; - move16(); /* 1/2 subsample resolution */ - fraction = 2; - move16(); - } - IF( EQ_16( t0, t0_min ) ) /* Limit case */ + IF( fr_steps == 0 ) { - fraction = 0; - move16(); - cor_max = Interpol_4( &corr[t0], fraction ); + pitch_index = sub( T0, T0_min ); } - ELSE + ELSE IF( EQ_16( fr_steps, 2 ) ) { - t0 = sub( t0, 1 ); - cor_max = Interpol_4( &corr[t0], fraction ); - FOR( i = add( fraction, step ); i <= 3; i = (Word16) ( i + step ) ) - { - temp = Interpol_4( &corr[t0], i ); - IF( GT_16( temp, cor_max ) ) - { - cor_max = temp; - move16(); - fraction = i; - move16(); - } - } + /* pitch_index = (T0 - T0_min) * 2 + (T0_frac>>1);*/ + pitch_index = add( shl( sub( T0, T0_min ), 1 ), shr( T0_frac, 1 ) ); } - - FOR( i = 0; i <= 3; i = (Word16) ( i + step ) ) + ELSE IF( EQ_16( fr_steps, 4 ) ) { - temp = Interpol_4( &corr[t1], i ); - IF( GT_16( temp, cor_max ) ) - { - cor_max = temp; - move16(); - fraction = i; - move16(); - t0 = t1; - move16(); - } + /*pitch_index = (T0 - T0_min) * 4 + T0_frac;*/ + pitch_index = add( shl( sub( T0, T0_min ), 2 ), T0_frac ); } - *pit_frac = fraction; - move16(); - - return ( t0 ); + return pitch_index; } -#endif + +/*-------------------------------------------------------------------* + * pitch_fr4() + * + * Find the closed loop pitch period with 1/4 subsample resolution. + *-------------------------------------------------------------------*/ Word16 pitch_fr4_fx( /* o : chosen integer pitch lag */ const Word16 exc[], /* i : excitation buffer Q_new*/ @@ -1471,7 +811,7 @@ Word16 pitch_fr4_fx( /* o : chosen integer pitch lag const Word16 t0_fr1, /* i : minimum value for resolution 1 */ const Word16 L_frame, /* i : length of the frame */ const Word16 L_subfr /* i : size of subframe */ -#if defined REUSE_EVS_BE_ACELP_PITCH && !defined REUSE_EVS_ACELP_PITCH_NORM_CORR +#if !defined REUSE_EVS_ACELP_PITCH_NORM_CORR , const Word16 element_mode, /* i : mode element */ const Word16 Q_new /* i : scaling factor */ @@ -1530,7 +870,7 @@ Word16 pitch_fr4_fx( /* o : chosen integer pitch lag t_max = add( t0_max, L_INTERPOL1 ); corr = &corr_v[-t_min]; /* corr[t_min..t_max] */ -#if defined REUSE_EVS_BE_ACELP_PITCH && !defined REUSE_EVS_ACELP_PITCH_NORM_CORR +#if !defined REUSE_EVS_ACELP_PITCH_NORM_CORR if ( element_mode > EVS_MONO ) { norm_corr_ivas_fx( exc, xn, h, t_min, t_max, corr, L_subfr, Q_new ); @@ -1960,100 +1300,6 @@ void pit_Q_enc_fx( return; } -#ifndef REUSE_EVS_BE_ACELP_PITCH_PIT_Q -void pit_Q_enc_ivas_fx( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - const Word16 Opt_AMR_WB, /* i : flag indicating AMR-WB IO mode */ - const Word16 nBits, /* i : # of Q bits */ - const Word16 delta, /* i : Half the CL searched interval */ - const Word16 pit_flag, /* i : absolute(0) or delta(1) pitch Q */ - const Word16 limit_flag, /* i : restrained(0) or extended(1) Q limits */ - const Word16 T0, /* i : integer pitch lag */ - const Word16 T0_frac, /* i : pitch fraction */ - Word16 *T0_min, /* i/o: delta search min */ - Word16 *T0_max /* o : delta search max_val */ -) -{ - Word16 pitch_index; - - IF( EQ_16( nBits, 10 ) ) /* absolute encoding with 10 bits */ - { - IF( limit_flag == 0 ) - { - /* pitch_index = T0*4 + T0_frac - (PIT_MIN*4);*/ - pitch_index = sub( add( shl( T0, 2 ), T0_frac ), ( PIT_MIN * 4 ) ); - } - ELSE IF( EQ_16( limit_flag, 1 ) ) - { - /*pitch_index = T0*4 + T0_frac - (PIT_MIN_EXTEND*4);*/ - pitch_index = sub( add( shl( T0, 2 ), T0_frac ), ( PIT_MIN_EXTEND * 4 ) ); - } - ELSE /* limit_flag == 2 */ - { - /*pitch_index = T0*4 + T0_frac - (PIT_MIN_DOUBLEEXTEND*4);*/ - pitch_index = sub( add( shl( T0, 2 ), T0_frac ), ( PIT_MIN_DOUBLEEXTEND * 4 ) ); - } - } - ELSE IF( EQ_16( nBits, 9 ) ) /* absolute encoding with 9 bits */ - { - pitch_index = abs_pit_enc_fx( 4, limit_flag, T0, T0_frac ); - - /* find T0_min and T0_max for delta search */ - IF( Opt_AMR_WB ) - { - limit_T0_fx( L_FRAME, delta, pit_flag, 0, T0, 0, T0_min, T0_max ); /* T0_frac==0 to keep IO with AMR-WB */ - } - } - ELSE IF( EQ_16( nBits, 8 ) ) /* absolute encoding with 8 bits */ - { - pitch_index = abs_pit_enc_fx( 2, limit_flag, T0, T0_frac ); - - /* find T0_min and T0_max for delta search */ - IF( Opt_AMR_WB ) - { - limit_T0_fx( L_FRAME, delta, pit_flag, 0, T0, 0, T0_min, T0_max ); /* T0_frac==0 to keep IO with AMR-WB */ - } - } - ELSE IF( EQ_16( nBits, 6 ) ) /* relative encoding with 6 bits */ - { - pitch_index = delta_pit_enc_fx( 4, T0, T0_frac, *T0_min ); - } - ELSE IF( EQ_16( nBits, 5 ) ) /* relative encoding with 5 bits */ - { - IF( EQ_16( delta, 8 ) ) - { - pitch_index = delta_pit_enc_fx( 2, T0, T0_frac, *T0_min ); - } - ELSE /* delta == 4 */ - { - pitch_index = delta_pit_enc_fx( 4, T0, T0_frac, *T0_min ); - } - } - ELSE /* nBits == 4 ) */ /* relative encoding with 4 bits */ - { - IF( EQ_16( delta, 8 ) ) - { - pitch_index = delta_pit_enc_fx( 0, T0, T0_frac, *T0_min ); - } - ELSE /* delta == 4 */ - { - pitch_index = delta_pit_enc_fx( 2, T0, T0_frac, *T0_min ); - } - } - - IF( !Opt_AMR_WB ) - { - /* find T0_min and T0_max for delta search */ - limit_T0_fx( L_FRAME, delta, L_SUBFR, limit_flag, T0, T0_frac, T0_min, T0_max ); - } - - { - push_indice( hBstr, IND_PITCH, pitch_index, nBits ); - } - - return; -} -#endif /*-------------------------------------------------------------------* * pit16k_Q_enc() * @@ -2131,80 +1377,6 @@ void pit16k_Q_enc_fx( return; } -#ifndef REUSE_EVS_BE_ACELP_PITCH_PIT_Q - -void pit16k_Q_enc_ivas_fx( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - const Word16 nBits, /* i : # of Q bits */ - const Word16 limit_flag, /* i : restrained(0) or extended(1) Q limits */ - const Word16 T0, /* i : integer pitch lag */ - const Word16 T0_frac, /* i : pitch fraction */ - Word16 *T0_min, /* i/o: delta search min */ - Word16 *T0_max /* o : delta search max_val */ -) -{ - Word16 pitch_index; - - IF( EQ_16( nBits, 10 ) ) /* absolute encoding with 10 bits */ - { - { - IF( LT_16( T0, PIT16k_FR2_EXTEND_10b ) ) - { - /*pitch_index = T0*4 + T0_frac - (PIT16k_MIN_EXTEND*4);*/ - pitch_index = add( shl( T0, 2 ), sub( T0_frac, ( PIT16k_MIN_EXTEND * 4 ) ) ); - } - ELSE - { - /*pitch_index = T0*2 + (T0_frac>>1) - (PIT16k_FR2_EXTEND_10b*2) + ((PIT16k_FR2_EXTEND_10b-PIT16k_MIN_EXTEND)*4);*/ - pitch_index = add( sub( add( shl( T0, 1 ), shr( T0_frac, 1 ) ), ( PIT16k_FR2_EXTEND_10b * 2 ) ), ( ( PIT16k_FR2_EXTEND_10b - PIT16k_MIN_EXTEND ) * 4 ) ); - } - } - - push_indice( hBstr, IND_PITCH, pitch_index, nBits ); - } - ELSE IF( EQ_16( nBits, 9 ) ) /* absolute encoding with 9 bits */ - { - { - /*-------------------------------------------------------------------* - * The pitch range is encoded absolutely with 9 bits - * and is divided as follows: - * PIT16k_EXTEND_MIN to PIT16k_FR2_EXTEND_9b-1 resolution 1/4 (frac = 0,1,2 or 3) - * PIT16k_FR2_EXTEND_9b to PIT16k_FR1_EXTEND_9b-1 resolution 1/2 (frac = 0 or 2) - * PIT16k_FR1_EXTEND_9b to PIT16k_MAX_EXTEND resolution 1 (frac = 0) - *-------------------------------------------------------------------*/ - - IF( LT_16( T0, PIT16k_FR2_EXTEND_9b ) ) - { - /*pitch_index = T0*4 + T0_frac - (PIT16k_MIN_EXTEND*4);*/ - pitch_index = add( shl( T0, 2 ), sub( T0_frac, ( PIT16k_MIN_EXTEND * 4 ) ) ); - } - ELSE IF( LT_16( T0, PIT16k_FR1_EXTEND_9b ) ) - { - /*pitch_index = T0*2 + (T0_frac>>1) - (PIT16k_FR2_EXTEND_9b*2) + ((PIT16k_FR2_EXTEND_9b-PIT16k_MIN_EXTEND)*4);*/ - pitch_index = add( sub( add( shl( T0, 1 ), shr( T0_frac, 1 ) ), ( PIT16k_FR2_EXTEND_9b * 2 ) ), ( ( PIT16k_FR2_EXTEND_9b - PIT16k_MIN_EXTEND ) * 4 ) ); - } - ELSE - { - /*pitch_index = T0 - PIT16k_FR1_EXTEND_9b + ((PIT16k_FR2_EXTEND_9b-PIT16k_MIN_EXTEND)*4) + ((PIT16k_FR1_EXTEND_9b-PIT16k_FR2_EXTEND_9b)*2);*/ - pitch_index = add( add( sub( T0, PIT16k_FR1_EXTEND_9b ), ( ( PIT16k_FR2_EXTEND_9b - PIT16k_MIN_EXTEND ) * 4 ) ), ( ( PIT16k_FR1_EXTEND_9b - PIT16k_FR2_EXTEND_9b ) * 2 ) ); - } - } - - push_indice( hBstr, IND_PITCH, pitch_index, 9 ); - } - ELSE /* nBits == 6 */ /* relative encoding with 6 bits */ - { - /*pitch_index = (T0 - *T0_min) * 4 + T0_frac;*/ - pitch_index = add( shl( sub( T0, *T0_min ), 2 ), T0_frac ); - - push_indice( hBstr, IND_PITCH, pitch_index, nBits ); - } - - limit_T0_fx( L_FRAME16k, 8, L_SUBFR, limit_flag, T0, T0_frac, T0_min, T0_max ); - - return; -} -#endif /*------------------------------------------------------------------* * pit_encode: * diff --git a/lib_enc/pre_proc_fx.c b/lib_enc/pre_proc_fx.c index 0dc722acdea50bd9290028a55aece27de21b10ef..55e7437ee2f1fef5fcc9b5c84abef4eeeb69a934 100644 --- a/lib_enc/pre_proc_fx.c +++ b/lib_enc/pre_proc_fx.c @@ -126,12 +126,6 @@ void pre_proc_fx( LPD_state_HANDLE hLPDmem = st->hLPDmem; FD_BWE_ENC_HANDLE hBWE_FD = st->hBWE_FD; -#ifndef ISSUE_1796_replace_shl_o -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move16(); -#endif -#endif /*------------------------------------------------------------------* * Initializations @@ -1048,11 +1042,7 @@ void pre_proc_fx( test(); IF( ( ( st->tcxonly == 0 ) || ( EQ_16( st->codec_mode, MODE1 ) ) ) && GT_32( st->input_Fs, 8000 ) ) { -#ifdef ISSUE_1796_replace_shl_o st->mem_preemph_enc = shl_sat( new_inp_16k[sub( L_frame_tmp, 1 )], 1 ); -#else - st->mem_preemph_enc = shl_o( new_inp_16k[sub( L_frame_tmp, 1 )], 1, &Overflow ); -#endif move16(); } diff --git a/lib_enc/prot_fx_enc.h b/lib_enc/prot_fx_enc.h index a1c09b1269fa63e2770ec2528f36844192295a70..5e2e144472add4930a7f0db4b1b2bcc7fe703230 100644 --- a/lib_enc/prot_fx_enc.h +++ b/lib_enc/prot_fx_enc.h @@ -106,19 +106,6 @@ void AVQ_encmux_fx( Word16 avq_bit_sFlag, /* i : flag for AVQ bit saving solution */ Word16 trgtSvPos /* i : target SV for AVQ bit savings */ ); -#ifndef REUSE_EVS_BE_ACELP_AVQ -void AVQ_encmux_ivas_fx( - BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */ - const Word16 extl, /* i : extension layer */ - Word16 xriq[], /* i/o: rounded subvectors [0..8*Nsv-1] followed - by rounded bit allocations [8*Nsv..8*Nsv+Nsv-1] */ - Word16 *nb_bits, /* i/o: number of allocated bits */ - const Word16 Nsv, /* i: number of subvectors */ - Word16 nq_out[], /* o : AVQ nq index */ - Word16 avq_bit_sFlag, /* i : flag for AVQ bit saving solution */ - Word16 trgtSvPos /* i : target SV for AVQ bit savings */ -); -#endif void bw_detect_fx( Encoder_State *st, /* i/o: Encoder State */ const Word16 signal_in[], /* i : input signal */ @@ -984,18 +971,6 @@ void pit16k_Q_enc_fx( Word16 *T0_min, /* i/o: delta search min */ Word16 *T0_max /* o : delta search max */ ); -#ifndef REUSE_EVS_BE_ACELP_PITCH_PIT_Q - -void pit16k_Q_enc_ivas_fx( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - const Word16 nBits, /* i : # of Q bits */ - const Word16 limit_flag, /* i : restrained(0) or extended(1) Q limits */ - const Word16 T0, /* i : integer pitch lag */ - const Word16 T0_frac, /* i : pitch fraction */ - Word16 *T0_min, /* i/o: delta search min */ - Word16 *T0_max /* o : delta search max_val */ -); -#endif Word16 pitch_fr4_fx( /* o : chosen integer pitch lag */ const Word16 exc[], /* i : excitation buffer Q_new*/ const Word16 xn[], /* i : target signal Q_new-1+shift*/ @@ -1009,29 +984,12 @@ Word16 pitch_fr4_fx( /* o : chosen integer pitch lag const Word16 t0_fr1, /* i : minimum value for resolution 1 */ const Word16 L_frame, /* i : length of the frame */ const Word16 L_subfr /* i : size of subframe */ -#if defined REUSE_EVS_BE_ACELP_PITCH && !defined REUSE_EVS_ACELP_PITCH_NORM_CORR +#if !defined REUSE_EVS_ACELP_PITCH_NORM_CORR , const Word16 element_mode, /* i : mode element */ const Word16 Q_new /* i : scaling factor */ #endif ); -#ifndef REUSE_EVS_BE_ACELP_PITCH -Word16 pitch_fr4_ivas_fx( /* o : chosen integer pitch lag */ - const Word16 exc[], /* i : excitation buffer Q_new */ - const Word16 xn[], /* i : target signal Q_new-1 */ - const Word16 h[], /* i : weighted synthesis filter impulse response Q(14 - norm_s[h[0]) */ - const Word16 t0_min, /* i : minimum value in the searched range. Q0 */ - const Word16 t0_max, /* i : maximum value in the searched range. Q0 */ - Word16 *pit_frac, /* o : chosen fraction (0, 1, 2 or 3) */ - const Word16 i_subfr, /* i : flag to first subframe */ - const Word16 limit_flag, /* i : flag for limits (0=restrained, 1=extended) */ - const Word16 t0_fr2, /* i : minimum value for resolution 1/2 */ - const Word16 t0_fr1, /* i : minimum value for resolution 1 */ - const Word16 L_frame, /* i : length of the frame */ - const Word16 L_subfr, /* i : size of subframe */ - Word16 Q_new /* i */ -); -#endif void pit_Q_enc_fx( BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ const Word16 Opt_AMR_WB, /* i : flag indicating AMR-WB IO mode */ @@ -1044,21 +1002,6 @@ void pit_Q_enc_fx( Word16 *T0_min, /* i/o: delta search min */ Word16 *T0_max /* o : delta search max */ ); -#ifndef REUSE_EVS_BE_ACELP_PITCH_PIT_Q - -void pit_Q_enc_ivas_fx( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - const Word16 Opt_AMR_WB, /* i : flag indicating AMR-WB IO mode */ - const Word16 nBits, /* i : # of Q bits */ - const Word16 delta, /* i : Half the CL searched interval */ - const Word16 pit_flag, /* i : absolute(0) or delta(1) pitch Q */ - const Word16 limit_flag, /* i : restrained(0) or extended(1) Q limits */ - const Word16 T0, /* i : integer pitch lag */ - const Word16 T0_frac, /* i : pitch fraction */ - Word16 *T0_min, /* i/o: delta search min */ - Word16 *T0_max /* o : delta search max_val */ -); -#endif void PsychAdaptLowFreqEmph_fx( Word32 x[], const Word16 lpcGains[], const Word16 lpcGains_e[] ); @@ -1564,12 +1507,7 @@ void Mode2_pit_encode_fx( Word16 pit_fr2, Word16 pit_max, Word16 pit_res_max ); -#ifndef REUSE_EVS_BE_ACELP_4T64 -void E_ACELP_4tsearch_fx( Word16 dn[] /*Qdn*/, const Word16 cn[] /*Q_xn*/, const Word16 H[] /*Q12*/, Word16 code[] /*Q9*/, const PulseConfig *config, Word16 ind[] /*Q0*/, Word16 y[] /*Qy*/ ); -void E_ACELP_4tsearch_ivas_fx( Word16 dn[] /*Qdn*/, const Word16 cn[] /*Q_xn*/, const Word16 H[] /*Q12*/, Word16 code[] /*Q9*/, const PulseConfig *config, Word16 ind[] /*Q0*/, Word16 y[] /*Qy*/ ); -#else void E_ACELP_4tsearch_fx( Word16 dn[] /*Qdn*/, const Word16 cn[] /*Q_xn*/, const Word16 H[] /*Q12*/, Word16 code[] /*Q9*/, const PulseConfig *config, Word16 ind[] /*Q0*/, Word16 y[] /*Qy*/, const Word16 element_mode ); -#endif void E_ACELP_4t_fx( Word16 dn[], /* Qdn */ Word16 cn[] /* Q_xn */, @@ -1583,30 +1521,10 @@ void E_ACELP_4t_fx( const Word16 last_L_frame, const Word32 total_brate, const Word16 i_subfr, - const Word16 cmpl_flag -#ifdef REUSE_EVS_BE_ACELP_4T64 - , + const Word16 cmpl_flag, const Word16 element_mode /*Q0*/ -#endif ); -#ifndef REUSE_EVS_BE_ACELP_4T64 -void E_ACELP_4t_ivas_fx( - Word16 dn[], /* Qdn */ - Word16 cn[] /* Q_xn */, - Word16 H[], /* Q12 */ - Word16 R[], /* Qx */ - Word8 acelpautoc, - Word16 code[], /* Q9 */ - Word16 cdk_index, - Word16 _index[], - const Word16 L_frame, - const Word16 last_L_frame, - const Word32 total_brate, - const Word16 i_subfr, - const Word16 cmpl_flag, - Word16 element_mode ); -#endif void E_ACELP_innovative_codebook_fx( Word16 *exc, /* i : pointer to the excitation frame Q_new */ Word16 T0, /* i : integer pitch lag Q0 */ @@ -2300,21 +2218,8 @@ void tcx_hm_analyse_fx( Word16 *hm_bits_out /* o: bit consumption Q0 */ ); void E_ACELP_4tsearchx_fx( Word16 dn[] /*Qdn*/, const Word16 cn[] /*Q_new*/, Word16 Rw[] /*Q9*/, Word16 code[] /*Q9*/, const PulseConfig *config, Word16 ind[] /*Q0*/ -#ifdef REUSE_EVS_BE_ACELP_4T64 , - const Word16 element_mode -#endif -); -#ifndef REUSE_EVS_BE_ACELP_4T64 -void E_ACELP_4tsearchx_ivas_fx( - Word16 dn[], /*Qdn*/ - const Word16 cn[], /*Q_new*/ - Word16 Rw[], /*Q9*/ - Word16 code[], /*Q9*/ - const PulseConfig *config, - Word16 ind[], /*Q0*/ - Word16 element_mode ); -#endif + const Word16 element_mode ); void E_ACELP_weighted_code( const Word16 code[], /* i: code Q9*/ const Word16 H[], /* i: impulse response Q*/ @@ -3467,37 +3372,13 @@ Word16 pit_encode_fx( /* o : Fractional pitc const Word16 *xn, /* i : target vector */ const Word16 tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag */ const Word16 tdm_Pri_pitch_buf[] /* i : primary channel pitch buffer */ -#if defined REUSE_EVS_BE_ACELP_PITCH && !defined REUSE_EVS_ACELP_PITCH_NORM_CORR +#if !defined REUSE_EVS_ACELP_PITCH_NORM_CORR , const Word16 element_mode, /* i : mode element */ const Word16 Q_new /* i : scaling factor */ #endif ); -#ifndef REUSE_EVS_BE_ACELP_PITCH -Word16 pit_encode_ivas_fx( /* o : Fractional pitch for each subframe */ - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - const Word16 pitch_bits[], /* i : pitch bits */ - const Word32 core_brate, /* i : core bitrate */ - const Word16 Opt_AMR_WB, /* i : flag indicating AMR-WB IO mode */ - const Word16 L_frame, /* i : length of the frame */ - const Word16 coder_type, /* i : coding type */ - Word16 *limit_flag, /* i/o: restrained(0) or extended(1) Q limits */ - const Word16 i_subfr, /* i : subframe index */ - Word16 *exc, /* i/o: pointer to excitation signal frame Q_new */ - const Word16 L_subfr, /* i : subframe length */ - const Word16 *pitch, /* i : open loop pitch estimates in current frame */ - Word16 *T0_min, /* i/o: lower limit for close-loop search */ - Word16 *T0_max, /* i/o: higher limit for close-loop search */ - Word16 *T0, /* i/o: close loop integer pitch */ - Word16 *T0_frac, /* i/o: close loop fractional part of the pitch */ - const Word16 *h1, /* i : weighted filter input response Q(14 - norm_s(h1[0]) */ - const Word16 *xn, /* i : target vector Q_new */ - const Word16 tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag */ - const Word16 tdm_Pri_pitch_buf[], /* i : primary channel pitch buffer */ - Word16 Q_new /* i */ -); -#endif Word16 lp_filt_exc_enc_fx( const Word16 codec_mode, /* i : MODE1 or MODE2 Q0 */ const Word16 coder_type, /* i : coding type Q0 */ @@ -3514,24 +3395,6 @@ Word16 lp_filt_exc_enc_fx( Word16 *gain_pit, /* o : adaptive excitation gain Q14 */ Word16 *lp_flag /* i/o: mode selection Q0 */ ); -#ifndef REUSE_EVS_BE_ACELP_LP_FILT -Word16 lp_filt_exc_enc_ivas_fx( - const Word16 codec_mode, /* i : MODE1 or MODE2 Q0 */ - const Word16 coder_type, /* i : coding type Q0 */ - const Word16 i_subfr, /* i : subframe index Q0 */ - Word16 *exc, /* i/o: pointer to excitation signal frame Q_new */ - const Word16 *h1, /* i : weighted filter i response Q(15) */ - const Word16 *xn, /* i : target vector Q_new-1+shift */ - Word16 *y1, /* o : zero-memory filtered adaptive excitation Q_new-1+shift */ - Word16 *xn2, /* o : target vector for innovation search Q_new-1+shift */ - const Word16 L_subfr, /* i : length of vectors for gain quantization Q0 */ - const Word16 L_frame, /* i : frame size Q0 */ - Word16 *g_corr, /* o : ACELP correlation values mant/exp */ - const Word16 clip_gain, /* i : adaptive gain clipping flag Q0 */ - Word16 *gain_pit, /* o : adaptive excitation gain Q14 */ - Word16 *lp_flag /* i/o: mode selection Q0 */ -); -#endif Word16 inov_encode_fx( Encoder_State *st_fx, /* i/o: encoder state structure */ const Word32 core_brate, /* i : core bitrate */ @@ -3603,28 +3466,6 @@ void gain_enc_mless_fx( Word16 *g_corr, /* i/o: correlations , -2,, -2 and 2 Qx*/ const Word16 clip_gain /* i : gain pitch clipping flag (1 = clipping) Q0*/ ); -#ifndef REUSE_EVS_BE_GAINQ -void gain_enc_mless_ivas_fx( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - const Word16 gains_mode[], /* i : gain bits Q0*/ - const Word16 element_mode, /* i : element mode Q0*/ - const Word16 L_frame, /* i : length of the frame Q0*/ - const Word16 i_subfr, /* i : subframe index Q0*/ - const Word16 tc_subfr, /* i : TC subframe index Q0*/ - const Word16 *xn, /* i : target vector Q_xn*/ - const Word16 *y1, /* i : zero-memory filtered adaptive excitation Q_xn*/ - const Word16 Q_xn, /* i : xn and y1 scaling */ - const Word16 *y2, /* i : zero-memory filtered algebraic codebook excitation Q9*/ - const Word16 *code, /* i : algebraic excitation Q9*/ - const Word16 Es_pred, /* i : predicted scaled innovation energy Q8*/ - Word16 *gain_pit, /* o : quantized pitch gain Q14*/ - Word32 *gain_code, /* o : quantized codebook gain Q16*/ - Word16 *gain_inov, /* o : gain of the innovation (used for normalization) Q12*/ - Word32 *norm_gain_code, /* o : norm. gain of the codebook excitation Q16*/ - Word16 *g_corr, /* i/o: correlations , -2,, -2 and 2 Qx*/ - const Word16 clip_gain /* i : gain pitch clipping flag (1 = clipping) Q0*/ -); -#endif void updt_IO_switch_enc_fx( Encoder_State *st, /* i/o: state structure */ const Word16 input_frame /* i : i frame length */ @@ -3799,33 +3640,9 @@ void gain_enc_lbr_fx( Word16 gp_mem[], /* i/o: gain_pitch from previous subframes Q14*/ const Word16 clip_gain, /* i : gain pitch clipping flag (1 = clipping) Q0*/ const Word16 L_subfr /* i : subframe length Q0*/ -#ifdef REUSE_EVS_BE_GAINQ_LBR , const Word16 element_mode /* i : mode element Q0*/ -#endif -); -#ifndef REUSE_EVS_BE_GAINQ_LBR -void gain_enc_lbr_ivas_fx( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - const Word16 gains_mode[], /* i : gain bits Q0*/ - const Word16 coder_type, /* i : coding type Q0*/ - const Word16 i_subfr, /* i : subframe index Q0*/ - const Word16 *xn, /* i : target vector Q_xn*/ - const Word16 *y1, /* i : zero-memory filtered adaptive excitation Q_xn*/ - const Word16 Q_xn, /* i : xn and y1 format */ - const Word16 *y2, /* i : zero-memory filtered algebraic codebook excitation Q9*/ - const Word16 *code, /* i : algebraic excitation Q9*/ - Word16 *gain_pit, /* o : quantized pitch gain Q14*/ - Word32 *gain_code, /* o : quantized codebook gain Q16*/ - Word16 *gain_inov, /* o : gain of the innovation (used for normalization) Q12*/ - Word32 *norm_gain_code, /* o : norm. gain of the codebook excitation Q16*/ - Word16 *g_corr, /* i/o: correlations , -2,, -2 and 2 mant/exp*/ - Word32 gc_mem[], /* i/o: gain_code from previous subframes Q16*/ - Word16 gp_mem[], /* i/o: gain_pitch from previous subframes Q14*/ - const Word16 clip_gain, /* i : gain pitch clipping flag (1 = clipping) Q0*/ - const Word16 L_subfr /* i : subframe length Q0*/ ); -#endif void gain_enc_SQ_fx( BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ const Word16 gains_mode[], /* i : gain bits Q0*/ @@ -3843,25 +3660,6 @@ void gain_enc_SQ_fx( const Word16 clip_gain, /* i : gain pitch clipping flag (1 = clipping) Q0*/ const Word16 Q_xn /* i : xn and y1 scaling */ ); -#ifndef REUSE_EVS_BE_GAINQ -void gain_enc_SQ_ivas_fx( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - const Word16 gains_mode[], /* i : gain bits Q0*/ - const Word16 i_subfr, /* i : subframe index Q0*/ - const Word16 *xn, /* i : target vector Q_xn*/ - const Word16 *yy1, /* i : zero-memory filtered adaptive excitation Q_xn*/ - const Word16 *y2, /* i : zero-memory filtered algebraic codebook excitation Q9*/ - const Word16 *code, /* i : algebraic excitation Q9*/ - const Word16 Es_pred, /* i : predicted scaled innovation energy Q8*/ - Word16 *gain_pit, /* o : quantized pitch gain Q14*/ - Word32 *gain_code, /* o : quantized codebook gain Q16*/ - Word16 *gain_inov, /* o : gain of the innovation (used for normalization) Q12*/ - Word32 *norm_gain_code, /* o : norm. gain of the codebook excitation Q16*/ - Word16 *g_corr, /* i/o: correlations , ,, -2 and 2 Qx*/ - const Word16 clip_gain, /* i : gain pitch clipping flag (1 = clipping) Q0*/ - const Word16 Q_xn /* i : xn and y1 scaling */ -); -#endif void updt_tar_fx( const Word16 *x, /* i : old target (for pitch search) */ Word16 *x2, /* o : new target (for codebook search) */ @@ -4453,16 +4251,6 @@ void acelp_1t64_fx( Word16 y[], /* o : filtered fixed codebook excitation */ const Word16 L_subfr /* i : subframe length */ ); -#ifndef REUSE_EVS_BE_ACELP_1t64 -void acelp_1t64_ivas_fx( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - const Word16 dn[], /* i : corr. between target and h[]. */ - const Word16 h[], /* i : impulse response of weighted synthesis filter */ - Word16 code[], /* o : algebraic (fixed) codebook excitation */ - Word16 y[], /* o : filtered fixed codebook excitation */ - const Word16 L_subfr /* i : subframe length */ -); -#endif void acelp_2t32_fx( BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ const Word16 dn[], /* i : corr. between target and h[]. */ @@ -4470,15 +4258,6 @@ void acelp_2t32_fx( Word16 code[], /* o : algebraic (fixed) codebook excitation */ Word16 y[] /* o : filtered fixed codebook excitation */ ); -#ifndef REUSE_EVS_BE_ACELP_2t32 -void acelp_2t32_ivas_fx( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - const Word16 dn[], /* i : corr. between target and h[]. */ - const Word16 h[], /* i : impulse response of weighted synthesis filter */ - Word16 code[], /* o : algebraic (fixed) codebook excitation */ - Word16 y[] /* o : filtered fixed codebook excitation */ -); -#endif Word16 acelp_4t64_fx( BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ Word16 dn[], /* i : corr. between target and h[]. */ @@ -4491,26 +4270,8 @@ Word16 acelp_4t64_fx( Word16 nbbits, /* i : number of bits per codebook */ const Word16 cmpl_flag, /* i : coomplexity reduction flag */ const Word16 Opt_AMR_WB /* i : flag indicating AMR-WB IO mode */ -#ifdef REUSE_EVS_BE_ACELP_4T64 , - const Word16 element_mode -#endif -); -#ifndef REUSE_EVS_BE_ACELP_4T64 -Word16 acelp_4t64_ivas_fx( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - Word16 dn[], /* i : corr. between target and h[]. */ - const Word16 cn[], /* i : residual after long term prediction Q_new*/ - const Word16 H[], /* i : impulse response of weighted synthesis filter Q12*/ - Word16 R[], /* i : autocorrelation values */ - const Word16 acelpautoc, /* i : autocorrealtion flag */ - Word16 code[], /* o : algebraic (fixed) codebook excitation Q9*/ - Word16 y[], /* o : filtered fixed codebook excitation Q9*/ - Word16 nbbits, /* i : number of bits per codebook */ - const Word16 cmpl_flag, /* i : complexity reduction flag */ - const Word16 Opt_AMR_WB, /* i : flag indicating AMR-WB IO mode */ - Word16 element_mode ); -#endif + const Word16 element_mode ); ivas_error evs_enc_fx( Encoder_State *st, /* i/o: encoder state structure */ const Word16 *data, /* i : input signal Q0*/ diff --git a/lib_enc/pvq_core_enc_fx.c b/lib_enc/pvq_core_enc_fx.c index a5e19346144be671c53723d302b35236f0508aa7..647e97f8722a40d91865851668c661b5aef37f74 100644 --- a/lib_enc/pvq_core_enc_fx.c +++ b/lib_enc/pvq_core_enc_fx.c @@ -267,12 +267,6 @@ void pvq_encode_frame_ivas_fx( Word32 xy_corr, yy_corr; PVQ_ENC_DATA pvq_enc; PVQ_ENC_HANDLE hPVQ = &pvq_enc; -#ifndef ISSUE_1796_replace_shl_o -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move16(); -#endif -#endif rc_enc_init_fx( hPVQ, pvq_bits ); @@ -333,11 +327,7 @@ void pvq_encode_frame_ivas_fx( } tmp = ratio( xy_corr, yy_corr, &exp ); -#ifdef ISSUE_1796_replace_shl_o gopt[is] = shl_sat( tmp, sub( sub( sub( 14, Q_coefs ), shift ), exp ) ); -#else - gopt[is] = shl_o( tmp, sub( sub( sub( 14, Q_coefs ), shift ), exp ), &Overflow ); -#endif move16(); if ( gopt[is] == 0 ) @@ -397,12 +387,6 @@ void pvq_encode_frame_fx( Word32 xy_corr, yy_corr; PVQ_ENC_DATA pvq_enc; PVQ_ENC_HANDLE hPVQ = &pvq_enc; -#ifndef ISSUE_1796_replace_shl_o -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move16(); -#endif -#endif rc_enc_init_fx( hPVQ, pvq_bits ); @@ -463,11 +447,7 @@ void pvq_encode_frame_fx( } tmp = ratio( xy_corr, yy_corr, &exp ); -#ifdef ISSUE_1796_replace_shl_o gopt[is] = shl_sat( tmp, sub( sub( sub( 14, Q_coefs ), shift ), exp ) ); -#else - gopt[is] = shl_o( tmp, sub( sub( sub( 14, Q_coefs ), shift ), exp ), &Overflow ); -#endif move16(); if ( gopt[is] == 0 ) { @@ -943,23 +923,13 @@ static void densityIndexSymbolEncode_ivas_fx( Word32 sym_freq, cum_freq, tot; Word32 acc; UWord16 lsb; -#ifndef ISSUE_1796_replace_shl_o -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move16(); -#endif -#endif sym_freq = L_deposit_l( 1 ); IF( s_and( (Word16) 0xFFFE, density ) != 0 ) /* even */ { angle = atan2_fx( SQRT_DIM_fx[r_dim], SQRT_DIM_fx[l_dim] ); -#ifdef ISSUE_1796_replace_shl_o angle = shl_sat( angle, 1 ); -#else - angle = shl_o( angle, 1, &Overflow ); -#endif angle = mult_r( angle, 20861 ); c = mult_r( density, angle ); @@ -1026,23 +996,13 @@ static void densityIndexSymbolEncode_fx( Word32 sym_freq, cum_freq, tot; Word32 acc; UWord16 lsb; -#ifndef ISSUE_1796_replace_shl_o -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move16(); -#endif -#endif sym_freq = L_deposit_l( 1 ); IF( s_and( (Word16) 0xFFFE, density ) != 0 ) /* even */ { angle = atan2_fx( SQRT_DIM_fx[r_dim], SQRT_DIM_fx[l_dim] ); -#ifdef ISSUE_1796_replace_shl_o angle = shl_sat( angle, 1 ); -#else - angle = shl_o( angle, 1, &Overflow ); -#endif angle = mult_r( angle, 20861 ); c = mult_r( density, angle ); diff --git a/lib_enc/scale_enc_fx.c b/lib_enc/scale_enc_fx.c index 32633c89d559d81ddf07d1db91f106c8f9150d31..2f3cd18338af7c7145123d6507512b60cba3f80d 100644 --- a/lib_enc/scale_enc_fx.c +++ b/lib_enc/scale_enc_fx.c @@ -98,11 +98,7 @@ void Preemph_scaled( BASOP_SATURATE_WARNING_OFF_EVS Overflow = 0; -#ifdef ISSUE_1796_replace_shl_o QVal = shl_sat( 1, sub( 15, bits ) ); -#else - QVal = shl_o( 1, sub( 15, bits ), &Overflow ); -#endif BASOP_SATURATE_WARNING_ON_EVS mu = shr( Preemph_factor, bits ); /* Q15 --> Q(15-bits) */ diff --git a/lib_enc/set_impulse_fx.c b/lib_enc/set_impulse_fx.c index 7a2224611b34c82fe57cc7930e7e061825376608..46693bfe0381e8af458a385fab86077fa2644418 100644 --- a/lib_enc/set_impulse_fx.c +++ b/lib_enc/set_impulse_fx.c @@ -202,11 +202,7 @@ void set_impulse_fx( num = div_s( num, den ); -#ifdef ISSUE_1796_replace_shl_o krit_fx = shr_sat( num, sub( sub( shl_sat( exp_num, 1 ), exp_den ), 2 ) ); /* Q18 */ -#else - krit_fx = shr_sat( num, sub( sub( shl_o( exp_num, 1, &Overflow ), exp_den ), 2 ) ); /* Q18 */ -#endif IF( GT_16( krit_fx, krit_max_fx ) ) { diff --git a/lib_enc/speech_music_classif_fx.c b/lib_enc/speech_music_classif_fx.c index 65f3fb1b86b3e7cf378ba0a83d99b709515a8ec2..e2c8f59ffcd6ffbc872fde234cfeb83dee1555e2 100644 --- a/lib_enc/speech_music_classif_fx.c +++ b/lib_enc/speech_music_classif_fx.c @@ -3762,11 +3762,7 @@ static void spec_analysis_fx( test(); IF( GT_16( peak_idx[k], valey_idx[i] ) && LT_16( peak_idx[k], valey_idx[i + 1] ) ) { -#ifdef ISSUE_1796_replace_shl_o p2v[k] = sub_o( shl_sat( peak[k], 1 ), add_o( valley[i], valley[i + 1], &Overflow ), &Overflow ); -#else - p2v[k] = sub_o( shl_o( peak[k], 1, &Overflow ), add_o( valley[i], valley[i + 1], &Overflow ), &Overflow ); -#endif move16(); k = add( k, 1 ); } diff --git a/lib_enc/swb_bwe_enc_fx.c b/lib_enc/swb_bwe_enc_fx.c index 40fefd684dd6c4877ba872b508441f717f9479b4..2b2c809a9837b449d812759564a996d1d535d609 100644 --- a/lib_enc/swb_bwe_enc_fx.c +++ b/lib_enc/swb_bwe_enc_fx.c @@ -1059,20 +1059,12 @@ static Word16 FD_BWE_class_fx( /* o : FD BWE class expd = sub( sub( 30, expd ), shl( st_fx->prev_Q_shb, 1 ) ); scale = shr( sub( den, num ), 15 ); -#ifdef ISSUE_1796_replace_shl_o num = shl_sat( num, scale ); -#else - num = shl_o( num, scale, &Overflow ); -#endif expn = sub( expn, scale ); tmp = div_s( num, den ); expn = sub( expn, expd ); -#ifdef ISSUE_1796_replace_shl_o gain_tmp = shl_sat( tmp, sub( expn, 1 ) ); /*Q14 */ -#else - gain_tmp = shl_o( tmp, sub( expn, 1 ), &Overflow ); /*Q14 */ -#endif } test(); IF( EQ_16( hBWE_FD->prev_mode, TRANSIENT ) ) @@ -1172,11 +1164,7 @@ static Word16 FD_BWE_class_fx( /* o : FD BWE class } test(); -#ifdef ISSUE_1796_replace_shl_o IF( GT_16( sharp, 4608 ) && GT_16( peak, shl_sat( 1, add( Q_syn, 3 ) ) ) ) -#else - IF( GT_16( sharp, 4608 ) && GT_16( peak, shl_o( 1, add( Q_syn, 3 ), &Overflow ) ) ) -#endif { k = add( k, 1 ); move16(); diff --git a/lib_enc/swb_tbe_enc_fx.c b/lib_enc/swb_tbe_enc_fx.c index f243cd27cd741780ca2c1a6fd0eabc9e862aa7d5..d5c546c35569fdb118a0cef6e1c31b2fde915e2f 100644 --- a/lib_enc/swb_tbe_enc_fx.c +++ b/lib_enc/swb_tbe_enc_fx.c @@ -784,14 +784,12 @@ void wb_tbe_enc_fx( autocorr_fx( hb_old_speech, LPC_SHB_ORDER_WB + 1, R_h, R_l, &Q_R, WBTBE_LPCWIN_LENGTH, win_lpc_hb_wb_fx, 0, 1 ); -#ifdef NONBE_FIX_1130_DIV_ZERO_LEV_DUR if ( st_fx->element_mode > EVS_MONO ) { /* Ensure R[0] isn't zero when entering Levinson-Durbin */ R_l[0] = s_max( R_l[0], 1 ); move16(); } -#endif E_LPC_lev_dur( R_h, R_l, lpc_wb_temp_fx, LepsP, LPC_SHB_ORDER_WB, NULL ); @@ -1390,11 +1388,9 @@ void wb_tbe_enc_ivas_fx( autocorr_fx( hb_old_speech, LPC_SHB_ORDER_WB + 1, R_h, R_l, &Q_R, ( ( NS2SA( INT_FS_12k8, 5000000L ) + L_SUBFR + L_FRAME ) * 5 / 16 ), win_lpc_hb_wb_ivas_fx, 0, 1 ); -#ifdef NONBE_FIX_1130_DIV_ZERO_LEV_DUR /* Ensure R[0] isn't zero when entering Levinson-Durbin */ R_l[0] = s_max( R_l[0], 1 ); move16(); -#endif E_LPC_lev_dur( R_h, R_l, lpc_wb_temp_fx, LepsP, LPC_SHB_ORDER_WB, NULL ); // Since 0th index will be 1 in floating point buffer, in fixed point one has to take norm of 0th index to identify the Q-factor @@ -4698,29 +4694,17 @@ static void EstimateSHBFrameGain_fx( move32(); FOR( i = 0; i < l_shb_lahead; i++ ) { -#ifdef ISSUE_1796_replace_shl_o sig = mult_r( shl_sat( oriSHB[i], scaling ), win_shb[i] ); -#else - sig = mult_r( shl_o( oriSHB[i], scaling, &Overflow ), win_shb[i] ); -#endif oriNrg = L_mac0_o( oriNrg, sig, sig, &Overflow ); /* 2*Q_oriSHB + 2*scaling */ } FOR( ; i < l_frame; i++ ) { -#ifdef ISSUE_1796_replace_shl_o sig = shl_sat( oriSHB[i], scaling ); -#else - sig = shl_o( oriSHB[i], scaling, &Overflow ); -#endif oriNrg = L_mac0_o( oriNrg, sig, sig, &Overflow ); /* 2*Q_oriSHB + 2*scaling */ } FOR( ; i < tmp; i++ ) { -#ifdef ISSUE_1796_replace_shl_o sig = mult_r( shl_sat( oriSHB[i], scaling ), win_shb[l_frame + l_shb_lahead - 1 - i] ); -#else - sig = mult_r( shl_o( oriSHB[i], scaling, &Overflow ), win_shb[l_frame + l_shb_lahead - 1 - i] ); -#endif oriNrg = L_mac0_o( oriNrg, sig, sig, &Overflow ); /* 2*Q_oriSHB + 2*scaling */ } } @@ -4899,29 +4883,17 @@ static void EstimateSHBFrameGain_ivas_fx( move32(); FOR( i = 0; i < l_shb_lahead; i++ ) { -#ifdef ISSUE_1796_replace_shl_o sig = mult_r( shl_sat( oriSHB[i], scaling ), win_shb[i] ); -#else - sig = mult_r( shl_o( oriSHB[i], scaling, &Overflow ), win_shb[i] ); -#endif oriNrg = L_mac0_o( oriNrg, sig, sig, &Overflow ); /* 2*Q_oriSHB + 2*scaling */ } FOR( ; i < l_frame; i++ ) { -#ifdef ISSUE_1796_replace_shl_o sig = shl_sat( oriSHB[i], scaling ); -#else - sig = shl_o( oriSHB[i], scaling, &Overflow ); -#endif oriNrg = L_mac0_o( oriNrg, sig, sig, &Overflow ); /* 2*Q_oriSHB + 2*scaling */ } FOR( ; i < tmp; i++ ) { -#ifdef ISSUE_1796_replace_shl_o sig = mult_r( shl_sat( oriSHB[i], scaling ), win_shb[l_frame + l_shb_lahead - 1 - i] ); -#else - sig = mult_r( shl_o( oriSHB[i], scaling, &Overflow ), win_shb[l_frame + l_shb_lahead - 1 - i] ); -#endif oriNrg = L_mac0_o( oriNrg, sig, sig, &Overflow ); /* 2*Q_oriSHB + 2*scaling */ } } @@ -6253,12 +6225,6 @@ static void determine_gain_weights_fx( Word16 j; Word16 exp, exp1, frac, tmp, exp2; Word32 L_tmp; -#ifndef ISSUE_1796_replace_shl_o -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move16(); -#endif -#endif FOR( j = 0; j < dims; j++ ) { @@ -6279,11 +6245,7 @@ static void determine_gain_weights_fx( { exp2 = sub( exp, 2 ); } -#ifdef ISSUE_1796_replace_shl_o weights[j] = shl_sat( tmp, exp2 ); -#else - weights[j] = shl_o( tmp, exp2, &Overflow ); -#endif move16(); /* Q12 */ } ELSE diff --git a/lib_enc/tcx_ltp_enc_fx.c b/lib_enc/tcx_ltp_enc_fx.c index a069f99b435d805ee3380619c30a5b94cc24ed8b..3cb55ba25ac4f44f2abc05215aa5ae9b1157c96b 100644 --- a/lib_enc/tcx_ltp_enc_fx.c +++ b/lib_enc/tcx_ltp_enc_fx.c @@ -86,12 +86,6 @@ static void tcx_ltp_pitch_search( Word16 i, t, t0, t1, step, fraction, t0_min, t0_max, t_min, t_max, delta, temp_m, temp_e, s, s_wsp; Word32 cor_max, cor[256], *pt_cor, temp; Word16 wsp2[L_FRAME_PLUS + PIT_MAX_MAX + L_INTERPOL1]; -#ifndef ISSUE_1796_replace_shl_o -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif delta = 16; @@ -183,11 +177,7 @@ static void tcx_ltp_pitch_search( temp_m = divide1616( extract_h( L_shl( cor_max, s ) ), temp_m ); temp_e = sub( negate( s ), temp_e ); -#ifdef ISSUE_1796_replace_shl_o *norm_corr = shl_sat( temp_m, temp_e ); -#else - *norm_corr = shl_o( temp_m, temp_e, &Overflow ); -#endif IF( GE_16( t1, pitfr1 ) ) { @@ -301,12 +291,6 @@ static void tcx_ltp_pitch_search_ivas_fx( Word16 i, t, t0, t1, step, fraction, t0_min, t0_max, t_min, t_max, delta, temp_m, temp_e, s, s_wsp; Word32 cor_max, cor[256], *pt_cor, temp; Word16 wsp2[L_FRAME_PLUS + PIT_MAX_MAX + L_INTERPOL1]; -#ifndef ISSUE_1796_replace_shl_o -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif delta = 16; move16(); @@ -393,11 +377,7 @@ static void tcx_ltp_pitch_search_ivas_fx( temp_m = divide1616( extract_h( L_shl( cor_max, s ) ), temp_m ); temp_e = sub( negate( s ), temp_e ); -#ifdef ISSUE_1796_replace_shl_o *norm_corr = shl_sat( temp_m, temp_e ); -#else - *norm_corr = shl_o( temp_m, temp_e, &Overflow ); -#endif test(); IF( check_border_case && EQ_16( t1, t0_min ) ) @@ -544,11 +524,7 @@ static void tcx_ltp_find_gain( Word16 *speech, Word16 *pred_speech, Word16 L_fra g = divide1616( round_fx_o( corr, &Overflow ), round_fx_o( ener, &Overflow ) ); BASOP_SATURATE_WARNING_OFF_EVS -#ifdef ISSUE_1796_replace_shl_o g = shl_sat( g, sub( s1, s2 ) ); -#else - g = shl_o( g, sub( s1, s2 ), &Overflow ); -#endif BASOP_SATURATE_WARNING_ON_EVS /* Quantize gain */ @@ -599,11 +575,7 @@ static void tcx_ltp_find_gain_ivas_fx( Word16 *speech /*Qx*/, Word16 *pred_speec g = divide1616( round_fx_o( corr, &Overflow ), round_fx_o( ener, &Overflow ) ); BASOP_SATURATE_WARNING_OFF_EVS -#ifdef ISSUE_1796_replace_shl_o g = shl_sat( g, sub( s1, s2 ) ); /*Q15*/ -#else - g = shl_o( g, sub( s1, s2 ), &Overflow ); /*Q15*/ -#endif BASOP_SATURATE_WARNING_ON_EVS /* Quantize gain */ diff --git a/lib_enc/tcx_utils_enc_fx.c b/lib_enc/tcx_utils_enc_fx.c index a6e0a3e8010af8eb43edf77efa003edd86bf9ec8..62ba1cd95e79e49fd38289549661eace59f9f94d 100644 --- a/lib_enc/tcx_utils_enc_fx.c +++ b/lib_enc/tcx_utils_enc_fx.c @@ -2072,18 +2072,8 @@ void QuantizeGain( Word16 n, Word16 *pGain, Word16 *pGain_e, Word16 *pQuantizedG Word16 ener, ener_e, enerInv, enerInv_e, gain, gain_e; Word16 quantizedGain; Word32 tmp32; -#ifndef ISSUE_1796_replace_shl_o -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif -#ifdef ISSUE_1796_replace_shl_o ener = mult_r( shl_sat( n, 5 ), 26214 /*128.f/NORM_MDCT_FACTOR Q15*/ ); -#else - ener = mult_r( shl_o( n, 5, &Overflow ), 26214 /*128.f/NORM_MDCT_FACTOR Q15*/ ); -#endif ener_e = 15 - 5 - 7; move16(); IF( GE_16( n, 1024 ) ) @@ -2153,12 +2143,6 @@ void tcx_noise_factor_fx( Word16 c1, c2; Word16 att; /* noise level attenuation factor for transient windows */ Word32 xMax; -#ifndef ISSUE_1796_replace_shl_o -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; - move32(); -#endif -#endif assert( nTransWidth <= 16 ); @@ -2254,11 +2238,7 @@ void tcx_noise_factor_fx( att = BASOP_Util_Divide3232_Scale( L_shl( L_min( accu1, accu2 ), 1 ), L_add( accu1, accu2 ), &s ); att = Sqrt16( att, &s ); BASOP_SATURATE_WARNING_OFF_EVS; /* att is always <= 1.0 */ -#ifdef ISSUE_1796_replace_shl_o att = shl_sat( att, s ); -#else - att = shl_o( att, s, &Overflow ); -#endif BASOP_SATURATE_WARNING_ON_EVS; } ELSE @@ -2461,11 +2441,7 @@ void tcx_noise_factor_fx( tmp1 = BASOP_Util_Divide3232_Scale( Mpy_32_16_1( sqErrorNrg, att ), n, &s ); s = add( add( add( s, x_orig_e ), inv_gain2_e ), 7 - 15 ); BASOP_SATURATE_WARNING_OFF_EVS; -#ifdef ISSUE_1796_replace_shl_o tmp1 = shl_sat( tmp1, s ); -#else - tmp1 = shl_o( tmp1, s, &Overflow ); -#endif BASOP_SATURATE_WARNING_ON_EVS; } ELSE @@ -2509,12 +2485,8 @@ void tcx_noise_factor_ivas_fx( Word16 i, k, win, segmentOffset, j; Word32 sqErrorNrg = 0, n; move32(); -#ifdef FIX_1781_SPECTRAL_GAPS Word32 inv_gain2, tilt_factor; Word16 inv_gain2_e, nTransWidth_1, exp_sqErrorNrg = 0; -#else - Word16 inv_gain2, inv_gain2_e, tilt_factor, nTransWidth_1, exp_sqErrorNrg = 0; -#endif move16(); Word32 accu1, accu2, tmp32; Word16 tmp1, tmp2, s; @@ -2544,25 +2516,13 @@ void tcx_noise_factor_ivas_fx( /* tilt_factor = 1.0f /(float)pow(max(0.375f, tiltCompFactor), 1.0f/(float)L_frame); */ tmp32 = BASOP_Util_Log2( L_deposit_h( s_max( 0x3000, tiltCompFactor ) ) ); /* 6Q25 */ tmp32 = L_shr( Mpy_32_16_1( tmp32, negate( tmp1 ) ), 6 ); -#ifdef FIX_1781_SPECTRAL_GAPS tilt_factor = BASOP_Util_InvLog2( L_sub( tmp32, 0x2000000 ) ); /* 1Q30 */ -#else - tilt_factor = round_fx( BASOP_Util_InvLog2( L_sub( tmp32, 0x2000000 ) ) ); /* 1Q14 */ -#endif /* inv_gain2 = 1.0f / ((float)(nTransWidth * nTransWidth) * gain_tcx); */ tmp32 = L_mult( imult1616( nTransWidth, nTransWidth ), gain_tcx ); /* 15Q16 */ -#ifdef FIX_1781_SPECTRAL_GAPS inv_gain2 = BASOP_Util_Divide3232_Scale_newton( MAX_32, tmp32, &inv_gain2_e ); -#else - inv_gain2 = BASOP_Util_Divide3232_Scale( MAX_32, tmp32, &inv_gain2_e ); -#endif inv_gain2_e = add( inv_gain2_e, sub( 0, add( 15, gain_tcx_e ) ) ); -#ifdef FIX_1781_SPECTRAL_GAPS inv_gain2 = L_shr( inv_gain2, 2 ); /* 2 bits headroom */ -#else - inv_gain2 = shr( inv_gain2, 2 ); /* 2 bits headroom */ -#endif inv_gain2_e = add( inv_gain2_e, 2 ); /* find last nonzero line below iFirstLine, use it as start offset */ @@ -2588,11 +2548,7 @@ void tcx_noise_factor_ivas_fx( /* inv_gain2 *= (float)pow(tilt_factor, (float)i); */ FOR( k = 0; k < i; k++ ) { -#ifdef FIX_1781_SPECTRAL_GAPS inv_gain2 = L_shl( Mpy_32_32( inv_gain2, tilt_factor ), 1 ); -#else - inv_gain2 = shl( mult( inv_gain2, tilt_factor ), 1 ); -#endif } i = add( i, 1 ); @@ -2642,11 +2598,7 @@ void tcx_noise_factor_ivas_fx( att = BASOP_Util_Divide3232_Scale( L_shl( L_min( accu1, accu2 ), 1 ), L_add( accu1, accu2 ), &s ); att = Sqrt16( att, &s ); BASOP_SATURATE_WARNING_OFF_EVS; /* att is always <= 1.0 */ -#ifdef ISSUE_1796_replace_shl_o att = shl_sat( att, s ); -#else - att = shl_o( att, s, &Overflow ); -#endif BASOP_SATURATE_WARNING_ON_EVS; } ELSE @@ -2660,11 +2612,7 @@ void tcx_noise_factor_ivas_fx( FOR( ; i < lowpassLine; i++ ) { -#ifdef FIX_1781_SPECTRAL_GAPS inv_gain2 = L_shl( Mpy_32_32( inv_gain2, tilt_factor ), 1 ); -#else - inv_gain2 = shl( mult( inv_gain2, tilt_factor ), 1 ); -#endif IF( sqQ[i] != 0 ) /* current line is not zero, so reset pointers */ { @@ -2732,12 +2680,7 @@ void tcx_noise_factor_ivas_fx( win = add( win, 1 ); } /* update segment sum: magnitudes scaled by smoothing function */ -#ifdef FIX_1781_SPECTRAL_GAPS sqQ[i] = Mpy_32_32( imult3216( L_abs( x_orig[i] ), win ), inv_gain2 ); -#else - sqQ[i] = Mpy_32_16_1( imult3216( L_abs( x_orig[i] ), win ), inv_gain2 ); - move32(); -#endif exp_spQ[i] = add( x_orig_e, inv_gain2_e ); move16(); } diff --git a/lib_enc/transition_enc_fx.c b/lib_enc/transition_enc_fx.c index 952d706ec7d64d166dadac92413eb0b51b614d86..8ed4b2fa831302dfade9954be2653aa1529bdf8d 100644 --- a/lib_enc/transition_enc_fx.c +++ b/lib_enc/transition_enc_fx.c @@ -212,13 +212,7 @@ void transition_enc_fx( IF( EQ_16( *tc_subfr, TC_0_0 ) ) { /* this is called only to compute unused bits */ -#ifdef NONBE_1325_TD_STEREO_QUANT_LSF_SEC config_acelp1_fx( ENC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl, st_fx->extl_brate, L_FRAME, -1, &( st_fx->acelp_cfg ), hBstr->nb_bits_tot, TRANSITION, -1, TC_0_0, 3, NULL, unbits_ACELP, st_fx->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st_fx->idchan, 0 /*tdm_Pitch_reuse_flag*/, st_fx->tdm_LRTD_flag, 0 /*GSC_IVAS_mode*/ ); -#else - config_acelp1_fx( ENC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl, st_fx->extl_brate, - L_FRAME, -1, &( st_fx->acelp_cfg ), hBstr->nb_bits_tot, TRANSITION, -1, TC_0_0, 3, NULL, unbits_ACELP, - st_fx->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st_fx->idchan, st_fx->active_cnt, 0 /*tdm_Pitch_reuse_flag*/, st_fx->tdm_LRTD_flag, 0 /*GSC_IVAS_mode*/ ); -#endif } *clip_gain = gp_clip_fx( st_fx->element_mode, st_fx->core_brate, st_fx->voicing_fx, i_subfr, TRANSITION, xn_fx, gp_cl_fx, sub( shift_wsp, 1 ) ); @@ -290,7 +284,7 @@ void transition_enc_fx( /* Find the closed loop pitch period */ *T0 = pitch_fr4_fx( &exc_fx[i_subfr], xn_fx, h1_fx, *T0_min, *T0_max, T0_frac, pit_flag, limit_flag, pit_start, pit_limit, L_FRAME, L_SUBFR -#if defined REUSE_EVS_BE_ACELP_PITCH && !defined REUSE_EVS_ACELP_PITCH_NORM_CORR +#if !defined REUSE_EVS_ACELP_PITCH_NORM_CORR , 0 /*st_fx->element_mode*/, Q_new #endif @@ -333,13 +327,7 @@ void transition_enc_fx( IF( LE_16( sub( i_subfr, *tc_subfr ), L_SUBFR ) ) { -#ifdef NONBE_1325_TD_STEREO_QUANT_LSF_SEC config_acelp1_fx( ENC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl, st_fx->extl_brate, st_fx->L_frame, -1, &( st_fx->acelp_cfg ), hBstr->nb_bits_tot, TRANSITION, -1, *tc_subfr, 2, NULL, unbits_ACELP, st_fx->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st_fx->idchan, 0 /*tdm_Pitch_reuse_flag*/, st_fx->tdm_LRTD_flag, 0 /*GSC_IVAS_mode*/ ); -#else - config_acelp1_fx( ENC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl, st_fx->extl_brate, - st_fx->L_frame, -1, &( st_fx->acelp_cfg ), hBstr->nb_bits_tot, TRANSITION, -1, *tc_subfr, 2, NULL, - unbits_ACELP, st_fx->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st_fx->idchan, st_fx->active_cnt, 0 /*tdm_Pitch_reuse_flag*/, st_fx->tdm_LRTD_flag, 0 /*GSC_IVAS_mode*/ ); -#endif } /*-----------------------------------------------------------------* @@ -429,7 +417,7 @@ void transition_enc_fx( move16(); *T0 = pitch_fr4_fx( &exc_fx[i_subfr], xn_fx, h1_fx, *T0_min, *T0_max, T0_frac, pit_flag, limit_flag, pit_start, 3 * L_SUBFR, L_FRAME, L_SUBFR -#if defined REUSE_EVS_BE_ACELP_PITCH && !defined REUSE_EVS_ACELP_PITCH_NORM_CORR +#if !defined REUSE_EVS_ACELP_PITCH_NORM_CORR , 0 /*st_fx->element_mode*/, Q_new #endif @@ -497,7 +485,7 @@ void transition_enc_fx( move16(); *T0 = pitch_fr4_fx( &exc_fx[i_subfr], xn_fx, h1_fx, *T0_min, *T0_max, T0_frac, pit_flag, limit_flag, PIT_MIN, PIT_FR1_8b, L_FRAME, L_SUBFR -#if defined REUSE_EVS_BE_ACELP_PITCH && !defined REUSE_EVS_ACELP_PITCH_NORM_CORR +#if !defined REUSE_EVS_ACELP_PITCH_NORM_CORR , 0 /*st_fx->element_mode*/, Q_new #endif @@ -548,7 +536,7 @@ void transition_enc_fx( pit_flag = L_SUBFR; move16(); *T0 = pitch_fr4_fx( &exc_fx[i_subfr], xn_fx, h1_fx, *T0_min, *T0_max, T0_frac, pit_flag, limit_flag, PIT_MIN, PIT_FR1_8b, L_FRAME, L_SUBFR -#if defined REUSE_EVS_BE_ACELP_PITCH && !defined REUSE_EVS_ACELP_PITCH_NORM_CORR +#if !defined REUSE_EVS_ACELP_PITCH_NORM_CORR , 0 /*st_fx->element_mode*/, Q_new #endif @@ -584,7 +572,7 @@ void transition_enc_fx( IF( !( ( *tc_subfr == 0 ) && ( EQ_16( i_subfr, L_SUBFR ) ) ) ) { *T0 = pitch_fr4_fx( &exc_fx[i_subfr], xn_fx, h1_fx, *T0_min, *T0_max, T0_frac, pit_flag, limit_flag, PIT_MIN, PIT_FR1_8b, L_FRAME, L_SUBFR -#if defined REUSE_EVS_BE_ACELP_PITCH && !defined REUSE_EVS_ACELP_PITCH_NORM_CORR +#if !defined REUSE_EVS_ACELP_PITCH_NORM_CORR , 0 /*st_fx->element_mode*/, Q_new #endif @@ -595,7 +583,7 @@ void transition_enc_fx( ELSE { *T0 = pitch_fr4_fx( &exc_fx[i_subfr], xn_fx, h1_fx, *T0_min, *T0_max, T0_frac, pit_flag, limit_flag, PIT_FR2_9b, PIT_FR1_9b, L_FRAME, L_SUBFR -#if defined REUSE_EVS_BE_ACELP_PITCH && !defined REUSE_EVS_ACELP_PITCH_NORM_CORR +#if !defined REUSE_EVS_ACELP_PITCH_NORM_CORR , 0 /*st_fx->element_mode*/, Q_new #endif @@ -776,7 +764,7 @@ void transition_enc_fx( IF( EQ_16( nBits, 10 ) ) { *T0 = pitch_fr4_fx( &exc_fx[i_subfr], xn_fx, h1_fx, *T0_min, *T0_max, T0_frac, 0, limit_flag, PIT16k_FR2_EXTEND_10b, PIT16k_MAX, st_fx->L_frame, L_SUBFR -#if defined REUSE_EVS_BE_ACELP_PITCH && !defined REUSE_EVS_ACELP_PITCH_NORM_CORR +#if !defined REUSE_EVS_ACELP_PITCH_NORM_CORR , 0 /*st_fx->element_mode*/, Q_new #endif @@ -792,7 +780,7 @@ void transition_enc_fx( * PIT16k_FR2_TC0_2SUBFR to 2*L_SUBFR resolution 1/2 (frac = 0 or 2) *-----------------------------------------------------------------------------*/ *T0 = pitch_fr4_fx( &exc_fx[i_subfr], xn_fx, h1_fx, *T0_min, *T0_max, T0_frac, 0, limit_flag, PIT16k_FR2_TC0_2SUBFR, 2 * L_SUBFR, st_fx->L_frame, L_SUBFR -#if defined REUSE_EVS_BE_ACELP_PITCH && !defined REUSE_EVS_ACELP_PITCH_NORM_CORR +#if !defined REUSE_EVS_ACELP_PITCH_NORM_CORR , 0 /*st_fx->element_mode*/, Q_new #endif @@ -823,7 +811,7 @@ void transition_enc_fx( { /* delta search */ *T0 = pitch_fr4_fx( &exc_fx[i_subfr], xn_fx, h1_fx, *T0_min, *T0_max, T0_frac, L_SUBFR, limit_flag, PIT16k_FR2_EXTEND_9b, PIT16k_FR1_EXTEND_9b, st_fx->L_frame, L_SUBFR -#if defined REUSE_EVS_BE_ACELP_PITCH && !defined REUSE_EVS_ACELP_PITCH_NORM_CORR +#if !defined REUSE_EVS_ACELP_PITCH_NORM_CORR , 0 /*st_fx->element_mode*/, Q_new #endif @@ -1085,14 +1073,7 @@ void transition_enc_ivas_fx( IF( EQ_16( *tc_subfr, TC_0_0 ) ) { /* this is called only to compute unused bits */ -#ifdef NONBE_1325_TD_STEREO_QUANT_LSF_SEC config_acelp1_fx( ENC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl, st_fx->extl_brate, L_FRAME, -1, &( st_fx->acelp_cfg ), hBstr->nb_bits_tot, TRANSITION, -1, TC_0_0, 3, NULL, unbits_ACELP, st_fx->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st_fx->idchan, 0 /*tdm_Pitch_reuse_flag*/, st_fx->tdm_LRTD_flag, 0 /*GSC_IVAS_mode*/ ); -#else - config_acelp1_fx( ENC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl, st_fx->extl_brate, - L_FRAME, -1, &( st_fx->acelp_cfg ), hBstr->nb_bits_tot, TRANSITION, -1, TC_0_0, 3, NULL, unbits_ACELP, - st_fx->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st_fx->idchan, st_fx->active_cnt, 0 /*tdm_Pitch_reuse_flag*/, st_fx->tdm_LRTD_flag, 0 /*GSC_IVAS_mode*/ - ); -#endif } *clip_gain = gp_clip_fx( st_fx->element_mode, st_fx->core_brate, st_fx->voicing_fx, i_subfr, TRANSITION, xn_fx, gp_cl_fx, sub( shift_wsp, 1 ) ); @@ -1164,7 +1145,7 @@ void transition_enc_ivas_fx( /* Find the closed loop pitch period */ *T0 = pitch_fr4_fx( &exc_fx[i_subfr], xn_fx, h1_fx, *T0_min, *T0_max, T0_frac, pit_flag, limit_flag, pit_start, pit_limit, L_FRAME, L_SUBFR -#if defined REUSE_EVS_BE_ACELP_PITCH && !defined REUSE_EVS_ACELP_PITCH_NORM_CORR +#if !defined REUSE_EVS_ACELP_PITCH_NORM_CORR , 0 /*st_fx->element_mode*/, Q_new #endif @@ -1207,13 +1188,7 @@ void transition_enc_ivas_fx( IF( LE_16( sub( i_subfr, *tc_subfr ), L_SUBFR ) ) { -#ifdef NONBE_1325_TD_STEREO_QUANT_LSF_SEC config_acelp1_fx( ENC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl, st_fx->extl_brate, st_fx->L_frame, -1, &( st_fx->acelp_cfg ), hBstr->nb_bits_tot, TRANSITION, -1, *tc_subfr, 2, NULL, unbits_ACELP, st_fx->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st_fx->idchan, 0 /*tdm_Pitch_reuse_flag*/, st_fx->tdm_LRTD_flag, 0 /*GSC_IVAS_mode*/ ); -#else - config_acelp1_fx( ENC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl, st_fx->extl_brate, - st_fx->L_frame, -1, &( st_fx->acelp_cfg ), hBstr->nb_bits_tot, TRANSITION, -1, *tc_subfr, 2, NULL, - unbits_ACELP, st_fx->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st_fx->idchan, st_fx->active_cnt, 0 /*tdm_Pitch_reuse_flag*/, st_fx->tdm_LRTD_flag, 0 /*GSC_IVAS_mode*/ ); -#endif } /*-----------------------------------------------------------------* @@ -1303,7 +1278,7 @@ void transition_enc_ivas_fx( move16(); *T0 = pitch_fr4_fx( &exc_fx[i_subfr], xn_fx, h1_fx, *T0_min, *T0_max, T0_frac, pit_flag, limit_flag, pit_start, 3 * L_SUBFR, L_FRAME, L_SUBFR -#if defined REUSE_EVS_BE_ACELP_PITCH && !defined REUSE_EVS_ACELP_PITCH_NORM_CORR +#if !defined REUSE_EVS_ACELP_PITCH_NORM_CORR , 0 /*st_fx->element_mode*/, Q_new #endif @@ -1371,7 +1346,7 @@ void transition_enc_ivas_fx( move16(); *T0 = pitch_fr4_fx( &exc_fx[i_subfr], xn_fx, h1_fx, *T0_min, *T0_max, T0_frac, pit_flag, limit_flag, PIT_MIN, PIT_FR1_8b, L_FRAME, L_SUBFR -#if defined REUSE_EVS_BE_ACELP_PITCH && !defined REUSE_EVS_ACELP_PITCH_NORM_CORR +#if !defined REUSE_EVS_ACELP_PITCH_NORM_CORR , 0 /*st_fx->element_mode*/, Q_new #endif @@ -1423,7 +1398,7 @@ void transition_enc_ivas_fx( move16(); *T0 = pitch_fr4_fx( &exc_fx[i_subfr], xn_fx, h1_fx, *T0_min, *T0_max, T0_frac, pit_flag, limit_flag, PIT_MIN, PIT_FR1_8b, L_FRAME, L_SUBFR -#if defined REUSE_EVS_BE_ACELP_PITCH && !defined REUSE_EVS_ACELP_PITCH_NORM_CORR +#if !defined REUSE_EVS_ACELP_PITCH_NORM_CORR , 0 /*st_fx->element_mode*/, Q_new #endif @@ -1458,7 +1433,7 @@ void transition_enc_ivas_fx( IF( !( ( *tc_subfr == 0 ) && ( EQ_16( i_subfr, L_SUBFR ) ) ) ) { *T0 = pitch_fr4_fx( &exc_fx[i_subfr], xn_fx, h1_fx, *T0_min, *T0_max, T0_frac, pit_flag, limit_flag, PIT_MIN, PIT_FR1_8b, L_FRAME, L_SUBFR -#if defined REUSE_EVS_BE_ACELP_PITCH && !defined REUSE_EVS_ACELP_PITCH_NORM_CORR +#if !defined REUSE_EVS_ACELP_PITCH_NORM_CORR , 0 /*st_fx->element_mode*/, Q_new #endif @@ -1469,18 +1444,14 @@ void transition_enc_ivas_fx( ELSE { *T0 = pitch_fr4_fx( &exc_fx[i_subfr], xn_fx, h1_fx, *T0_min, *T0_max, T0_frac, pit_flag, limit_flag, PIT_FR2_9b, PIT_FR1_9b, L_FRAME, L_SUBFR -#if defined REUSE_EVS_BE_ACELP_PITCH && !defined REUSE_EVS_ACELP_PITCH_NORM_CORR +#if !defined REUSE_EVS_ACELP_PITCH_NORM_CORR , 0 /*st_fx->element_mode*/, Q_new #endif ); move16(); } -#ifndef REUSE_EVS_BE_ACELP_PITCH_PIT_Q - pit_Q_enc_ivas_fx( hBstr, 0, nBits, 8, pit_flag, limit_flag, *T0, *T0_frac, T0_min, T0_max ); -#else pit_Q_enc_fx( hBstr, 0, nBits, 8, pit_flag, limit_flag, *T0, *T0_frac, T0_min, T0_max ); -#endif /* Find the adaptive codebook vector - ACELP long-term prediction */ pred_lt4_ivas_fx( &exc_fx[i_subfr], &exc_fx[i_subfr], *T0, *T0_frac, L_SUBFR + 1, L_pitch_inter4_2, L_INTERPOL2, PIT_UP_SAMP ); @@ -1518,13 +1489,8 @@ void transition_enc_ivas_fx( *clip_gain = gp_clip_fx( st_fx->element_mode, st_fx->core_brate, st_fx->voicing_fx, i_subfr, TRANSITION, xn_fx, gp_cl_fx, ( Q_new + shift - 1 ) ); move16(); -#ifndef REUSE_EVS_BE_ACELP_LP_FILT - lp_select = lp_filt_exc_enc_ivas_fx( MODE1, TRANSITION, i_subfr, exc_fx, h1_fx, - xn_fx, y1_fx, xn2_fx, L_SUBFR, st_fx->L_frame, g_corr_fx, *clip_gain, gain_pit_fx, &lp_flag ); -#else lp_select = lp_filt_exc_enc_fx( MODE1, TRANSITION, i_subfr, exc_fx, h1_fx, xn_fx, y1_fx, xn2_fx, L_SUBFR, st_fx->L_frame, g_corr_fx, *clip_gain, gain_pit_fx, &lp_flag ); -#endif IF( EQ_16( lp_flag, NORMAL_OPERATION ) ) { push_indice( hBstr, IND_LP_FILT_SELECT, lp_select, 1 ); @@ -1657,17 +1623,13 @@ void transition_enc_ivas_fx( IF( EQ_16( nBits, 10 ) ) { *T0 = pitch_fr4_fx( &exc_fx[i_subfr], xn_fx, h1_fx, *T0_min, *T0_max, T0_frac, 0, limit_flag, PIT16k_FR2_EXTEND_10b, PIT16k_MAX, st_fx->L_frame, L_SUBFR -#if defined REUSE_EVS_BE_ACELP_PITCH && !defined REUSE_EVS_ACELP_PITCH_NORM_CORR +#if !defined REUSE_EVS_ACELP_PITCH_NORM_CORR , 0 /*st_fx->element_mode*/, Q_new #endif ); move16(); -#ifndef REUSE_EVS_BE_ACELP_PITCH_PIT_Q - pit16k_Q_enc_ivas_fx( hBstr, nBits, limit_flag, *T0, *T0_frac, T0_min, T0_max ); -#else pit16k_Q_enc_fx( hBstr, nBits, limit_flag, *T0, *T0_frac, T0_min, T0_max ); -#endif } ELSE IF( EQ_16( nBits, 8 ) ) /* tc_subfr==0 && i_subfr==L_SUBFR */ { @@ -1677,7 +1639,7 @@ void transition_enc_ivas_fx( * PIT16k_FR2_TC0_2SUBFR to 2*L_SUBFR resolution 1/2 (frac = 0 or 2) *-----------------------------------------------------------------------------*/ *T0 = pitch_fr4_fx( &exc_fx[i_subfr], xn_fx, h1_fx, *T0_min, *T0_max, T0_frac, 0, limit_flag, PIT16k_FR2_TC0_2SUBFR, 2 * L_SUBFR, st_fx->L_frame, L_SUBFR -#if defined REUSE_EVS_BE_ACELP_PITCH && !defined REUSE_EVS_ACELP_PITCH_NORM_CORR +#if !defined REUSE_EVS_ACELP_PITCH_NORM_CORR , 0 /*st_fx->element_mode*/, Q_new #endif @@ -1708,7 +1670,7 @@ void transition_enc_ivas_fx( { /* delta search */ *T0 = pitch_fr4_fx( &exc_fx[i_subfr], xn_fx, h1_fx, *T0_min, *T0_max, T0_frac, L_SUBFR, limit_flag, PIT16k_FR2_EXTEND_9b, PIT16k_FR1_EXTEND_9b, st_fx->L_frame, L_SUBFR -#if defined REUSE_EVS_BE_ACELP_PITCH && !defined REUSE_EVS_ACELP_PITCH_NORM_CORR +#if !defined REUSE_EVS_ACELP_PITCH_NORM_CORR , 0 /*st_fx->element_mode*/, Q_new #endif @@ -1777,13 +1739,8 @@ void transition_enc_ivas_fx( *clip_gain = gp_clip_fx( st_fx->element_mode, st_fx->core_brate, st_fx->voicing_fx, i_subfr, TRANSITION, xn_fx, gp_cl_fx, Q_new ); move16(); -#ifndef REUSE_EVS_BE_ACELP_LP_FILT - lp_select = lp_filt_exc_enc_ivas_fx( MODE1, TRANSITION, i_subfr, exc_fx, h1_fx, - xn_fx, y1_fx, xn2_fx, L_SUBFR, st_fx->L_frame, g_corr_fx, *clip_gain, gain_pit_fx, &lp_flag ); -#else lp_select = lp_filt_exc_enc_fx( MODE1, TRANSITION, i_subfr, exc_fx, h1_fx, xn_fx, y1_fx, xn2_fx, L_SUBFR, st_fx->L_frame, g_corr_fx, *clip_gain, gain_pit_fx, &lp_flag ); -#endif IF( EQ_16( lp_flag, NORMAL_OPERATION ) ) { push_indice( hBstr, IND_LP_FILT_SELECT, lp_select, 1 ); @@ -1895,7 +1852,7 @@ static void tc_enc_fx( IF( EQ_16( nBits, 9 ) ) { *T0 = pitch_fr4_fx( &exc_fx[i_subfr], xn_fx, h1_fx, *T0_min, *T0_max, T0_frac, 0, 0, PIT_FR2_9b, PIT_FR1_9b, L_FRAME, L_SUBFR -#if defined REUSE_EVS_BE_ACELP_PITCH && !defined REUSE_EVS_ACELP_PITCH_NORM_CORR +#if !defined REUSE_EVS_ACELP_PITCH_NORM_CORR , 0 /*st_fx->element_mode*/, Q_new #endif @@ -1905,7 +1862,7 @@ static void tc_enc_fx( ELSE IF( EQ_16( nBits, 6 ) ) { *T0 = pitch_fr4_fx( &exc_fx[i_subfr], xn_fx, h1_fx, *T0_min, *T0_max, T0_frac, 0, 0, PIT_MIN, L_SUBFR, L_FRAME, L_SUBFR -#if defined REUSE_EVS_BE_ACELP_PITCH && !defined REUSE_EVS_ACELP_PITCH_NORM_CORR +#if !defined REUSE_EVS_ACELP_PITCH_NORM_CORR , 0 /*st_fx->element_mode*/, Q_new #endif @@ -1915,7 +1872,7 @@ static void tc_enc_fx( ELSE { *T0 = pitch_fr4_fx( &exc_fx[i_subfr], xn_fx, h1_fx, *T0_min, *T0_max, T0_frac, 0, 0, PIT_MAX, PIT_MIN, L_FRAME, L_SUBFR -#if defined REUSE_EVS_BE_ACELP_PITCH && !defined REUSE_EVS_ACELP_PITCH_NORM_CORR +#if !defined REUSE_EVS_ACELP_PITCH_NORM_CORR , 0 /*st_fx->element_mode*/, Q_new #endif @@ -1940,7 +1897,7 @@ static void tc_enc_fx( IF( EQ_16( nBits, 10 ) ) { *T0 = pitch_fr4_fx( &exc_fx[i_subfr], xn_fx, h1_fx, *T0_min, *T0_max, T0_frac, 0, 1, PIT16k_FR2_EXTEND_10b, PIT16k_MAX, L_FRAME16k, L_SUBFR -#if defined REUSE_EVS_BE_ACELP_PITCH && !defined REUSE_EVS_ACELP_PITCH_NORM_CORR +#if !defined REUSE_EVS_ACELP_PITCH_NORM_CORR , 0 /*st_fx->element_mode*/, Q_new #endif @@ -1951,7 +1908,7 @@ static void tc_enc_fx( { /* T0_frac with 1/2 sample resolution */ *T0 = pitch_fr4_fx( &exc_fx[i_subfr], xn_fx, h1_fx, *T0_min, *T0_max, T0_frac, 0, 0, PIT16k_MIN, L_SUBFR, L_FRAME16k, L_SUBFR -#if defined REUSE_EVS_BE_ACELP_PITCH && !defined REUSE_EVS_ACELP_PITCH_NORM_CORR +#if !defined REUSE_EVS_ACELP_PITCH_NORM_CORR , 0 /*st_fx->element_mode*/, Q_new #endif @@ -2137,7 +2094,7 @@ static void tc_enc_ivas_fx( IF( EQ_16( nBits, 9 ) ) { *T0 = pitch_fr4_fx( &exc_fx[i_subfr], xn_fx, h1, *T0_min, *T0_max, T0_frac, 0, 0, PIT_FR2_9b, PIT_FR1_9b, L_FRAME, L_SUBFR -#if defined REUSE_EVS_BE_ACELP_PITCH && !defined REUSE_EVS_ACELP_PITCH_NORM_CORR +#if !defined REUSE_EVS_ACELP_PITCH_NORM_CORR , 0 /*st_fx->element_mode*/, Q_new #endif @@ -2147,7 +2104,7 @@ static void tc_enc_ivas_fx( ELSE IF( EQ_16( nBits, 6 ) ) { *T0 = pitch_fr4_fx( &exc_fx[i_subfr], xn_fx, h1, *T0_min, *T0_max, T0_frac, 0, 0, PIT_MIN, L_SUBFR, L_FRAME, L_SUBFR -#if defined REUSE_EVS_BE_ACELP_PITCH && !defined REUSE_EVS_ACELP_PITCH_NORM_CORR +#if !defined REUSE_EVS_ACELP_PITCH_NORM_CORR , 0 /*st_fx->element_mode*/, Q_new #endif @@ -2157,7 +2114,7 @@ static void tc_enc_ivas_fx( ELSE { *T0 = pitch_fr4_fx( &exc_fx[i_subfr], xn_fx, h1, *T0_min, *T0_max, T0_frac, 0, 0, PIT_MAX, PIT_MIN, L_FRAME, L_SUBFR -#if defined REUSE_EVS_BE_ACELP_PITCH && !defined REUSE_EVS_ACELP_PITCH_NORM_CORR +#if !defined REUSE_EVS_ACELP_PITCH_NORM_CORR , 0 /*st_fx->element_mode*/, Q_new #endif @@ -2182,7 +2139,7 @@ static void tc_enc_ivas_fx( IF( EQ_16( nBits, 10 ) ) { *T0 = pitch_fr4_fx( &exc_fx[i_subfr], xn_fx, h1, *T0_min, *T0_max, T0_frac, 0, 1, PIT16k_FR2_EXTEND_10b, PIT16k_MAX, L_FRAME16k, L_SUBFR -#if defined REUSE_EVS_BE_ACELP_PITCH && !defined REUSE_EVS_ACELP_PITCH_NORM_CORR +#if !defined REUSE_EVS_ACELP_PITCH_NORM_CORR , 0 /*st_fx->element_mode*/, Q_new #endif @@ -2193,7 +2150,7 @@ static void tc_enc_ivas_fx( { /* T0_frac with 1/2 sample resolution */ *T0 = pitch_fr4_fx( &exc_fx[i_subfr], xn_fx, h1, *T0_min, *T0_max, T0_frac, 0, 0, PIT16k_MIN, L_SUBFR, L_FRAME16k, L_SUBFR -#if defined REUSE_EVS_BE_ACELP_PITCH && !defined REUSE_EVS_ACELP_PITCH_NORM_CORR +#if !defined REUSE_EVS_ACELP_PITCH_NORM_CORR , 0 /*st_fx->element_mode*/, Q_new #endif @@ -2308,11 +2265,7 @@ static void tc_enc_ivas_fx( { IF( EQ_16( nBits, 10 ) ) { -#ifndef REUSE_EVS_BE_ACELP_PITCH_PIT_Q - pit16k_Q_enc_ivas_fx( hBstr, nBits, 1, *T0, *T0_frac, T0_min, T0_max ); -#else pit16k_Q_enc_fx( hBstr, nBits, 1, *T0, *T0_frac, T0_min, T0_max ); -#endif } ELSE IF( EQ_16( nBits, 6 ) ) { diff --git a/lib_enc/vad_fx.c b/lib_enc/vad_fx.c index c70865a81018f75ae7d9dcbc5fcd4bd042c85a43..3591301753b937028e1b5c7dcd2b06150a7c0ac0 100644 --- a/lib_enc/vad_fx.c +++ b/lib_enc/vad_fx.c @@ -1040,11 +1040,7 @@ Word16 wb_vad_fx( snr_sumt = add( snr_sumt, shr( snr, 4 ) ); /*Q4 */ -#ifdef ISSUE_1796_replace_shl_o tmp = shl_sat( snr, 5 ); /* Q8 -> Q13 */ -#else - tmp = shl_o( snr, 5, &Overflow ); /* Q8 -> Q13 */ -#endif IF( LT_16( i, 2 ) ) { tmp = add_o( tmp, delta1, &Overflow ); /*Q13 */ diff --git a/lib_enc/voiced_enc_fx.c b/lib_enc/voiced_enc_fx.c index 0de0285d54b4417ee11c1f4d57bcec549b10dc0a..be1272c2a6c8f27d483c3192bb4e6cb86150a00e 100644 --- a/lib_enc/voiced_enc_fx.c +++ b/lib_enc/voiced_enc_fx.c @@ -558,11 +558,7 @@ ivas_error ppp_voiced_encoder_fx( } /* Bump up if big change between the previous and the current CWs */ -#ifdef ISSUE_1796_replace_shl_o IF( LT_16( shl_sat( hSC_VBR->vadsnr_fx, 1 ), hSC_VBR->SNR_THLD_fx ) ) /*Q8 */ -#else - IF( LT_16( shl_o( hSC_VBR->vadsnr_fx, 1, &Overflow ), hSC_VBR->SNR_THLD_fx ) ) /*Q8 */ -#endif { /*if ( res_enratio > 5.0 && tmp < 0.65 ) */ /* 5 in Q11, 0.65 in Q15 // L_shl(tmp_fx,sub(31,Qtmp)) makes tmp_fx FIXED Q31 */ @@ -589,11 +585,7 @@ ivas_error ppp_voiced_encoder_fx( /* Rapid rampdown frame where time resolution is important */ /* Not a suitable PPP frame -> Bump to CELP */ -#ifdef ISSUE_1796_replace_shl_o IF( LT_16( shl_sat( hSC_VBR->vadsnr_fx, 1 ), hSC_VBR->SNR_THLD_fx ) ) /*Q8 */ -#else - IF( LT_16( shl_o( hSC_VBR->vadsnr_fx, 1, &Overflow ), hSC_VBR->SNR_THLD_fx ) ) /*Q8 */ -#endif { /* if (res_enratio < 0.025) */ IF( LT_32( L_shl_o( res_enratio_fx, 4, &Overflow ), 819 ) ) /*0x0333 = 0.025 in Q15, res_enratio_fx in Q15 after shl 4 */ @@ -621,11 +613,7 @@ ivas_error ppp_voiced_encoder_fx( /* if (min(res_enratio, sp_enratio) < 0.075 && tmp < -0.5f)) : 2458 = 0.075 in Q15 */ test(); -#ifdef ISSUE_1796_replace_shl_o if ( LT_32( L_min( L_shl_o( res_enratio_fx, 4, &Overflow ), sp_enratio_fx ), 2458 ) && LT_32( tmp_fx, shl_sat( -1, sub( Qtmp, 1 ) ) ) ) -#else - if ( LT_32( L_min( L_shl_o( res_enratio_fx, 4, &Overflow ), sp_enratio_fx ), 2458 ) && LT_32( tmp_fx, shl_o( -1, sub( Qtmp, 1 ), &Overflow ) ) ) -#endif { hSC_VBR->bump_up = 1; move16(); @@ -633,11 +621,7 @@ ivas_error ppp_voiced_encoder_fx( /* Rapid rampup frame where time resolution is important */ /* Not a suitable PPP frame -> Bump to CELP */ -#ifdef ISSUE_1796_replace_shl_o IF( LT_16( shl_sat( hSC_VBR->vadsnr_fx, 1 ), hSC_VBR->SNR_THLD_fx ) ) /*Q8 */ -#else - IF( LT_16( shl_o( hSC_VBR->vadsnr_fx, 1, &Overflow ), hSC_VBR->SNR_THLD_fx ) ) /*Q8 */ -#endif { IF( GT_32( res_enratio_fx, 29696 ) ) /*14.5 in Q11 */ { @@ -756,11 +740,7 @@ ivas_error ppp_voiced_encoder_fx( expb = sub( 30, add( expb, Qadj ) ); scale = shr( sub( fraca, fracb ), 15 ); -#ifdef ISSUE_1796_replace_shl_o fracb = shl_sat( fracb, scale ); -#else - fracb = shl_o( fracb, scale, &Overflow ); -#endif expb = sub( expb, scale ); tmp = div_s( fracb, fraca ); @@ -793,11 +773,7 @@ ivas_error ppp_voiced_encoder_fx( /* Ltmp1_32 = 0.8f * st->prev_cw_en */ Ltmp1_32 = Mult_32_16( hSC_VBR->prev_cw_en_fx, 26214 ); /* Q = (Q_prev_cw_en_fx + Q15+1)-Q16 = Q_prev_cw_en_fx */ -#ifdef ISSUE_1796_replace_shl_o IF( LT_16( shl_sat( hSC_VBR->vadsnr_fx, 1 ), hSC_VBR->SNR_THLD_fx ) ) /*Q8 */ -#else - IF( LT_16( shl_o( hSC_VBR->vadsnr_fx, 1, &Overflow ), hSC_VBR->SNR_THLD_fx ) ) /*Q8 */ -#endif { /* if ( DTFS_getEngy(*CURRP_NQ) > 0.8f * st->prev_cw_en && max(pos_nq, neg_nq) > 3.0f && st->rate_control ) */ /* pos_nq_fx and neg_nq_fx in Q28 ???? */ @@ -917,11 +893,7 @@ ivas_error ppp_voiced_encoder_fx( test(); test(); test(); -#ifdef ISSUE_1796_replace_shl_o IF( ( GT_32( Ltmp_32, hSC_VBR->prev_cw_en_fx ) ) && ( GT_32( L_max( pos_q_fx, neg_q_fx ), 939524096 ) ) && ( GT_32( energy_impz_fx, 30720 ) ) && ( GT_32( Mult_32_16( tmpres_fx, 23265 ), shl_sat( 1, sub( Qtmpres, 1 ) ) ) ) ) -#else - IF( ( GT_32( Ltmp_32, hSC_VBR->prev_cw_en_fx ) ) && ( GT_32( L_max( pos_q_fx, neg_q_fx ), 939524096 ) ) && ( GT_32( energy_impz_fx, 30720 ) ) && ( GT_32( Mult_32_16( tmpres_fx, 23265 ), shl_o( 1, sub( Qtmpres, 1 ), &Overflow ) ) ) ) -#endif { /* if ((pos_q > neg_q) && ((pos_q>3.0*pos_nq0) || ((pos_q > 1.5*pos_nq0) && (neg_q < 1.5*neg_nq0)))) */ test(); @@ -1098,11 +1070,7 @@ ivas_error ppp_voiced_encoder_fx( move16(); } -#ifdef ISSUE_1796_replace_shl_o IF( LT_16( shl_sat( hSC_VBR->vadsnr_fx, 1 ), hSC_VBR->SNR_THLD_fx ) ) /* Q8 */ -#else - IF( LT_16( shl_o( hSC_VBR->vadsnr_fx, 1, &Overflow ), hSC_VBR->SNR_THLD_fx ) ) /* Q8 */ -#endif { /* if ((( tmp < 3.05 && max(res_enratio,sp_enratio) > 0.8 ) && (st->rate_control))|| (( tmp < 2.8 && max(res_enratio,sp_enratio) > 0.65 ) && (!st->rate_control))) */ @@ -1437,11 +1405,7 @@ static Word32 DTFS_freq_corr_fx( scale = shr( sub( fraca, fracb ), 15 ); -#ifdef ISSUE_1796_replace_shl_o fracb = shl_sat( fracb, scale ); -#else - fracb = shl_o( fracb, scale, &Overflow ); -#endif expb = sub( expb, scale ); tmp = div_s( fracb, fraca ); diff --git a/lib_isar/isar_prot.h b/lib_isar/isar_prot.h index 03c25d3afc94aaa198414569d1b89f1aa20af7e7..d2db093596aef285757d9ad7ab0698240f609304 100644 --- a/lib_isar/isar_prot.h +++ b/lib_isar/isar_prot.h @@ -128,15 +128,6 @@ void isar_log_cldfb2wav_data( ); #endif -#ifndef FIX_1372_ISAR_POST_REND -void isar_SplitRenderer_PostRenderer( - ISAR_BIN_HR_SPLIT_POST_REND_HANDLE hBinPostRenderer, /* i/o: binaural renderer handle */ - MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, - Word32 Cldfb_RealBuffer_Ref_Binaural_fx[][CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o : Reference/out Binaural signals */ - Word32 Cldfb_ImagBuffer_Ref_Binaural_fx[][CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o : Reference/out Binaural signals */ - const IVAS_QUATERNION Quaternion_act -); -#else void isar_SplitRenderer_PostRenderer( ISAR_BIN_HR_SPLIT_POST_REND_HANDLE hBinPostRenderer, /* i/o: binaural renderer handle */ MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, @@ -145,7 +136,6 @@ void isar_SplitRenderer_PostRenderer( const IVAS_QUATERNION Quaternion_act, Word16 *Q_in ); -#endif void isar_splitBinLCLDDecProcess( ISAR_BIN_HR_SPLIT_LCLD_DEC_HANDLE hSplitBinLCLDDec, @@ -332,14 +322,12 @@ void isar_set_split_rend_ht_setup_fx( Word32 Rmat_fx[MAX_PARAM_SPATIAL_SUBFRAMES][3][3] ); -#ifdef LC3PLUS_LEA_COMPAT_BITRATES_48_6 Word32 isar_get_lc3plus_bitrate( const Word32 SplitRendBitRate, const ISAR_SPLIT_REND_POSE_CORRECTION_MODE poseCorrectionMode, const Word32 nChannels, const Word32 codecFrameDurationUs ); -#endif ivas_error isar_split_rend_validate_config( const ISAR_SPLIT_REND_CONFIG_DATA *pSplitRendConfig, const Word16 is_pcm_out diff --git a/lib_isar/isar_splitRendererPost.c b/lib_isar/isar_splitRendererPost.c index f27d2f6a0df7a5c69f76382c0806412fc8667858..f03afbeb8b79a4df9097257ed1f67b889301fd75 100644 --- a/lib_isar/isar_splitRendererPost.c +++ b/lib_isar/isar_splitRendererPost.c @@ -1589,14 +1589,6 @@ static void interpolate_rend_md_fx( * *-----------------------------------------------------------------------------------------*/ -#ifndef FIX_1372_ISAR_POST_REND -void isar_SplitRenderer_PostRenderer( - ISAR_BIN_HR_SPLIT_POST_REND_HANDLE hBinPostRenderer, /* i/o: binaural renderer handle */ - MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, - Word32 Cldfb_RealBuffer_Ref_Binaural_fx[][CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o : Reference/out Binaural signals */ - Word32 Cldfb_ImagBuffer_Ref_Binaural_fx[][CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o : Reference/out Binaural signals */ - const IVAS_QUATERNION Quaternion_act ) -#else void isar_SplitRenderer_PostRenderer( ISAR_BIN_HR_SPLIT_POST_REND_HANDLE hBinPostRenderer, /* i/o: binaural renderer handle */ MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, @@ -1604,20 +1596,13 @@ void isar_SplitRenderer_PostRenderer( Word32 Cldfb_ImagBuffer_Ref_Binaural_fx[][CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o : Reference/out Binaural signals */ const IVAS_QUATERNION Quaternion_act, Word16 *Q_in ) -#endif { Word16 pos_idx, b, brange[2], ch_idx1; Word16 num_md_bands, slot_idx, b2, index_slot, num_slots, sf_idx_md; Word32 gd_int_fx; -#ifndef FIX_1372_ISAR_POST_REND - Word32 pred_out_re_fx[BINAURAL_CHANNELS], pred_out_im_fx[BINAURAL_CHANNELS]; - Word32 tmp_re_fx, tmp_im_fx; - Word16 exp_tmp1, exp_tmp2; -#else Word64 pred_out_re_fx64[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], pred_out_im_fx64[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; Word64 tmp_re_fx64, tmp_im_fx64, out64_re, out64_im; Word16 shift64 = 63; -#endif ISAR_BIN_HR_SPLIT_REND_MD rot_md_act[1][MAX_SPLIT_REND_MD_BANDS]; Word16 interp_yaw_pose_idx[2], interp_pitch_pose_idx[2], interp_roll_pose_idx[2]; Word32 interp_yaw_fact_fx, interp_pitch_fact_fx, interp_roll_fact_fx; @@ -1707,21 +1692,6 @@ void isar_SplitRenderer_PostRenderer( FOR( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ ) { /* Apply prediction matrix */ -#ifndef FIX_1372_ISAR_POST_REND - ivas_cmult_fix( Cldfb_RealBuffer_Ref_Binaural_fx[0][index_slot][b2], 25, Cldfb_ImagBuffer_Ref_Binaural_fx[0][index_slot][b2], 25, mix_mat_re_fx[0][ch_idx1], 6, mix_mat_im_fx[0][ch_idx1], 6, &tmp_re_fx, &tmp_im_fx, &exp_tmp1, &exp_tmp2 ); - - pred_out_re_fx[ch_idx1] = tmp_re_fx; - pred_out_im_fx[ch_idx1] = tmp_im_fx; - Word16 exp_re = exp_tmp1; - Word16 exp_im = exp_tmp2; - - ivas_cmult_fix( Cldfb_RealBuffer_Ref_Binaural_fx[1][index_slot][b2], 25, Cldfb_ImagBuffer_Ref_Binaural_fx[1][index_slot][b2], 25, mix_mat_re_fx[1][ch_idx1], 6, mix_mat_im_fx[1][ch_idx1], 6, &tmp_re_fx, &tmp_im_fx, &exp_tmp1, &exp_tmp2 ); - - pred_out_re_fx[ch_idx1] = BASOP_Util_Add_Mant32Exp( pred_out_re_fx[ch_idx1], exp_re, tmp_re_fx, exp_tmp1, &exp_re ); - pred_out_re_fx[ch_idx1] = L_shl( pred_out_re_fx[ch_idx1], exp_re - 25 ); - pred_out_im_fx[ch_idx1] = BASOP_Util_Add_Mant32Exp( pred_out_im_fx[ch_idx1], exp_im, tmp_im_fx, exp_tmp2, &exp_im ); - pred_out_im_fx[ch_idx1] = L_shl( pred_out_im_fx[ch_idx1], exp_im - 25 ); -#else tmp_re_fx64 = W_mult_32_32( Cldfb_RealBuffer_Ref_Binaural_fx[0][index_slot][b2], mix_mat_re_fx[0][ch_idx1] ); tmp_im_fx64 = W_mult_32_32( Cldfb_ImagBuffer_Ref_Binaural_fx[0][index_slot][b2], mix_mat_im_fx[0][ch_idx1] ); out64_re = W_sub( tmp_re_fx64, tmp_im_fx64 ); @@ -1756,21 +1726,11 @@ void isar_SplitRenderer_PostRenderer( move16(); move64(); move64(); -#endif - } - -#ifndef FIX_1372_ISAR_POST_REND - FOR( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ ) - { - Cldfb_RealBuffer_Ref_Binaural_fx[ch_idx1][index_slot][b2] = pred_out_re_fx[ch_idx1]; - Cldfb_ImagBuffer_Ref_Binaural_fx[ch_idx1][index_slot][b2] = pred_out_im_fx[ch_idx1]; } -#endif } } } -#ifdef FIX_1372_ISAR_POST_REND FOR( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ ) { FOR( slot_idx = 0; slot_idx < num_slots; slot_idx++ ) @@ -1786,7 +1746,6 @@ void isar_SplitRenderer_PostRenderer( } *Q_in = sub( add( *Q_in, shift64 ), Q6 ); move16(); -#endif } pos_idx = 0; @@ -1846,11 +1805,7 @@ static void isar_rend_CldfbSplitPostRendProcessTdIn( } } -#ifndef FIX_1372_ISAR_POST_REND - isar_SplitRenderer_PostRenderer( hBinHrSplitPostRend, pMultiBinPoseData, Cldfb_RealBuffer_Binaural_fx, Cldfb_ImagBuffer_Binaural_fx, QuaternionPost ); -#else isar_SplitRenderer_PostRenderer( hBinHrSplitPostRend, pMultiBinPoseData, Cldfb_RealBuffer_Binaural_fx, Cldfb_ImagBuffer_Binaural_fx, QuaternionPost, &Q_in ); -#endif /* Implement CLDFB synthesis */ FOR( ch_idx = 0; ch_idx < BINAURAL_CHANNELS; ch_idx++ ) @@ -1871,11 +1826,7 @@ static void isar_rend_CldfbSplitPostRendProcessTdIn( Scale_sig32( RealBuffer_fx[slot_idx], CLDFB_NO_CHANNELS_MAX, scaleFactor ); Scale_sig32( ImagBuffer_fx[slot_idx], CLDFB_NO_CHANNELS_MAX, scaleFactor ); } -#ifndef FIX_1372_ISAR_POST_REND - Q_cldfb = add( scaleFactor, sub( Q_output, Q5 ) ); -#else Q_cldfb = add( scaleFactor, Q_in ); -#endif Scale_sig32( hBinHrSplitPostRend->cldfbSyn[ch_idx]->cldfb_state_fx, hBinHrSplitPostRend->cldfbSyn[ch_idx]->p_filter_length, sub( sub( Q_cldfb, 1 ), Q11 ) ); cldfbSynthesis_ivas_fx( RealBuffer_fx, ImagBuffer_fx, &( output_fx[ch_idx][0] ), num_cldfb_bands * CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, 0, 0, hBinHrSplitPostRend->cldfbSyn[ch_idx] ); // Q_cldfb - 1 Scale_sig32( hBinHrSplitPostRend->cldfbSyn[ch_idx]->cldfb_state_fx, hBinHrSplitPostRend->cldfbSyn[ch_idx]->p_filter_length, sub( Q11, sub( Q_cldfb, 1 ) ) ); @@ -1916,11 +1867,7 @@ void isar_rend_CldfbSplitPostRendProcess( return; } -#ifndef FIX_1372_ISAR_POST_REND - isar_SplitRenderer_PostRenderer( hBinHrSplitPostRend, pMultiBinPoseData, Cldfb_RealBuffer_Binaural_fx, Cldfb_ImagBuffer_Binaural_fx, QuaternionPost ); -#else isar_SplitRenderer_PostRenderer( hBinHrSplitPostRend, pMultiBinPoseData, Cldfb_RealBuffer_Binaural_fx, Cldfb_ImagBuffer_Binaural_fx, QuaternionPost, &Q_cldfb_in ); -#endif /* Implement CLDFB synthesis */ FOR( ch_idx = 0; ch_idx < BINAURAL_CHANNELS; ch_idx++ ) diff --git a/lib_isar/isar_splitRendererPre.c b/lib_isar/isar_splitRendererPre.c index d0dc8e6d58099ea46fd0156b3f4b1b334f6a35f4..71e285a9cbad6587313e87688c5be37d33bc8fe1 100644 --- a/lib_isar/isar_splitRendererPre.c +++ b/lib_isar/isar_splitRendererPre.c @@ -2718,11 +2718,7 @@ ivas_error split_renderer_open_lc3plus( config.channels = BINAURAL_CHANNELS; if ( ( error = ISAR_LC3PLUS_ENC_Open( config, -#ifdef LC3PLUS_LEA_COMPAT_BITRATES_48_6 isar_get_lc3plus_bitrate( pSplitRendConfig->splitRendBitRate, pSplitRendConfig->poseCorrectionMode, config.channels, config.lc3plus_frame_duration_us ), -#else - isar_get_lcld_bitrate( pSplitRendConfig->splitRendBitRate, pSplitRendConfig->poseCorrectionMode ), -#endif &hSplitRendWrapper->hLc3plusEnc ) ) != IVAS_ERR_OK ) { return error; @@ -3017,7 +3013,6 @@ ivas_error isar_renderMultiTDBinToSplitBinaural( } ELSE { -#ifdef LC3PLUS_LEA_COMPAT_BITRATES_48_6 IF( EQ_32( pBits->pose_correction, ISAR_SPLIT_REND_POSE_CORRECTION_MODE_NONE ) ) { available_bits = isar_get_lc3plus_bitrate( SplitRendBitRate, hSplitBin->multiBinPoseData.poseCorrectionMode, hSplitBin->hLc3plusEnc->config.channels, hSplitBin->hLc3plusEnc->config.lc3plus_frame_duration_us ); @@ -3027,9 +3022,6 @@ ivas_error isar_renderMultiTDBinToSplitBinaural( { available_bits = L_sub( Mpy_32_32( SplitRendBitRate, ONE_BY_FRAMES_PER_SEC_Q31 ), pBits->bits_written ); } -#else - available_bits = ( SplitRendBitRate / FRAMES_PER_SEC ) - pBits->bits_written; -#endif IF( ( error = splitRendLc3plusEncodeAndWrite( hSplitBin, pBits, available_bits, in_fx, Q_in ) ) != IVAS_ERR_OK ) { return error; diff --git a/lib_isar/isar_splitRenderer_utils.c b/lib_isar/isar_splitRenderer_utils.c index fae8de0eb1f54e9108d80dc2f10eb521b894b64b..54e0ec79c781436e31b3a021e1448b0a569c4cc2 100644 --- a/lib_isar/isar_splitRenderer_utils.c +++ b/lib_isar/isar_splitRenderer_utils.c @@ -742,7 +742,6 @@ Word32 isar_get_lcld_bitrate( return -1; } -#ifdef LC3PLUS_LEA_COMPAT_BITRATES_48_6 /*------------------------------------------------------------------------- * Function isar_get_lc3plus_bitrate() * @@ -770,7 +769,6 @@ Word32 isar_get_lc3plus_bitrate( return bitrate; } -#endif /*------------------------------------------------------------------------- * Function isar_split_rend_validate_config() diff --git a/lib_isar/lib_isar_pre_rend.c b/lib_isar/lib_isar_pre_rend.c index 5441b9b9f1de2e2389d0e2ee3db639e36e66ee0e..da4f6542f69b0cfefab4404a2182a7672c1731d3 100644 --- a/lib_isar/lib_isar_pre_rend.c +++ b/lib_isar/lib_isar_pre_rend.c @@ -463,7 +463,6 @@ ivas_error ISAR_PRE_REND_MultiBinToSplitBinaural( assert( Q_out[0] == Q_out[1] ); -#ifdef LC3PLUS_LEA_COMPAT_BITRATES_48_6 IF( EQ_32( pBits->pose_correction, ISAR_SPLIT_REND_POSE_CORRECTION_MODE_NONE ) ) { available_bits = isar_get_lc3plus_bitrate( SplitRendBitRate, hSplitBin->multiBinPoseData.poseCorrectionMode, hSplitBin->hLc3plusEnc->config.channels, hSplitBin->hLc3plusEnc->config.lc3plus_frame_duration_us ); @@ -473,9 +472,6 @@ ivas_error ISAR_PRE_REND_MultiBinToSplitBinaural( { available_bits = L_sub( Mpy_32_32( SplitRendBitRate, ONE_BY_FRAMES_PER_SEC_Q31 ), pBits->bits_written ); } -#else - available_bits = ( SplitRendBitRate / FRAMES_PER_SEC ) - pBits->bits_written; -#endif IF( ( error = splitRendLc3plusEncodeAndWrite( hSplitBin, pBits, available_bits, pOutput_fx, Q_out[0] ) ) != IVAS_ERR_OK ) { return error; diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index e03429596f611384879007a08deec51f46a4d055..f81fa0d3dcde3a47ebb7307f3f99f4ad25dfe4d4 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -120,17 +120,9 @@ static void adaptTransportSignalsHeadtracked_fx( COMBINED_ORIENTATION_HANDLE hHe static void ivas_dirac_dec_binaural_check_and_switch_transports_headtracked_fx( COMBINED_ORIENTATION_HANDLE hHeadTrackData, Word32 inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], Word32 inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], const Word16 nBins, const Word16 nSlots, Word32 Rmat[3][3] /*Q30*/ ); -#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF static void hrtfShGetHrtf_fx( const Word16 bin, const Word16 aziDeg, const Word16 eleDeg, Word32 *lRealp, Word32 *lImagp, Word32 *rRealp, Word32 *rImagp, PARAMBIN_HRTF_GAIN_CACHE *gainCache, const Word16 useCachedValue, HRTFS_PARAMBIN_HANDLE hHrtfParambin ); -#else -static void hrtfShGetHrtf_fx( const Word16 bin, const Word16 aziDeg, const Word16 eleDeg, Word32 *lRealp, Word32 *lImagp, Word32 *rRealp, Word32 *rImagp, PARAMBIN_HRTF_GAIN_CACHE *gainCache, const Word16 useCachedValue ); -#endif -#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF static void getDirectPartGains_fx( const Word16 bin, Word16 aziDeg, Word16 eleDeg, Word32 *lRealp, Word32 *lImagp, Word32 *rRealp, Word32 *rImagp, const UWord8 renderStereoOutputInsteadOfBinaural, Word32 Rmat[3][3] /*Q30*/, PARAMBIN_HRTF_GAIN_CACHE *gainCache, const Word16 isHeadtracked, HRTFS_PARAMBIN_HANDLE hHrtfParambin ); -#else -static void getDirectPartGains_fx( const Word16 bin, Word16 aziDeg, Word16 eleDeg, Word32 *lRealp, Word32 *lImagp, Word32 *rRealp, Word32 *rImagp, const UWord8 renderStereoOutputInsteadOfBinaural, Word32 Rmat[3][3] /*Q30*/, PARAMBIN_HRTF_GAIN_CACHE *gainCache, const Word16 isHeadtracked ); -#endif static void ivas_masa_ext_rend_parambin_internal_fx( MASA_EXT_REND_HANDLE hMasaExtRend, COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, Word32 *output_fx[] /*Q11*/, const Word16 subframe, const SPLIT_REND_WRAPPER *hSplitRendWrapper, Word32 Cldfb_Out_Real[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], Word32 Cldfb_Out_Imag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX] ); @@ -159,12 +151,8 @@ static void matrixTransp2Mul_fx( *------------------------------------------------------------------------*/ ivas_error ivas_dirac_dec_init_binaural_data_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ -#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ HRTFS_PARAMBIN_HANDLE *phHrtfParambin /* i : HRTF structure for rendering */ -#else - HRTFS_PARAMBIN_HANDLE hHrtfParambin /* i : HRTF structure for rendering */ -#endif ) { DIRAC_DEC_BIN_HANDLE hDiracDecBin; @@ -180,9 +168,7 @@ ivas_error ivas_dirac_dec_init_binaural_data_fx( ivas_error error; Word16 num_poses, pos_idx; -#ifdef FIX_587_DEFAULT_REVERB const IVAS_ROOM_ACOUSTICS_CONFIG_DATA *pRoomAcoustics; -#endif num_poses = 1; IF( st_ivas->hSplitBinRend != NULL ) @@ -207,9 +193,7 @@ ivas_error ivas_dirac_dec_init_binaural_data_fx( hDiracDecBin->hReverb = NULL; hDiracDecBin->h_freq_domain_decorr_ap_params = NULL; hDiracDecBin->h_freq_domain_decorr_ap_state = NULL; -#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF hDiracDecBin->phHrtfParambin = NULL; -#endif } output_Fs = st_ivas->hDecoderConfig->output_Fs; @@ -301,28 +285,16 @@ ivas_error ivas_dirac_dec_init_binaural_data_fx( } ELSE IF( EQ_32( renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) /* Indication of binaural rendering with room effect */ { -#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF -#ifdef NONBE_FIX_981_PARAMBIN_DEFAULT_EARLY_PART IF( EQ_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) ) { Copy32( ( *phHrtfParambin )->parametricEarlyPartEneCorrection_fx, hDiracDecBin->earlyPartEneCorrection_fx, nBins ); -#ifdef FIX_587_DEFAULT_REVERB pRoomAcoustics = NULL; -#endif } ELSE { set32_fx( hDiracDecBin->earlyPartEneCorrection_fx, ONE_IN_Q28, CLDFB_NO_CHANNELS_MAX ); -#ifdef FIX_587_DEFAULT_REVERB pRoomAcoustics = &( st_ivas->hRenderConfig->roomAcoustics ); -#endif } -#else - Copy32( ( *phHrtfParambin )->parametricEarlyPartEneCorrection_fx, hDiracDecBin->earlyPartEneCorrection_fx, nBins ); -#endif -#else - Copy32( hHrtfParambin->parametricEarlyPartEneCorrection_fx, hDiracDecBin->earlyPartEneCorrection_fx, nBins ); -#endif hDiracDecBin->q_earlyPartEneCorrection = Q28; move16(); /* reconfiguration needed when Reverb. parameters are changed -> close and open the handle again */ @@ -337,19 +309,7 @@ ivas_error ivas_dirac_dec_init_binaural_data_fx( IF( hDiracDecBin->hReverb == NULL && EQ_16( pos_idx, 0 ) ) /* open reverb only for the main direction */ { -#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF -#ifdef FIX_587_DEFAULT_REVERB -#ifdef FIX_1139_REV_COLORATION_SHORT_T60 IF( NE_32( ( error = ivas_binaural_reverb_init( &hDiracDecBin->hReverb, st_ivas->hHrtfStatistics, nBins, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, pRoomAcoustics, output_Fs, ( *phHrtfParambin )->parametricReverberationTimes_fx, ( *phHrtfParambin )->parametricReverberationEneCorrections_fx, hDiracDecBin->earlyPartEneCorrection_fx ) ), IVAS_ERR_OK ) ) -#else - if ( NE_32( ( error = ivas_binaural_reverb_init( &hDiracDecBin->hReverb, st_ivas->hHrtfStatistics, nBins, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, pRoomAcoustics, output_Fs, ( *phHrtfParambin )->parametricReverberationTimes_fx, ( *phHrtfParambin )->parametricReverberationEneCorrections_fx ) ), IVAS_ERR_OK ) ) -#endif -#else - if ( NE_32( ( 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, ( *phHrtfParambin )->parametricReverberationTimes_fx, ( *phHrtfParambin )->parametricReverberationEneCorrections_fx ) ), IVAS_ERR_OK ) ) -#endif -#else - 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_fx, st_ivas->hHrtfParambin->parametricReverberationEneCorrections_fx ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -419,9 +379,7 @@ ivas_error ivas_dirac_dec_init_binaural_data_fx( hDiracDecBin->reqularizationFactor_fx = configure_reqularization_factor_fx( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate ); /* Q14 */ move16(); -#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF hDiracDecBin->phHrtfParambin = phHrtfParambin; -#endif st_ivas->hDiracDecBin[pos_idx] = hDiracDecBin; } @@ -436,12 +394,7 @@ ivas_error ivas_dirac_dec_init_binaural_data_fx( move16(); if ( EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) ) { -#ifdef FIX_1222_OMASA_DEC_CHANNEL_BUFFERS nchan_to_allocate = add( BINAURAL_CHANNELS, st_ivas->nchan_ism ); -#else - nchan_to_allocate = 2 * BINAURAL_CHANNELS + 2; - move16(); -#endif } n_samples_granularity = NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ); @@ -1796,11 +1749,7 @@ static void ivas_dirac_dec_binaural_formulate_target_covariance_matrices_fx( spreadCoh_fx = s_max( spreadCoh_fx, altSpreadCoh_fx ); } -#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF getDirectPartGains_fx( bin, aziDeg, eleDeg, &lRealp_fx, &lImagp_fx, &rRealp_fx, &rImagp_fx, hDiracDecBin->renderStereoOutputInsteadOfBinaural, Rmat_fx, &gainCache[gainCacheBaseIndex], isHeadtracked, *hDiracDecBin->phHrtfParambin ); -#else - getDirectPartGains_fx( bin, aziDeg, eleDeg, &lRealp_fx, &lImagp_fx, &rRealp_fx, &rImagp_fx, hDiracDecBin->renderStereoOutputInsteadOfBinaural, Rmat_fx, &gainCache[gainCacheBaseIndex], isHeadtracked ); -#endif Word16 q_lr = Q28; move16(); @@ -1851,11 +1800,7 @@ static void ivas_dirac_dec_binaural_formulate_target_covariance_matrices_fx( rImagp_fx = Mpy_32_32( rImagp_fx, centerMul_fx ); // Q25 /* Apply the gain for the left source of the three coherent sources */ -#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF getDirectPartGains_fx( bin, add( aziDeg, 30 ), eleDeg, &lRealpTmp_fx, &lImagpTmp_fx, &rRealpTmp_fx, &rImagpTmp_fx, hDiracDecBin->renderStereoOutputInsteadOfBinaural, Rmat_fx, &gainCache[gainCacheBaseIndex + 1], isHeadtracked, *hDiracDecBin->phHrtfParambin ); -#else - getDirectPartGains_fx( bin, add( aziDeg, 30 ), eleDeg, &lRealpTmp_fx, &lImagpTmp_fx, &rRealpTmp_fx, &rImagpTmp_fx, hDiracDecBin->renderStereoOutputInsteadOfBinaural, Rmat_fx, &gainCache[gainCacheBaseIndex + 1], isHeadtracked ); -#endif hrtfEneSides_fx = L_add( Mpy_32_32( lRealpTmp_fx, lRealpTmp_fx ), // Q25 L_add( Mpy_32_32( lImagpTmp_fx, lImagpTmp_fx ), // Q25 @@ -1869,11 +1814,7 @@ static void ivas_dirac_dec_binaural_formulate_target_covariance_matrices_fx( /* 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_fx( bin, aziDeg + 330, eleDeg, &lRealpTmp_fx, &lImagpTmp_fx, &rRealpTmp_fx, &rImagpTmp_fx, hDiracDecBin->renderStereoOutputInsteadOfBinaural, Rmat_fx, &gainCache[gainCacheBaseIndex + 2], isHeadtracked, *hDiracDecBin->phHrtfParambin ); -#else - getDirectPartGains_fx( bin, aziDeg + 330, eleDeg, &lRealpTmp_fx, &lImagpTmp_fx, &rRealpTmp_fx, &rImagpTmp_fx, hDiracDecBin->renderStereoOutputInsteadOfBinaural, Rmat_fx, &gainCache[gainCacheBaseIndex + 2], isHeadtracked ); -#endif hrtfEneSides_fx = L_add( hrtfEneSides_fx, L_add( Mpy_32_32( lRealpTmp_fx, lRealpTmp_fx ), // Q25 @@ -2629,11 +2570,7 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( q_processMtxPrev_SCCR[bin] = q_processMtx_bin; move16(); -#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF getDirectPartGains_fx( bin, aziDeg, eleDeg, &lRealp_fx, &lImagp_fx, &rRealp_fx, &rImagp_fx, hDiracDecBin->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache[chB], isHeadtracked, *hDiracDecBin->phHrtfParambin ); -#else - getDirectPartGains_fx( bin, aziDeg, eleDeg, &lRealp_fx, &lImagp_fx, &rRealp_fx, &rImagp_fx, hDiracDecBin->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache[chB], isHeadtracked ); -#endif hDiracDecBin->processMtxRe_fx[0][chB + 2][bin] = extract_h( Mpy_32_32( lRealp_fx, gainFactor_fx ) ); move16(); @@ -4024,17 +3961,10 @@ static void matrixTransp1Mul_fx( { FOR( chB = 0; chB < BINAURAL_CHANNELS; chB++ ) { -#ifdef FIX_ISSUE_1811_EXCEEDING_W_SHIFTS outRe_fx[chA][chB] = W_extract_h( W_shl( tmp_outRe_fx[chA][chB], s_max( -63, sub( q_common, q_tmp_outRe_fx[chA][chB] ) ) ) ); move32(); outIm_fx[chA][chB] = W_extract_h( W_shl( tmp_outIm_fx[chA][chB], s_max( -63, sub( q_common, q_tmp_outIm_fx[chA][chB] ) ) ) ); move32(); -#else - outRe_fx[chA][chB] = W_extract_h( W_shl( tmp_outRe_fx[chA][chB], sub( q_common, q_tmp_outRe_fx[chA][chB] ) ) ); - move32(); - outIm_fx[chA][chB] = W_extract_h( W_shl( tmp_outIm_fx[chA][chB], sub( q_common, q_tmp_outIm_fx[chA][chB] ) ) ); - move32(); -#endif } } *q_out = sub( q_common, 32 ); @@ -4882,13 +4812,8 @@ static void getDirectPartGains_fx( const UWord8 renderStereoOutputInsteadOfBinaural, Word32 Rmat[3][3], /*Q30*/ PARAMBIN_HRTF_GAIN_CACHE *gainCache, -#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF const Word16 isHeadtracked, - HRTFS_PARAMBIN_HANDLE hHrtfParambin -#else - const Word16 isHeadtracked -#endif -) + HRTFS_PARAMBIN_HANDLE hHrtfParambin ) { // float aziRad, eleRad; Word32 y, mappedX; @@ -5017,11 +4942,7 @@ static void getDirectPartGains_fx( test(); IF( EQ_16( aziDeg, gainCache->azi ) && EQ_16( eleDeg, gainCache->ele ) ) { -#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF hrtfShGetHrtf_fx( bin, aziDeg, eleDeg, lRealp, lImagp, rRealp, rImagp, gainCache, TRUE, hHrtfParambin ); -#else - hrtfShGetHrtf_fx( bin, aziDeg, eleDeg, lRealp, lImagp, rRealp, rImagp, gainCache, TRUE ); -#endif } ELSE { @@ -5036,11 +4957,7 @@ static void getDirectPartGains_fx( // eleDeg = L_shr(eleDeg_32, 22); // aziDeg = L_shr(aziDeg_32, 22); } -#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF hrtfShGetHrtf_fx( bin, aziDeg, eleDeg, lRealp, lImagp, rRealp, rImagp, gainCache, FALSE, hHrtfParambin ); -#else - hrtfShGetHrtf_fx( bin, aziDeg, eleDeg, lRealp, lImagp, rRealp, rImagp, gainCache, FALSE ); -#endif } } @@ -5056,21 +4973,14 @@ static void hrtfShGetHrtf_fx( Word32 *rRealp, Word32 *rImagp, PARAMBIN_HRTF_GAIN_CACHE *gainCache, -#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF const Word16 useCachedValue, - HRTFS_PARAMBIN_HANDLE hHrtfParambin -#else - const Word16 useCachedValue -#endif -) + HRTFS_PARAMBIN_HANDLE hHrtfParambin ) { Word16 k; -#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF Word16( *hrtfShCoeffsReInt_fx )[16][60]; Word16( *hrtfShCoeffsImInt_fx )[16][60]; hrtfShCoeffsReInt_fx = hHrtfParambin->hrtfShCoeffsRe_fx; hrtfShCoeffsImInt_fx = hHrtfParambin->hrtfShCoeffsIm_fx; -#endif *lRealp = 0; *lImagp = 0; @@ -5088,17 +4998,10 @@ static void hrtfShGetHrtf_fx( FOR( k = 0; k < HRTF_SH_CHANNELS; k++ ) { -#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF *lRealp = Madd_32_16( *lRealp, shVec[k], hrtfShCoeffsReInt_fx[0][k][bin] ); // Q28 *lImagp = Madd_32_16( *lImagp, shVec[k], hrtfShCoeffsImInt_fx[0][k][bin] ); // Q28 *rRealp = Madd_32_16( *rRealp, shVec[k], hrtfShCoeffsReInt_fx[1][k][bin] ); // Q28 *rImagp = Madd_32_16( *rImagp, shVec[k], hrtfShCoeffsImInt_fx[1][k][bin] ); // Q28 -#else - *lRealp = Madd_32_16( *lRealp, shVec[k], hrtfShCoeffsRe_fx[0][k][bin] ); // Q28 - *lImagp = Madd_32_16( *lImagp, shVec[k], hrtfShCoeffsIm_fx[0][k][bin] ); // Q28 - *rRealp = Madd_32_16( *rRealp, shVec[k], hrtfShCoeffsRe_fx[1][k][bin] ); // Q28 - *rImagp = Madd_32_16( *rImagp, shVec[k], hrtfShCoeffsIm_fx[1][k][bin] ); // Q28 -#endif move32(); move32(); move32(); @@ -5117,18 +5020,11 @@ static void hrtfShGetHrtf_fx( FOR( k = 0; k < HRTF_SH_CHANNELS; k++ ) { -#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF *lRealp = Madd_32_16( *lRealp, shVec[k], hrtfShCoeffsReInt_fx[0][k][bin] ); // Q28 *lImagp = Madd_32_16( *lImagp, shVec[k], hrtfShCoeffsImInt_fx[0][k][bin] ); // Q28 *rRealp = Madd_32_16( *rRealp, shVec[k], hrtfShCoeffsReInt_fx[1][k][bin] ); // Q28 *rImagp = Madd_32_16( *rImagp, shVec[k], hrtfShCoeffsImInt_fx[1][k][bin] ); // Q28 -#else - *lRealp = Madd_32_16( *lRealp, shVec[k], hrtfShCoeffsRe_fx[0][k][bin] ); // Q28 - *lImagp = Madd_32_16( *lImagp, shVec[k], hrtfShCoeffsIm_fx[0][k][bin] ); // Q28 - *rRealp = Madd_32_16( *rRealp, shVec[k], hrtfShCoeffsRe_fx[1][k][bin] ); // Q28 - *rImagp = Madd_32_16( *rImagp, shVec[k], hrtfShCoeffsIm_fx[1][k][bin] ); // Q28 -#endif - gainCache->shVec_fx[k] = shVec[k]; // Q29 + gainCache->shVec_fx[k] = shVec[k]; // Q29 move32(); move32(); move32(); diff --git a/lib_rend/ivas_efap_fx.c b/lib_rend/ivas_efap_fx.c index bfe51a19ddd01d4ead1aa9e46b363ea7d9577915..68908cfaa36eb8aef6acb6aef1964a83e79a3cd1 100644 --- a/lib_rend/ivas_efap_fx.c +++ b/lib_rend/ivas_efap_fx.c @@ -37,9 +37,7 @@ #include "options.h" #include "prot_fx.h" #include "ivas_prot_rend_fx.h" -#ifdef FIX_1050_EFAP_ALLOC #include "ivas_rom_rend.h" -#endif #include "ivas_stat_dec.h" #include "wmc_auto.h" #include "ivas_prot_fx.h" @@ -52,12 +50,10 @@ #define EFAP_MAX_GHOST_LS 5 /* Maximum number of ghost Loudspeakers, for memory allocation purpose */ #define POLY_THRESH_Q29 53687LL // Q29 #define POLY_THRESH_Q28 26843 // Q28 -#ifdef FIX_1050_EFAP_ALLOC #ifdef DEBUG_EFAP_POLY_TOFILE #define PANNING_AZI_RESOLUTION 2 #define PANNING_ELE_RESOLUTION 5 #endif -#endif #define Q22_1 4194304 #define Q22_45_DEG 188743680 #define Q22_90_DEG 377487360 @@ -132,10 +128,8 @@ ivas_error efap_init_data_fx( const Word16 efap_mode /* i : indicates whether EFAP or EFIP is used */ ) { -/* Handle instance declaration */ -#ifdef FIX_1050_EFAP_ALLOC + /* Handle instance declaration */ Word8 polyset_size; -#endif EFAP *efap; ivas_error error; @@ -181,7 +175,6 @@ ivas_error efap_init_data_fx( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for EFAP bufferS\n" ) ); } -#ifdef FIX_1050_EFAP_ALLOC /* get upper bound of number of polygons required */ polyset_size = efap_poly_limit[num_speaker_nodes - 1]; @@ -196,7 +189,6 @@ ivas_error efap_init_data_fx( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for EFAP bufferS\n" ) ); } -#endif /*-----------------------------------------------------------------* * Initialize values @@ -360,14 +352,12 @@ void efap_free_data_fx( free( ( *hEFAPdata )->vtxData.vtxOrder ); ( *hEFAPdata )->vtxData.vtxOrder = NULL; -#ifdef FIX_1050_EFAP_ALLOC free( ( *hEFAPdata )->polyData.polysetArray ); ( *hEFAPdata )->vtxData.vtxOrder = NULL; free( ( *hEFAPdata )->polyData.triArray ); ( *hEFAPdata )->vtxData.vtxOrder = NULL; -#endif free( ( *hEFAPdata )->bufferLong_fx ); ( *hEFAPdata )->bufferLong_fx = NULL; @@ -439,11 +429,7 @@ static ivas_error poly_init_fx( if ( GT_32( efap->vtxData.vertexArray[n].ele /*Q22*/, ( Q22_90_DEG /*90.0 Q22*/ - 4 /*1e-6 Q22*/ ) ) || LT_32( efap->vtxData.vertexArray[n].ele /*Q22*/, ( 4 /*1e-6 Q22*/ - Q22_90_DEG /*90.0 Q22*/ ) ) ) { -#ifdef FIX_1050_EFAP_ALLOC efap->vtxData.vertexArray[n].isNaN = true; -#else - efap->vtxData.vertexArray[n].isNaN = 1; -#endif move16(); } } @@ -1703,12 +1689,8 @@ static void add_vertex_fx( /* Final Idx */ vtxArray[pos].idx = add( extract_l( idxAziTmp ), i_mult( 181, extract_l( L_shr( idxEleTmp, Q22 ) ) ) ); // q0 -/* Setting the nan flag to 0 */ -#ifdef FIX_1050_EFAP_ALLOC + /* Setting the nan flag to 0 */ vtxArray[pos].isNaN = false; -#else - vtxArray[pos].isNaN = 0; -#endif move16(); /* Set the default downmix type */ diff --git a/lib_rend/ivas_mcmasa_ana_fx.c b/lib_rend/ivas_mcmasa_ana_fx.c index 4d41d73a581d6e031b307ac14f49f47d672e2905..1ce8dc77f2fbfc56d5747d0ad716945d699dedfe 100644 --- a/lib_rend/ivas_mcmasa_ana_fx.c +++ b/lib_rend/ivas_mcmasa_ana_fx.c @@ -1622,9 +1622,6 @@ void ivas_create_masa_out_meta_fx( Word16 spreadCoherence_q, Word16 surroundingCoherence_q ) { -#ifndef FIX_1121_MASA_DESCRIPTOR - const UWord8 ivasmasaFormatDescriptor[8] = { 0x49, 0x56, 0x41, 0x53, 0x4D, 0x41, 0x53, 0x41 }; /* "IVASMASA" */ -#endif Word16 i, sf, band; UWord8 numFrequencyBands; UWord8 numDirections; diff --git a/lib_rend/ivas_objectRenderer_fx.c b/lib_rend/ivas_objectRenderer_fx.c index d3c7b7002e2ab4a7bb1e50008dc8c4f30bbdbee8..850debb72510d383900f4431eed154c5dda2d275 100644 --- a/lib_rend/ivas_objectRenderer_fx.c +++ b/lib_rend/ivas_objectRenderer_fx.c @@ -68,15 +68,13 @@ static void angles_to_vec_fx( *---------------------------------------------------------------------*/ ivas_error ivas_td_binaural_open_unwrap_fx( - TDREND_HRFILT_FiltSet_t **hHrtfTD, /* i/o: HR filter model (from file or NULL) */ - const Word32 output_Fs, /* i : Output sampling rate */ - const Word16 nchan_transport, /* i : Number of channels */ - const IVAS_FORMAT ivas_format, /* i : IVAS format (ISM/MC) */ - const AUDIO_CONFIG transport_config, /* i : Transport configuration */ - const Word16 *directivity, /* i : Directivity pattern (used for ISM) */ -#ifdef CONF_DISTATT - const Word32 *distAtt, /* i : Distance attenuation (used for ISM) */ -#endif + TDREND_HRFILT_FiltSet_t **hHrtfTD, /* i/o: HR filter model (from file or NULL) */ + const Word32 output_Fs, /* i : Output sampling rate */ + const Word16 nchan_transport, /* i : Number of channels */ + const IVAS_FORMAT ivas_format, /* i : IVAS format (ISM/MC) */ + const AUDIO_CONFIG transport_config, /* i : Transport configuration */ + const Word16 *directivity, /* i : Directivity pattern (used for ISM) */ + const Word32 *distAtt, /* i : Distance attenuation (used for ISM) */ const IVAS_OUTPUT_SETUP hTransSetup, /* i : Loudspeaker layout */ BINAURAL_TD_OBJECT_RENDERER_HANDLE *hBinRendererTd, /* o : TD renderer handle */ Word32 *binaural_latency_ns, /* i : Binauralization delay */ @@ -89,9 +87,7 @@ ivas_error ivas_td_binaural_open_unwrap_fx( Word32 Pos_fx[3]; // Q25 Word32 Dir_fx[3]; // Q30 TDREND_DirAtten_t *DirAtten_p; -#ifdef CONF_DISTATT TDREND_DistAtten_t DistAtten; -#endif Word16 nchan_rend; ivas_error error; @@ -208,7 +204,6 @@ ivas_error ivas_td_binaural_open_unwrap_fx( DirAtten_p->ConeOuterGain_fx = ONE_IN_Q30; move32(); -#ifdef CONF_DISTATT DistAtten.DistAttenModel = TDREND_DIST_ATTEN_MODEL_INV_DIST_CLAMPED; // Q0 move16(); DistAtten.MaxDist_fx = 2113929216; /* Maximum radius (2^ISM_RADIUS_NBITS-1)*0.25 */ /*15.75 in Q27*/ @@ -217,7 +212,6 @@ ivas_error ivas_td_binaural_open_unwrap_fx( move32(); DistAtten.RollOffFactor_fx = ONE_IN_Q30; // Q30 move32(); -#endif // TDREND_SRC_SPATIAL_t *SrcSpatial_p = pBinRendTd->Sources[nS]->SrcSpatial_p; IF( NE_32( ( error = TDREND_MIX_SRC_SetPos_fx( pBinRendTd, nS, Pos_fx ) ), IVAS_ERR_OK ) ) @@ -237,12 +231,10 @@ ivas_error ivas_td_binaural_open_unwrap_fx( { return error; } -#ifdef CONF_DISTATT IF( NE_32( ( error = TDREND_MIX_SRC_SetDistAtten( pBinRendTd, nS, &DistAtten ) ), IVAS_ERR_OK ) ) { return error; } -#endif } } test(); @@ -268,7 +260,6 @@ ivas_error ivas_td_binaural_open_unwrap_fx( move32(); move32(); move32(); -#ifdef CONF_DISTATT if ( NULL == distAtt ) { DistAtten.DistAttenModel = TDREND_DIST_ATTEN_MODEL_INV_DIST_CLAMPED; // Q0 @@ -287,17 +278,14 @@ ivas_error ivas_td_binaural_open_unwrap_fx( DistAtten.RefDist_fx = distAtt[1]; DistAtten.RollOffFactor_fx = distAtt[2]; } -#endif IF( NE_32( ( error = TDREND_MIX_SRC_SetDirAtten_fx( pBinRendTd, nS, DirAtten_p ) ), IVAS_ERR_OK ) ) { return error; } -#ifdef CONF_DISTATT IF( NE_32( ( error = TDREND_MIX_SRC_SetDistAtten( pBinRendTd, nS, &DistAtten ) ), IVAS_ERR_OK ) ) { return error; } -#endif } } @@ -422,25 +410,17 @@ ivas_error ivas_td_binaural_renderer_unwrap_fx( Word16 tmp_headRotEnabled; tmp_headRotEnabled = 0; move16(); -#ifdef FIX_1135_EXT_RENDERER_HANDLES Word16 tmp_CombinedOrient_subframe_idx; tmp_CombinedOrient_subframe_idx = 0; move16(); -#endif IF( enableCombinedOrientation != NULL ) { tmp_headRotEnabled = enableCombinedOrientation[hCombinedOrientationData->subframe_idx]; move16(); -#ifdef FIX_1135_EXT_RENDERER_HANDLES tmp_CombinedOrient_subframe_idx = hCombinedOrientationData->subframe_idx; -#endif } -#ifdef FIX_1135_EXT_RENDERER_HANDLES IF( NE_32( ( error = TDREND_Update_listener_orientation_fx( hBinRendererTd, tmp_headRotEnabled, &Quaternions[tmp_CombinedOrient_subframe_idx], &Pos[tmp_CombinedOrient_subframe_idx] ) ), IVAS_ERR_OK ) ) -#else - IF( NE_32( ( error = TDREND_Update_listener_orientation_fx( hBinRendererTd, tmp_headRotEnabled, &Quaternions[hCombinedOrientationData->subframe_idx], &Pos[hCombinedOrientationData->subframe_idx] ) ), IVAS_ERR_OK ) ) -#endif { return error; } @@ -472,11 +452,7 @@ ivas_error ivas_td_binaural_renderer_unwrap_fx( /* Render subframe */ -#ifdef NONBE_FIX_1196_TD_HEADTRACKING_INTERPOLATION IF( NE_32( ( error = TDREND_GetMix_fx( hBinRendererTd, output_fx, subframe_length, subframe_idx ) ), IVAS_ERR_OK ) ) -#else - IF( NE_32( ( error = TDREND_GetMix_fx( hBinRendererTd, output_fx, subframe_length, subframe_idx, ism_md_subframe_update ) ), IVAS_ERR_OK ) ) -#endif { return error; } @@ -519,12 +495,7 @@ ivas_error TDREND_GetMix_fx( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */ Word32 *output[], /* i/o: ISM object synth / rendered output in 0,1 Q11 */ const Word16 subframe_length, /* i/o: subframe length */ -#ifdef NONBE_FIX_1196_TD_HEADTRACKING_INTERPOLATION - const Word16 subframe_idx /* i : Subframe index to 5 ms subframe */ -#else - const Word16 subframe_idx, /* i : Subframe index to 5 ms subframe */ - const Word16 ism_md_subframe_update /* i : Number of subframes to delay ism metadata to sync with audio */ -#endif + const Word16 subframe_idx /* i : Subframe index to 5 ms subframe */ ) { Word16 i; @@ -537,17 +508,10 @@ ivas_error TDREND_GetMix_fx( Word32 hrf_right_delta[SFX_SPAT_BIN_MAX_FILTER_LENGTH]; Word16 intp_count; -#ifndef NONBE_FIX_1196_TD_HEADTRACKING_INTERPOLATION - Word16 subframe_update_flag; -#endif Word16 hrf_left_delta_e = 0, hrf_right_delta_e = 0; move16(); move16(); -#ifndef NONBE_FIX_1196_TD_HEADTRACKING_INTERPOLATION - subframe_update_flag = (Word16) EQ_16( subframe_idx, ism_md_subframe_update ); - move16(); -#endif error = IVAS_ERR_OK; move32(); /* Clear the output buffer to accumulate rendered sources */ @@ -573,21 +537,12 @@ ivas_error TDREND_GetMix_fx( test(); IF( EQ_16( SrcRend_p->PlayStatus, TDREND_PLAYSTATUS_PLAYING ) && ( hBinRendererTd->Listener_p->PoseUpdated || SrcSpatial_p->Updated ) ) { -#ifdef NONBE_FIX_1196_TD_HEADTRACKING_INTERPOLATION TDREND_SRC_REND_UpdateFiltersFromSpatialParams_fx( hBinRendererTd, SrcRend_p, SrcSpatial_p, Src_p->hrf_left_prev_fx, &Src_p->hrf_left_prev_e, Src_p->hrf_right_prev_fx, &Src_p->hrf_right_prev_e, hrf_left_delta, &hrf_left_delta_e, hrf_right_delta, &hrf_right_delta_e, &intp_count, &Src_p->filterlength, &Src_p->itd, &Src_p->Gain_fx, Src_p ); -#else - TDREND_SRC_REND_UpdateFiltersFromSpatialParams_fx( hBinRendererTd, SrcRend_p, SrcSpatial_p, - Src_p->hrf_left_prev_fx, &Src_p->hrf_left_prev_e, Src_p->hrf_right_prev_fx, &Src_p->hrf_right_prev_e, - hrf_left_delta, &hrf_left_delta_e, hrf_right_delta, &hrf_right_delta_e, - &intp_count, &Src_p->filterlength, &Src_p->itd, - &Src_p->Gain_fx, - Src_p, subframe_update_flag ); -#endif } /* Render source if needed */ @@ -843,9 +798,7 @@ ivas_error ivas_td_binaural_open_ext_fx( IVAS_FORMAT ivas_format; IVAS_OUTPUT_SETUP hTransSetup; ivas_error error; -#ifdef CONF_DISTATT Word32 *distAtt_fx = NULL; -#endif Word16 *directivity_fx = NULL; IF( NE_16( inConfig, IVAS_AUDIO_CONFIG_LS_CUSTOM ) ) @@ -887,16 +840,10 @@ ivas_error ivas_td_binaural_open_ext_fx( if ( NULL != hRendCfg ) { directivity_fx = hRendCfg->directivity_fx; -#ifdef CONF_DISTATT distAtt_fx = hRendCfg->distAtt_fx; -#endif } -#ifdef CONF_DISTATT return ivas_td_binaural_open_unwrap_fx( pTDRend->hHrtfTD, outFs, nchan_transport, ivas_format, transport_config, directivity_fx, distAtt_fx, hTransSetup, &pTDRend->hBinRendererTd, &pTDRend->binaural_latency_ns, SrcInd ); -#else - return ivas_td_binaural_open_unwrap_fx( pTDRend->hHrtfTD, outFs, nchan_transport, ivas_format, transport_config, directivity_fx, hTransSetup, &pTDRend->hBinRendererTd, &pTDRend->binaural_latency_ns, SrcInd ); -#endif } @@ -1008,12 +955,8 @@ ivas_error ivas_td_binaural_renderer_ext_fx( Word16 pos_q = Q25; move16(); -#ifdef FIX_1135_EXT_RENDERER_HANDLES test(); IF( *hCombinedOrientationData != NULL && ( *hCombinedOrientationData )->listenerPos != NULL ) -#else - IF( ( *hCombinedOrientationData )->listenerPos != NULL ) -#endif { ( *hCombinedOrientationData )->listenerPos[idx].x_fx = L_shr( ( *hCombinedOrientationData )->listenerPos[idx].x_fx, sub( ( *hCombinedOrientationData )->listenerPos[idx].q_fact, pos_q ) ); move32(); diff --git a/lib_rend/ivas_objectRenderer_sfx_fx.c b/lib_rend/ivas_objectRenderer_sfx_fx.c index de287937039d75501f4baab9d318558ae12ec777..d179bd871240226a8b26a3d6f191594a5b0e6e24 100644 --- a/lib_rend/ivas_objectRenderer_sfx_fx.c +++ b/lib_rend/ivas_objectRenderer_sfx_fx.c @@ -229,11 +229,7 @@ static void sincResample_fx( /* Calculate the sinc-index for the center value of the sinc */ Word16 center_val_e; Word64 center_val; -#ifndef FIX_ISSUE_1811_EXCEEDING_W_SHIFTS - center_val = W_sub( t_frac_plus_eps, W_shl( t, sub( 31, t_frac_plus_eps_e ) ) ); // exp(center_val_e) -#else - center_val = W_sub( t_frac_plus_eps, W_shl( t, s_min( sub( 31, t_frac_plus_eps_e ), 63 ) ) ); // exp( center_val_e ) -#endif + center_val = W_sub( t_frac_plus_eps, W_shl( t, s_min( sub( 31, t_frac_plus_eps_e ), 63 ) ) ); // exp( center_val_e ) center_val_e = add( t_frac_plus_eps_e, 6 ); Word16 com_e = s_max( 0, center_val_e ); center_val = W_add( W_shr( center_val, sub( com_e, center_val_e ) ), W_shl( 1, sub( 30, com_e ) ) ); // exp(center_val_e) @@ -312,15 +308,10 @@ void TDREND_firfilt_fx( gain_tmp_fx = L_shl_sat( prevGain_fx, 1 ); // Q31 /* Handle memory */ - p_signal_fx = buffer_fx + sub( filterlength, 1 ); // Qx - Copy32( mem_fx, buffer_fx, sub( filterlength, 1 ) ); /* Insert memory */ // Qx -#ifdef NONBE_FIX_1176_OSBA_REVERB_JBM_ASAN_ERROR + p_signal_fx = buffer_fx + sub( filterlength, 1 ); // Qx + Copy32( mem_fx, buffer_fx, sub( filterlength, 1 ) ); /* Insert memory */ // Qx Copy32( signal_fx, p_signal_fx, subframe_length ); /* Insert current frame */ // Qx Copy32( p_signal_fx + add( sub( subframe_length, filterlength ), 1 ), mem_fx, sub( filterlength, 1 ) ); /* Update memory for next frame */ // Qx -#else - Copy32( signal_fx, buffer_fx + sub( filterlength, 1 ), subframe_length ); /* Insert current frame */ // Qx - Copy32( signal_fx + add( sub( subframe_length, filterlength ), 1 ), mem_fx, sub( filterlength, 1 ) ); /* Update memory for next frame */ // Qx -#endif /* Convolution */ FOR( i = 0; i < intp_count; i++ ) diff --git a/lib_rend/ivas_objectRenderer_sources_fx.c b/lib_rend/ivas_objectRenderer_sources_fx.c index 62a8fc90616ffe01436e3fe6e7d8c24f6ce20410..4c30f23de7ce0945b0495b097f19db6900798f63 100644 --- a/lib_rend/ivas_objectRenderer_sources_fx.c +++ b/lib_rend/ivas_objectRenderer_sources_fx.c @@ -48,9 +48,7 @@ static void TDREND_SRC_SPATIAL_Init_fx( TDREND_SRC_SPATIAL_t *SrcSpatial_p, cons static Word16 TDREND_SRC_SPATIAL_GetDirGain_fx( const TDREND_DirAtten_t *DirAtten_p, const Word32 *Front_p_fx, const Word32 *RelPos_p, const Word16 RelPos_p_e ); static Word16 TDREND_SRC_SPATIAL_GetDistGain_fx( const TDREND_DistAtten_t *DistAtten_p, const Word32 Dist_fx, const Word16 Dist_e ); static void TDREND_SRC_SPATIAL_SetDirAtten_fx( TDREND_SRC_SPATIAL_t *SrcSpatial_p, const TDREND_DirAtten_t *DirAtten_p ); -#ifdef CONF_DISTATT static void TDREND_SRC_SPATIAL_SetDistAtten( TDREND_SRC_SPATIAL_t *SrcSpatial_p, const TDREND_DistAtten_t *DistAtten_p ); -#endif static ivas_error TDREND_SRC_REND_Alloc( TDREND_SRC_REND_t **SrcRend_pp ); static void TDREND_SRC_SPATIAL_Dealloc( TDREND_SRC_SPATIAL_t *SrcSpatial_p ); @@ -157,7 +155,6 @@ ivas_error TDREND_MIX_SRC_SetDirAtten_fx( return IVAS_ERR_OK; } -#ifdef CONF_DISTATT /*-------------------------------------------------------------------* * TDREND_MIX_SRC_SetDistAtten() * @@ -183,7 +180,6 @@ ivas_error TDREND_MIX_SRC_SetDistAtten( return IVAS_ERR_OK; } -#endif /*-------------------------------------------------------------------* @@ -307,13 +303,8 @@ void TDREND_SRC_REND_UpdateFiltersFromSpatialParams_fx( Word16 *itd, /* o : ITD value */ // Q0 Word32 *Gain, -/* o : Gain value */ // Q30 -#ifdef NONBE_FIX_1196_TD_HEADTRACKING_INTERPOLATION - TDREND_SRC_t *Src_p /* i/o: Source pointer */ -#else - TDREND_SRC_t *Src_p, /* i/o: Source pointer */ - const Word16 subframe_update_flag -#endif + /* o : Gain value */ // Q30 + TDREND_SRC_t *Src_p /* i/o: Source pointer */ ) { TDREND_MIX_Listener_t *Listener_p; @@ -475,11 +466,7 @@ void TDREND_SRC_REND_UpdateFiltersFromSpatialParams_fx( test(); -#ifdef NONBE_FIX_1196_TD_HEADTRACKING_INTERPOLATION IF( ( *intp_count > 0 ) ) -#else - IF( ( *intp_count > 0 ) && subframe_update_flag ) -#endif { /* Set deltas for interpolation */ Word16 tmp_e; @@ -665,7 +652,6 @@ static void TDREND_SRC_SPATIAL_SetDirAtten_fx( return; } -#ifdef CONF_DISTATT /*-------------------------------------------------------------------* * TDREND_SRC_SPATIAL_SetDistAtten() * @@ -689,7 +675,6 @@ static void TDREND_SRC_SPATIAL_SetDistAtten( return; } -#endif /*-------------------------------------------------------------------* * TDREND_SRC_SPATIAL_GetDirGain() @@ -795,46 +780,28 @@ static Word16 TDREND_SRC_SPATIAL_GetDistGain_fx( Word16 tmp_e; Word32 tmp32; Word16 flag; -#ifdef CONF_DISTATT Word16 Dist_s; Word16 tmp16; -#else - Word16 DistGain_e; -#endif DistGain_fx = ONE_IN_Q14; // Q14 move16(); -#ifndef CONF_DISTATT - DistGain_e = 1; - move16(); -#endif Dist2_fx = Dist_fx; move32(); Dist2_e = Dist_e; move16(); -#ifdef CONF_DISTATT tmp32 = 0; move32(); tmp_e = 0; move16(); -#endif SWITCH( DistAtten_p->DistAttenModel ) { case TDREND_DIST_ATTEN_MODEL_INV_DIST: -#ifdef CONF_DISTATT /* DistGain = powf( DistAtten_p->RefDist / Dist2, DistAtten_p->RollOffFactor ); */ tmp16 = BASOP_Util_Divide3232_Scale( DistAtten_p->RefDist_fx, Dist2_fx, &Dist_s ); /* tmp16 is Q(15 - Dist_s + Dist2_e - 1) */ tmp32 = L_deposit_h( tmp16 ); /* tmp32 is Q(31 - Dist_s + Dist2_e - 1) */ /* tmp32 exponent: 31 - (31 - Dist_s + Dist2_e - 1) = Dist_s - Dist2_e + 1, RollOffFactor_fx exponent: 31 - 30 = 1 */ tmp32 = BASOP_Util_fPow( tmp32, add( sub( Dist_s, Dist2_e ), 1 ), DistAtten_p->RollOffFactor_fx, 1, &tmp_e ); /* Q(31 - tmp_e) */ -#else - tmp32 = BASOP_Util_Add_Mant32Exp( Dist2_fx, Dist2_e, L_negate( DistAtten_p->RefDist_fx ), 1, &tmp_e ); // exp: tmp_e - tmp32 = Mpy_32_32( tmp32, DistAtten_p->RollOffFactor_fx ); // exp: 1 + tmp_e - tmp32 = BASOP_Util_Add_Mant32Exp( DistAtten_p->RefDist_fx, 1, tmp32, add( 1, tmp_e ), &tmp_e ); // exp: tmp_e - DistGain_fx = BASOP_Util_Divide3232_Scale( DistAtten_p->RefDist_fx, tmp32, &DistGain_e ); // exp: DistGain_e - DistGain_e = add( DistGain_e, sub( 1, tmp_e ) ); -#endif BREAK; case TDREND_DIST_ATTEN_MODEL_INV_DIST_CLAMPED: @@ -854,24 +821,15 @@ static Word16 TDREND_SRC_SPATIAL_GetDistGain_fx( Dist2_e = 4; move16(); } -#ifdef CONF_DISTATT /* DistGain = powf( DistAtten_p->RefDist / Dist2, DistAtten_p->RollOffFactor ); */ tmp16 = BASOP_Util_Divide3232_Scale( DistAtten_p->RefDist_fx, Dist2_fx, &Dist_s ); /* tmp16 is Q(15 - Dist_s + Dist2_e - 1) */ tmp32 = L_deposit_h( tmp16 ); /* tmp32 is Q(31 - Dist_s + Dist2_e - 1) */ /* tmp32 exponent: 31 - (31 - Dist_s + Dist2_e - 1) = Dist_s - Dist2_e + 1, RollOffFactor_fx exponent: 31 - 30 = 1 */ tmp32 = BASOP_Util_fPow( tmp32, add( sub( Dist_s, Dist2_e ), 1 ), DistAtten_p->RollOffFactor_fx, 1, &tmp_e ); /* Q(31 - tmp_e) */ -#else - tmp32 = BASOP_Util_Add_Mant32Exp( Dist2_fx, Dist2_e, L_negate( DistAtten_p->RefDist_fx ), 1, &tmp_e ); // exp: tmp_e - tmp32 = Mpy_32_32( tmp32, DistAtten_p->RollOffFactor_fx ); // exp: 1 + tmp_e - tmp32 = BASOP_Util_Add_Mant32Exp( DistAtten_p->RefDist_fx, 1, tmp32, add( 1, tmp_e ), &tmp_e ); // exp: tmp_e - DistGain_fx = BASOP_Util_Divide3232_Scale( DistAtten_p->RefDist_fx, tmp32, &DistGain_e ); // exp: DistGain_e - DistGain_e = add( DistGain_e, sub( 1, tmp_e ) ); -#endif BREAK; } -#ifdef CONF_DISTATT tmp16 = extract_h( L_shr( tmp32, sub( 1, tmp_e ) ) ); // Reducing it to Q14: Go to Q30 and extract_h. right shift by 31-tmp_e-30 = 1-tmp_e IF( GT_16( tmp16, ONE_IN_Q14 ) ) { @@ -879,9 +837,6 @@ static Word16 TDREND_SRC_SPATIAL_GetDistGain_fx( } DistGain_fx = tmp16; -#else - DistGain_fx = shr( DistGain_fx, sub( 1, DistGain_e ) ); // Reducing it to Q14 -#endif return DistGain_fx; } diff --git a/lib_rend/ivas_output_init_fx.c b/lib_rend/ivas_output_init_fx.c index a863373f808e53ef5195a806c1b7c3deff54eb0f..ebd1f3f278f7e18a2cb50005709b7be91a290154 100644 --- a/lib_rend/ivas_output_init_fx.c +++ b/lib_rend/ivas_output_init_fx.c @@ -355,11 +355,7 @@ Word16 ivas_get_nchan_buffers_dec_fx( { nchan_out_buff = s_max( nchan_out_buff, add( st_ivas->hOutSetup.nchan_out_woLFE, st_ivas->hOutSetup.num_lfe ) ); } -#ifdef FIX_1138_SBA_EXT_ERROR_PRINTOUT ELSE IF( NE_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) ) -#else - ELSE -#endif { nchan_out_buff = s_max( audioCfg2channels( st_ivas->transport_config ), audioCfg2channels( st_ivas->intern_config ) ); nchan_out_buff = s_max( nchan_out_buff, audioCfg2channels( output_config ) ); @@ -390,37 +386,27 @@ Word16 ivas_get_nchan_buffers_dec_fx( nchan_out_buff = s_max( nchan_out_buff, audioCfg2channels( st_ivas->intern_config ) ); nchan_out_buff = s_max( nchan_out_buff, audioCfg2channels( output_config ) ); } -#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT test(); -#ifdef NONBE_FIX_1074_NOBJ_SIGNAL_OMASA_LBR test(); IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) && GT_16( st_ivas->nchan_ism, 0 ) && LT_16( st_ivas->nchan_ism, 5 ) ) /* Last condition needed only in BASOP */ -#else - IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) && GT_16( st_ivas->nchan_ism, 0 ) ) -#endif { nchan_out_buff = add( st_ivas->nchan_ism, CPE_CHANNELS ); } -#endif } ELSE IF( EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) ) { nchan_out_buff = add( st_ivas->nchan_ism, CPE_CHANNELS ); -#ifdef FIX_1222_OMASA_DEC_CHANNEL_BUFFERS test(); test(); -#endif IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_LS_CUSTOM ) ) { nchan_out_buff = s_max( nchan_out_buff, add( st_ivas->hOutSetup.nchan_out_woLFE, st_ivas->hOutSetup.num_lfe ) ); } -#ifdef FIX_1222_OMASA_DEC_CHANNEL_BUFFERS ELSE IF( EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) || EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) || EQ_32( st_ivas->renderer_type, RENDERER_STEREO_PARAMETRIC ) ) { nchan_out_buff = s_max( nchan_out_buff, add( BINAURAL_CHANNELS, st_ivas->nchan_ism ) ); } -#endif ELSE IF( NE_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) ) { nchan_out_buff = s_max( nchan_out_buff, audioCfg2channels( st_ivas->intern_config ) ); @@ -477,11 +463,7 @@ Word16 ivas_get_nchan_buffers_dec_fx( { nchan_out_buff = s_max( nchan_out_buff, add( st_ivas->hOutSetup.nchan_out_woLFE, st_ivas->hOutSetup.num_lfe ) ); } -#ifdef FIX_1052_EXT_OUTPUT ELSE IF( NE_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) ) -#else - ELSE -#endif { nchan_out_buff = s_max( audioCfg2channels( st_ivas->transport_config ), audioCfg2channels( st_ivas->intern_config ) ); nchan_out_buff = s_max( nchan_out_buff, audioCfg2channels( output_config ) ); diff --git a/lib_rend/ivas_prot_rend_fx.h b/lib_rend/ivas_prot_rend_fx.h index ba20ad51b3fa962f5b44af04ff1679557f7defee..84af7ab1c4e60585f9132b8478e91ff8131ef16b 100644 --- a/lib_rend/ivas_prot_rend_fx.h +++ b/lib_rend/ivas_prot_rend_fx.h @@ -232,11 +232,7 @@ void ivas_masa_ext_rend_parambin_render_fx( ivas_error ivas_dirac_dec_init_binaural_data_fx( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ -#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF HRTFS_PARAMBIN_HANDLE *phHrtfParambin /* i : HRTF structure for rendering */ -#else - HRTFS_PARAMBIN_HANDLE hHrtfParambin /* i : HRTF structure for rendering */ -#endif ); void ivas_dirac_dec_close_binaural_data( @@ -678,9 +674,7 @@ ivas_error ivas_td_binaural_open_unwrap_fx( const IVAS_FORMAT ivas_format, /* i : IVAS format (ISM/MC) */ const AUDIO_CONFIG transport_config, /* i : Transport configuration */ const Word16 *directivity, /* i : Directivity pattern (used for ISM) */ -#ifdef CONF_DISTATT const Word32 *distAtt, /* i : Distance attenuation (used for ISM) */ -#endif const IVAS_OUTPUT_SETUP hTransSetup, /* i : Loudspeaker layout */ BINAURAL_TD_OBJECT_RENDERER_HANDLE *hBinRendererTd, /* o : TD renderer handle */ Word32 *binaural_latency_ns, /* i : Binauralization delay */ @@ -705,12 +699,7 @@ ivas_error TDREND_GetMix_fx( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */ Word32 *output[], /* i/o: ISM object synth / rendered output in 0,1 */ const Word16 subframe_length, /* i/o: subframe length Q11 */ -#ifdef NONBE_FIX_1196_TD_HEADTRACKING_INTERPOLATION const Word16 subframe_idx /* i : Subframe index to 5 ms subframe */ -#else - const Word16 subframe_idx, /* i : Subframe index to 5 ms subframe */ - const Word16 ism_md_subframe_update /* i : Number of subframes to delay ism metadata to sync with audio */ -#endif ); void BSplineModelEvalDealloc_fx( @@ -768,13 +757,11 @@ ivas_error TDREND_MIX_SRC_SetDirAtten_fx( const TDREND_DirAtten_t *DirAtten_p /* i : Directional attenuation specifier */ ); -#ifdef CONF_DISTATT ivas_error TDREND_MIX_SRC_SetDistAtten( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */ const Word16 SrcInd, /* i : Source index */ const TDREND_DistAtten_t *DistAtten_p /* i : Distance attenuation specifier */ ); -#endif ivas_error TDREND_MIX_SRC_SetPlayState( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */ @@ -798,12 +785,7 @@ void TDREND_SRC_REND_UpdateFiltersFromSpatialParams_fx( Word16 *filterlength, /* o : Length of filters */ Word16 *itd, /* o : ITD value */ Word32 *Gain, /* o : Gain value Q30 */ -#ifdef NONBE_FIX_1196_TD_HEADTRACKING_INTERPOLATION TDREND_SRC_t *Src_p /* i/o: Source pointer */ -#else - TDREND_SRC_t *Src_p, /* i/o: Source pointer */ - const Word16 subframe_update_flag /* i : Flag to determine update subframe idx */ -#endif ); ivas_error TDREND_SRC_Alloc( @@ -953,10 +935,8 @@ ivas_error ivas_binaural_reverb_init( const Word32 sampling_rate, /* i : sampling rate */ const Word32 *defaultTimes, /* i : default reverberation times */ const Word32 *defaultEne /* i : default reverberation energies */ -#ifdef FIX_1139_REV_COLORATION_SHORT_T60 , Word32 *earlyEne /* i/o: Early part energies to be modified */ -#endif ); void ivas_binaural_reverb_close_fx( diff --git a/lib_rend/ivas_render_config_fx.c b/lib_rend/ivas_render_config_fx.c index 9ce867566be1bd650a4c6f9de2dabfc6a29048f8..98e5a0b3324fc63091defb5efac165317dfd66b2 100644 --- a/lib_rend/ivas_render_config_fx.c +++ b/lib_rend/ivas_render_config_fx.c @@ -109,10 +109,6 @@ ivas_error ivas_render_config_init_from_rom_fx( { return IVAS_ERROR( IVAS_ERR_UNEXPECTED_NULL_POINTER, "Unexpected null pointer while attempting to fill renderer configuration from ROM" ); } -#ifndef FIX_587_DEFAULT_REVERB - ( *hRenderConfig )->roomAcoustics.override = FALSE; - move16(); -#endif ( *hRenderConfig )->roomAcoustics.nBands = IVAS_REVERB_DEFAULT_N_BANDS; move16(); ( *hRenderConfig )->roomAcoustics.acousticPreDelay_fx = IVAS_REVERB_DEFAULT_PRE_DELAY_FX; @@ -138,14 +134,12 @@ ivas_error ivas_render_config_init_from_rom_fx( ( *hRenderConfig )->directivity_fx[add( i_mult( i, 3 ), 2 )] = 32767 /*1.0f in Q15*/; /* Back attenuation */ move16(); } -#ifdef CONF_DISTATT ( *hRenderConfig )->distAtt_fx[0] = 2113929216; /* Maximum radius (2^ISM_RADIUS_NBITS-1)*0.25 */ /*15.75 in Q27*/ /* Default max dist */ move32(); ( *hRenderConfig )->distAtt_fx[1] = ONE_IN_Q30; // Q30 /* Default ref dist */ move32(); ( *hRenderConfig )->distAtt_fx[2] = ONE_IN_Q30; // Q30 /* Default rolloff factor */ move32(); -#endif ( *hRenderConfig )->split_rend_config.splitRendBitRate = ISAR_MAX_SPLIT_REND_BITRATE; move32(); ( *hRenderConfig )->split_rend_config.dof = 3; diff --git a/lib_rend/ivas_reverb_fx.c b/lib_rend/ivas_reverb_fx.c index 92f428884be5109f5b3ebc7bf449966a01916abe..a1ae8152d0bffc953fe612cb2a66ea981981ac0c 100644 --- a/lib_rend/ivas_reverb_fx.c +++ b/lib_rend/ivas_reverb_fx.c @@ -72,11 +72,9 @@ static Word16 wrap_rad_fixed( #define CLDFB_SLOTS_PER_SECOND 800 /* Used for initializing reverb */ -#ifdef FIX_1139_REV_COLORATION_SHORT_T60 #define REV_TIME_THRESHOLD ( 13421773 ) /* 0.2f in Q26 */ #define Q26_REV_TIME_THRESHOLD_TIMES_0_5 ( 6710886 ) /* 0.2 * 0.5 in Q26 */ #define Q29_0_5_PER_REV_TIME_THRESHOLD ( 1342177280 ) /* 0.2 / 0.5 in Q29 */ -#endif #define INNER_BLK_SIZE 80 /* size of data blocks used for more efficient delay line and IIR filter processing */ /* should be a divisor of the frame length at any sampling rate and an even number*/ @@ -134,16 +132,11 @@ typedef struct ivas_reverb_params_t Word16 pT60_filter_coeff_fx[MAX_NR_OUTPUTS * IVAS_REV_MAX_NR_BRANCHES * IVAS_REV_MAX_IIR_FILTER_LENGTH]; /* In Matlab: IIR: [(2 * L) x ( + 1)] (odd: b-vector, even: a-vector) */ /* In Matlab: FIR: [L x ] */ - Word32 *pFc_fx; /* Center frequencies for FFT filter design */ - Word32 *pRt60_fx; /* RT60 values at these frequencies */ - Word16 *pRt60_e; /* exponents for RT60 values at these frequencies */ - Word32 *pDsr_fx; /* DSR values at these frequencies */ - Word16 *pDsr_e; /* DSR values at these frequencies */ -#ifndef FIX_1053_REVERB_RECONFIGURATION - Word32 *pHrtf_avg_pwr_response_l_fx; /* The HRTF set's average left ear power response */ - Word32 *pHrtf_avg_pwr_response_r_fx; /* The HRTF set's average right ear power response */ - Word32 *pHrtf_inter_aural_coherence_fx; /* The HRTF set's inter-aural coherence for diffuse sound */ -#endif + Word32 *pFc_fx; /* Center frequencies for FFT filter design */ + Word32 *pRt60_fx; /* RT60 values at these frequencies */ + Word16 *pRt60_e; /* exponents for RT60 values at these frequencies */ + Word32 *pDsr_fx; /* DSR values at these frequencies */ + Word16 *pDsr_e; /* DSR values at these frequencies */ const Word32 *pHrtf_avg_pwr_response_l_const_fx; /* The HRTF set's average left ear power response */ const Word32 *pHrtf_avg_pwr_response_r_const_fx; /* The HRTF set's average right ear power response */ const Word32 *pHrtf_inter_aural_coherence_const_fx; /* The HRTF set's inter-aural coherence for diffuse sound */ @@ -247,11 +240,9 @@ static void ivas_binaural_reverb_setReverbTimes_fx( L_tmp = Mpy_32_16_1( output_Fs, tmp ); /*- exp */ binCenterFreq_exp = add( 31, exp ); binCenterFreq_fx = L_shr( L_tmp, 1 ); // divide by 2 -#ifdef FIX_1931_BIN_COHR_CROSS_MIX norm = norm_l( binCenterFreq_fx ); binCenterFreq_fx = L_shl( binCenterFreq_fx, norm ); binCenterFreq_exp = sub( binCenterFreq_exp, norm ); -#endif IF( bin == 0 ) { diffuseFieldICC_fx = ONE_IN_Q31; @@ -275,12 +266,7 @@ static void ivas_binaural_reverb_setReverbTimes_fx( /* binCenterFreq / 2700.0f */ L_tmp = Mpy_32_32( binCenterFreq_fx, 795364 /* 1 / 2700 in Q31 */ ); -#ifdef FIX_1931_BIN_COHR_CROSS_MIX L_tmp = L_shl( L_tmp, binCenterFreq_exp ); /* Q31 */ -#else - norm = norm_l( L_tmp ); - L_tmp = L_shl( L_tmp, norm ); /* Q31 */ -#endif /* ( 1.0f - binCenterFreq / 2700.0f ) */ L_tmp = L_sub( ONE_IN_Q31, L_tmp ); /* Q31 */ @@ -414,7 +400,6 @@ static void ivas_binaural_reverb_setReverbTimes_fx( currentEnergy_exp = currentEnergy_exp + attenuationFactorPerSampleSq_exp; } -#ifdef FIX_1139_REV_COLORATION_SHORT_T60 /* In some configurations with small T60s it is possible the number of taps randomizes to zero. Ensure at least 1 filter tap. */ IF( EQ_16( tap, 0 ) ) @@ -430,7 +415,6 @@ static void ivas_binaural_reverb_setReverbTimes_fx( actualizedEnergy_exp = 1; move16(); } -#endif hReverb->taps[bin][ch] = tap; /* Number of taps determined at the above random procedure */ move16(); @@ -1403,9 +1387,6 @@ static ivas_error setup_FDN_branches_fx( { Word16 nr_coefs, branch_idx, channel_idx; ivas_error error; -#ifndef FIX_1053_REVERB_RECONFIGURATION - Word16 *pCoef_a, *pCoef_b; -#endif error = IVAS_ERR_OK; /* initialize feedback branches */ @@ -1429,15 +1410,6 @@ static ivas_error setup_FDN_branches_fx( { FOR( branch_idx = 0; branch_idx < pParams->nr_loops; branch_idx++ ) { -#ifndef FIX_1053_REVERB_RECONFIGURATION - pCoef_b = &pParams->pT60_filter_coeff_fx[shl( i_mult( nr_coefs, branch_idx ), 1 )]; /*Q14*/ - pCoef_a = &pParams->pT60_filter_coeff_fx[add( shl( i_mult( nr_coefs, branch_idx ), 1 ), nr_coefs )]; /*Q14*/ - - IF( NE_32( ( error = set_t60_filter( hReverb, branch_idx, nr_coefs, pCoef_a, pCoef_b ) ), IVAS_ERR_OK ) ) - { - return error; - } -#endif IF( NE_32( ( error = set_feedback_delay_fx( hReverb, branch_idx, pParams->pLoop_delays[branch_idx] ) ), IVAS_ERR_OK ) ) { return error; @@ -1460,19 +1432,11 @@ static ivas_error setup_FDN_branches_fx( return error; } -#ifdef FIX_1053_REVERB_RECONFIGURATION /*------------------------------------------------------------------------- * ivas_reverb_open_fx() * * Allocate and initialize FDN reverberation handle *------------------------------------------------------------------------*/ -#else -/*------------------------------------------------------------------------- - * ivas_reverb_open_fx() - * - * Allocate and initialize Crend reverberation handle - *------------------------------------------------------------------------*/ -#endif ivas_error ivas_reverb_open_fx( REVERB_HANDLE *hReverb, /* i/o: Reverberator handle */ const HRTFS_STATISTICS_HANDLE hHrtfStatistics, /* i : HRTF statistics handle */ @@ -1480,13 +1444,9 @@ ivas_error ivas_reverb_open_fx( const Word32 output_Fs ) { ivas_error error; -#ifdef FIX_1053_REVERB_RECONFIGURATION REVERB_HANDLE pState = *hReverb; UWord16 nr_coefs, branch_idx; Word16 *pCoef_a, *pCoef_b; -#else - REVERB_HANDLE pState = NULL; -#endif Word16 bin_idx, subframe_len, output_frame, predelay_bf_len, loop_idx, i; ivas_reverb_params_t params; Word32 pColor_target_l_fx[RV_LENGTH_NR_FC]; @@ -1505,7 +1465,6 @@ ivas_error ivas_reverb_open_fx( move16(); nr_fc_input = hRenderConfig->roomAcoustics.nBands; -#ifdef FIX_1053_REVERB_RECONFIGURATION IF( *hReverb == NULL ) { IF( ( pState = (REVERB_HANDLE) malloc( sizeof( REVERB_DATA ) ) ) == NULL ) @@ -1513,18 +1472,10 @@ ivas_error ivas_reverb_open_fx( return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for FDN Reverberator" ); } } -#else - /* Allocate main reverb. handle */ - IF( ( pState = (REVERB_HANDLE) malloc( sizeof( REVERB_DATA ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend Reverberator " ); - } -#endif IF( NE_32( ( error = set_base_config_fx( ¶ms, output_Fs ) ), IVAS_ERR_OK ) ) { return error; } -#ifdef FIX_1053_REVERB_RECONFIGURATION IF( *hReverb == NULL ) { /* Allocate memory for feedback delay lines */ @@ -1542,22 +1493,6 @@ ivas_error ivas_reverb_open_fx( return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for CREND Reverberator" ); } } -#else - /* Allocate memory for feedback delay lines */ - FOR( loop_idx = 0; loop_idx < IVAS_REV_MAX_NR_BRANCHES; loop_idx++ ) - { - IF( ( pState->loop_delay_buffer_fx[loop_idx] = (Word32 *) malloc( params.pLoop_delays[loop_idx] * sizeof( Word32 ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for CREND Reverberator" ); - } - } - - /* Allocate memory for the pre-delay delay line */ - IF( ( pState->pPredelay_buffer_fx = (Word32 *) malloc( output_frame * sizeof( Word32 ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for CREND Reverberator" ); - } -#endif pState->nr_of_branches = IVAS_REV_MAX_NR_BRANCHES; move16(); set_fft_and_datablock_sizes_fx( pState, subframe_len ); @@ -1567,16 +1502,9 @@ ivas_error ivas_reverb_open_fx( /* === 'Control logic': compute the reverb processing parameters from the === */ /* === room, source and listener acoustic information provided in the reverb config === */ /* Setting up shared temporary buffers for fc, RT60, DSR, etc. */ -#ifndef FIX_1053_REVERB_RECONFIGURATION - params.pHrtf_avg_pwr_response_l_fx = &pFft_wf_filter_ch0_fx[0][0]; - params.pHrtf_avg_pwr_response_r_fx = params.pHrtf_avg_pwr_response_l_fx + nr_fc_fft_filter; -#endif params.pRt60_fx = &pFft_wf_filter_ch1_fx[0][0]; params.pDsr_fx = params.pRt60_fx + nr_fc_fft_filter; params.pFc_fx = &pState->fft_filter_color_0.fft_spectrum_fx[0]; -#ifndef FIX_1053_REVERB_RECONFIGURATION - params.pHrtf_inter_aural_coherence_fx = &pState->fft_filter_color_1.fft_spectrum_fx[0]; -#endif set32_fx( pState->fft_filter_color_1.fft_spectrum_fx, 0, RV_FILTER_MAX_FFT_SIZE ); /* Note: these temp buffers can only be used before the final step of the FFT filter design : */ /* before calls to ivas_reverb_calc_correl_filters(...) or to ivas_reverb_calc_color_filters(...) */ @@ -1601,10 +1529,6 @@ ivas_error ivas_reverb_open_fx( /* set reverb acoustic configuration based on renderer config */ -#ifndef FIX_587_DEFAULT_REVERB - pState->pConfig.roomAcoustics.override = hRenderConfig->roomAcoustics.override; - move16(); -#endif pState->pConfig.roomAcoustics.nBands = hRenderConfig->roomAcoustics.nBands; move16(); @@ -1616,15 +1540,10 @@ ivas_error ivas_reverb_open_fx( move32(); } -#ifdef FIX_1053_REVERB_RECONFIGURATION IF( *hReverb == NULL ) { pState->dmx_gain_fx = calc_dmx_gain_fx(); } -#else - /* set up input downmix */ - pState->dmx_gain_fx = calc_dmx_gain_fx(); -#endif /* set up predelay - must be after set_base_config() and before compute_t60_coeffs() */ calc_predelay_fx( ¶ms, hRenderConfig->roomAcoustics.acousticPreDelay_fx, output_Fs ); @@ -1671,7 +1590,6 @@ ivas_error ivas_reverb_open_fx( /* Compute the window used for FFT filters */ ivas_reverb_define_window_fft_fx( pTime_window_fx, transition_start, transition_length, nr_fc_fft_filter ); -#ifdef FIX_1053_REVERB_RECONFIGURATION /* === Copy parameters from ivas_reverb_params_t into DSP blocks === */ /* === to be used for subsequent audio signal processing === */ if ( *hReverb == NULL ) @@ -1685,19 +1603,6 @@ ivas_error ivas_reverb_open_fx( return error; } } -#else - /* === Now, copy parameters from ivas_reverb_params_t into DSP blocks === */ - /* === to be used for subsequent audio signal processing === */ - - pState->do_corr_filter = params.do_corr_filter; - move16(); - - /* clear & init jot reverb fft filters */ - IF( NE_32( ( error = initialize_reverb_filters_fx( pState ) ), IVAS_ERR_OK ) ) - { - return error; - } -#endif Word16 q_pFft_wf_filter_ch0_fx = 23, q_pFft_wf_filter_ch1_fx = 23; move16(); @@ -1766,10 +1671,6 @@ ivas_error ivas_reverb_open_fx( pFft_wf_filter_ch1_fx[i][1] = L_shl( pFft_wf_filter_ch1_fx[i][1], sub( 31, q_pFft_wf_filter_ch1_fx ) ); move32(); } -#ifndef FIX_1053_REVERB_RECONFIGURATION - Scale_sig32( params.pHrtf_inter_aural_coherence_fx, nr_fc_fft_filter, 4 ); /*Scaling ( *hReverb )->fft_filter_color_0.fft_spectrum_fx to Q31*/ - Scale_sig32( params.pFc_fx, nr_fc_fft_filter, 17 ); /*Scaling ( *hReverb )->fft_filter_color_1.fft_spectrum_fx to Q31*/ -#endif /* Copying the computed FFT colorations filters to the fft_filter components */ IF( NE_32( ( error = set_color_fft_filter_fx( pState, 0, pFft_wf_filter_ch0_fx ) ), IVAS_ERR_OK ) ) @@ -1782,7 +1683,6 @@ ivas_error ivas_reverb_open_fx( return error; } -#ifdef FIX_1053_REVERB_RECONFIGURATION if ( *hReverb == NULL ) { /* init predelay */ @@ -1811,16 +1711,6 @@ ivas_error ivas_reverb_open_fx( return error; } } -#else - /* init predelay */ - ivas_rev_delay_line_init( &( pState->predelay_line ), pState->pPredelay_buffer_fx, params.pre_delay, predelay_bf_len ); - - /* set up feedback delay network */ - IF( NE_32( ( error = setup_FDN_branches_fx( pState, ¶ms ) ), IVAS_ERR_OK ) ) - { - return error; - } -#endif *hReverb = pState; return error; @@ -2545,44 +2435,22 @@ ivas_error ivas_binaural_reverb_init( const Word32 sampling_rate, /* i : sampling rate */ const Word32 *defaultTimes, /* i : default reverberation times */ const Word32 *defaultEne /* i : default reverberation energies */ -#ifdef FIX_1139_REV_COLORATION_SHORT_T60 , Word32 *earlyEne /* i/o: Early part energies to be modified */ -#endif ) { ivas_error error; -#ifdef FIX_1139_REV_COLORATION_SHORT_T60 Word16 preDelay, bin; Word32 revTimes[CLDFB_NO_CHANNELS_MAX]; Word32 revEne[CLDFB_NO_CHANNELS_MAX]; -#else - const Word32 *revTimes; - const Word32 *revEne; - Word32 t60[CLDFB_NO_CHANNELS_MAX]; - Word32 ene[CLDFB_NO_CHANNELS_MAX]; - Word16 preDelay; -#endif Word32 temp32; error = IVAS_ERR_OK; -#ifdef FIX_587_DEFAULT_REVERB IF( roomAcoustics != NULL ) -#else - if ( ( roomAcoustics != NULL ) && roomAcoustics->override ) -#endif { -#ifndef FIX_1139_REV_COLORATION_SHORT_T60 - revTimes = t60; - revEne = ene; -#endif -#ifdef FIX_1139_REV_COLORATION_SHORT_T60 IF( ( error = ivas_reverb_prepare_cldfb_params( roomAcoustics, hHrtfStatistics, sampling_rate, revTimes, revEne ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_reverb_prepare_cldfb_params( roomAcoustics, hHrtfStatistics, sampling_rate, t60, ene ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -2592,7 +2460,6 @@ ivas_error ivas_binaural_reverb_init( } ELSE { -#ifdef FIX_1139_REV_COLORATION_SHORT_T60 FOR( bin = 0; bin < CLDFB_NO_CHANNELS_MAX; bin++ ) { revTimes[bin] = defaultTimes[bin]; @@ -2600,14 +2467,9 @@ ivas_error ivas_binaural_reverb_init( revEne[bin] = defaultEne[bin]; move32(); } -#else - revTimes = defaultTimes; - revEne = defaultEne; -#endif preDelay = 10; } -#ifdef FIX_1139_REV_COLORATION_SHORT_T60 FOR( bin = 0; bin < CLDFB_NO_CHANNELS_MAX; bin++ ) { /* Adjust the room effect parameters when the reverberation time is less than a threshold value, to avoid @@ -2658,7 +2520,6 @@ ivas_error ivas_binaural_reverb_init( } } } -#endif error = ivas_binaural_reverb_open_fx( hReverbPr, numBins, numCldfbSlotsPerFrame, sampling_rate, revTimes, revEne, preDelay ); diff --git a/lib_rend/ivas_rom_rend.h b/lib_rend/ivas_rom_rend.h index d05857e6056a8c12833354d1f934b699570aca95..f98fc83dfdffbf316301365134ab51355456c681 100644 --- a/lib_rend/ivas_rom_rend.h +++ b/lib_rend/ivas_rom_rend.h @@ -114,7 +114,6 @@ extern const Word32 ivas_reverb_default_DSR_fx[]; /*Q-30*/ * Renderer SBA & MC enc/dec matrices *----------------------------------------------------------------------------------*/ -#ifdef FIX_1050_EFAP_ALLOC /*----------------------------------------------------------------------------------* * EFAP ROM tables *----------------------------------------------------------------------------------*/ @@ -122,7 +121,6 @@ extern const Word32 ivas_reverb_default_DSR_fx[]; /*Q-30*/ extern const Word8 efap_poly_limit[MAX_OUTPUT_CHANNELS]; -#endif /*----------------------------------------------------------------------------------* * LS Configuration Converter ROM tables *----------------------------------------------------------------------------------*/ diff --git a/lib_rend/ivas_rom_rend_fx.c b/lib_rend/ivas_rom_rend_fx.c index 6cf454a8a5771b943e5f4303e00228dd7cc6d2a0..6b27d9f1732c7929f22727c517ded829c3bf9d92 100644 --- a/lib_rend/ivas_rom_rend_fx.c +++ b/lib_rend/ivas_rom_rend_fx.c @@ -286,7 +286,6 @@ const Word32 ivas_reverb_default_DSR_fx[IVAS_REVERB_DEFAULT_N_BANDS] /*Q30*/ = * Renderer SBA & MC enc/dec matrices *----------------------------------------------------------------------------------*/ -#ifdef FIX_1050_EFAP_ALLOC /*----------------------------------------------------------------------------------* * EFAP ROM tables *----------------------------------------------------------------------------------*/ @@ -294,7 +293,6 @@ const Word32 ivas_reverb_default_DSR_fx[IVAS_REVERB_DEFAULT_N_BANDS] /*Q30*/ = const Word8 efap_poly_limit[MAX_OUTPUT_CHANNELS] = {22, 22, 22, 26, 30, 34, 36, 42, 42, 44, 47, 51, 52, 54, 54, 54}; -#endif /*----------------------------------------------------------------------------------* * LS Renderer ROM tables *----------------------------------------------------------------------------------*/ diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index e55ccdb6a60c49ed5122091629629f08a32077a6..db6cc1d6ea69477dd503a3ce9dc0cf5f426b8881 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -574,9 +574,6 @@ typedef struct ivas_binaural_reverb_struct UWord32 binRend_RandNext; Word16 highestBinauralCoherenceBin; -#ifndef FIX_1053_REVERB_RECONFIGURATION - float dmxmtx[BINAURAL_CHANNELS][MAX_OUTPUT_CHANNELS]; -#endif Word32 dmxmtx_fx[BINAURAL_CHANNELS][MAX_OUTPUT_CHANNELS]; Word32 foa_enc_fx[MAX_OUTPUT_CHANNELS][FOA_CHANNELS]; @@ -593,7 +590,6 @@ typedef struct ivas_diffuse_distribution_data_structure } DIFFUSE_DISTRIBUTION_DATA, *DIFFUSE_DISTRIBUTION_HANDLE; -#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF typedef struct ivas_hrtfs_parambin_struct { Word16 hrtfShCoeffsRe_fx[BINAURAL_CHANNELS][HRTF_SH_CHANNELS][HRTF_NUM_BINS]; /* Q14 */ @@ -606,7 +602,6 @@ typedef struct ivas_hrtfs_parambin_struct Word16 allocatedFromFile; /* Unused variable that should not be here. Remove in cleanup. */ } HRTFS_PARAMBIN, *HRTFS_PARAMBIN_HANDLE; -#endif /* Parametric binaural data structure */ typedef struct ivas_dirac_dec_binaural_data_structure @@ -671,9 +666,7 @@ typedef struct ivas_dirac_dec_binaural_data_structure ivas_td_decorr_state_t *hTdDecorr; Word16 reqularizationFactor_fx; /* Q14 */ -#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF HRTFS_PARAMBIN_HANDLE *phHrtfParambin; -#endif DIFFUSE_DISTRIBUTION_HANDLE hDiffuseDist; @@ -706,12 +699,8 @@ typedef struct EFAP_VERTEX Word32 ele; /* elevation of the loudspeaker */ /* Q22 */ Word32 pos[3]; /* [x y z] cartesian coordinate vector */ /* Q31 */ Word16 idx; /* integer, that corresponds to the first index for the LS in the 1D output */ -#ifdef FIX_1050_EFAP_ALLOC - bool isNaN; /* used to indicate if the vertex is a virtual speaker */ -#else - Word16 isNaN; /* used to indicate if the vertex is a virtual speaker */ -#endif - EFAP_VTX_DMX_TYPE dmxType; /* virtual speaker downmix type */ + bool isNaN; /* used to indicate if the vertex is a virtual speaker */ + EFAP_VTX_DMX_TYPE dmxType; /* virtual speaker downmix type */ } EFAP_VERTEX; @@ -724,12 +713,8 @@ typedef struct EFAP_VERTEX_DATA } EFAP_VERTEX_DATA; typedef struct EFAP_POLYSET { - Word16 chan[EFAP_MAX_CHAN_NUM]; /* An array indicating the loudspeaker index of the polygon vertices */ -#ifdef FIX_1050_EFAP_ALLOC - bool isNaN[EFAP_MAX_CHAN_NUM]; /* Indicates if one of the vertices isNaN */ -#else - Word16 isNaN[EFAP_MAX_CHAN_NUM]; /* Indicates if one of the vertices isNaN */ -#endif + Word16 chan[EFAP_MAX_CHAN_NUM]; /* An array indicating the loudspeaker index of the polygon vertices */ + bool isNaN[EFAP_MAX_CHAN_NUM]; /* Indicates if one of the vertices isNaN */ Word16 numChan; /* An integer between 0 and EFAP_MAX_CHAN_NUM corresponding to the number of vertices of the polygon */ Word32 polyAzi[EFAP_MAX_CHAN_NUM]; /* An array (same length as "chan"), with the azimuth of the channels */ /* Q22 */ Word32 polyEle[EFAP_MAX_CHAN_NUM]; /* An array (same length as "chan"), with the elevation of the channels */ /* Q22 */ @@ -743,18 +728,10 @@ typedef struct EFAP_LS_TRIANGLE typedef struct EFAP_POLYSET_DATA { -#ifdef FIX_1050_EFAP_ALLOC EFAP_POLYSET *polysetArray; /* Array of polygons */ -#else - EFAP_POLYSET polysetArray[EFAP_MAX_POLY_SET]; /* Array of polygons */ -#endif - Word16 numPoly; /* Number of polygons */ -#ifdef FIX_1050_EFAP_ALLOC + Word16 numPoly; /* Number of polygons */ EFAP_LS_TRIANGLE *triArray; /* Array of triangles */ -#else - EFAP_LS_TRIANGLE triArray[EFAP_MAX_POLY_SET]; /* Array of triangles */ -#endif - Word16 numTri; /* Number of triangles */ + Word16 numTri; /* Number of triangles */ } EFAP_POLYSET_DATA; @@ -1451,21 +1428,6 @@ typedef struct ivas_hrtfs_fastconv_struct } HRTFS_FASTCONV, *HRTFS_FASTCONV_HANDLE; -#ifndef NONBE_FIX_991_PARAMBIN_BINARY_HRTF -typedef struct ivas_hrtfs_parambin_struct -{ - Word16 hrtfShCoeffsRe_fx[BINAURAL_CHANNELS][HRTF_SH_CHANNELS][HRTF_NUM_BINS]; /* Q14 */ - Word16 hrtfShCoeffsIm_fx[BINAURAL_CHANNELS][HRTF_SH_CHANNELS][HRTF_NUM_BINS]; /* Q14 */ - - Word32 parametricReverberationTimes_fx[CLDFB_NO_CHANNELS_MAX]; /* Q26 */ - Word32 parametricReverberationEneCorrections_fx[CLDFB_NO_CHANNELS_MAX]; /* Q31 */ - Word32 parametricEarlyPartEneCorrection_fx[CLDFB_NO_CHANNELS_MAX]; /* Q28 */ - - Word16 allocatedFromFile; - -} HRTFS_PARAMBIN, *HRTFS_PARAMBIN_HANDLE; -#endif - typedef struct ivas_hrtfs_statistics_struct { diff --git a/lib_rend/lib_rend.h b/lib_rend/lib_rend.h index fee0fac6b375b85619e04eca5a920e4acf88f34b..05b78f670f967cc2c76797c9c7187cf960105dc8 100644 --- a/lib_rend/lib_rend.h +++ b/lib_rend/lib_rend.h @@ -115,10 +115,8 @@ ivas_error IVAS_REND_Open( const bool asHrtfBinary, /* i : load hrtf binary file */ const Word16 nonDiegeticPan, /* i : non-diegetic object flag */ const Word32 nonDiegeticPanGain, /* i : non-diegetic panning gain Q31*/ -#ifdef FIX_1135_EXT_RENDERER_HANDLES const Word16 Opt_Headrotation, /* i : indicates whether head-rotation is used */ const Word16 Opt_ExternalOrientation, /* i : indicates whether external orientations are used */ -#endif const Word16 num_subframes /* i : number of subframes */ ); diff --git a/lib_rend/lib_rend_fx.c b/lib_rend/lib_rend_fx.c index 228e6cfee6eb1badb2094e061c86b6433199a1dd..c74d77bf9494e6cc72fae05897705cc76d0e4736 100644 --- a/lib_rend/lib_rend_fx.c +++ b/lib_rend/lib_rend_fx.c @@ -246,11 +246,7 @@ static void freeMasaExtRenderer( MASA_EXT_REND_HANDLE *hMasaExtRendOut ); static void intermidiate_ext_dirac_render( MASA_EXT_REND_HANDLE hMasaExtRend, Word16 to_fix ); static ivas_error renderSbaToMultiBinauralCldfb( input_sba *sbaInput, Word32 Cldfb_Out_Real[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], Word32 Cldfb_Out_Imag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], const Word16 low_res_pre_rend_rot, const Word16 num_subframes, const Word16 Q_in ); -#ifdef FIX_1843_IO_QFACTOR_INIT static ivas_error renderSbaToMultiBinaural( input_sba *sbaInput, const AUDIO_CONFIG outConfig, Word32 out[][L_FRAME48k], const Word16 *pq_fact ); -#else -static ivas_error renderSbaToMultiBinaural( input_sba *sbaInput, const AUDIO_CONFIG outConfig, Word32 out[][L_FRAME48k] ); -#endif /*-------------------------------------------------------------------* @@ -1213,12 +1209,8 @@ static void closeHeadRotation( IVAS_REND_HANDLE hIvasRend ) { test(); -#ifdef FIX_1135_EXT_RENDERER_HANDLES test(); IF( hIvasRend != NULL && hIvasRend->headRotData.headRotEnabled && hIvasRend->headRotData.hOrientationTracker != NULL ) -#else - IF( ( hIvasRend != NULL ) && ( hIvasRend->headRotData.hOrientationTracker != NULL ) ) -#endif { free( hIvasRend->headRotData.hOrientationTracker ); } @@ -3297,17 +3289,15 @@ static void clearInputMasa( *------------------------------------------------------------------------*/ ivas_error IVAS_REND_Open( - IVAS_REND_HANDLE *phIvasRend, /* i/o: Pointer to renderer handle */ - const Word32 outputSampleRate, /* i : output sampling rate */ - const IVAS_AUDIO_CONFIG outConfig, /* i : output audio config */ - const bool asHrtfBinary, /* i : load hrtf binary file */ - const Word16 nonDiegeticPan, /* i : non-diegetic object flag */ - const Word32 nonDiegeticPanGain, /* i : non-diegetic panning gain Q31*/ -#ifdef FIX_1135_EXT_RENDERER_HANDLES + IVAS_REND_HANDLE *phIvasRend, /* i/o: Pointer to renderer handle */ + const Word32 outputSampleRate, /* i : output sampling rate */ + const IVAS_AUDIO_CONFIG outConfig, /* i : output audio config */ + const bool asHrtfBinary, /* i : load hrtf binary file */ + const Word16 nonDiegeticPan, /* i : non-diegetic object flag */ + const Word32 nonDiegeticPanGain, /* i : non-diegetic panning gain Q31*/ const Word16 Opt_Headrotation, /* i : indicates whether head-rotation is used */ const Word16 Opt_ExternalOrientation, /* i : indicates whether external orientations are used */ -#endif - const Word16 num_subframes /* i : number of subframes */ + const Word16 num_subframes /* i : number of subframes */ ) { Word16 i; @@ -3359,46 +3349,34 @@ ivas_error IVAS_REND_Open( } /* Initialize headrotation data */ -#ifdef FIX_1135_EXT_RENDERER_HANDLES hIvasRend->headRotData.headRotEnabled = 0; IF( Opt_Headrotation ) { -#endif IF( NE_32( ( error = initHeadRotation_fx( hIvasRend ) ), IVAS_ERR_OK ) ) { return error; } -#ifdef FIX_1135_EXT_RENDERER_HANDLES } -#endif /* Initialize external orientation data */ -#ifdef FIX_1135_EXT_RENDERER_HANDLES hIvasRend->hExternalOrientationData = NULL; IF( Opt_ExternalOrientation ) { -#endif IF( NE_32( ( error = ivas_external_orientation_open( &( hIvasRend->hExternalOrientationData ), num_subframes ) ), IVAS_ERR_OK ) ) { return error; } -#ifdef FIX_1135_EXT_RENDERER_HANDLES } -#endif /* Initilize combined orientation data */ -#ifdef FIX_1135_EXT_RENDERER_HANDLES hIvasRend->hCombinedOrientationData = NULL; IF( Opt_Headrotation || Opt_ExternalOrientation ) { -#endif IF( NE_32( ( error = ivas_combined_orientation_open( &( hIvasRend->hCombinedOrientationData ), outputSampleRate, num_subframes ) ), IVAS_ERR_OK ) ) { return error; } -#ifdef FIX_1135_EXT_RENDERER_HANDLES } -#endif /* Initialize EFAP */ IF( NE_32( ( error = initEfap( &hIvasRend->efapOutWrapper, outConfig, &hIvasRend->customLsOut ) ), IVAS_ERR_OK ) ) @@ -3511,17 +3489,13 @@ ivas_error IVAS_REND_Open( } } -#ifdef FIX_1135_EXT_RENDERER_HANDLES IF( EQ_32( hIvasRend->outputConfig, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) { -#endif IF( NE_32( ( error = ivas_HRTF_statistics_init( &( hIvasRend->hHrtfs.hHrtfStatistics ), hIvasRend->sampleRateOut ) ), IVAS_ERR_OK ) ) { return error; } -#ifdef FIX_1135_EXT_RENDERER_HANDLES } -#endif return IVAS_ERR_OK; } @@ -4530,12 +4504,8 @@ ivas_error IVAS_REND_GetDelay_fx( { IF( NE_32( hIvasRend->inputsSba[i].base.inConfig, IVAS_AUDIO_CONFIG_INVALID ) ) { -#ifdef FIX_1135_EXT_RENDERER_HANDLES test(); IF( hIvasRend->splitRendWrapper != NULL && hIvasRend->splitRendWrapper->hBinHrSplitPreRend != NULL ) -#else - IF( hIvasRend->splitRendWrapper->hBinHrSplitPreRend != NULL ) -#endif { IF( hIvasRend->hRendererConfig->split_rend_config.rendererSelection == ISAR_SPLIT_REND_RENDERER_SELECTION_FASTCONV ) { @@ -4858,16 +4828,10 @@ Word16 IVAS_REND_GetRenderConfig( } hRCin = hIvasRend->hRendererConfig; -#ifndef FIX_587_DEFAULT_REVERB - hRCout->roomAcoustics.override = hRCin->roomAcoustics.override; -#endif hRCout->roomAcoustics.nBands = hRCin->roomAcoustics.nBands; hRCout->roomAcoustics.acousticPreDelay_fx = hRCin->roomAcoustics.acousticPreDelay_fx; hRCout->roomAcoustics.inputPreDelay_fx = hRCin->roomAcoustics.inputPreDelay_fx; Copy( hRCin->directivity_fx, hRCout->directivity_fx, 3 * MAX_NUM_OBJECTS ); -#ifndef FIX_587_DEFAULT_REVERB - move16(); -#endif move16(); move32(); move32(); @@ -4908,16 +4872,12 @@ Word16 IVAS_REND_FeedRenderConfig( ) { RENDER_CONFIG_HANDLE hRenderConfig; -#ifdef FIX_1053_REVERB_RECONFIGURATION UWord16 i; input_ism *pIsmInput; input_masa *pMasaInput; input_mc *pMcInput; input_sba *pSbaInput; ivas_error error; -#else - ivas_error error; -#endif test(); IF( hIvasRend == NULL || hIvasRend->hRendererConfig == NULL ) @@ -4926,10 +4886,6 @@ Word16 IVAS_REND_FeedRenderConfig( } hRenderConfig = hIvasRend->hRendererConfig; -#ifndef FIX_587_DEFAULT_REVERB - hRenderConfig->roomAcoustics.override = renderConfig.roomAcoustics.override; - move16(); -#endif hRenderConfig->roomAcoustics.nBands = renderConfig.roomAcoustics.nBands; move16(); hRenderConfig->roomAcoustics.acousticPreDelay_fx = renderConfig.roomAcoustics.acousticPreDelay_fx; @@ -4955,7 +4911,6 @@ Word16 IVAS_REND_FeedRenderConfig( Copy32( renderConfig.roomAcoustics.AbsCoeff_fx, hRenderConfig->roomAcoustics.AbsCoeff_fx, IVAS_ROOM_ABS_COEFF ); } -#ifdef FIX_1053_REVERB_RECONFIGURATION /* Re-initialize reverb instance if already available */ /* ISM inputs */ for ( i = 0, pIsmInput = hIvasRend->inputsIsm; i < RENDERER_MAX_ISM_INPUTS; ++i, ++pIsmInput ) @@ -4995,11 +4950,7 @@ Word16 IVAS_REND_FeedRenderConfig( if ( pMasaInput->hMasaExtRend->hDiracDecBin[0] != NULL && pMasaInput->hMasaExtRend->hDiracDecBin[0]->hReverb != NULL ) { ivas_binaural_reverb_close_fx( &pMasaInput->hMasaExtRend->hDiracDecBin[0]->hReverb ); -#ifdef FIX_1139_REV_COLORATION_SHORT_T60 IF( NE_32( ( error = ivas_binaural_reverb_init( &pMasaInput->hMasaExtRend->hDiracDecBin[0]->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, pMasaInput->hMasaExtRend->hSpatParamRendCom->num_freq_bands, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, &( hRenderConfig->roomAcoustics ), *pMasaInput->base.ctx.pOutSampleRate, NULL, NULL, NULL ) ), IVAS_ERR_OK ) ) -#else - IF( NE_32( ( error = ivas_binaural_reverb_init( &pMasaInput->hMasaExtRend->hDiracDecBin[0]->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, pMasaInput->hMasaExtRend->hSpatParamRendCom->num_freq_bands, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, &( hRenderConfig->roomAcoustics ), *pMasaInput->base.ctx.pOutSampleRate, NULL, NULL ) ), IVAS_ERR_OK ) ) -#endif { return error; } @@ -5007,11 +4958,7 @@ Word16 IVAS_REND_FeedRenderConfig( if ( pMasaInput->hMasaExtRend->hReverb != NULL ) { ivas_binaural_reverb_close_fx( &pMasaInput->hMasaExtRend->hReverb ); -#ifdef FIX_1139_REV_COLORATION_SHORT_T60 IF( NE_32( ( error = ivas_binaural_reverb_init( &pMasaInput->hMasaExtRend->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, pMasaInput->hMasaExtRend->hSpatParamRendCom->num_freq_bands, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, &( hRenderConfig->roomAcoustics ), *pMasaInput->base.ctx.pOutSampleRate, NULL, NULL, NULL ) ), IVAS_ERR_OK ) ) -#else - IF( NE_32( ( error = ivas_binaural_reverb_init( &pMasaInput->hMasaExtRend->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, pMasaInput->hMasaExtRend->hSpatParamRendCom->num_freq_bands, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, &( hRenderConfig->roomAcoustics ), *pMasaInput->base.ctx.pOutSampleRate, NULL, NULL ) ), IVAS_ERR_OK ) ) -#endif { return error; } @@ -5060,7 +5007,6 @@ Word16 IVAS_REND_FeedRenderConfig( } } } -#endif hRenderConfig->split_rend_config = renderConfig.split_rend_config; /* Overwrite any pose correction settings if 0 DOF (no pose correction) was selected */ @@ -5270,12 +5216,10 @@ ivas_error IVAS_REND_SetOrientationTrackingMode( const IVAS_HEAD_ORIENT_TRK_T orientation_tracking /* i : Head orientation tracking type */ ) { -#ifdef FIX_1135_EXT_RENDERER_HANDLES if ( hIvasRend->headRotData.headRotEnabled == 0 ) { return IVAS_ERR_OK; } -#endif return ivas_orient_trk_SetTrackingType_fx( hIvasRend->headRotData.hOrientationTracker, orientation_tracking ); } @@ -6025,11 +5969,7 @@ static ivas_error renderIsmToBinauralRoom( hCombinedOrientationData = ismInput->base.ctx.pCombinedOrientationData; combinedOrientationEnabled = 0; move16(); -#ifdef FIX_1135_EXT_RENDERER_HANDLES IF( *hCombinedOrientationData != NULL ) -#else - IF( hCombinedOrientationData != NULL ) -#endif { FOR( subframe_idx = 0; subframe_idx < ( *hCombinedOrientationData )->num_subframes; subframe_idx++ ) { @@ -6172,9 +6112,7 @@ static ivas_error renderIsmToBinauralRoom( } } -#ifdef FIX_1843_IO_QFACTOR_INIT *ismInput->crendWrapper->p_io_qfactor = *exp; -#endif /* render 7_1_4 with BRIRs */ IF( NE_32( ( 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 ) ) { @@ -6853,11 +6791,7 @@ static ivas_error renderMcToBinaural( hCombinedOrientationData = mcInput->base.ctx.pCombinedOrientationData; combinedOrientationEnabled = 0; move16(); -#ifdef FIX_1135_EXT_RENDERER_HANDLES IF( *hCombinedOrientationData != NULL ) -#else - IF( hCombinedOrientationData != NULL ) -#endif { FOR( subframe_idx = 0; subframe_idx < ( *hCombinedOrientationData )->num_subframes; subframe_idx++ ) { @@ -6921,9 +6855,7 @@ static ivas_error renderMcToBinaural( CREND_HANDLE hCrend; hCrend = mcInput->crendWrapper->hCrend[0]; -#ifdef FIX_1843_IO_QFACTOR_INIT *mcInput->crendWrapper->p_io_qfactor = exp; -#endif /* call CREND */ IF( NE_32( ( error = ivas_rend_crendProcessSubframe( mcInput->crendWrapper, mcInput->base.inConfig, outConfig, NULL, NULL, NULL, NULL, NULL, p_tmpRendBuffer_fx, p_tmpRendBuffer_fx, mcInput->base.inputBuffer.config.numSamplesPerChannel, *mcInput->base.ctx.pOutSampleRate, 0 ) ), IVAS_ERR_OK ) ) { @@ -6978,11 +6910,7 @@ static ivas_error renderMcToBinauralRoom( hCombinedOrientationData = mcInput->base.ctx.pCombinedOrientationData; combinedOrientationEnabled = 0; move16(); -#ifdef FIX_1135_EXT_RENDERER_HANDLES IF( *hCombinedOrientationData != NULL ) -#else - IF( hCombinedOrientationData != NULL ) -#endif { FOR( subframe_idx = 0; subframe_idx < ( *hCombinedOrientationData )->num_subframes; subframe_idx++ ) { @@ -7049,9 +6977,7 @@ static ivas_error renderMcToBinauralRoom( CREND_HANDLE hCrend; hCrend = mcInput->crendWrapper->hCrend[0]; -#ifdef FIX_1843_IO_QFACTOR_INIT *mcInput->crendWrapper->p_io_qfactor = exp; -#endif /* call CREND */ IF( NE_32( ( 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 ) ) { @@ -7106,11 +7032,7 @@ static ivas_error renderMcCustomLsToBinauralRoom( hCombinedOrientationData = mcInput->base.ctx.pCombinedOrientationData; combinedOrientationEnabled = 0; move16(); -#ifdef FIX_1135_EXT_RENDERER_HANDLES IF( *hCombinedOrientationData != NULL ) -#else - IF( hCombinedOrientationData != NULL ) -#endif { FOR( subframe_idx = 0; subframe_idx < ( *hCombinedOrientationData )->num_subframes; subframe_idx++ ) { @@ -7168,9 +7090,7 @@ static ivas_error renderMcCustomLsToBinauralRoom( CREND_HANDLE hCrend; hCrend = mcInput->crendWrapper->hCrend[0]; -#ifdef FIX_1843_IO_QFACTOR_INIT *mcInput->crendWrapper->p_io_qfactor = exp; -#endif /* call CREND */ IF( NE_32( ( 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 ) ) { @@ -7410,9 +7330,7 @@ static ivas_error renderMcToSplitBinaural( copyBufferTo2dArray_fx( tmpRotBuffer, tmpRendBuffer ); -#ifdef FIX_1843_IO_QFACTOR_INIT *mcInput->crendWrapper->p_io_qfactor = exp; -#endif /* call CREND (rotation already performed) */ IF( NE_32( ( 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, pos_idx ) ), IVAS_ERR_OK ) ) { @@ -7596,12 +7514,8 @@ static void renderSbaToSba( static ivas_error renderSbaToMultiBinaural( input_sba *sbaInput, const AUDIO_CONFIG outConfig, -#ifdef FIX_1843_IO_QFACTOR_INIT Word32 out[][L_FRAME48k], const Word16 *pq_fact ) -#else - Word32 out[][L_FRAME48k] ) -#endif { Word32 tmpCrendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; Word32 *p_tmpCrendBuffer[MAX_OUTPUT_CHANNELS]; @@ -7686,9 +7600,7 @@ static ivas_error renderSbaToMultiBinaural( assert( sbaInput->crendWrapper->hCrend[0]->hReverb == NULL ); -#ifdef FIX_1843_IO_QFACTOR_INIT *sbaInput->crendWrapper->p_io_qfactor = *pq_fact; -#endif /* call CREND */ IF( NE_32( ( 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, pos_idx ) ), IVAS_ERR_OK ) ) { @@ -7761,11 +7673,7 @@ static ivas_error renderSbaToSplitBinaural( } else { -#ifdef FIX_1843_IO_QFACTOR_INIT IF( ( error = renderSbaToMultiBinaural( sbaInput, outConfig, tmpCrendBuffer, outAudio.pq_fact ) ) != IVAS_ERR_OK ) -#else - IF( ( error = renderSbaToMultiBinaural( sbaInput, outConfig, tmpCrendBuffer ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -7824,11 +7732,7 @@ static ivas_error renderSbaToBinaural( hCombinedOrientationData = sbaInput->base.ctx.pCombinedOrientationData; combinedOrientationEnabled = 0; move16(); -#ifdef FIX_1135_EXT_RENDERER_HANDLES IF( *hCombinedOrientationData != NULL ) -#else - IF( hCombinedOrientationData != NULL ) -#endif { FOR( subframe_idx = 0; subframe_idx < ( *hCombinedOrientationData )->num_subframes; subframe_idx++ ) { @@ -7868,9 +7772,7 @@ static ivas_error renderSbaToBinaural( CREND_HANDLE hCrend; hCrend = sbaInput->crendWrapper->hCrend[0]; -#ifdef FIX_1843_IO_QFACTOR_INIT *sbaInput->crendWrapper->p_io_qfactor = *outAudio.pq_fact; -#endif /* call CREND */ IF( NE_32( ( error = ivas_rend_crendProcessSubframe( sbaInput->crendWrapper, sbaInput->base.inConfig, outConfig, NULL, NULL, NULL, NULL, NULL, output_fx, output_fx, sbaInput->base.inputBuffer.config.numSamplesPerChannel, *sbaInput->base.ctx.pOutSampleRate, 0 ) ), IVAS_ERR_OK ) ) { @@ -7927,11 +7829,7 @@ static ivas_error renderSbaToBinauralRoom( hCombinedOrientationData = sbaInput->base.ctx.pCombinedOrientationData; combinedOrientationEnabled = 0; move16(); -#ifdef FIX_1135_EXT_RENDERER_HANDLES IF( *hCombinedOrientationData != NULL ) -#else - IF( hCombinedOrientationData != NULL ) -#endif { FOR( subframe_idx = 0; subframe_idx < ( *hCombinedOrientationData )->num_subframes; subframe_idx++ ) { @@ -7987,9 +7885,7 @@ static ivas_error renderSbaToBinauralRoom( } copyBufferTo2dArray_fx( tmpMcBuffer, tmpCrendBuffer ); -#ifdef FIX_1843_IO_QFACTOR_INIT *sbaInput->crendWrapper->p_io_qfactor = *outAudio.pq_fact; -#endif /* call CREND */ IF( NE_32( ( 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 ) ) { @@ -9914,11 +9810,7 @@ static ivas_error ivas_masa_ext_rend_parambin_init( ) { DIRAC_DEC_BIN_HANDLE hDiracDecBin; -#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF HRTFS_PARAMBIN_HANDLE *phHrtfParambin; -#else - HRTFS_PARAMBIN_HANDLE hHrtfParambin; -#endif Word16 nBins; Word32 output_Fs; RENDERER_TYPE renderer_type; @@ -9927,9 +9819,7 @@ static ivas_error ivas_masa_ext_rend_parambin_init( Word16 tmpFloat_fx; ivas_error error; Word16 frequency_axis_fx[CLDFB_NO_CHANNELS_MAX]; -#ifdef FIX_587_DEFAULT_REVERB const IVAS_ROOM_ACOUSTICS_CONFIG_DATA *pRoomAcoustics; -#endif Word16 pos_idx, num_poses; Word16 tmp; @@ -9939,11 +9829,7 @@ static ivas_error ivas_masa_ext_rend_parambin_init( error = IVAS_ERR_OK; move32(); -#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF phHrtfParambin = inputMasa->hMasaExtRend->hHrtfParambin; -#else - hHrtfParambin = *( inputMasa->hMasaExtRend->hHrtfParambin ); -#endif /* Set common variables and defaults */ output_Fs = *( inputMasa->base.ctx.pOutSampleRate ); move32(); @@ -10052,46 +9938,22 @@ static ivas_error ivas_masa_ext_rend_parambin_init( } ELSE IF( EQ_16( renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) /* Indication of binaural rendering with room effect */ { -#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF -#ifdef NONBE_FIX_981_PARAMBIN_DEFAULT_EARLY_PART IF( EQ_32( *inputMasa->base.ctx.pOutConfig, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) ) { Copy32( ( *phHrtfParambin )->parametricEarlyPartEneCorrection_fx, hDiracDecBin->earlyPartEneCorrection_fx, nBins ); -#ifdef FIX_587_DEFAULT_REVERB pRoomAcoustics = NULL; -#endif } ELSE { set32_fx( hDiracDecBin->earlyPartEneCorrection_fx, ONE_IN_Q28, CLDFB_NO_CHANNELS_MAX ); -#ifdef FIX_587_DEFAULT_REVERB pRoomAcoustics = &( hRendCfg->roomAcoustics ); -#endif } -#else - Copy32( ( *phHrtfParambin )->parametricEarlyPartEneCorrection_fx, hDiracDecBin->earlyPartEneCorrection_fx, nBins ); -#endif -#else - Copy32( hHrtfParambin->parametricEarlyPartEneCorrection_fx, hDiracDecBin->earlyPartEneCorrection_fx, nBins ); -#endif hDiracDecBin->q_earlyPartEneCorrection = Q28; move16(); IF( hDiracDecBin->hReverb == NULL && pos_idx == 0 ) /* open reverb only for the main direction */ { -#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF -#ifdef FIX_587_DEFAULT_REVERB -#ifdef FIX_1139_REV_COLORATION_SHORT_T60 IF( NE_32( ( error = ivas_binaural_reverb_init( &hDiracDecBin->hReverb, hHrtfStatistics, nBins, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, pRoomAcoustics, output_Fs, ( *phHrtfParambin )->parametricReverberationTimes_fx, ( *phHrtfParambin )->parametricReverberationEneCorrections_fx, hDiracDecBin->earlyPartEneCorrection_fx ) ), IVAS_ERR_OK ) ) -#else - if ( NE_32( ( error = ivas_binaural_reverb_init( &hDiracDecBin->hReverb, hHrtfStatistics, nBins, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, pRoomAcoustics, output_Fs, ( *phHrtfParambin )->parametricReverberationTimes_fx, ( *phHrtfParambin )->parametricReverberationEneCorrections_fx ) ), IVAS_ERR_OK ) ) -#endif -#else - if ( NE_32( ( error = ivas_binaural_reverb_init( &hDiracDecBin->hReverb, hHrtfStatistics, nBins, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, &( hRendCfg->roomAcoustics ), output_Fs, ( *phHrtfParambin )->parametricReverberationTimes_fx, ( *phHrtfParambin )->parametricReverberationEneCorrections_fx ) ), IVAS_ERR_OK ) ) -#endif -#else - IF( NE_32( ( error = ivas_binaural_reverb_init( &hDiracDecBin->hReverb, hHrtfStatistics, nBins, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, &( hRendCfg->roomAcoustics ), output_Fs, hHrtfParambin->parametricReverberationTimes_fx, hHrtfParambin->parametricReverberationEneCorrections_fx ) ), IVAS_ERR_OK ) ) -#endif { return error; } @@ -10135,9 +9997,7 @@ static ivas_error ivas_masa_ext_rend_parambin_init( hDiracDecBin->reqularizationFactor_fx = 6554; /* 0.4f in Q14 */ move16(); -#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF hDiracDecBin->phHrtfParambin = phHrtfParambin; -#endif inputMasa->hMasaExtRend->hDiracDecBin[pos_idx] = hDiracDecBin; } diff --git a/lib_util/hrtf_file_reader.c b/lib_util/hrtf_file_reader.c index 6c755957e4f8820d78e3b5fd1c6fb8648eddf6b2..445cd09ae8678564fed118a81c5ab4711f710320 100644 --- a/lib_util/hrtf_file_reader.c +++ b/lib_util/hrtf_file_reader.c @@ -191,7 +191,6 @@ static ivas_error check_hrtf_binary_header( { /* Check the renderer type */ -#ifdef USE_NEW_HRTF_BINARY_FILE_FORMAT if ( ( hrtf_header->rend_type != HRTF_READER_RENDERER_BINAURAL_MIXER_CONV ) && ( hrtf_header->rend_type != HRTF_READER_RENDERER_BINAURAL_MIXER_CONV_ROOM ) && ( hrtf_header->rend_type != HRTF_READER_RENDERER_BINAURAL_FASTCONV ) && ( hrtf_header->rend_type != HRTF_READER_RENDERER_BINAURAL_FASTCONV_ROOM ) && ( hrtf_header->rend_type != HRTF_READER_RENDERER_BINAURAL_PARAMETRIC ) && ( hrtf_header->rend_type != HRTF_READER_RENDERER_BINAURAL_PARAMETRIC_ROOM ) && @@ -199,15 +198,6 @@ static ivas_error check_hrtf_binary_header( { return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Header of HRTF binary file not compliant (renderer type)" ); } -#else - if ( ( hrtf_header->rend_type != RENDERER_BINAURAL_MIXER_CONV ) && ( hrtf_header->rend_type != RENDERER_BINAURAL_MIXER_CONV_ROOM ) && - ( hrtf_header->rend_type != RENDERER_BINAURAL_FASTCONV ) && ( hrtf_header->rend_type != RENDERER_BINAURAL_FASTCONV_ROOM ) && - ( hrtf_header->rend_type != RENDERER_BINAURAL_PARAMETRIC ) && ( hrtf_header->rend_type != RENDERER_BINAURAL_PARAMETRIC_ROOM ) && - ( hrtf_header->rend_type != RENDERER_BINAURAL_OBJECTS_TD ) ) - { - return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Header of HRTF binary file not compliant (renderer type)" ); - } -#endif /* Check the output format of the decoder */ if ( ( hrtf_header->input_cfg != BINAURAL_INPUT_AUDIO_CONFIG_COMBINED ) && ( hrtf_header->input_cfg != BINAURAL_INPUT_AUDIO_CONFIG_HOA3 ) && ( hrtf_header->input_cfg != BINAURAL_INPUT_AUDIO_CONFIG_HOA2 ) && ( hrtf_header->input_cfg != BINAURAL_INPUT_AUDIO_CONFIG_FOA ) && ( hrtf_header->input_cfg != BINAURAL_INPUT_AUDIO_CONFIG_UNDEFINED ) ) @@ -361,9 +351,6 @@ static ivas_error LoadBSplineBinary( float f_tmp_latency_s; -#ifndef USE_NEW_HRTF_BINARY_FILE_FORMAT - float f_tmp_lr_energy_and_iac_dyn[LR_IAC_LENGTH_NR_FC]; -#endif fread( &f_tmp_latency_s, sizeof( float ), 1, f_hrtf ); HrFiltSet_p->latency_s_fx = float_to_fix( f_tmp_latency_s, Q31 ); @@ -549,27 +536,6 @@ static ivas_error LoadBSplineBinary( LoadBSplineBinaryITD( &HrFiltSet_p->ModelParamsITD, f_hrtf ); } -#ifndef USE_NEW_HRTF_BINARY_FILE_FORMAT - /* left/right energy and interaural coherence for late reverb */ - FOR( i = 0; i < 3; i++ ) - { - fread( f_tmp_lr_energy_and_iac_dyn, sizeof( const float ), LR_IAC_LENGTH_NR_FC, f_hrtf ); - HrFiltSet_p->lr_energy_and_iac_dyn_fx[i] = (Word32 *) malloc( LR_IAC_LENGTH_NR_FC * sizeof( Word32 ) ); - if ( HrFiltSet_p->lr_energy_and_iac_dyn_fx[i] == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for hrtf data" ); - } - IF( i == 2 ) - { - floatToFixed_arr32( f_tmp_lr_energy_and_iac_dyn, HrFiltSet_p->lr_energy_and_iac_dyn_fx[i], Q27, LR_IAC_LENGTH_NR_FC ); /* tables from which lr_energy_and_iac is updated has Q27 for i=2 */ - } - ELSE - { - floatToFixed_arr32( f_tmp_lr_energy_and_iac_dyn, HrFiltSet_p->lr_energy_and_iac_dyn_fx[i], Q23, LR_IAC_LENGTH_NR_FC ); /* tables from which lr_energy_and_iac is updated has Q23 for i=0,1 */ - } - HrFiltSet_p->lr_energy_and_iac_fx[i] = (const Word32 *) HrFiltSet_p->lr_energy_and_iac_dyn_fx[i]; - } -#endif return IVAS_ERR_OK; } @@ -645,11 +611,7 @@ static ivas_error load_reverb_from_binary( return header_check_result; } -#ifdef USE_NEW_HRTF_BINARY_FILE_FORMAT - is_reverb = ( hrtf_header.rend_type == HRTF_READER_RENDERER_BINAURAL_REVERB_ALL ); -#else is_reverb = ( hrtf_header.rend_type == HRTF_READER_RENDERER_BINAURAL_REVERB_ALL ); -#endif if ( !is_reverb ) { if ( fread( hrtf_data, 1, hrtf_header.data_size, f_hrtf ) != hrtf_header.data_size ) @@ -784,11 +746,7 @@ static ivas_error TDREND_MIX_LoadHRTF( return header_check_result; } -#ifdef USE_NEW_HRTF_BINARY_FILE_FORMAT is_tdrend = ( hrtf_header.rend_type == HRTF_READER_RENDERER_BINAURAL_OBJECTS_TD ); -#else - is_tdrend = ( hrtf_header.rend_type == RENDERER_BINAURAL_OBJECTS_TD ); -#endif if ( !is_tdrend ) { if ( fread( hrtf_data, 1, hrtf_header.data_size, f_hrtf ) != hrtf_header.data_size ) @@ -1095,7 +1053,6 @@ static ivas_error create_HRTF_from_rawdata( hrtf_data_rptr += sizeof( UWord16 ); /* inv_diffuse_weight */ -#ifdef USE_NEW_HRTF_BINARY_FILE_FORMAT for ( i = 0; i < ( *hHRTF )->max_num_ir; i++ ) { ( *hHRTF )->inv_diffuse_weight_fx[0][i] = (Word16) ( *( (float *) ( hrtf_data_rptr ) ) * ONE_IN_Q15 ); @@ -1106,15 +1063,6 @@ static ivas_error create_HRTF_from_rawdata( ( *hHRTF )->inv_diffuse_weight_fx[1][i] = (Word16) ( *( (float *) ( hrtf_data_rptr ) ) * ONE_IN_Q15 ); hrtf_data_rptr += sizeof( float ); } -#else - /* inv_diffuse_weight */ - for ( i = 0; i < ( *hHRTF )->max_num_ir; i++ ) - { - ( *hHRTF )->inv_diffuse_weight_fx[0][i] = (Word16) ( *( (float *) ( hrtf_data_rptr ) ) * ONE_IN_Q15 ); - ( *hHRTF )->inv_diffuse_weight_fx[1][i] = ( *hHRTF )->inv_diffuse_weight[0][i]; - hrtf_data_rptr += sizeof( float ); - } -#endif /* max_total_num_fsamp_per_iteration */ max_total_num_fsamp_per_iteration = *( (UWord16 *) ( hrtf_data_rptr ) ); @@ -1257,13 +1205,9 @@ static ivas_error create_HRTF_from_rawdata( static ivas_error create_fastconv_HRTF_from_rawdata( - HRTFS_FASTCONV_HANDLE *hHRTF, /* i/o: HRTF FastConv handle */ - char *hrtf_data, /* i : pointer to binary file */ -#ifdef USE_NEW_HRTF_BINARY_FILE_FORMAT - HRTF_READER_RENDERER_TYPE rend_type, /* i : Renderer type */ -#else - RENDERER_TYPE rend_type, /* i : Renderer type */ -#endif + HRTFS_FASTCONV_HANDLE *hHRTF, /* i/o: HRTF FastConv handle */ + char *hrtf_data, /* i : pointer to binary file */ + HRTF_READER_RENDERER_TYPE rend_type, /* i : Renderer type */ BINAURAL_INPUT_AUDIO_CONFIG input_cfg /* i : Input binaural config */ ) { @@ -1273,13 +1217,10 @@ static ivas_error create_fastconv_HRTF_from_rawdata( float f_tmp_ntaps_max[BINAURAL_NTAPS_MAX]; float f_tmp_brir_reverb[CLDFB_NO_CHANNELS_MAX]; char *hrtf_data_rptr; -#ifdef USE_NEW_HRTF_BINARY_FILE_FORMAT ivas_error error; -#endif ( *hHRTF )->allocate_init_flag = 0; -#ifdef USE_NEW_HRTF_BINARY_FILE_FORMAT if ( rend_type == HRTF_READER_RENDERER_BINAURAL_FASTCONV ) { if ( ( error = ivas_allocate_binaural_hrtf_fx( *hHRTF, 0, input_cfg, RENDERER_BINAURAL_FASTCONV, ( *hHRTF )->allocate_init_flag ) ) != IVAS_ERR_OK ) @@ -1298,38 +1239,21 @@ static ivas_error create_fastconv_HRTF_from_rawdata( { return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "renderer type not compliant" ); } -#else - ivas_allocate_binaural_hrtf_fx( *hHRTF, 0, input_cfg, rend_type, ( *hHRTF )->allocate_init_flag ); -#endif hrtf_data_rptr = hrtf_data; -#if !defined USE_NEW_HRTF_BINARY_FILE_FORMAT - /* BINAURAL_CONVBANDS */ - if ( BINAURAL_CONVBANDS != *( (uint16_t *) ( hrtf_data_rptr ) ) ) - { - return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (BINAURAL_CONVBANDS)" ); - } - hrtf_data_rptr += sizeof( uint16_t ); -#endif -/* HRIR */ -#ifdef USE_NEW_HRTF_BINARY_FILE_FORMAT + /* HRIR */ if ( rend_type == HRTF_READER_RENDERER_BINAURAL_FASTCONV && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_COMBINED ) -#else - if ( rend_type == RENDERER_BINAURAL_FASTCONV && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_COMBINED ) -#endif { f_tmp = *( (float *) ( hrtf_data_rptr ) ); hrtf_data_rptr += sizeof( float ); ( *hHRTF )->FASTCONV_HRIR_latency_s_fx = (Word32) ( f_tmp * 1000000000 ); -#if defined USE_NEW_HRTF_BINARY_FILE_FORMAT if ( BINAURAL_CONVBANDS != *( (uint16_t *) ( hrtf_data_rptr ) ) ) { return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (BINAURAL_CONVBANDS)" ); } hrtf_data_rptr += sizeof( uint16_t ); -#endif if ( HRTF_LS_CHANNELS != *( (uint16_t *) ( hrtf_data_rptr ) ) ) { @@ -1380,24 +1304,18 @@ static ivas_error create_fastconv_HRTF_from_rawdata( } } } -#ifdef USE_NEW_HRTF_BINARY_FILE_FORMAT else if ( rend_type == HRTF_READER_RENDERER_BINAURAL_FASTCONV && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_HOA3 ) -#else - else if ( rend_type == RENDERER_BINAURAL_FASTCONV && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_HOA3 ) -#endif { /* HRIR_HOA3 */ f_tmp = *( (float *) ( hrtf_data_rptr ) ); ( *hHRTF )->FASTCONV_HOA3_latency_s_fx = (Word32) ( f_tmp * 1000000000 ); hrtf_data_rptr += sizeof( float ); -#if defined USE_NEW_HRTF_BINARY_FILE_FORMAT if ( BINAURAL_CONVBANDS != *( (uint16_t *) ( hrtf_data_rptr ) ) ) { return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (BINAURAL_CONVBANDS)" ); } hrtf_data_rptr += sizeof( uint16_t ); -#endif if ( HOA3_CHANNELS != *( (uint16_t *) ( hrtf_data_rptr ) ) ) { @@ -1447,24 +1365,18 @@ static ivas_error create_fastconv_HRTF_from_rawdata( } } } -#ifdef USE_NEW_HRTF_BINARY_FILE_FORMAT else if ( rend_type == HRTF_READER_RENDERER_BINAURAL_FASTCONV && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_HOA2 ) -#else - else if ( rend_type == RENDERER_BINAURAL_FASTCONV && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_HOA2 ) -#endif { /* HRIR_HOA2 */ f_tmp = *( (float *) ( hrtf_data_rptr ) ); ( *hHRTF )->FASTCONV_HOA2_latency_s_fx = (Word32) ( f_tmp * 1000000000 ); hrtf_data_rptr += sizeof( float ); -#if defined USE_NEW_HRTF_BINARY_FILE_FORMAT if ( BINAURAL_CONVBANDS != *( (uint16_t *) ( hrtf_data_rptr ) ) ) { return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (BINAURAL_CONVBANDS)" ); } hrtf_data_rptr += sizeof( uint16_t ); -#endif if ( HOA2_CHANNELS != *( (uint16_t *) ( hrtf_data_rptr ) ) ) { @@ -1515,24 +1427,18 @@ static ivas_error create_fastconv_HRTF_from_rawdata( } } } -#ifdef USE_NEW_HRTF_BINARY_FILE_FORMAT else if ( rend_type == HRTF_READER_RENDERER_BINAURAL_FASTCONV && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_FOA ) -#else - else if ( rend_type == RENDERER_BINAURAL_FASTCONV && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_FOA ) -#endif { /* HRIR_FOA */ f_tmp = *( (float *) ( hrtf_data_rptr ) ); ( *hHRTF )->FASTCONV_FOA_latency_s_fx = (Word32) ( f_tmp * 1000000000 ); hrtf_data_rptr += sizeof( float ); -#if defined USE_NEW_HRTF_BINARY_FILE_FORMAT if ( BINAURAL_CONVBANDS != *( (uint16_t *) ( hrtf_data_rptr ) ) ) { return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (BINAURAL_CONVBANDS)" ); } hrtf_data_rptr += sizeof( uint16_t ); -#endif if ( FOA_CHANNELS != *( (uint16_t *) ( hrtf_data_rptr ) ) ) { @@ -1583,24 +1489,18 @@ static ivas_error create_fastconv_HRTF_from_rawdata( } } } -/* BRIR */ -#ifdef USE_NEW_HRTF_BINARY_FILE_FORMAT + /* BRIR */ else if ( rend_type == HRTF_READER_RENDERER_BINAURAL_FASTCONV_ROOM && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_COMBINED ) -#else - else if ( rend_type == RENDERER_BINAURAL_FASTCONV_ROOM && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_COMBINED ) -#endif { f_tmp = *( (float *) ( hrtf_data_rptr ) ); ( *hHRTF )->FASTCONV_BRIR_latency_s_fx = (Word32) ( f_tmp * 1000000000 ); hrtf_data_rptr += sizeof( float ); -#if defined USE_NEW_HRTF_BINARY_FILE_FORMAT if ( BINAURAL_CONVBANDS != *( (uint16_t *) ( hrtf_data_rptr ) ) ) { return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (BINAURAL_CONVBANDS)" ); } hrtf_data_rptr += sizeof( uint16_t ); -#endif if ( HRTF_LS_CHANNELS != *( (uint16_t *) ( hrtf_data_rptr ) ) ) { @@ -1720,11 +1620,7 @@ ivas_error load_fastconv_HRTF_from_binary( free( hrtf_data ); return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "HRTF binary file not compliant (number of HRTF)" ); } -#ifdef USE_NEW_HRTF_BINARY_FILE_FORMAT if ( ( hrtf_header.rend_type == HRTF_READER_RENDERER_BINAURAL_FASTCONV ) || ( hrtf_header.rend_type == HRTF_READER_RENDERER_BINAURAL_FASTCONV_ROOM ) ) -#else - if ( ( hrtf_header.rend_type == RENDERER_BINAURAL_FASTCONV ) || ( hrtf_header.rend_type == RENDERER_BINAURAL_FASTCONV_ROOM ) ) -#endif { if ( fread( hrtf_data, 1, hrtf_header.data_size, f_hrtf ) != hrtf_header.data_size ) { @@ -1894,11 +1790,7 @@ ivas_error load_parambin_HRTF_from_binary( } -#ifdef USE_NEW_HRTF_BINARY_FILE_FORMAT if ( hrtf_header.rend_type == HRTF_READER_RENDERER_BINAURAL_PARAMETRIC_ROOM ) /* Parametric binauralizer data is represented as single entity */ -#else - if ( hrtf_header.rend_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) /* Parametric binauralizer data is represented as single entity */ -#endif { if ( fread( hrtf_data, 1, hrtf_header.data_size, f_hrtf ) != hrtf_header.data_size ) { @@ -1988,11 +1880,7 @@ ivas_error create_SetOfHRTF_from_binary( hHRTF = NULL; if ( hrtf_header.frequency == output_Fs ) { -#ifdef USE_NEW_HRTF_BINARY_FILE_FORMAT if ( hrtf_header.rend_type == HRTF_READER_RENDERER_BINAURAL_MIXER_CONV ) -#else - if ( hrtf_header.rend_type == RENDERER_BINAURAL_MIXER_CONV ) -#endif { if ( hrtf_header.input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_COMBINED ) { @@ -2011,11 +1899,7 @@ ivas_error create_SetOfHRTF_from_binary( hHRTF = &( ( *hSetOfHRTF ).hHRTF_hrir_foa ); } } -#ifdef USE_NEW_HRTF_BINARY_FILE_FORMAT else if ( hrtf_header.rend_type == HRTF_READER_RENDERER_BINAURAL_MIXER_CONV_ROOM ) -#else - else if ( hrtf_header.rend_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) -#endif { if ( hrtf_header.input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_COMBINED ) { diff --git a/lib_util/masa_file_reader.c b/lib_util/masa_file_reader.c index 2bbc1bec6999a4f9d40afcd9c0963d8d7eae68f7..fad9e5c717b20ab789fca9159d4388326583467d 100644 --- a/lib_util/masa_file_reader.c +++ b/lib_util/masa_file_reader.c @@ -35,9 +35,7 @@ #include #include #include "ivas_prot_fx.h" -#ifdef FIX_1121_MASA_DESCRIPTOR #include "ivas_rom_com.h" /* load 'ivasmasaFormatDescriptor[8]' */ -#endif struct MasaFileReader @@ -114,9 +112,6 @@ ivas_error MasaFileReader_readNextFrame( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } -#ifndef FIX_1121_MASA_DESCRIPTOR - const uint8_t ivasmasaFormatDescriptor[8] = { 0x49, 0x56, 0x41, 0x53, 0x4D, 0x41, 0x53, 0x41 }; /* "IVASMASA" */ -#endif uint16_t twoByteBuffer = 0; int16_t i, j, b; IVAS_MASA_METADATA_HANDLE hMeta; diff --git a/lib_util/masa_file_writer.c b/lib_util/masa_file_writer.c index ab25963201ee24abbda50e57636bbd356d74fc93..63c073ba1f2bf4e2108504f6b371fce2d6b363c5 100644 --- a/lib_util/masa_file_writer.c +++ b/lib_util/masa_file_writer.c @@ -41,20 +41,12 @@ typedef struct masaMetaDelayStorage { MASA_DECRIPTIVE_META descriptiveMeta; -#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT uint16_t directionIndex[MASA_MAXIMUM_DIRECTIONS][DELAY_MASA_PARAM_DEC_SFR + 1][MASA_FREQUENCY_BANDS]; uint8_t directToTotalRatio[MASA_MAXIMUM_DIRECTIONS][DELAY_MASA_PARAM_DEC_SFR + 1][MASA_FREQUENCY_BANDS]; uint8_t spreadCoherence[MASA_MAXIMUM_DIRECTIONS][DELAY_MASA_PARAM_DEC_SFR + 1][MASA_FREQUENCY_BANDS]; uint8_t surroundCoherence[DELAY_MASA_PARAM_DEC_SFR + 1][MASA_FREQUENCY_BANDS]; uint8_t diffuseToTotalRatio[DELAY_MASA_PARAM_DEC_SFR + 1][MASA_FREQUENCY_BANDS]; uint8_t prevDelay; -#else - uint16_t directionIndex[MASA_MAXIMUM_DIRECTIONS][DELAY_MASA_PARAM_DEC_SFR][MASA_FREQUENCY_BANDS]; - uint8_t directToTotalRatio[MASA_MAXIMUM_DIRECTIONS][DELAY_MASA_PARAM_DEC_SFR][MASA_FREQUENCY_BANDS]; - uint8_t spreadCoherence[MASA_MAXIMUM_DIRECTIONS][DELAY_MASA_PARAM_DEC_SFR][MASA_FREQUENCY_BANDS]; - uint8_t surroundCoherence[DELAY_MASA_PARAM_DEC_SFR][MASA_FREQUENCY_BANDS]; - uint8_t diffuseToTotalRatio[DELAY_MASA_PARAM_DEC_SFR][MASA_FREQUENCY_BANDS]; -#endif } MASA_META_DELAY_STORAGE; @@ -97,22 +89,14 @@ static void getExtMasaMetadataFileName( static void delayMasaMetadata( MASA_DECODER_EXT_OUT_META_HANDLE extOutMeta, /* i/o: New input metadata which is inplace replaced with delayed metadata frame */ -#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT - MASA_META_DELAY_STORAGE *delayStorage, /* i/o: Storage for 15 ms of metadata and related descriptive metadata */ - uint8_t delayNsf -#else - MASA_META_DELAY_STORAGE *delayStorage /* i/o: Storage for 10 ms of metadata and related descriptive metadata */ -#endif -) + MASA_META_DELAY_STORAGE *delayStorage, /* i/o: Storage for 15 ms of metadata and related descriptive metadata */ + uint8_t delayNsf ) { int16_t dir, sf, band; uint8_t currentNumberOfDirections; -#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT int16_t storeReadOffset; -#endif /* Move meta to delay and output. Always use two directions as the metadata is prepared to contain zero energy second direction * if there is 1dir meta. */ -#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT /* stable state expected results delay change expected results delayNsf = 2 delayNsf = 3 delayNsf = 3 (from 2) delayNsf = 2 (from 3) ext[0] = delayStorage[0] (prev ext[2]) ext[0] = delayStorage[0] (prev ext[1]) ext[0] = delayStorage[0] (prev ext[2]) ext[0] = delayStorage[1] (prev ext[2]) @@ -183,43 +167,6 @@ static void delayMasaMetadata( } } -#else - for ( sf = 0; sf < MAX_PARAM_SPATIAL_SUBFRAMES - DELAY_MASA_PARAM_DEC_SFR; sf++ ) - { - for ( band = 0; band < MASA_FREQUENCY_BANDS; band++ ) - { - uint16_t temp_u16; - uint8_t temp_u8; - for ( dir = 0; dir < MASA_MAXIMUM_DIRECTIONS; dir++ ) - { - temp_u16 = delayStorage->directionIndex[dir][sf][band]; - delayStorage->directionIndex[dir][sf][band] = extOutMeta->directionIndex[dir][sf + DELAY_MASA_PARAM_DEC_SFR][band]; - extOutMeta->directionIndex[dir][sf + DELAY_MASA_PARAM_DEC_SFR][band] = extOutMeta->directionIndex[dir][sf][band]; - extOutMeta->directionIndex[dir][sf][band] = temp_u16; - - temp_u8 = delayStorage->directToTotalRatio[dir][sf][band]; - delayStorage->directToTotalRatio[dir][sf][band] = extOutMeta->directToTotalRatio[dir][sf + DELAY_MASA_PARAM_DEC_SFR][band]; - extOutMeta->directToTotalRatio[dir][sf + DELAY_MASA_PARAM_DEC_SFR][band] = extOutMeta->directToTotalRatio[dir][sf][band]; - extOutMeta->directToTotalRatio[dir][sf][band] = temp_u8; - - temp_u8 = delayStorage->spreadCoherence[dir][sf][band]; - delayStorage->spreadCoherence[dir][sf][band] = extOutMeta->spreadCoherence[dir][sf + DELAY_MASA_PARAM_DEC_SFR][band]; - extOutMeta->spreadCoherence[dir][sf + DELAY_MASA_PARAM_DEC_SFR][band] = extOutMeta->spreadCoherence[dir][sf][band]; - extOutMeta->spreadCoherence[dir][sf][band] = temp_u8; - } - - temp_u8 = delayStorage->surroundCoherence[sf][band]; - delayStorage->surroundCoherence[sf][band] = extOutMeta->surroundCoherence[sf + DELAY_MASA_PARAM_DEC_SFR][band]; - extOutMeta->surroundCoherence[sf + DELAY_MASA_PARAM_DEC_SFR][band] = extOutMeta->surroundCoherence[sf][band]; - extOutMeta->surroundCoherence[sf][band] = temp_u8; - - temp_u8 = delayStorage->diffuseToTotalRatio[sf][band]; - delayStorage->diffuseToTotalRatio[sf][band] = extOutMeta->diffuseToTotalRatio[sf + DELAY_MASA_PARAM_DEC_SFR][band]; - extOutMeta->diffuseToTotalRatio[sf + DELAY_MASA_PARAM_DEC_SFR][band] = extOutMeta->diffuseToTotalRatio[sf][band]; - extOutMeta->diffuseToTotalRatio[sf][band] = temp_u8; - } - } -#endif /* Finalize descriptive meta by using new frame except for number of directions which is the larger of the two */ currentNumberOfDirections = extOutMeta->descriptiveMeta.numberOfDirections; @@ -229,9 +176,7 @@ static void delayMasaMetadata( } delayStorage->descriptiveMeta.numberOfDirections = currentNumberOfDirections; -#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT delayStorage->prevDelay = delayNsf; -#endif return; } @@ -274,9 +219,7 @@ ivas_error MasaFileWriter_open( if ( !delayCompensationEnabled ) { self->delayStorage = calloc( sizeof( MASA_META_DELAY_STORAGE ), 1 ); -#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT self->delayStorage->prevDelay = DELAY_MASA_PARAM_DEC_SFR; -#endif } *masaWriter = self; @@ -292,13 +235,9 @@ ivas_error MasaFileWriter_open( *---------------------------------------------------------------------*/ ivas_error MasaFileWriter_writeFrame( - MasaFileWriter *self, /* i/o: MasaFileWriter handle */ -#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT + MasaFileWriter *self, /* i/o: MasaFileWriter handle */ MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta, /* i/o: MASA ext out meta handle to be written */ const float *decDelay /* i : decoding audio delay */ -#else - MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta /* i/o: MASA ext out meta handle to be written */ -#endif ) { if ( self == NULL ) @@ -309,7 +248,6 @@ ivas_error MasaFileWriter_writeFrame( uint16_t descMetaTemp = 0; int16_t i, sf, dir, numDirections; uint8_t writeTempOther[MASA_FREQUENCY_BANDS]; -#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT /* If delay storage has been reserved, then we are in the normal mode for the decoder * (i.e., no delay compensation for PCM) which means that metadata should be delayed * by two or three subframes (10 or 15 ms). Descriptive metadata is a combined result. */ @@ -319,15 +257,6 @@ ivas_error MasaFileWriter_writeFrame( delayMasaMetadata( hMasaExtOutMeta, self->delayStorage, delayFrames ); } -#else - /* If delay storage has been reserved, then we are in the normal mode for the decoder - * (i.e., no delay compensation for PCM) which means that metadata should be delayed - * by two subframes (10 ms). Descriptive metadata is a combined result. */ - if ( self->delayStorage ) - { - delayMasaMetadata( hMasaExtOutMeta, self->delayStorage ); - } -#endif numDirections = hMasaExtOutMeta->descriptiveMeta.numberOfDirections + 1; if ( fwrite( &( hMasaExtOutMeta->descriptiveMeta.formatDescriptor ), sizeof( uint8_t ), 8, self->file ) != 8 ) diff --git a/lib_util/masa_file_writer.h b/lib_util/masa_file_writer.h index c3e142254b9e6e365e3f95e9d9bcb97af66cd547..74d098388c0e5acf03f777d75d6868f496bf3c6e 100644 --- a/lib_util/masa_file_writer.h +++ b/lib_util/masa_file_writer.h @@ -47,13 +47,9 @@ ivas_error MasaFileWriter_open( ); ivas_error MasaFileWriter_writeFrame( - MasaFileWriter *self, /* i/o: MasaFileWriter handle */ -#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT + MasaFileWriter *self, /* i/o: MasaFileWriter handle */ IVAS_MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta, /* i/o: MASA ext out meta handle to be written */ const float *decDelay /* i : decoding audio delay */ -#else - IVAS_MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta /* i/o: MASA ext out meta handle to be written */ -#endif ); void MasaFileWriter_close( diff --git a/lib_util/render_config_reader.c b/lib_util/render_config_reader.c index db4d22b6373804bbfd9a38a4e9c13fa9e2ee4359..e2457301f9d20e3e522aa1605f5e618fe1f7191e 100644 --- a/lib_util/render_config_reader.c +++ b/lib_util/render_config_reader.c @@ -129,9 +129,7 @@ struct RenderConfigReader AcousticEnv *pAE; /* Acoustic environments */ uint32_t nDP; /* Number of directivity patterns */ DirectrivityPat *pDP; /* Directivity Pattern */ -#ifdef CONF_DISTATT - float distAtt[3]; /* [MaxDist Q30, RefDist Q30, Rolloff Q30] */ -#endif + float distAtt[3]; /* [MaxDist Q30, RefDist Q30, Rolloff Q30] */ }; @@ -443,11 +441,7 @@ static ivas_error read_bin_bits( *pTarget = 0; for ( n = 0; n < nBits; n++ ) { -#ifdef FIX_WARNING_RENDER_CONFIG nByte = (uint32_t) ( ( this->readOffset + n ) >> 3 ); -#else - nByte = ( this->readOffset + n ) >> 3; -#endif bit = this->pBitstream[nByte] >> ( 7 - ( ( this->readOffset + n ) % 8 ) ) & 1; *pTarget = ( *pTarget << 1 ) + bit; } @@ -1008,7 +1002,6 @@ static ivas_error get_bin_outer_attenuation( return IVAS_ERR_OK; } -#ifdef CONF_DISTATT /*-----------------------------------------------------------------------------------------* * Function get_bin_max_dist () * Gets a Maximum Distance value [1.0, 64.0] @@ -1078,7 +1071,6 @@ static ivas_error get_bin_rolloff( return IVAS_ERR_OK; } -#endif /*-----------------------------------------------------------------------------------------* * Function read_txt_vector() @@ -1206,9 +1198,7 @@ ivas_error RenderConfigReader_checkValues( pRoom_acoustics = &hRenderConfig->roomAcoustics; tab_value_err_count = 0; int16_t wall_idx; -#ifdef CONF_DISTATT int16_t i; -#endif /* Verify the number of frequency bands in the config input data */ if ( ( pRoom_acoustics->nBands > N_BANDS_MAX ) || ( pRoom_acoustics->nBands < N_BANDS_MIN ) ) @@ -1289,7 +1279,6 @@ ivas_error RenderConfigReader_checkValues( pRoom_acoustics->AbsCoeff_fx[wall_idx] = ER_MAX_ABS_COEFF_FX; } } -#ifdef CONF_DISTATT /* Verify range of distance attenuation parameters: 0.1 <= distAtt[0] <= distAtt[1] */ /* 0.0 <= distAtt[2] <= 10.0 */ hRenderConfig->distAtt[0] = max( 0.1f, hRenderConfig->distAtt[0] ); @@ -1303,7 +1292,6 @@ ivas_error RenderConfigReader_checkValues( hRenderConfig->directivity[i * 3 + 1] = max( 0.0f, min( 360.0f, hRenderConfig->directivity[i * 3 + 1] ) ); hRenderConfig->directivity[i * 3 + 2] = max( 0.0f, min( 1.0f, hRenderConfig->directivity[i * 3 + 2] ) ); } -#endif } @@ -1345,9 +1333,7 @@ ivas_error RenderConfigReader_open( pSelf->pAE = NULL; pSelf->nDP = 0; pSelf->pDP = NULL; -#ifdef CONF_DISTATT pSelf->distAtt[0] = -1; -#endif *ppRenderConfigReader = pSelf; return IVAS_ERR_OK; @@ -1867,7 +1853,6 @@ static ivas_error RenderConfigReader_readBinary( } } } -#ifdef CONF_DISTATT /**********************************/ /* Read the distance attenuation */ /**********************************/ @@ -1895,7 +1880,6 @@ static ivas_error RenderConfigReader_readBinary( return error; } } -#endif /* Cleanup */ @@ -2662,7 +2646,6 @@ ivas_error RenderConfigReader_read( free( pValue ); accDPIdx++; } -#ifdef CONF_DISTATT else if ( strcmp( chapter, "DISTANCEATTENUATION" ) == 0 ) { params_idx = 0; @@ -2708,7 +2691,6 @@ ivas_error RenderConfigReader_read( free( pValue ); } -#endif else if ( strcmp( chapter, "GENERAL" ) == 0 && strlen( pParams ) != 0 ) { params_idx = 0; @@ -2865,12 +2847,10 @@ ivas_error RenderConfigReader_getAcousticEnvironment( pAcEnv->AbsCoeff_fx[j] = (Word32) ( pRenderConfigReader->pAE[n].pEarlyReflections->pAbsCoeff[j] * ONE_IN_Q30 ); } } -#ifdef FIX_1053_REVERB_RECONFIGURATION else { pAcEnv->use_er = false; } -#endif return IVAS_ERR_OK; } } @@ -2886,19 +2866,13 @@ ivas_error RenderConfigReader_getAcousticEnvironment( ivas_error RenderConfigReader_getDirectivity( RenderConfigReader *pRenderConfigReader, /* i : RenderConfigReader handle */ uint16_t *id, /* i : Directivity pattern ID */ -#ifdef CONF_DISTATT - Word16 *directivity_fx /* o : Target directivity */ -#else - float *directivity /* o : Target directivity */ -#endif + Word16 *directivity_fx /* o : Target directivity */ ) { uint16_t n, m; uint16_t last_specified_id; bool idExists; -#ifdef CONF_DISTATT float directivity[12]; -#endif if ( pRenderConfigReader == NULL ) { @@ -2927,12 +2901,8 @@ ivas_error RenderConfigReader_getDirectivity( } } /* case when -dpid is not specified, select first directivity pattern from config file */ -#ifdef NONBE_1229_FIX_ISM1_DPID move16(); if ( last_specified_id == 65535 ) -#else - if ( n == 0 ) -#endif { last_specified_id = (uint16_t) pRenderConfigReader->pDP[0].id; } @@ -2962,7 +2932,6 @@ ivas_error RenderConfigReader_getDirectivity( } } -#ifdef CONF_DISTATT /* Convert to Word16 */ FOR( n = 0; n < 4; n++ ) { @@ -2970,12 +2939,10 @@ ivas_error RenderConfigReader_getDirectivity( directivity_fx[n * 3 + 1] = (Word16) ( directivity[n * 3 + 1] * ( 1u << 6 ) ); directivity_fx[n * 3 + 2] = (Word16) ( directivity[n * 3 + 2] * ( ( 1u << 15 ) - 1 ) ); } -#endif return IVAS_ERR_OK; } -#ifdef CONF_DISTATT /*------------------------------------------------------------------------------------------* * RenderConfigReader_getDistanceAttenuation() * @@ -3010,7 +2977,6 @@ ivas_error RenderConfigReader_getDistanceAttenuation( return IVAS_ERR_OK; } -#endif /*------------------------------------------------------------------------------------------* * RenderConfigReader_close() diff --git a/lib_util/render_config_reader.h b/lib_util/render_config_reader.h index ff6e30d83c34b0dbe7ad1bdb0383c467d9aea51b..58946eca6bd690c3fd887db079e24f1bcbef6d97 100644 --- a/lib_util/render_config_reader.h +++ b/lib_util/render_config_reader.h @@ -60,18 +60,12 @@ ivas_error RenderConfigReader_getAcousticEnvironment( ivas_error RenderConfigReader_getDirectivity( RenderConfigReader *pRenderConfigReader, /* i : RenderConfigReader handle */ uint16_t *pId, /* i : Directivity pattern ID */ -#ifdef CONF_DISTATT - Word16 *directivity_fx /* o : Target directivity */ -#else - float *directivity /* o : Target directivity */ -#endif + Word16 *directivity_fx /* o : Target directivity */ ); -#ifdef CONF_DISTATT ivas_error RenderConfigReader_getDistanceAttenuation( RenderConfigReader *pRenderConfigReader, /* i : RenderConfigReader handle */ Word32 *distAtt_fx /* o : Distance attenuation */ ); -#endif /* Verifies configuration parameters */ ivas_error RenderConfigReader_checkValues( IVAS_RENDER_CONFIG_HANDLE hRenderConfig /* o : Renderer configuration handle */