Loading apps/decoder.c +1 −17 Original line number Diff line number Diff line Loading @@ -134,10 +134,7 @@ static bool parseCmdlIVAS_dec( int16_t argc, char **argv, DecArguments *arg ); static void usage_dec( void ); static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf ); static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, IVAS_DEC_HANDLE hIvasDec ); #if 0 void run_fft_unit_test( void ); void run_mdct_unit_test( void ); #endif /*------------------------------------------------------------------------------------------* * main() Loading Loading @@ -165,9 +162,6 @@ int main( RenderConfigReader *renderConfigReader = NULL; int16_t *pcmBuf = NULL; IVAS_RENDER_FRAMESIZE asked_frame_size; #if 0 int16_t run_unit_tests = 0; #endif #ifdef WMOPS reset_wmops(); Loading @@ -180,16 +174,6 @@ int main( IVAS_DEC_PrintDisclaimer(); #if 0 if ( run_unit_tests ) { run_fft_unit_test(); run_mdct_unit_test(); return 0; } #endif if ( !parseCmdlIVAS_dec( (int16_t) argc, argv, &arg ) ) { /* Error printout done in parseCmdlIVAS_dec() */ Loading apps/encoder.c +251 −14 Original line number Diff line number Diff line Loading @@ -30,8 +30,13 @@ *******************************************************************************************************/ #include "lib_enc.h" #include <string.h> #include "options.h" #ifdef DEBUGGING #include "debug.h" #endif #include "stl.h" #include "lib_enc.h" #include "cmdl_tools.h" #include "audio_file_reader.h" #include "bitstream_writer.h" Loading @@ -39,9 +44,6 @@ #include "jbm_file_reader.h" #include "masa_file_reader.h" #include "wmc_auto.h" #include "options.h" #include "stl.h" #define WMC_TOOL_SKIP Loading @@ -62,6 +64,10 @@ typedef union _EncInputFormatConfig /* MONO details */ bool stereoToMonoDownmix; #ifdef DEBUGGING /* STEREO details */ IVAS_ENC_STEREO_MODE stereoMode; #endif /* ISM details */ struct EncIsmConfig Loading Loading @@ -126,6 +132,10 @@ typedef struct const char *ca_config_file; bool mimeOutput; IVAS_ENC_COMPLEXITY_LEVEL complexityLevel; #ifdef DEBUGGING IVAS_ENC_FORCED_MODE forcedMode; const char *forcedModeFile; #endif bool pca; bool ism_extended_metadata; Loading @@ -141,6 +151,10 @@ static bool parseCmdlIVAS_enc( int16_t argc, char *argv[], EncArguments *arg ); static void usage_enc( void ); static bool readBandwidth( FILE *file, IVAS_ENC_BANDWIDTH *bandwidth, int32_t *bandwidthFrameCounter ); static bool readBitrate( FILE *file, int32_t *bitrate ); #ifdef DEBUGGING static ivas_error readForcedMode( FILE *file, IVAS_ENC_FORCED_MODE *forcedMode, int32_t *forceFrameCounter ); static IVAS_ENC_FORCED_MODE parseForcedMode( char *forcedModeChar ); #endif /*------------------------------------------------------------------------------------------* Loading Loading @@ -168,6 +182,9 @@ int main( MasaFileReader *masaReader = NULL; IsmFileReader *ismReaders[IVAS_MAX_NUM_OBJECTS] = { NULL, NULL, NULL, NULL }; int16_t *pcmBuf = NULL; #ifdef DEBUGGING FILE *f_forcedModeProfile = NULL; #endif #ifdef WMOPS reset_wmops(); Loading Loading @@ -357,7 +374,11 @@ int main( } break; case IVAS_ENC_INPUT_STEREO: #ifdef DEBUGGING if ( ( error = IVAS_ENC_ConfigureForStereo( hIvasEnc, arg.inputFs, totalBitrate, arg.max_bwidth_user, bandwidth, arg.dtxConfig, arg.is_binaural, arg.inputFormatConfig.stereoMode ) ) != IVAS_ERR_OK ) #else if ( ( error = IVAS_ENC_ConfigureForStereo( hIvasEnc, arg.inputFs, totalBitrate, arg.max_bwidth_user, bandwidth, arg.dtxConfig, arg.is_binaural ) ) != IVAS_ERR_OK ) #endif { fprintf( stderr, "\nIVAS_ENC_ConfigureForStereo failed: %s\n\n", IVAS_ENC_GetErrorMessage( error ) ); goto cleanup; Loading @@ -371,21 +392,12 @@ int main( } break; case IVAS_ENC_INPUT_SBA: #if 0 if ((error = IVAS_ENC_ConfigureForAmbisonics_fx(hIvasEnc, arg.inputFs, totalBitrate, arg.max_bwidth_user, bandwidth, arg.dtxConfig, arg.inputFormatConfig.sba.order, arg.inputFormatConfig.sba.isPlanar, arg.pca)) != IVAS_ERR_OK) { fprintf(stderr, "\nIVAS_ENC_ConfigureForAmbisonics failed: %s\n\n", IVAS_ENC_GetErrorMessage(error)); goto cleanup; } #else if ( ( error = IVAS_ENC_ConfigureForAmbisonics( hIvasEnc, arg.inputFs, totalBitrate, arg.max_bwidth_user, bandwidth, arg.dtxConfig, arg.inputFormatConfig.sba.order, arg.inputFormatConfig.sba.isPlanar, arg.pca ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_ENC_ConfigureForAmbisonics failed: %s\n\n", IVAS_ENC_GetErrorMessage( error ) ); goto cleanup; } #endif break; case IVAS_ENC_INPUT_MASA: if ( ( error = IVAS_ENC_ConfigureForMasa( hIvasEnc, arg.inputFs, totalBitrate, arg.max_bwidth_user, bandwidth, arg.dtxConfig, arg.inputFormatConfig.masaVariant ) ) != IVAS_ERR_OK ) Loading Loading @@ -514,6 +526,20 @@ int main( } } #ifdef DEBUGGING IVAS_ENC_FORCED_MODE forcedMode = arg.forcedMode; int32_t force_profile_cnt = 0; if ( arg.forcedModeFile ) { if ( ( f_forcedModeProfile = fopen( arg.forcedModeFile, "rb" ) ) == NULL ) { fprintf( stderr, "\nError: Incorrect mode specification or the profile file could not be opened: %s\n\n", arg.forcedModeFile ); usage_enc(); goto cleanup; } } #endif /*------------------------------------------------------------------------------------------* * Allocate input data buffer Loading Loading @@ -648,6 +674,27 @@ int main( } } #ifdef DEBUGGING if ( f_forcedModeProfile ) { if ( ( error = readForcedMode( f_forcedModeProfile, &forcedMode, &force_profile_cnt ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError reading from file: %s\n%s\n", arg.forcedModeFile, IVAS_ENC_GetErrorMessage( error ) ); goto cleanup; } } /* Force mode not set when configuring, set in first frame even if not reading from file */ if ( f_forcedModeProfile || frame == 0 ) { if ( ( error = IVAS_ENC_SetForcedMode( hIvasEnc, forcedMode ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_ENC_SetForcedMode failed: %s\n\n", IVAS_ENC_GetErrorMessage( error ) ); goto cleanup; } } #endif /* Read ISM input metadata */ for ( i = 0; i < numIsmInputs; ++i ) { Loading Loading @@ -808,7 +855,10 @@ static void initArgStruct( EncArguments *arg ) arg->mimeOutput = false; arg->ism_extended_metadata = false; arg->complexityLevel = IVAS_ENC_COMPLEXITY_LEVEL_THREE; #ifdef DEBUGGING arg->forcedMode = IVAS_ENC_FORCE_UNFORCED; arg->forcedModeFile = NULL; #endif arg->pca = false; return; Loading Loading @@ -937,6 +987,29 @@ static bool parseCmdlIVAS_enc( return false; } } #ifdef DEBUGGING /*-----------------------------------------------------------------* * Force specific mode *-----------------------------------------------------------------*/ else if ( strcmp( argv_to_upper, "-FORCE" ) == 0 ) { strncpy( stmp, argv[i + 1], sizeof( stmp ) ); arg->forcedMode = parseForcedMode( stmp ); if ( arg->forcedMode == IVAS_ENC_FORCE_UNDEFINED ) { arg->forcedModeFile = argv[i + 1]; fprintf( stdout, "Force switching file: %s\n", argv[i + 1] ); } else { fprintf( stdout, "Forcing codec to: %s\n", argv[i + 1] ); } i += 2; } #ifdef DEBUG_MODE_INFO #ifdef DEBUG_MODE_INFO_TWEAK /*-----------------------------------------------------------------* Loading @@ -950,6 +1023,7 @@ static bool parseCmdlIVAS_enc( } #endif /* #ifdef DEBUG_MODE_INFO_TWEAK */ #endif /* #ifdef DEBUG_MODE_INFO */ #endif /* #ifdef DEBUGGING */ /*-----------------------------------------------------------------* * deactivate delay compensation Loading Loading @@ -1053,6 +1127,78 @@ static bool parseCmdlIVAS_enc( { i++; arg->inputFormat = IVAS_ENC_INPUT_STEREO; #ifdef DEBUGGING if ( ( i < argc - 4 ) && argv[i][0] != 45 ) /* note: 45 corresponds to "-" */ { if ( sscanf( argv[i], "%d", &tmp ) > 0 ) { if ( tmp == 1 ) { arg->inputFormatConfig.stereoMode = IVAS_ENC_STEREO_MODE_DFT; i++; } else if ( tmp == 2 ) { arg->inputFormatConfig.stereoMode = IVAS_ENC_STEREO_MODE_TD; i++; } else if ( tmp == 3 ) { arg->inputFormatConfig.stereoMode = IVAS_ENC_STEREO_MODE_MDCT_DECISION; #ifdef DEBUG_FORCE_MDCT_STEREO_MODE i++; /* force mdct stereo mode for debugging purposes */ if ( i < argc - 4 ) { if ( sscanf( argv[i], "%d", &tmp ) > 0 ) { if ( tmp == 0 ) { /* keep "DECISION" */ arg->inputFormatConfig.stereoMode = IVAS_ENC_STEREO_MODE_MDCT_DECISION; i++; } else if ( tmp == 1 ) { arg->inputFormatConfig.stereoMode = IVAS_ENC_STEREO_MODE_MDCT_FORCE_LR; i++; } else if ( tmp == 2 ) { arg->inputFormatConfig.stereoMode = IVAS_ENC_STEREO_MODE_MDCT_FORCE_MS; i++; } else { fprintf( stderr, "Error: Incorrect mdct stereo coding method (%d) specified\n\n", tmp ); usage_enc(); return false; } } } #endif } else { fprintf( stderr, "Error: Incorrect stereo mode (%d) specified\n\n", tmp ); usage_enc(); return false; } } else { fprintf( stderr, "Error: Stereo mode not specified.\n\n" ); /* in the debugging stage */ usage_enc(); return false; } } else { arg->inputFormatConfig.stereoMode = IVAS_ENC_STEREO_MODE_UNIFIED; } #endif /* DEBUGGING */ } else if ( strcmp( argv_to_upper, "-BINAURAL" ) == 0 ) { Loading Loading @@ -1649,6 +1795,10 @@ static void usage_enc( void ) fprintf( stdout, "-pca : activate PCA in SBA format FOA at 256 kbps \n" ); 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" ); #ifdef DEBUGGING fprintf( stdout, "-force T : Force specific mode, T = (speech, music, ACELP, GSC, TCX, HQ),\n" ); fprintf( stdout, " alternatively, T can be a text file where each line contains \"nb_frames T\"\n" ); #endif #ifdef DEBUG_MODE_INFO #ifdef DEBUG_MODE_INFO_TWEAK fprintf( stdout, "-info <folder> : specify subfolder name for debug output\n" ); Loading Loading @@ -1747,4 +1897,91 @@ static bool readBitrate( } #ifdef DEBUGGING /*---------------------------------------------------------------------* * parseForcedMode() * * *---------------------------------------------------------------------*/ static IVAS_ENC_FORCED_MODE parseForcedMode( char *forcedModeChar ) { to_upper( forcedModeChar ); if ( ( strcmp( forcedModeChar, "SPEECH" ) == 0 ) || ( strcmp( forcedModeChar, "'SPEECH'" ) == 0 ) || ( strcmp( forcedModeChar, "0" ) == 0 ) ) { return IVAS_ENC_FORCE_SPEECH; } if ( ( strcmp( forcedModeChar, "MUSIC" ) == 0 ) || ( strcmp( forcedModeChar, "'MUSIC'" ) == 0 ) || ( strcmp( forcedModeChar, "AUDIO" ) == 0 ) || ( strcmp( forcedModeChar, "'AUDIO'" ) == 0 ) || ( strcmp( forcedModeChar, "1" ) == 0 ) ) { return IVAS_ENC_FORCE_MUSIC; } if ( ( strcmp( forcedModeChar, "ACELP" ) == 0 ) || ( strcmp( forcedModeChar, "'ACELP'" ) == 0 ) ) { return IVAS_ENC_FORCE_ACELP; } if ( ( strcmp( forcedModeChar, "GSC" ) == 0 ) || ( strcmp( forcedModeChar, "'GSC'" ) == 0 ) ) { return IVAS_ENC_FORCE_GSC; } if ( ( strcmp( forcedModeChar, "TCX" ) == 0 ) || ( strcmp( forcedModeChar, "'TCX'" ) == 0 ) ) { return IVAS_ENC_FORCE_TCX; } if ( ( strcmp( forcedModeChar, "HQ" ) == 0 ) || ( strcmp( forcedModeChar, "'HQ'" ) == 0 ) ) { return IVAS_ENC_FORCE_HQ; } return IVAS_ENC_FORCE_UNDEFINED; } /*---------------------------------------------------------------------* * readForcedMode() * * *---------------------------------------------------------------------*/ static ivas_error readForcedMode( FILE *file, IVAS_ENC_FORCED_MODE *forcedMode, int32_t *forceFrameCounter ) { int16_t res; char stmp[8]; if ( *forceFrameCounter == 0 ) { /* read next force and number of frames from the profile file */ while ( ( res = (int16_t) fscanf( file, "%d %7s", forceFrameCounter, stmp ) ) != 2 && feof( file ) ) { rewind( file ); } *forcedMode = parseForcedMode( stmp ); if ( *forcedMode == IVAS_ENC_FORCE_UNDEFINED ) { fprintf( stderr, "Error: incorect mode specification or the force profile file could not be opened: %s\n\n", stmp ); return IVAS_ERR_WRONG_PARAMS; } if ( res != 2 && !feof( file ) ) { fprintf( stderr, "Error: incorrect format of the force profile file (please ensure that it does not contain any empty lines)\n\n" ); return IVAS_ERR_WRONG_PARAMS; } } /* current profile still active, only decrease the counter */ ( *forceFrameCounter )--; return IVAS_ERR_OK; } #endif #undef WMC_TOOL_SKIP lib_com/ACcontextMapping.c +6 −1 Original line number Diff line number Diff line Loading @@ -39,6 +39,7 @@ #include "cnst.h" #include "prot.h" #include "wmc_auto.h" #include "prot_fx.h" /*-------------------------------------------------------------------* * get_next_coeff_mapped_ivas() Loading Loading @@ -66,7 +67,7 @@ int16_t get_next_coeff_mapped_ivas( return hm_cfg->indexBuffer[*idx]; } #else Word16 get_next_coeff_mapped_ivas( Word16 get_next_coeff_mapped_ivas_fx( Word16 ii[2], /* i/o: coefficient indexes Q0*/ Word32 *pp, /* o : peak(1)/hole(0) indicator Q0*/ Word16 *idx, /* o : index in unmapped domain Q0*/ Loading @@ -89,6 +90,7 @@ Word16 get_next_coeff_mapped_ivas( #endif #ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * get_next_coeff_unmapped_ivas() * Loading @@ -106,7 +108,9 @@ int16_t get_next_coeff_unmapped_ivas( return *idx; } #endif #ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * update_mixed_context_ivas() * Loading @@ -128,3 +132,4 @@ int32_t update_mixed_context_ivas( return ( ctx & 0xf ) * 16 + t + 13; } #endif lib_com/ari.c +2 −0 Original line number Diff line number Diff line Loading @@ -42,6 +42,7 @@ #include "wmc_auto.h" #ifndef IVAS_FLOAT_FIXED /*--------------------------------------------------------------- Ari 14 bits common routines -------------------------------------------------------------*/ Loading @@ -65,3 +66,4 @@ int32_t mul_sbc_14bits_ivas( /*function in line*/ } #endif lib_com/ari_hm.c +10 −0 Original line number Diff line number Diff line Loading @@ -50,6 +50,7 @@ * *-------------------------------------------------------------------*/ #ifndef IVAS_FLOAT_FIXED void UnmapIndex_ivas( const int16_t PeriodicityIndex, const int16_t Bandwidth, Loading Loading @@ -99,6 +100,7 @@ void UnmapIndex_ivas( return; } #endif void UnmapIndex_fx( const Word16 PeriodicityIndex, /* Q0 */ Loading Loading @@ -167,6 +169,7 @@ void UnmapIndex_fx( } #ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * ConfigureContextHm_ivas() * Loading Loading @@ -241,6 +244,7 @@ void ConfigureContextHm_ivas( return; } #endif /*-------------------------------------------------------------------* Loading @@ -249,6 +253,7 @@ void ConfigureContextHm_ivas( * *-------------------------------------------------------------------*/ #ifndef IVAS_FLOAT_FIXED int16_t CountIndexBits_ivas( const int16_t Bandwidth, const int16_t PeriodicityIndex ) Loading @@ -261,6 +266,7 @@ int16_t CountIndexBits_ivas( return 8; } #endif Word16 CountIndexBits_fx( Word16 Bandwidth, /* Q0 */ Loading @@ -285,6 +291,7 @@ Word16 CountIndexBits_fx( #define WMC_TOOL_SKIP #ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * tcx_hm_render_ivas() * Loading Loading @@ -343,6 +350,7 @@ Word16 tcx_hm_render_ivas( return 0; } #endif Word32 tcx_hm_render_fx( const Word32 lag, /* i: pitch lag Q0 */ Loading Loading @@ -400,6 +408,7 @@ Word32 tcx_hm_render_fx( return 0; } #ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * tcx_hm_modify_envelope_ivas() * Loading Loading @@ -446,6 +455,7 @@ void tcx_hm_modify_envelope_ivas( return; } #endif void tcx_hm_modify_envelope_fx( const Word16 gain, /* i: HM gain Q11 */ Loading Loading
apps/decoder.c +1 −17 Original line number Diff line number Diff line Loading @@ -134,10 +134,7 @@ static bool parseCmdlIVAS_dec( int16_t argc, char **argv, DecArguments *arg ); static void usage_dec( void ); static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf ); static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, IVAS_DEC_HANDLE hIvasDec ); #if 0 void run_fft_unit_test( void ); void run_mdct_unit_test( void ); #endif /*------------------------------------------------------------------------------------------* * main() Loading Loading @@ -165,9 +162,6 @@ int main( RenderConfigReader *renderConfigReader = NULL; int16_t *pcmBuf = NULL; IVAS_RENDER_FRAMESIZE asked_frame_size; #if 0 int16_t run_unit_tests = 0; #endif #ifdef WMOPS reset_wmops(); Loading @@ -180,16 +174,6 @@ int main( IVAS_DEC_PrintDisclaimer(); #if 0 if ( run_unit_tests ) { run_fft_unit_test(); run_mdct_unit_test(); return 0; } #endif if ( !parseCmdlIVAS_dec( (int16_t) argc, argv, &arg ) ) { /* Error printout done in parseCmdlIVAS_dec() */ Loading
apps/encoder.c +251 −14 Original line number Diff line number Diff line Loading @@ -30,8 +30,13 @@ *******************************************************************************************************/ #include "lib_enc.h" #include <string.h> #include "options.h" #ifdef DEBUGGING #include "debug.h" #endif #include "stl.h" #include "lib_enc.h" #include "cmdl_tools.h" #include "audio_file_reader.h" #include "bitstream_writer.h" Loading @@ -39,9 +44,6 @@ #include "jbm_file_reader.h" #include "masa_file_reader.h" #include "wmc_auto.h" #include "options.h" #include "stl.h" #define WMC_TOOL_SKIP Loading @@ -62,6 +64,10 @@ typedef union _EncInputFormatConfig /* MONO details */ bool stereoToMonoDownmix; #ifdef DEBUGGING /* STEREO details */ IVAS_ENC_STEREO_MODE stereoMode; #endif /* ISM details */ struct EncIsmConfig Loading Loading @@ -126,6 +132,10 @@ typedef struct const char *ca_config_file; bool mimeOutput; IVAS_ENC_COMPLEXITY_LEVEL complexityLevel; #ifdef DEBUGGING IVAS_ENC_FORCED_MODE forcedMode; const char *forcedModeFile; #endif bool pca; bool ism_extended_metadata; Loading @@ -141,6 +151,10 @@ static bool parseCmdlIVAS_enc( int16_t argc, char *argv[], EncArguments *arg ); static void usage_enc( void ); static bool readBandwidth( FILE *file, IVAS_ENC_BANDWIDTH *bandwidth, int32_t *bandwidthFrameCounter ); static bool readBitrate( FILE *file, int32_t *bitrate ); #ifdef DEBUGGING static ivas_error readForcedMode( FILE *file, IVAS_ENC_FORCED_MODE *forcedMode, int32_t *forceFrameCounter ); static IVAS_ENC_FORCED_MODE parseForcedMode( char *forcedModeChar ); #endif /*------------------------------------------------------------------------------------------* Loading Loading @@ -168,6 +182,9 @@ int main( MasaFileReader *masaReader = NULL; IsmFileReader *ismReaders[IVAS_MAX_NUM_OBJECTS] = { NULL, NULL, NULL, NULL }; int16_t *pcmBuf = NULL; #ifdef DEBUGGING FILE *f_forcedModeProfile = NULL; #endif #ifdef WMOPS reset_wmops(); Loading Loading @@ -357,7 +374,11 @@ int main( } break; case IVAS_ENC_INPUT_STEREO: #ifdef DEBUGGING if ( ( error = IVAS_ENC_ConfigureForStereo( hIvasEnc, arg.inputFs, totalBitrate, arg.max_bwidth_user, bandwidth, arg.dtxConfig, arg.is_binaural, arg.inputFormatConfig.stereoMode ) ) != IVAS_ERR_OK ) #else if ( ( error = IVAS_ENC_ConfigureForStereo( hIvasEnc, arg.inputFs, totalBitrate, arg.max_bwidth_user, bandwidth, arg.dtxConfig, arg.is_binaural ) ) != IVAS_ERR_OK ) #endif { fprintf( stderr, "\nIVAS_ENC_ConfigureForStereo failed: %s\n\n", IVAS_ENC_GetErrorMessage( error ) ); goto cleanup; Loading @@ -371,21 +392,12 @@ int main( } break; case IVAS_ENC_INPUT_SBA: #if 0 if ((error = IVAS_ENC_ConfigureForAmbisonics_fx(hIvasEnc, arg.inputFs, totalBitrate, arg.max_bwidth_user, bandwidth, arg.dtxConfig, arg.inputFormatConfig.sba.order, arg.inputFormatConfig.sba.isPlanar, arg.pca)) != IVAS_ERR_OK) { fprintf(stderr, "\nIVAS_ENC_ConfigureForAmbisonics failed: %s\n\n", IVAS_ENC_GetErrorMessage(error)); goto cleanup; } #else if ( ( error = IVAS_ENC_ConfigureForAmbisonics( hIvasEnc, arg.inputFs, totalBitrate, arg.max_bwidth_user, bandwidth, arg.dtxConfig, arg.inputFormatConfig.sba.order, arg.inputFormatConfig.sba.isPlanar, arg.pca ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_ENC_ConfigureForAmbisonics failed: %s\n\n", IVAS_ENC_GetErrorMessage( error ) ); goto cleanup; } #endif break; case IVAS_ENC_INPUT_MASA: if ( ( error = IVAS_ENC_ConfigureForMasa( hIvasEnc, arg.inputFs, totalBitrate, arg.max_bwidth_user, bandwidth, arg.dtxConfig, arg.inputFormatConfig.masaVariant ) ) != IVAS_ERR_OK ) Loading Loading @@ -514,6 +526,20 @@ int main( } } #ifdef DEBUGGING IVAS_ENC_FORCED_MODE forcedMode = arg.forcedMode; int32_t force_profile_cnt = 0; if ( arg.forcedModeFile ) { if ( ( f_forcedModeProfile = fopen( arg.forcedModeFile, "rb" ) ) == NULL ) { fprintf( stderr, "\nError: Incorrect mode specification or the profile file could not be opened: %s\n\n", arg.forcedModeFile ); usage_enc(); goto cleanup; } } #endif /*------------------------------------------------------------------------------------------* * Allocate input data buffer Loading Loading @@ -648,6 +674,27 @@ int main( } } #ifdef DEBUGGING if ( f_forcedModeProfile ) { if ( ( error = readForcedMode( f_forcedModeProfile, &forcedMode, &force_profile_cnt ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError reading from file: %s\n%s\n", arg.forcedModeFile, IVAS_ENC_GetErrorMessage( error ) ); goto cleanup; } } /* Force mode not set when configuring, set in first frame even if not reading from file */ if ( f_forcedModeProfile || frame == 0 ) { if ( ( error = IVAS_ENC_SetForcedMode( hIvasEnc, forcedMode ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_ENC_SetForcedMode failed: %s\n\n", IVAS_ENC_GetErrorMessage( error ) ); goto cleanup; } } #endif /* Read ISM input metadata */ for ( i = 0; i < numIsmInputs; ++i ) { Loading Loading @@ -808,7 +855,10 @@ static void initArgStruct( EncArguments *arg ) arg->mimeOutput = false; arg->ism_extended_metadata = false; arg->complexityLevel = IVAS_ENC_COMPLEXITY_LEVEL_THREE; #ifdef DEBUGGING arg->forcedMode = IVAS_ENC_FORCE_UNFORCED; arg->forcedModeFile = NULL; #endif arg->pca = false; return; Loading Loading @@ -937,6 +987,29 @@ static bool parseCmdlIVAS_enc( return false; } } #ifdef DEBUGGING /*-----------------------------------------------------------------* * Force specific mode *-----------------------------------------------------------------*/ else if ( strcmp( argv_to_upper, "-FORCE" ) == 0 ) { strncpy( stmp, argv[i + 1], sizeof( stmp ) ); arg->forcedMode = parseForcedMode( stmp ); if ( arg->forcedMode == IVAS_ENC_FORCE_UNDEFINED ) { arg->forcedModeFile = argv[i + 1]; fprintf( stdout, "Force switching file: %s\n", argv[i + 1] ); } else { fprintf( stdout, "Forcing codec to: %s\n", argv[i + 1] ); } i += 2; } #ifdef DEBUG_MODE_INFO #ifdef DEBUG_MODE_INFO_TWEAK /*-----------------------------------------------------------------* Loading @@ -950,6 +1023,7 @@ static bool parseCmdlIVAS_enc( } #endif /* #ifdef DEBUG_MODE_INFO_TWEAK */ #endif /* #ifdef DEBUG_MODE_INFO */ #endif /* #ifdef DEBUGGING */ /*-----------------------------------------------------------------* * deactivate delay compensation Loading Loading @@ -1053,6 +1127,78 @@ static bool parseCmdlIVAS_enc( { i++; arg->inputFormat = IVAS_ENC_INPUT_STEREO; #ifdef DEBUGGING if ( ( i < argc - 4 ) && argv[i][0] != 45 ) /* note: 45 corresponds to "-" */ { if ( sscanf( argv[i], "%d", &tmp ) > 0 ) { if ( tmp == 1 ) { arg->inputFormatConfig.stereoMode = IVAS_ENC_STEREO_MODE_DFT; i++; } else if ( tmp == 2 ) { arg->inputFormatConfig.stereoMode = IVAS_ENC_STEREO_MODE_TD; i++; } else if ( tmp == 3 ) { arg->inputFormatConfig.stereoMode = IVAS_ENC_STEREO_MODE_MDCT_DECISION; #ifdef DEBUG_FORCE_MDCT_STEREO_MODE i++; /* force mdct stereo mode for debugging purposes */ if ( i < argc - 4 ) { if ( sscanf( argv[i], "%d", &tmp ) > 0 ) { if ( tmp == 0 ) { /* keep "DECISION" */ arg->inputFormatConfig.stereoMode = IVAS_ENC_STEREO_MODE_MDCT_DECISION; i++; } else if ( tmp == 1 ) { arg->inputFormatConfig.stereoMode = IVAS_ENC_STEREO_MODE_MDCT_FORCE_LR; i++; } else if ( tmp == 2 ) { arg->inputFormatConfig.stereoMode = IVAS_ENC_STEREO_MODE_MDCT_FORCE_MS; i++; } else { fprintf( stderr, "Error: Incorrect mdct stereo coding method (%d) specified\n\n", tmp ); usage_enc(); return false; } } } #endif } else { fprintf( stderr, "Error: Incorrect stereo mode (%d) specified\n\n", tmp ); usage_enc(); return false; } } else { fprintf( stderr, "Error: Stereo mode not specified.\n\n" ); /* in the debugging stage */ usage_enc(); return false; } } else { arg->inputFormatConfig.stereoMode = IVAS_ENC_STEREO_MODE_UNIFIED; } #endif /* DEBUGGING */ } else if ( strcmp( argv_to_upper, "-BINAURAL" ) == 0 ) { Loading Loading @@ -1649,6 +1795,10 @@ static void usage_enc( void ) fprintf( stdout, "-pca : activate PCA in SBA format FOA at 256 kbps \n" ); 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" ); #ifdef DEBUGGING fprintf( stdout, "-force T : Force specific mode, T = (speech, music, ACELP, GSC, TCX, HQ),\n" ); fprintf( stdout, " alternatively, T can be a text file where each line contains \"nb_frames T\"\n" ); #endif #ifdef DEBUG_MODE_INFO #ifdef DEBUG_MODE_INFO_TWEAK fprintf( stdout, "-info <folder> : specify subfolder name for debug output\n" ); Loading Loading @@ -1747,4 +1897,91 @@ static bool readBitrate( } #ifdef DEBUGGING /*---------------------------------------------------------------------* * parseForcedMode() * * *---------------------------------------------------------------------*/ static IVAS_ENC_FORCED_MODE parseForcedMode( char *forcedModeChar ) { to_upper( forcedModeChar ); if ( ( strcmp( forcedModeChar, "SPEECH" ) == 0 ) || ( strcmp( forcedModeChar, "'SPEECH'" ) == 0 ) || ( strcmp( forcedModeChar, "0" ) == 0 ) ) { return IVAS_ENC_FORCE_SPEECH; } if ( ( strcmp( forcedModeChar, "MUSIC" ) == 0 ) || ( strcmp( forcedModeChar, "'MUSIC'" ) == 0 ) || ( strcmp( forcedModeChar, "AUDIO" ) == 0 ) || ( strcmp( forcedModeChar, "'AUDIO'" ) == 0 ) || ( strcmp( forcedModeChar, "1" ) == 0 ) ) { return IVAS_ENC_FORCE_MUSIC; } if ( ( strcmp( forcedModeChar, "ACELP" ) == 0 ) || ( strcmp( forcedModeChar, "'ACELP'" ) == 0 ) ) { return IVAS_ENC_FORCE_ACELP; } if ( ( strcmp( forcedModeChar, "GSC" ) == 0 ) || ( strcmp( forcedModeChar, "'GSC'" ) == 0 ) ) { return IVAS_ENC_FORCE_GSC; } if ( ( strcmp( forcedModeChar, "TCX" ) == 0 ) || ( strcmp( forcedModeChar, "'TCX'" ) == 0 ) ) { return IVAS_ENC_FORCE_TCX; } if ( ( strcmp( forcedModeChar, "HQ" ) == 0 ) || ( strcmp( forcedModeChar, "'HQ'" ) == 0 ) ) { return IVAS_ENC_FORCE_HQ; } return IVAS_ENC_FORCE_UNDEFINED; } /*---------------------------------------------------------------------* * readForcedMode() * * *---------------------------------------------------------------------*/ static ivas_error readForcedMode( FILE *file, IVAS_ENC_FORCED_MODE *forcedMode, int32_t *forceFrameCounter ) { int16_t res; char stmp[8]; if ( *forceFrameCounter == 0 ) { /* read next force and number of frames from the profile file */ while ( ( res = (int16_t) fscanf( file, "%d %7s", forceFrameCounter, stmp ) ) != 2 && feof( file ) ) { rewind( file ); } *forcedMode = parseForcedMode( stmp ); if ( *forcedMode == IVAS_ENC_FORCE_UNDEFINED ) { fprintf( stderr, "Error: incorect mode specification or the force profile file could not be opened: %s\n\n", stmp ); return IVAS_ERR_WRONG_PARAMS; } if ( res != 2 && !feof( file ) ) { fprintf( stderr, "Error: incorrect format of the force profile file (please ensure that it does not contain any empty lines)\n\n" ); return IVAS_ERR_WRONG_PARAMS; } } /* current profile still active, only decrease the counter */ ( *forceFrameCounter )--; return IVAS_ERR_OK; } #endif #undef WMC_TOOL_SKIP
lib_com/ACcontextMapping.c +6 −1 Original line number Diff line number Diff line Loading @@ -39,6 +39,7 @@ #include "cnst.h" #include "prot.h" #include "wmc_auto.h" #include "prot_fx.h" /*-------------------------------------------------------------------* * get_next_coeff_mapped_ivas() Loading Loading @@ -66,7 +67,7 @@ int16_t get_next_coeff_mapped_ivas( return hm_cfg->indexBuffer[*idx]; } #else Word16 get_next_coeff_mapped_ivas( Word16 get_next_coeff_mapped_ivas_fx( Word16 ii[2], /* i/o: coefficient indexes Q0*/ Word32 *pp, /* o : peak(1)/hole(0) indicator Q0*/ Word16 *idx, /* o : index in unmapped domain Q0*/ Loading @@ -89,6 +90,7 @@ Word16 get_next_coeff_mapped_ivas( #endif #ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * get_next_coeff_unmapped_ivas() * Loading @@ -106,7 +108,9 @@ int16_t get_next_coeff_unmapped_ivas( return *idx; } #endif #ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * update_mixed_context_ivas() * Loading @@ -128,3 +132,4 @@ int32_t update_mixed_context_ivas( return ( ctx & 0xf ) * 16 + t + 13; } #endif
lib_com/ari.c +2 −0 Original line number Diff line number Diff line Loading @@ -42,6 +42,7 @@ #include "wmc_auto.h" #ifndef IVAS_FLOAT_FIXED /*--------------------------------------------------------------- Ari 14 bits common routines -------------------------------------------------------------*/ Loading @@ -65,3 +66,4 @@ int32_t mul_sbc_14bits_ivas( /*function in line*/ } #endif
lib_com/ari_hm.c +10 −0 Original line number Diff line number Diff line Loading @@ -50,6 +50,7 @@ * *-------------------------------------------------------------------*/ #ifndef IVAS_FLOAT_FIXED void UnmapIndex_ivas( const int16_t PeriodicityIndex, const int16_t Bandwidth, Loading Loading @@ -99,6 +100,7 @@ void UnmapIndex_ivas( return; } #endif void UnmapIndex_fx( const Word16 PeriodicityIndex, /* Q0 */ Loading Loading @@ -167,6 +169,7 @@ void UnmapIndex_fx( } #ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * ConfigureContextHm_ivas() * Loading Loading @@ -241,6 +244,7 @@ void ConfigureContextHm_ivas( return; } #endif /*-------------------------------------------------------------------* Loading @@ -249,6 +253,7 @@ void ConfigureContextHm_ivas( * *-------------------------------------------------------------------*/ #ifndef IVAS_FLOAT_FIXED int16_t CountIndexBits_ivas( const int16_t Bandwidth, const int16_t PeriodicityIndex ) Loading @@ -261,6 +266,7 @@ int16_t CountIndexBits_ivas( return 8; } #endif Word16 CountIndexBits_fx( Word16 Bandwidth, /* Q0 */ Loading @@ -285,6 +291,7 @@ Word16 CountIndexBits_fx( #define WMC_TOOL_SKIP #ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * tcx_hm_render_ivas() * Loading Loading @@ -343,6 +350,7 @@ Word16 tcx_hm_render_ivas( return 0; } #endif Word32 tcx_hm_render_fx( const Word32 lag, /* i: pitch lag Q0 */ Loading Loading @@ -400,6 +408,7 @@ Word32 tcx_hm_render_fx( return 0; } #ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * tcx_hm_modify_envelope_ivas() * Loading Loading @@ -446,6 +455,7 @@ void tcx_hm_modify_envelope_ivas( return; } #endif void tcx_hm_modify_envelope_fx( const Word16 gain, /* i: HM gain Q11 */ Loading