Loading apps/decoder.c +0 −25 Original line number Diff line number Diff line Loading @@ -2650,31 +2650,6 @@ static ivas_error decodeG192( /* Placeholder for memory reallocation */ /* ... */ #ifdef DECODER_FORMAT_SWITCHING if ( IVAS_DEC_isRestartNeeded( hIvasDec ) ) { IVAS_DEC_BS_FORMAT tempFormat; if ( ( error = IVAS_DEC_GetFormat( hIvasDec, &tempFormat ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in IVAS_DEC_GetFormat, code: %d\n", error ); goto cleanup; } IVAS_DEC_MODE codecMode = ( tempFormat == IVAS_DEC_BS_MONO ) ? IVAS_DEC_MODE_EVS : IVAS_DEC_MODE_IVAS; error = restartDecoder( &hIvasDec, codecMode, &arg, NULL, /* ToDo : Provide rendererConfig */ NULL /* ToDo : Provide LS Custom Data */ ); if ( error != IVAS_ERR_OK ) { fprintf( stderr, "\nFailed to restart decoder\n" ); goto cleanup; } *phIvasDec = hIvasDec; /* Update for main()' s free */ } #endif /* Load HRTF binary file data */ if ( arg.hrtfReaderEnabled ) Loading lib_com/ivas_prot.h +5 −0 Original line number Diff line number Diff line Loading @@ -328,7 +328,12 @@ ivas_error ivas_dec( ); ivas_error ivas_dec_get_format( #ifdef DECODER_FORMAT_SWITCHING Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const bool isVoipMode /* i : voip mode indicator */ #else Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ #endif ); ivas_error ivas_dec_setup( Loading lib_dec/ivas_init_dec.c +107 −33 Original line number Diff line number Diff line Loading @@ -99,7 +99,12 @@ static AUDIO_CONFIG ivas_set_audio_config_from_sba_order( *---------------------------------------------------------------------*/ ivas_error ivas_dec_get_format( #ifdef DECODER_FORMAT_SWITCHING Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const bool isVoipMode /* i : voip mode indicator */ #else Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ #endif ) { int16_t k, idx, num_bits_read; Loading Loading @@ -130,16 +135,22 @@ ivas_error ivas_dec_get_format( !( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->last_ivas_format == MASA_FORMAT ) ) { #ifdef DECODER_FORMAT_SWITCHING if ( isVoipMode ) { st_ivas->restartNeeded = 1; return IVAS_ERR_OK; #else } else { #endif #ifdef DEBUGGING fprintf( stderr, "\nError: Changing the number of ISMs is not supported!\n" ); #endif return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Wrong number of objects signalled!" ); #ifdef DECODER_FORMAT_SWITCHING } #endif } /*-------------------------------------------------------------------* * Read other signaling (ISM/MC mode, number of channels, etc.) *-------------------------------------------------------------------*/ Loading Loading @@ -172,13 +183,20 @@ ivas_error ivas_dec_get_format( if ( st_ivas->ini_frame > 0 && nchan_ism != st_ivas->nchan_ism ) { #ifdef DECODER_FORMAT_SWITCHING if ( isVoipMode ) { st_ivas->restartNeeded = 1; return IVAS_ERR_OK; #else } else { #endif #ifdef DEBUGGING fprintf( stderr, "\nError: Changing the number of ISMs is not supported!\n" ); #endif return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Wrong number of objects signalled!" ); #ifdef DECODER_FORMAT_SWITCHING } #endif } Loading @@ -200,13 +218,20 @@ ivas_error ivas_dec_get_format( if ( st_ivas->ini_frame > 0 && sba_planar != st_ivas->sba_planar ) { #ifdef DECODER_FORMAT_SWITCHING if ( isVoipMode ) { st_ivas->restartNeeded = 1; return IVAS_ERR_OK; #else } else { #endif #ifdef DEBUGGING fprintf( stderr, "\nError: Changing the SBA planar/3D layout is not supported!\n" ); #endif return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Wrong SBA planar flag signalled!" ); #ifdef DECODER_FORMAT_SWITCHING } #endif } Loading @@ -217,13 +242,20 @@ ivas_error ivas_dec_get_format( if ( st_ivas->ini_frame > 0 && sba_order != st_ivas->sba_order ) { #ifdef DECODER_FORMAT_SWITCHING if ( isVoipMode ) { st_ivas->restartNeeded = 1; return IVAS_ERR_OK; #else } else { #endif #ifdef DEBUGGING fprintf( stderr, "\nError: Changing the SBA order is not supported!\n" ); #endif return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Wrong SBA order signalled!" ); #ifdef DECODER_FORMAT_SWITCHING } #endif } Loading @@ -236,7 +268,7 @@ ivas_error ivas_dec_get_format( if ( st_ivas->bit_stream[( ivas_total_brate / FRAMES_PER_SEC ) - 1] ) { #ifdef DECODER_FORMAT_SWITCHING if ( st_ivas->nchan_transport == 1 ) if ( st_ivas->nchan_transport == 1 && isVoipMode ) { st_ivas->restartNeeded = 1; return IVAS_ERR_OK; Loading @@ -248,7 +280,7 @@ ivas_error ivas_dec_get_format( else { #ifdef DECODER_FORMAT_SWITCHING if ( st_ivas->nchan_transport == 2 ) if ( st_ivas->nchan_transport == 2 && isVoipMode ) { st_ivas->restartNeeded = 1; return IVAS_ERR_OK; Loading Loading @@ -285,13 +317,20 @@ ivas_error ivas_dec_get_format( if ( st_ivas->ini_frame > 0 && nchan_ism != st_ivas->nchan_ism ) { #ifdef DECODER_FORMAT_SWITCHING if ( isVoipMode ) { st_ivas->restartNeeded = 1; return IVAS_ERR_OK; #else } else { #endif #ifdef DEBUGGING fprintf( stderr, "\nError: Changing the number of ISMs is not supported!\n" ); #endif return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Wrong number of objects signalled!" ); #ifdef DECODER_FORMAT_SWITCHING } #endif } Loading @@ -308,13 +347,20 @@ ivas_error ivas_dec_get_format( if ( st_ivas->ini_frame > 0 && nchan_ism != st_ivas->nchan_ism ) { #ifdef DECODER_FORMAT_SWITCHING if ( isVoipMode ) { st_ivas->restartNeeded = 1; return IVAS_ERR_OK; #else } else { #endif #ifdef DEBUGGING fprintf( stderr, "\nError: Changing the number of ISMs is not supported!\n" ); #endif return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Wrong number of objects signalled!" ); #ifdef DECODER_FORMAT_SWITCHING } #endif } Loading @@ -328,13 +374,20 @@ ivas_error ivas_dec_get_format( if ( st_ivas->ini_frame > 0 && nchan_ism != st_ivas->nchan_ism ) { #ifdef DECODER_FORMAT_SWITCHING if ( isVoipMode ) { st_ivas->restartNeeded = 1; return IVAS_ERR_OK; #else } else { #endif #ifdef DEBUGGING fprintf( stderr, "\nError: Changing the number of ISMs is not supported!\n" ); #endif return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Wrong number of objects signalled!" ); #ifdef DECODER_FORMAT_SWITCHING } #endif } Loading @@ -360,13 +413,20 @@ ivas_error ivas_dec_get_format( if ( st_ivas->ini_frame > 0 && sba_order != st_ivas->sba_order ) { #ifdef DECODER_FORMAT_SWITCHING if ( isVoipMode ) { st_ivas->restartNeeded = 1; return IVAS_ERR_OK; #else } else { #endif #ifdef DEBUGGING fprintf( stderr, "\nError: Changing the SBA order is not supported!\n" ); #endif return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Wrong SBA order signalled!" ); #ifdef DECODER_FORMAT_SWITCHING } #endif } Loading @@ -393,13 +453,20 @@ ivas_error ivas_dec_get_format( if ( st_ivas->ini_frame > 0 && st_ivas->transport_config != signaled_config ) { #ifdef DECODER_FORMAT_SWITCHING if ( isVoipMode ) { st_ivas->restartNeeded = 1; return IVAS_ERR_OK; #else } else { #endif #ifdef DEBUGGING fprintf( stderr, "\nError: Switching of MC configurations is not supported!\n" ); #endif return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "wrong MC configuration signalled!" ); #ifdef DECODER_FORMAT_SWITCHING } #endif } Loading Loading @@ -483,13 +550,20 @@ ivas_error ivas_dec_get_format( if ( st_ivas->ini_frame > 0 && nchan_ism != st_ivas->nchan_ism ) { #ifdef DECODER_FORMAT_SWITCHING if ( isVoipMode ) { st_ivas->restartNeeded = 1; return IVAS_ERR_OK; #else } else { #endif #ifdef DEBUGGING fprintf( stderr, "\nError: Changing the number of ISMs is not supported!\n" ); #endif return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Wrong number of objects signalled!" ); #ifdef DECODER_FORMAT_SWITCHING } #endif } Loading lib_dec/lib_dec.c +4 −0 Original line number Diff line number Diff line Loading @@ -1041,7 +1041,11 @@ ivas_error IVAS_DEC_ReadFormat( if ( st_ivas->bfi == 0 ) { #ifdef DECODER_FORMAT_SWITCHING if ( ( error = ivas_dec_get_format( st_ivas, hIvasDec->hVoIP != NULL ) ) != IVAS_ERR_OK ) #else if ( ( error = ivas_dec_get_format( st_ivas ) ) != IVAS_ERR_OK ) #endif { return error; } Loading tests/rtp/test_format_switching.py +1 −107 Original line number Diff line number Diff line Loading @@ -98,112 +98,6 @@ FORMAT_ARGUMENT_MAPPING = { "ISM4SBA3": ["-ism_sba", "4", "+3"], } def test_format_switching ( dut_encoder_frontend: EncoderFrontend, dut_decoder_frontend: DecoderFrontend ): bitrate = 48000 bandwidth = "FB" outMode = "MONO" # Create 1s test files cut_suffix = "_cut.wav" test_file = Path( str(FORMAT_TO_FILE_COMPARETEST["MONO"]).replace(".wav", cut_suffix) ) if not test_file.exists(): create_short_testvectors(1.0, False, None) with TemporaryDirectory() as tmp_dir: bitstreams = [] rtpdumps = [] codec=CODECS.IVAS #if key is "MONO": # codec=CODECS.EVS #else: # codec=CODECS.IVAS rtpPacker = IvasRtp(numFramesPerPacket=1, codec=codec) piData = dict() requestsData = dict() # Encode subformats for key, audioFile in FORMAT_TO_FILE_COMPARETEST.items(): if key in ["META", "16ch_8+4+4", "4d4", "t_design_4"]: break encoder_args = [] cutFile = Path( str(audioFile).replace(".wav", cut_suffix) ) encoder_args += FORMAT_ARGUMENT_MAPPING[key] if key in FORMAT_TO_METADATA_FILES: encoder_args += FORMAT_TO_METADATA_FILES[key] elif "SBA" in key: # ISM metadata files for OSBA encoder_args += FORMAT_TO_METADATA_FILES[key[:4]] temp_bitstream = Path(tmp_dir).joinpath(f"output-{bitrate}-{bandwidth}-{key}.bts").absolute() temp_rtpdump = Path(tmp_dir).joinpath(f"output-{bitrate}-{bandwidth}-{key}.rtpdump").absolute() dut_encoder_frontend.run( bitrate=bitrate, input_sampling_rate=48, input_path=cutFile, output_bitstream_path=temp_bitstream, sba_order=None, dtx_mode=False, max_band=bandwidth, add_option_list=encoder_args ) bitstreams.append(temp_bitstream) # Combine bitstreams cat_bitstream_no_evs = Path(tmp_dir).joinpath(f"output-{bitrate}-{bandwidth}-NO-EVS-CAT.bts").absolute() cat_rtpdump = Path(tmp_dir).joinpath(f"output-{bitrate}-{bandwidth}-CAT.rtpdump").absolute() cat_rtpdump_no_evs = Path(tmp_dir).joinpath(f"output-{bitrate}-{bandwidth}-NO-EVS-CAT.rtpdump").absolute() catBsNoEVS = bytes() catRTP = bytes() catRTPnoEVS = bytes() for bsFile in bitstreams: if "MONO" not in str(bsFile): with open (bsFile, mode="rb") as fd: catBsNoEVS += fd.read() with open (cat_bitstream_no_evs, mode="wb") as outFile: outFile.write(catBsNoEVS) # TODO: also pack EVS packets (while increasing timestamp and sequence number) # Pack to RTP packets rtpPacker.packG192File(g192File=cat_bitstream_no_evs, rtpDumpOut=cat_rtpdump_no_evs, piData=piData, requestsData=requestsData) #rtpdumps.append(temp_rtpdump) #for rtpdumpFile in rtpdumps: # with open (rtpdumpFile, mode="rb") as fd: # tempBits = fd.read() # catRTP += tempBits # if "MONO" not in str(rtpdumpFile): # catRTPnoEVS += tempBits #with open (cat_rtpdump, mode="wb") as outFile: # outFile.write(catRTP) #with open (cat_rtpdump_no_evs, mode="wb") as outFile: # outFile.write(catRTPnoEVS) # Decode the combined bitstreams cat_output_no_evs = Path(tmp_dir).joinpath(f"output-{bitrate}-{bandwidth}-NO-EVS-CAT.wav").absolute() cat_output_rtpdump = Path(tmp_dir).joinpath(f"output-{bitrate}-{bandwidth}.wav").absolute() dut_decoder_frontend.run( output_config=outMode, output_sampling_rate=48, input_bitstream_path=cat_bitstream_no_evs, output_path=cat_output_no_evs, add_option_list= [] ) dut_decoder_frontend.run( output_config=outMode, output_sampling_rate=48, input_bitstream_path=cat_rtpdump, output_path=cat_output_rtpdump, add_option_list= ["-VOIP_HF_ONLY=1"] ) def test_format_switching_new_encoder ( record_property, dut_decoder_frontend: DecoderFrontend Loading @@ -211,7 +105,7 @@ def test_format_switching_new_encoder ( bitrate = 48000 fs = 48 bandwidth = "FB" outMode = "MONO" outMode = "" dut_encoder_path = Path(ROOT_DIR).joinpath(f"IVAS_cod{BIN_EXT}") dut_encoder_fmtsw_path = Path(ROOT_DIR).joinpath(f"IVAS_cod_fmtsw{BIN_EXT}") Loading Loading
apps/decoder.c +0 −25 Original line number Diff line number Diff line Loading @@ -2650,31 +2650,6 @@ static ivas_error decodeG192( /* Placeholder for memory reallocation */ /* ... */ #ifdef DECODER_FORMAT_SWITCHING if ( IVAS_DEC_isRestartNeeded( hIvasDec ) ) { IVAS_DEC_BS_FORMAT tempFormat; if ( ( error = IVAS_DEC_GetFormat( hIvasDec, &tempFormat ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in IVAS_DEC_GetFormat, code: %d\n", error ); goto cleanup; } IVAS_DEC_MODE codecMode = ( tempFormat == IVAS_DEC_BS_MONO ) ? IVAS_DEC_MODE_EVS : IVAS_DEC_MODE_IVAS; error = restartDecoder( &hIvasDec, codecMode, &arg, NULL, /* ToDo : Provide rendererConfig */ NULL /* ToDo : Provide LS Custom Data */ ); if ( error != IVAS_ERR_OK ) { fprintf( stderr, "\nFailed to restart decoder\n" ); goto cleanup; } *phIvasDec = hIvasDec; /* Update for main()' s free */ } #endif /* Load HRTF binary file data */ if ( arg.hrtfReaderEnabled ) Loading
lib_com/ivas_prot.h +5 −0 Original line number Diff line number Diff line Loading @@ -328,7 +328,12 @@ ivas_error ivas_dec( ); ivas_error ivas_dec_get_format( #ifdef DECODER_FORMAT_SWITCHING Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const bool isVoipMode /* i : voip mode indicator */ #else Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ #endif ); ivas_error ivas_dec_setup( Loading
lib_dec/ivas_init_dec.c +107 −33 Original line number Diff line number Diff line Loading @@ -99,7 +99,12 @@ static AUDIO_CONFIG ivas_set_audio_config_from_sba_order( *---------------------------------------------------------------------*/ ivas_error ivas_dec_get_format( #ifdef DECODER_FORMAT_SWITCHING Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const bool isVoipMode /* i : voip mode indicator */ #else Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ #endif ) { int16_t k, idx, num_bits_read; Loading Loading @@ -130,16 +135,22 @@ ivas_error ivas_dec_get_format( !( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->last_ivas_format == MASA_FORMAT ) ) { #ifdef DECODER_FORMAT_SWITCHING if ( isVoipMode ) { st_ivas->restartNeeded = 1; return IVAS_ERR_OK; #else } else { #endif #ifdef DEBUGGING fprintf( stderr, "\nError: Changing the number of ISMs is not supported!\n" ); #endif return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Wrong number of objects signalled!" ); #ifdef DECODER_FORMAT_SWITCHING } #endif } /*-------------------------------------------------------------------* * Read other signaling (ISM/MC mode, number of channels, etc.) *-------------------------------------------------------------------*/ Loading Loading @@ -172,13 +183,20 @@ ivas_error ivas_dec_get_format( if ( st_ivas->ini_frame > 0 && nchan_ism != st_ivas->nchan_ism ) { #ifdef DECODER_FORMAT_SWITCHING if ( isVoipMode ) { st_ivas->restartNeeded = 1; return IVAS_ERR_OK; #else } else { #endif #ifdef DEBUGGING fprintf( stderr, "\nError: Changing the number of ISMs is not supported!\n" ); #endif return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Wrong number of objects signalled!" ); #ifdef DECODER_FORMAT_SWITCHING } #endif } Loading @@ -200,13 +218,20 @@ ivas_error ivas_dec_get_format( if ( st_ivas->ini_frame > 0 && sba_planar != st_ivas->sba_planar ) { #ifdef DECODER_FORMAT_SWITCHING if ( isVoipMode ) { st_ivas->restartNeeded = 1; return IVAS_ERR_OK; #else } else { #endif #ifdef DEBUGGING fprintf( stderr, "\nError: Changing the SBA planar/3D layout is not supported!\n" ); #endif return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Wrong SBA planar flag signalled!" ); #ifdef DECODER_FORMAT_SWITCHING } #endif } Loading @@ -217,13 +242,20 @@ ivas_error ivas_dec_get_format( if ( st_ivas->ini_frame > 0 && sba_order != st_ivas->sba_order ) { #ifdef DECODER_FORMAT_SWITCHING if ( isVoipMode ) { st_ivas->restartNeeded = 1; return IVAS_ERR_OK; #else } else { #endif #ifdef DEBUGGING fprintf( stderr, "\nError: Changing the SBA order is not supported!\n" ); #endif return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Wrong SBA order signalled!" ); #ifdef DECODER_FORMAT_SWITCHING } #endif } Loading @@ -236,7 +268,7 @@ ivas_error ivas_dec_get_format( if ( st_ivas->bit_stream[( ivas_total_brate / FRAMES_PER_SEC ) - 1] ) { #ifdef DECODER_FORMAT_SWITCHING if ( st_ivas->nchan_transport == 1 ) if ( st_ivas->nchan_transport == 1 && isVoipMode ) { st_ivas->restartNeeded = 1; return IVAS_ERR_OK; Loading @@ -248,7 +280,7 @@ ivas_error ivas_dec_get_format( else { #ifdef DECODER_FORMAT_SWITCHING if ( st_ivas->nchan_transport == 2 ) if ( st_ivas->nchan_transport == 2 && isVoipMode ) { st_ivas->restartNeeded = 1; return IVAS_ERR_OK; Loading Loading @@ -285,13 +317,20 @@ ivas_error ivas_dec_get_format( if ( st_ivas->ini_frame > 0 && nchan_ism != st_ivas->nchan_ism ) { #ifdef DECODER_FORMAT_SWITCHING if ( isVoipMode ) { st_ivas->restartNeeded = 1; return IVAS_ERR_OK; #else } else { #endif #ifdef DEBUGGING fprintf( stderr, "\nError: Changing the number of ISMs is not supported!\n" ); #endif return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Wrong number of objects signalled!" ); #ifdef DECODER_FORMAT_SWITCHING } #endif } Loading @@ -308,13 +347,20 @@ ivas_error ivas_dec_get_format( if ( st_ivas->ini_frame > 0 && nchan_ism != st_ivas->nchan_ism ) { #ifdef DECODER_FORMAT_SWITCHING if ( isVoipMode ) { st_ivas->restartNeeded = 1; return IVAS_ERR_OK; #else } else { #endif #ifdef DEBUGGING fprintf( stderr, "\nError: Changing the number of ISMs is not supported!\n" ); #endif return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Wrong number of objects signalled!" ); #ifdef DECODER_FORMAT_SWITCHING } #endif } Loading @@ -328,13 +374,20 @@ ivas_error ivas_dec_get_format( if ( st_ivas->ini_frame > 0 && nchan_ism != st_ivas->nchan_ism ) { #ifdef DECODER_FORMAT_SWITCHING if ( isVoipMode ) { st_ivas->restartNeeded = 1; return IVAS_ERR_OK; #else } else { #endif #ifdef DEBUGGING fprintf( stderr, "\nError: Changing the number of ISMs is not supported!\n" ); #endif return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Wrong number of objects signalled!" ); #ifdef DECODER_FORMAT_SWITCHING } #endif } Loading @@ -360,13 +413,20 @@ ivas_error ivas_dec_get_format( if ( st_ivas->ini_frame > 0 && sba_order != st_ivas->sba_order ) { #ifdef DECODER_FORMAT_SWITCHING if ( isVoipMode ) { st_ivas->restartNeeded = 1; return IVAS_ERR_OK; #else } else { #endif #ifdef DEBUGGING fprintf( stderr, "\nError: Changing the SBA order is not supported!\n" ); #endif return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Wrong SBA order signalled!" ); #ifdef DECODER_FORMAT_SWITCHING } #endif } Loading @@ -393,13 +453,20 @@ ivas_error ivas_dec_get_format( if ( st_ivas->ini_frame > 0 && st_ivas->transport_config != signaled_config ) { #ifdef DECODER_FORMAT_SWITCHING if ( isVoipMode ) { st_ivas->restartNeeded = 1; return IVAS_ERR_OK; #else } else { #endif #ifdef DEBUGGING fprintf( stderr, "\nError: Switching of MC configurations is not supported!\n" ); #endif return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "wrong MC configuration signalled!" ); #ifdef DECODER_FORMAT_SWITCHING } #endif } Loading Loading @@ -483,13 +550,20 @@ ivas_error ivas_dec_get_format( if ( st_ivas->ini_frame > 0 && nchan_ism != st_ivas->nchan_ism ) { #ifdef DECODER_FORMAT_SWITCHING if ( isVoipMode ) { st_ivas->restartNeeded = 1; return IVAS_ERR_OK; #else } else { #endif #ifdef DEBUGGING fprintf( stderr, "\nError: Changing the number of ISMs is not supported!\n" ); #endif return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Wrong number of objects signalled!" ); #ifdef DECODER_FORMAT_SWITCHING } #endif } Loading
lib_dec/lib_dec.c +4 −0 Original line number Diff line number Diff line Loading @@ -1041,7 +1041,11 @@ ivas_error IVAS_DEC_ReadFormat( if ( st_ivas->bfi == 0 ) { #ifdef DECODER_FORMAT_SWITCHING if ( ( error = ivas_dec_get_format( st_ivas, hIvasDec->hVoIP != NULL ) ) != IVAS_ERR_OK ) #else if ( ( error = ivas_dec_get_format( st_ivas ) ) != IVAS_ERR_OK ) #endif { return error; } Loading
tests/rtp/test_format_switching.py +1 −107 Original line number Diff line number Diff line Loading @@ -98,112 +98,6 @@ FORMAT_ARGUMENT_MAPPING = { "ISM4SBA3": ["-ism_sba", "4", "+3"], } def test_format_switching ( dut_encoder_frontend: EncoderFrontend, dut_decoder_frontend: DecoderFrontend ): bitrate = 48000 bandwidth = "FB" outMode = "MONO" # Create 1s test files cut_suffix = "_cut.wav" test_file = Path( str(FORMAT_TO_FILE_COMPARETEST["MONO"]).replace(".wav", cut_suffix) ) if not test_file.exists(): create_short_testvectors(1.0, False, None) with TemporaryDirectory() as tmp_dir: bitstreams = [] rtpdumps = [] codec=CODECS.IVAS #if key is "MONO": # codec=CODECS.EVS #else: # codec=CODECS.IVAS rtpPacker = IvasRtp(numFramesPerPacket=1, codec=codec) piData = dict() requestsData = dict() # Encode subformats for key, audioFile in FORMAT_TO_FILE_COMPARETEST.items(): if key in ["META", "16ch_8+4+4", "4d4", "t_design_4"]: break encoder_args = [] cutFile = Path( str(audioFile).replace(".wav", cut_suffix) ) encoder_args += FORMAT_ARGUMENT_MAPPING[key] if key in FORMAT_TO_METADATA_FILES: encoder_args += FORMAT_TO_METADATA_FILES[key] elif "SBA" in key: # ISM metadata files for OSBA encoder_args += FORMAT_TO_METADATA_FILES[key[:4]] temp_bitstream = Path(tmp_dir).joinpath(f"output-{bitrate}-{bandwidth}-{key}.bts").absolute() temp_rtpdump = Path(tmp_dir).joinpath(f"output-{bitrate}-{bandwidth}-{key}.rtpdump").absolute() dut_encoder_frontend.run( bitrate=bitrate, input_sampling_rate=48, input_path=cutFile, output_bitstream_path=temp_bitstream, sba_order=None, dtx_mode=False, max_band=bandwidth, add_option_list=encoder_args ) bitstreams.append(temp_bitstream) # Combine bitstreams cat_bitstream_no_evs = Path(tmp_dir).joinpath(f"output-{bitrate}-{bandwidth}-NO-EVS-CAT.bts").absolute() cat_rtpdump = Path(tmp_dir).joinpath(f"output-{bitrate}-{bandwidth}-CAT.rtpdump").absolute() cat_rtpdump_no_evs = Path(tmp_dir).joinpath(f"output-{bitrate}-{bandwidth}-NO-EVS-CAT.rtpdump").absolute() catBsNoEVS = bytes() catRTP = bytes() catRTPnoEVS = bytes() for bsFile in bitstreams: if "MONO" not in str(bsFile): with open (bsFile, mode="rb") as fd: catBsNoEVS += fd.read() with open (cat_bitstream_no_evs, mode="wb") as outFile: outFile.write(catBsNoEVS) # TODO: also pack EVS packets (while increasing timestamp and sequence number) # Pack to RTP packets rtpPacker.packG192File(g192File=cat_bitstream_no_evs, rtpDumpOut=cat_rtpdump_no_evs, piData=piData, requestsData=requestsData) #rtpdumps.append(temp_rtpdump) #for rtpdumpFile in rtpdumps: # with open (rtpdumpFile, mode="rb") as fd: # tempBits = fd.read() # catRTP += tempBits # if "MONO" not in str(rtpdumpFile): # catRTPnoEVS += tempBits #with open (cat_rtpdump, mode="wb") as outFile: # outFile.write(catRTP) #with open (cat_rtpdump_no_evs, mode="wb") as outFile: # outFile.write(catRTPnoEVS) # Decode the combined bitstreams cat_output_no_evs = Path(tmp_dir).joinpath(f"output-{bitrate}-{bandwidth}-NO-EVS-CAT.wav").absolute() cat_output_rtpdump = Path(tmp_dir).joinpath(f"output-{bitrate}-{bandwidth}.wav").absolute() dut_decoder_frontend.run( output_config=outMode, output_sampling_rate=48, input_bitstream_path=cat_bitstream_no_evs, output_path=cat_output_no_evs, add_option_list= [] ) dut_decoder_frontend.run( output_config=outMode, output_sampling_rate=48, input_bitstream_path=cat_rtpdump, output_path=cat_output_rtpdump, add_option_list= ["-VOIP_HF_ONLY=1"] ) def test_format_switching_new_encoder ( record_property, dut_decoder_frontend: DecoderFrontend Loading @@ -211,7 +105,7 @@ def test_format_switching_new_encoder ( bitrate = 48000 fs = 48 bandwidth = "FB" outMode = "MONO" outMode = "" dut_encoder_path = Path(ROOT_DIR).joinpath(f"IVAS_cod{BIN_EXT}") dut_encoder_fmtsw_path = Path(ROOT_DIR).joinpath(f"IVAS_cod_fmtsw{BIN_EXT}") Loading